drivers/input/touchscreen/s6sy761.c
Source file repositories/reference/linux-study-clean/drivers/input/touchscreen/s6sy761.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/input/touchscreen/s6sy761.c- Extension
.c- Size
- 13378 bytes
- Lines
- 545
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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/unaligned.hlinux/delay.hlinux/i2c.hlinux/input/mt.hlinux/input/touchscreen.hlinux/interrupt.hlinux/irq.hlinux/module.hlinux/pm_runtime.hlinux/regulator/consumer.h
Detected Declarations
struct s6sy761_dataenum s6sy761_regulatorsfunction s6sy761_read_eventsfunction s6sy761_report_coordinatesfunction s6sy761_report_releasefunction s6sy761_handle_coordinatesfunction s6sy761_handle_eventsfunction s6sy761_irq_handlerfunction s6sy761_input_openfunction s6sy761_input_closefunction s6sy761_sysfs_devidfunction s6sy761_power_onfunction s6sy761_hw_initfunction s6sy761_power_offfunction s6sy761_probefunction s6sy761_removefunction s6sy761_runtime_suspendfunction s6sy761_runtime_resumefunction s6sy761_suspendfunction s6sy761_resume
Annotated Snippet
struct s6sy761_data {
struct i2c_client *client;
struct regulator_bulk_data regulators[2];
struct input_dev *input;
struct touchscreen_properties prop;
u8 data[S6SY761_EVENT_SIZE * S6SY761_EVENT_COUNT];
u16 devid;
u8 tx_channel;
};
/*
* We can't simply use i2c_smbus_read_i2c_block_data because we
* need to read more than 255 bytes
*/
static int s6sy761_read_events(struct s6sy761_data *sdata, u16 n_events)
{
u8 cmd = S6SY761_READ_ALL_EVENT;
struct i2c_msg msgs[2] = {
{
.addr = sdata->client->addr,
.len = 1,
.buf = &cmd,
},
{
.addr = sdata->client->addr,
.flags = I2C_M_RD,
.len = (n_events * S6SY761_EVENT_SIZE),
.buf = sdata->data + S6SY761_EVENT_SIZE,
},
};
int ret;
ret = i2c_transfer(sdata->client->adapter, msgs, ARRAY_SIZE(msgs));
if (ret < 0)
return ret;
return ret == ARRAY_SIZE(msgs) ? 0 : -EIO;
}
static void s6sy761_report_coordinates(struct s6sy761_data *sdata,
u8 *event, u8 tid)
{
u8 major = event[4];
u8 minor = event[5];
u8 z = event[6] & S6SY761_MASK_Z;
u16 x = (event[1] << 4) | ((event[3] & S6SY761_MASK_X) >> 4);
u16 y = (event[2] << 4) | (event[3] & S6SY761_MASK_Y);
input_mt_slot(sdata->input, tid);
input_mt_report_slot_state(sdata->input, MT_TOOL_FINGER, true);
input_report_abs(sdata->input, ABS_MT_POSITION_X, x);
input_report_abs(sdata->input, ABS_MT_POSITION_Y, y);
input_report_abs(sdata->input, ABS_MT_TOUCH_MAJOR, major);
input_report_abs(sdata->input, ABS_MT_TOUCH_MINOR, minor);
input_report_abs(sdata->input, ABS_MT_PRESSURE, z);
input_sync(sdata->input);
}
static void s6sy761_report_release(struct s6sy761_data *sdata,
u8 *event, u8 tid)
{
input_mt_slot(sdata->input, tid);
input_mt_report_slot_state(sdata->input, MT_TOOL_FINGER, false);
input_sync(sdata->input);
}
static void s6sy761_handle_coordinates(struct s6sy761_data *sdata, u8 *event)
{
u8 tid;
u8 touch_state;
if (unlikely(!(event[0] & S6SY761_MASK_TID)))
return;
tid = ((event[0] & S6SY761_MASK_TID) >> 2) - 1;
touch_state = (event[0] & S6SY761_MASK_TOUCH_STATE) >> 6;
switch (touch_state) {
case S6SY761_TS_NONE:
break;
case S6SY761_TS_RELEASE:
s6sy761_report_release(sdata, event, tid);
break;
case S6SY761_TS_PRESS:
Annotation
- Immediate include surface: `linux/unaligned.h`, `linux/delay.h`, `linux/i2c.h`, `linux/input/mt.h`, `linux/input/touchscreen.h`, `linux/interrupt.h`, `linux/irq.h`, `linux/module.h`.
- Detected declarations: `struct s6sy761_data`, `enum s6sy761_regulators`, `function s6sy761_read_events`, `function s6sy761_report_coordinates`, `function s6sy761_report_release`, `function s6sy761_handle_coordinates`, `function s6sy761_handle_events`, `function s6sy761_irq_handler`, `function s6sy761_input_open`, `function s6sy761_input_close`.
- Atlas domain: Driver Families / drivers/input.
- Implementation status: source implementation candidate.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.