drivers/input/touchscreen/ili210x.c
Source file repositories/reference/linux-study-clean/drivers/input/touchscreen/ili210x.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/input/touchscreen/ili210x.c- Extension
.c- Size
- 28130 bytes
- Lines
- 1084
- 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/crc-ccitt.hlinux/delay.hlinux/gpio/consumer.hlinux/i2c.hlinux/ihex.hlinux/input.hlinux/input/mt.hlinux/input/touchscreen.hlinux/interrupt.hlinux/mod_devicetable.hlinux/module.hlinux/sizes.hlinux/slab.hlinux/unaligned.h
Detected Declarations
struct ili2xxx_chipstruct ili210xfunction ili210x_read_regfunction ili210x_read_touch_datafunction ili210x_touchdata_to_coordsfunction ili210x_check_continue_pollingfunction ili211x_read_touch_datafunction ili211x_touchdata_to_coordsfunction ili211x_decline_pollingfunction ili212x_touchdata_to_coordsfunction ili212x_check_continue_pollingfunction ili251x_read_reg_commonfunction ili251x_read_regfunction ili251x_read_touch_datafunction ili251x_touchdata_to_coordsfunction ili251x_check_continue_pollingfunction ili210x_report_eventsfunction ili210x_process_eventsfunction ili210x_irqfunction ili210x_work_i2c_pollfunction ili251x_firmware_update_resolutionfunction ili251x_firmware_update_firmware_versionfunction ili251x_firmware_update_kernel_versionfunction ili251x_firmware_update_protocol_versionfunction ili251x_firmware_update_ic_modefunction ili251x_firmware_update_cached_statefunction ili251x_firmware_version_showfunction ili251x_kernel_version_showfunction ili251x_protocol_version_showfunction ili251x_mode_showfunction ili210x_calibratefunction ili251x_switch_ic_modefunction ili251x_firmware_busyfunction ili251x_firmware_write_to_icfunction ili251x_firmware_resetfunction ili210x_hardware_resetfunction ili210x_do_firmware_updatefunction ili210x_firmware_updatefunction ili210x_firmware_update_storefunction ili210x_attributes_visiblefunction ili210x_power_downfunction ili210x_stopfunction ili210x_i2c_probe
Annotated Snippet
struct ili2xxx_chip {
int (*read_reg)(struct i2c_client *client, u8 reg,
void *buf, size_t len);
int (*get_touch_data)(struct i2c_client *client, u8 *data);
bool (*parse_touch_data)(const u8 *data, unsigned int finger,
unsigned int *x, unsigned int *y,
unsigned int *z);
bool (*continue_polling)(const u8 *data, bool touch);
unsigned int max_touches;
unsigned int resolution;
bool has_calibrate_reg;
bool has_firmware_proto;
bool has_pressure_reg;
};
struct ili210x {
struct i2c_client *client;
struct input_dev *input;
struct gpio_desc *reset_gpio;
struct touchscreen_properties prop;
const struct ili2xxx_chip *chip;
u8 version_firmware[8];
u8 version_kernel[5];
u8 version_proto[2];
u8 ic_mode[2];
bool stop;
};
static int ili210x_read_reg(struct i2c_client *client,
u8 reg, void *buf, size_t len)
{
struct i2c_msg msg[] = {
{
.addr = client->addr,
.flags = 0,
.len = 1,
.buf = ®,
},
{
.addr = client->addr,
.flags = I2C_M_RD,
.len = len,
.buf = buf,
}
};
int error, ret;
ret = i2c_transfer(client->adapter, msg, ARRAY_SIZE(msg));
if (ret != ARRAY_SIZE(msg)) {
error = ret < 0 ? ret : -EIO;
dev_err(&client->dev, "%s failed: %d\n", __func__, error);
return error;
}
return 0;
}
static int ili210x_read_touch_data(struct i2c_client *client, u8 *data)
{
return ili210x_read_reg(client, REG_TOUCHDATA,
data, ILI210X_DATA_SIZE);
}
static bool ili210x_touchdata_to_coords(const u8 *touchdata,
unsigned int finger,
unsigned int *x, unsigned int *y,
unsigned int *z)
{
if (!(touchdata[0] & BIT(finger)))
return false;
*x = get_unaligned_be16(touchdata + 1 + (finger * 4) + 0);
*y = get_unaligned_be16(touchdata + 1 + (finger * 4) + 2);
return true;
}
static bool ili210x_check_continue_polling(const u8 *data, bool touch)
{
return data[0] & 0xf3;
}
static const struct ili2xxx_chip ili210x_chip = {
.read_reg = ili210x_read_reg,
.get_touch_data = ili210x_read_touch_data,
.parse_touch_data = ili210x_touchdata_to_coords,
.continue_polling = ili210x_check_continue_polling,
.max_touches = 2,
.has_calibrate_reg = true,
};
Annotation
- Immediate include surface: `linux/crc-ccitt.h`, `linux/delay.h`, `linux/gpio/consumer.h`, `linux/i2c.h`, `linux/ihex.h`, `linux/input.h`, `linux/input/mt.h`, `linux/input/touchscreen.h`.
- Detected declarations: `struct ili2xxx_chip`, `struct ili210x`, `function ili210x_read_reg`, `function ili210x_read_touch_data`, `function ili210x_touchdata_to_coords`, `function ili210x_check_continue_polling`, `function ili211x_read_touch_data`, `function ili211x_touchdata_to_coords`, `function ili211x_decline_polling`, `function ili212x_touchdata_to_coords`.
- 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.