drivers/hid/hid-multitouch.c
Source file repositories/reference/linux-study-clean/drivers/hid/hid-multitouch.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/hid/hid-multitouch.c- Extension
.c- Size
- 79723 bytes
- Lines
- 2757
- Domain
- Driver Families
- Bucket
- drivers/hid
- 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/bits.hlinux/device.hlinux/hid.hlinux/module.hlinux/slab.hlinux/input/mt.hlinux/jiffies.hlinux/string.hlinux/timer.hhid-ids.hhid-haptic.h
Detected Declarations
struct mt_usagesstruct mt_applicationstruct mt_classstruct mt_report_datastruct mt_deviceenum latency_modeenum report_modefunction cypress_compute_slotfunction mt_show_quirksfunction mt_set_quirksfunction list_for_each_entryfunction mt_get_featurefunction mt_feature_mappingfunction set_absfunction list_for_each_entryfunction list_for_each_entryfunction mt_store_fieldfunction offsetoffunction mt_compute_slotfunction mt_release_pending_palmsfunction for_each_set_bitfunction mt_sync_framefunction mt_compute_timestampfunction mt_touch_eventfunction mt_process_slotfunction mt_process_mt_eventfunction mt_sync_framefunction mt_touch_reportfunction list_for_each_entryfunction mt_touch_input_configuredfunction mt_input_mappingfunction mt_input_mappedfunction mt_eventfunction mt_yogabook9_fixupfunction mt_reportfunction mt_need_to_apply_featurefunction mt_set_modesfunction mt_post_parse_default_settingsfunction mt_post_parsefunction mt_input_configuredfunction list_for_each_entryfunction mt_fix_const_fieldfunction mt_fix_const_fieldsfunction list_for_each_entryfunction mt_release_contactsfunction list_for_each_entryfunction list_for_each_entryfunction mt_expired_timeout
Annotated Snippet
struct mt_usages {
struct list_head list;
__s32 *x, *y, *cx, *cy, *p, *w, *h, *a;
__s32 *contactid; /* the device ContactID assigned to this slot */
bool *tip_state; /* is the touch valid? */
bool *inrange_state; /* is the finger in proximity of the sensor? */
bool *confidence_state; /* is the touch made by a finger? */
};
struct mt_application {
struct list_head list;
unsigned int application;
unsigned int report_id;
struct list_head mt_usages; /* mt usages list */
__s32 quirks;
__s32 *scantime; /* scantime reported */
__s32 scantime_logical_max; /* max value for raw scantime */
__s32 *raw_cc; /* contact count in the report */
int left_button_state; /* left button state */
unsigned int mt_flags; /* flags to pass to input-mt */
unsigned long *pending_palm_slots; /* slots where we reported palm
* and need to release */
__u8 num_received; /* how many contacts we received */
__u8 num_expected; /* expected last contact index */
__u8 buttons_count; /* number of physical buttons per touchpad */
__u8 touches_by_report; /* how many touches are present in one report:
* 1 means we should use a serial protocol
* > 1 means hybrid (multitouch) protocol
*/
unsigned long jiffies; /* the frame's jiffies */
int timestamp; /* the timestamp to be sent */
int prev_scantime; /* scantime reported previously */
bool have_contact_count;
};
struct mt_class {
__s32 name; /* MT_CLS */
__s32 quirks;
__s32 sn_move; /* Signal/noise ratio for move events */
__s32 sn_width; /* Signal/noise ratio for width events */
__s32 sn_height; /* Signal/noise ratio for height events */
__s32 sn_pressure; /* Signal/noise ratio for pressure events */
__u8 maxcontacts;
bool is_indirect; /* true for touchpads */
bool export_all_inputs; /* do not ignore mouse, keyboards, etc... */
};
struct mt_report_data {
struct list_head list;
struct hid_report *report;
struct mt_application *application;
bool is_mt_collection;
};
struct mt_device {
struct mt_class mtclass; /* our mt device class */
struct timer_list release_timer; /* to release sticky fingers */
struct hid_haptic_device *haptic; /* haptic related configuration */
struct hid_device *hdev; /* hid_device we're attached to */
unsigned long mt_io_flags; /* mt flags (MT_IO_FLAGS_RUNNING)
* first 8 bits are reserved for keeping the slot
* states, this is fine because we only support up
* to 250 slots (MT_MAX_MAXCONTACT)
*/
__u8 inputmode_value; /* InputMode HID feature value */
__u8 maxcontacts;
bool is_buttonpad; /* is this device a button pad? */
bool is_pressurepad; /* is this device a pressurepad? */
bool is_haptic_touchpad; /* is this device a haptic touchpad? */
bool serial_maybe; /* need to check for serial protocol */
struct list_head applications;
struct list_head reports;
};
static void mt_post_parse_default_settings(struct mt_device *td,
struct mt_application *app);
static void mt_post_parse(struct mt_device *td, struct mt_application *app);
/* classes of device behavior */
#define MT_CLS_DEFAULT 0x0001
#define MT_CLS_SERIAL 0x0002
Annotation
- Immediate include surface: `linux/bits.h`, `linux/device.h`, `linux/hid.h`, `linux/module.h`, `linux/slab.h`, `linux/input/mt.h`, `linux/jiffies.h`, `linux/string.h`.
- Detected declarations: `struct mt_usages`, `struct mt_application`, `struct mt_class`, `struct mt_report_data`, `struct mt_device`, `enum latency_mode`, `enum report_mode`, `function cypress_compute_slot`, `function mt_show_quirks`, `function mt_set_quirks`.
- Atlas domain: Driver Families / drivers/hid.
- 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.