drivers/input/touchscreen/zforce_ts.c
Source file repositories/reference/linux-study-clean/drivers/input/touchscreen/zforce_ts.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/input/touchscreen/zforce_ts.c- Extension
.c- Size
- 21552 bytes
- Lines
- 863
- 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/delay.hlinux/device.hlinux/gpio/consumer.hlinux/i2c.hlinux/input.hlinux/input/mt.hlinux/input/touchscreen.hlinux/interrupt.hlinux/module.hlinux/of.hlinux/property.hlinux/regulator/consumer.hlinux/slab.hlinux/unaligned.h
Detected Declarations
struct zforce_pointstruct zforce_tsfunction zforce_commandfunction zforce_send_waitfunction zforce_command_waitfunction zforce_resolutionfunction zforce_scan_frequencyfunction zforce_setconfigfunction zforce_startfunction zforce_stopfunction zforce_touch_eventfunction zforce_read_packetfunction zforce_completefunction zforce_irqfunction zforce_irq_threadfunction zforce_input_openfunction zforce_input_closefunction __zforce_suspendfunction zforce_suspendfunction zforce_resumefunction zforce_resetfunction zforce_ts_parse_legacy_propertiesfunction zforce_probe
Annotated Snippet
struct zforce_point {
int coord_x;
int coord_y;
int state;
int id;
int area_major;
int area_minor;
int orientation;
int pressure;
int prblty;
};
/*
* @client the i2c_client
* @input the input device
* @suspending in the process of going to suspend (don't emit wakeup
* events for commands executed to suspend the device)
* @suspended device suspended
* @command_done completion to wait for the command result
* @command_waiting the id of the command that is currently waiting
* for a result
* @command_result returned result of the command
*/
struct zforce_ts {
struct i2c_client *client;
struct input_dev *input;
struct touchscreen_properties prop;
char phys[32];
struct gpio_desc *gpio_int;
struct gpio_desc *gpio_rst;
bool suspending;
bool suspended;
bool boot_complete;
/* Firmware version information */
u16 version_major;
u16 version_minor;
u16 version_build;
u16 version_rev;
struct completion command_done;
int command_waiting;
int command_result;
};
static int zforce_command(struct zforce_ts *ts, u8 cmd)
{
struct i2c_client *client = ts->client;
char buf[3];
int ret;
dev_dbg(&client->dev, "%s: 0x%x\n", __func__, cmd);
buf[0] = FRAME_START;
buf[1] = 1; /* data size, command only */
buf[2] = cmd;
ret = i2c_master_send(client, &buf[0], ARRAY_SIZE(buf));
if (ret < 0) {
dev_err(&client->dev, "i2c send data request error: %d\n", ret);
return ret;
}
return 0;
}
static int zforce_send_wait(struct zforce_ts *ts, const char *buf, int len)
{
struct i2c_client *client = ts->client;
int ret;
dev_dbg(&client->dev, "sending %d bytes for command 0x%x\n",
buf[1], buf[2]);
ts->command_waiting = buf[2];
ret = i2c_master_send(client, buf, len);
if (ret < 0) {
dev_err(&client->dev, "i2c send data request error: %d\n", ret);
return ret;
}
dev_dbg(&client->dev, "waiting for result for command 0x%x\n", buf[2]);
if (wait_for_completion_timeout(&ts->command_done, WAIT_TIMEOUT) == 0)
return -ETIME;
ret = ts->command_result;
Annotation
- Immediate include surface: `linux/delay.h`, `linux/device.h`, `linux/gpio/consumer.h`, `linux/i2c.h`, `linux/input.h`, `linux/input/mt.h`, `linux/input/touchscreen.h`, `linux/interrupt.h`.
- Detected declarations: `struct zforce_point`, `struct zforce_ts`, `function zforce_command`, `function zforce_send_wait`, `function zforce_command_wait`, `function zforce_resolution`, `function zforce_scan_frequency`, `function zforce_setconfig`, `function zforce_start`, `function zforce_stop`.
- 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.