drivers/input/touchscreen/iqs5xx.c
Source file repositories/reference/linux-study-clean/drivers/input/touchscreen/iqs5xx.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/input/touchscreen/iqs5xx.c- Extension
.c- Size
- 26243 bytes
- Lines
- 1082
- 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/bits.hlinux/delay.hlinux/device.hlinux/err.hlinux/firmware.hlinux/gpio/consumer.hlinux/hex.hlinux/i2c.hlinux/input.hlinux/input/mt.hlinux/input/touchscreen.hlinux/interrupt.hlinux/kernel.hlinux/mod_devicetable.hlinux/module.hlinux/slab.hlinux/unaligned.h
Detected Declarations
struct iqs5xx_dev_id_infostruct iqs5xx_touch_datastruct iqs5xx_statusstruct iqs5xx_privatefunction iqs5xx_read_burstfunction iqs5xx_read_wordfunction iqs5xx_write_burstfunction iqs5xx_write_wordfunction iqs5xx_write_bytefunction iqs5xx_resetfunction iqs5xx_bl_cmdfunction iqs5xx_bl_openfunction iqs5xx_bl_writefunction iqs5xx_bl_verifyfunction iqs5xx_set_statefunction iqs5xx_openfunction iqs5xx_closefunction iqs5xx_axis_initfunction iqs5xx_dev_initfunction iqs5xx_irqfunction iqs5xx_fw_file_parsefunction iqs5xx_update_firmwarefunction iqs5xx_fw_file_writefunction fw_file_storefunction fw_info_showfunction iqs5xx_attr_is_visiblefunction iqs5xx_suspendfunction iqs5xx_resumefunction iqs5xx_probe
Annotated Snippet
struct iqs5xx_dev_id_info {
__be16 prod_num;
__be16 proj_num;
u8 major_ver;
u8 minor_ver;
u8 bl_status;
} __packed;
struct iqs5xx_touch_data {
__be16 abs_x;
__be16 abs_y;
__be16 strength;
u8 area;
} __packed;
struct iqs5xx_status {
u8 sys_info[2];
u8 num_active;
__be16 rel_x;
__be16 rel_y;
struct iqs5xx_touch_data touch_data[IQS5XX_NUM_CONTACTS];
} __packed;
struct iqs5xx_private {
struct i2c_client *client;
struct input_dev *input;
struct gpio_desc *reset_gpio;
struct touchscreen_properties prop;
struct mutex lock;
struct iqs5xx_dev_id_info dev_id_info;
u8 exp_file[2];
};
static int iqs5xx_read_burst(struct i2c_client *client,
u16 reg, void *val, u16 len)
{
__be16 reg_buf = cpu_to_be16(reg);
int ret, i;
struct i2c_msg msg[] = {
{
.addr = client->addr,
.flags = 0,
.len = sizeof(reg_buf),
.buf = (u8 *)®_buf,
},
{
.addr = client->addr,
.flags = I2C_M_RD,
.len = len,
.buf = (u8 *)val,
},
};
/*
* The first addressing attempt outside of a communication window fails
* and must be retried, after which the device clock stretches until it
* is available.
*/
for (i = 0; i < IQS5XX_NUM_RETRIES; i++) {
ret = i2c_transfer(client->adapter, msg, ARRAY_SIZE(msg));
if (ret == ARRAY_SIZE(msg))
return 0;
usleep_range(200, 300);
}
if (ret >= 0)
ret = -EIO;
dev_err(&client->dev, "Failed to read from address 0x%04X: %d\n",
reg, ret);
return ret;
}
static int iqs5xx_read_word(struct i2c_client *client, u16 reg, u16 *val)
{
__be16 val_buf;
int error;
error = iqs5xx_read_burst(client, reg, &val_buf, sizeof(val_buf));
if (error)
return error;
*val = be16_to_cpu(val_buf);
return 0;
}
static int iqs5xx_write_burst(struct i2c_client *client,
Annotation
- Immediate include surface: `linux/bits.h`, `linux/delay.h`, `linux/device.h`, `linux/err.h`, `linux/firmware.h`, `linux/gpio/consumer.h`, `linux/hex.h`, `linux/i2c.h`.
- Detected declarations: `struct iqs5xx_dev_id_info`, `struct iqs5xx_touch_data`, `struct iqs5xx_status`, `struct iqs5xx_private`, `function iqs5xx_read_burst`, `function iqs5xx_read_word`, `function iqs5xx_write_burst`, `function iqs5xx_write_word`, `function iqs5xx_write_byte`, `function iqs5xx_reset`.
- 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.