drivers/input/misc/yealink.c
Source file repositories/reference/linux-study-clean/drivers/input/misc/yealink.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/input/misc/yealink.c- Extension
.c- Size
- 24080 bytes
- Lines
- 960
- Domain
- Driver Families
- Bucket
- drivers/input
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kernel.hlinux/slab.hlinux/module.hlinux/mutex.hlinux/usb/input.hlinux/map_to_7segment.hyealink.h
Detected Declarations
struct yld_statusstruct pictogram_mapstruct segment_mapstruct yealink_devstruct driver_infofunction setCharfunction map_p1k_to_keyfunction report_keyfunction yealink_cmdfunction yealink_set_ringtonefunction yealink_do_idle_tasksfunction urb_irq_callbackfunction urb_ctl_callbackfunction input_evfunction input_openfunction input_closefunction show_mapfunction store_mapfunction show_linefunction show_line1function show_line2function show_line3function store_linefunction store_line1function store_line2function store_line3function get_iconsfunction set_iconfunction show_iconfunction hide_iconfunction store_ringtonefunction usb_cleanupfunction usb_disconnectfunction usb_probe
Annotated Snippet
struct yld_status {
u8 lcd[24];
u8 led;
u8 dialtone;
u8 ringtone;
u8 keynum;
} __attribute__ ((packed));
/*
* Register the LCD segment and icon map
*/
#define _LOC(k,l) { .a = (k), .m = (l) }
#define _SEG(t, a, am, b, bm, c, cm, d, dm, e, em, f, fm, g, gm) \
{ .type = (t), \
.u = { .s = { _LOC(a, am), _LOC(b, bm), _LOC(c, cm), \
_LOC(d, dm), _LOC(e, em), _LOC(g, gm), \
_LOC(f, fm) } } }
#define _PIC(t, h, hm, n) \
{ .type = (t), \
.u = { .p = { .name = (n), .a = (h), .m = (hm) } } }
static const struct lcd_segment_map {
char type;
union {
struct pictogram_map {
u8 a,m;
char name[10];
} p;
struct segment_map {
u8 a,m;
} s[7];
} u;
} lcdMap[] = {
#include "yealink.h"
};
struct yealink_dev {
struct input_dev *idev; /* input device */
struct usb_device *udev; /* usb device */
struct usb_interface *intf; /* usb interface */
/* irq input channel */
struct yld_ctl_packet *irq_data;
dma_addr_t irq_dma;
struct urb *urb_irq;
/* control output channel */
struct yld_ctl_packet *ctl_data;
dma_addr_t ctl_dma;
struct usb_ctrlrequest *ctl_req;
struct urb *urb_ctl;
char phys[64]; /* physical device path */
u8 lcdMap[ARRAY_SIZE(lcdMap)]; /* state of LCD, LED ... */
int key_code; /* last reported key */
struct mutex sysfs_mutex;
unsigned int shutdown:1;
int stat_ix;
union {
struct yld_status s;
u8 b[sizeof(struct yld_status)];
} master, copy;
};
/*******************************************************************************
* Yealink lcd interface
******************************************************************************/
/*
* Register a default 7 segment character set
*/
static SEG7_DEFAULT_MAP(map_seg7);
/* Display a char,
* char '\9' and '\n' are placeholders and do not overwrite the original text.
* A space will always hide an icon.
*/
static int setChar(struct yealink_dev *yld, int el, int chr)
{
int i, a, m, val;
if (el >= ARRAY_SIZE(lcdMap))
return -EINVAL;
if (chr == '\t' || chr == '\n')
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/slab.h`, `linux/module.h`, `linux/mutex.h`, `linux/usb/input.h`, `linux/map_to_7segment.h`, `yealink.h`.
- Detected declarations: `struct yld_status`, `struct pictogram_map`, `struct segment_map`, `struct yealink_dev`, `struct driver_info`, `function setChar`, `function map_p1k_to_key`, `function report_key`, `function yealink_cmd`, `function yealink_set_ringtone`.
- Atlas domain: Driver Families / drivers/input.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.