drivers/input/touchscreen/zinitix.c
Source file repositories/reference/linux-study-clean/drivers/input/touchscreen/zinitix.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/input/touchscreen/zinitix.c- Extension
.c- Size
- 19253 bytes
- Lines
- 767
- 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/i2c.hlinux/input.hlinux/input/mt.hlinux/input/touchscreen.hlinux/interrupt.hlinux/irq.hlinux/kernel.hlinux/module.hlinux/of.hlinux/property.hlinux/regulator/consumer.hlinux/slab.h
Detected Declarations
struct point_coordstruct touch_eventstruct bt541_ts_datafunction zinitix_read_datafunction zinitix_write_u16function zinitix_write_cmdfunction zinitix_get_u16_regfunction zinitix_init_touchfunction zinitix_init_regulatorsfunction zinitix_send_power_on_sequencefunction zinitix_report_fingerfunction zinitix_report_keysfunction zinitix_ts_irq_handlerfunction zinitix_startfunction zinitix_stopfunction zinitix_input_openfunction zinitix_input_closefunction zinitix_init_input_devfunction zinitix_ts_probefunction zinitix_suspendfunction zinitix_resume
Annotated Snippet
struct point_coord {
__le16 x;
__le16 y;
u8 width;
u8 sub_status;
// currently unused, but needed as padding:
u8 minor_width;
u8 angle;
};
struct touch_event {
__le16 status;
u8 finger_mask;
u8 time_stamp;
struct point_coord point_coord[MAX_SUPPORTED_FINGER_NUM];
};
struct bt541_ts_data {
struct i2c_client *client;
struct input_dev *input_dev;
struct touchscreen_properties prop;
struct regulator_bulk_data supplies[2];
u32 zinitix_mode;
u32 keycodes[MAX_SUPPORTED_BUTTON_NUM];
int num_keycodes;
bool have_versioninfo;
u16 chip_revision;
u16 firmware_version;
u16 regdata_version;
u16 icon_status_reg;
};
static int zinitix_read_data(struct i2c_client *client,
u16 reg, void *values, size_t length)
{
__le16 reg_le = cpu_to_le16(reg);
int ret;
/* A single i2c_transfer() transaction does not work here. */
ret = i2c_master_send(client, (u8 *)®_le, sizeof(reg_le));
if (ret != sizeof(reg_le))
return ret < 0 ? ret : -EIO;
ret = i2c_master_recv(client, (u8 *)values, length);
if (ret != length)
return ret < 0 ? ret : -EIO;
return 0;
}
static int zinitix_write_u16(struct i2c_client *client, u16 reg, u16 value)
{
__le16 packet[2] = {cpu_to_le16(reg), cpu_to_le16(value)};
int ret;
ret = i2c_master_send(client, (u8 *)packet, sizeof(packet));
if (ret != sizeof(packet))
return ret < 0 ? ret : -EIO;
return 0;
}
static int zinitix_write_cmd(struct i2c_client *client, u16 reg)
{
__le16 reg_le = cpu_to_le16(reg);
int ret;
ret = i2c_master_send(client, (u8 *)®_le, sizeof(reg_le));
if (ret != sizeof(reg_le))
return ret < 0 ? ret : -EIO;
return 0;
}
static u16 zinitix_get_u16_reg(struct bt541_ts_data *bt541, u16 vreg)
{
struct i2c_client *client = bt541->client;
int error;
__le16 val;
error = zinitix_read_data(client, vreg, (void *)&val, 2);
if (error)
return U8_MAX;
return le16_to_cpu(val);
}
static int zinitix_init_touch(struct bt541_ts_data *bt541)
{
struct i2c_client *client = bt541->client;
Annotation
- Immediate include surface: `linux/delay.h`, `linux/i2c.h`, `linux/input.h`, `linux/input/mt.h`, `linux/input/touchscreen.h`, `linux/interrupt.h`, `linux/irq.h`, `linux/kernel.h`.
- Detected declarations: `struct point_coord`, `struct touch_event`, `struct bt541_ts_data`, `function zinitix_read_data`, `function zinitix_write_u16`, `function zinitix_write_cmd`, `function zinitix_get_u16_reg`, `function zinitix_init_touch`, `function zinitix_init_regulators`, `function zinitix_send_power_on_sequence`.
- 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.