drivers/input/touchscreen/chipone_icn8505.c
Source file repositories/reference/linux-study-clean/drivers/input/touchscreen/chipone_icn8505.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/input/touchscreen/chipone_icn8505.c- Extension
.c- Size
- 12702 bytes
- Lines
- 508
- 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/acpi.hlinux/crc32.hlinux/delay.hlinux/firmware.hlinux/interrupt.hlinux/i2c.hlinux/input.hlinux/input/mt.hlinux/input/touchscreen.hlinux/module.h
Detected Declarations
struct icn8505_touchstruct icn8505_touch_datastruct icn8505_datafunction icn8505_read_xferfunction icn8505_write_xferfunction icn8505_read_datafunction icn8505_read_reg_silentfunction icn8505_write_regfunction icn8505_read_prog_datafunction icn8505_write_prog_datafunction icn8505_write_prog_regfunction icn8505_try_fw_uploadfunction icn8505_upload_fwfunction icn8505_touch_activefunction icn8505_irqfunction icn8505_probe_acpifunction icn8505_probefunction icn8505_suspendfunction icn8505_resume
Annotated Snippet
struct icn8505_touch {
u8 slot;
u8 x[2];
u8 y[2];
u8 pressure; /* Seems more like finger width then pressure really */
u8 event;
/* The difference between 2 and 3 is unclear */
#define ICN8505_EVENT_NO_DATA 1 /* No finger seen yet since wakeup */
#define ICN8505_EVENT_UPDATE1 2 /* New or updated coordinates */
#define ICN8505_EVENT_UPDATE2 3 /* New or updated coordinates */
#define ICN8505_EVENT_END 4 /* Finger lifted */
} __packed;
struct icn8505_touch_data {
u8 softbutton;
u8 touch_count;
struct icn8505_touch touches[ICN8505_MAX_TOUCHES];
} __packed;
struct icn8505_data {
struct i2c_client *client;
struct input_dev *input;
struct touchscreen_properties prop;
char firmware_name[32];
};
static int icn8505_read_xfer(struct i2c_client *client, u16 i2c_addr,
int reg_addr, int reg_addr_width,
void *data, int len, bool silent)
{
u8 buf[3];
int i, ret;
struct i2c_msg msg[2] = {
{
.addr = i2c_addr,
.buf = buf,
.len = reg_addr_width / 8,
},
{
.addr = i2c_addr,
.flags = I2C_M_RD,
.buf = data,
.len = len,
}
};
for (i = 0; i < (reg_addr_width / 8); i++)
buf[i] = (reg_addr >> (reg_addr_width - (i + 1) * 8)) & 0xff;
ret = i2c_transfer(client->adapter, msg, 2);
if (ret != ARRAY_SIZE(msg)) {
if (ret >= 0)
ret = -EIO;
if (!silent)
dev_err(&client->dev,
"Error reading addr %#x reg %#x: %d\n",
i2c_addr, reg_addr, ret);
return ret;
}
return 0;
}
static int icn8505_write_xfer(struct i2c_client *client, u16 i2c_addr,
int reg_addr, int reg_addr_width,
const void *data, int len, bool silent)
{
u8 buf[3 + 32]; /* 3 bytes for 24 bit reg-addr + 32 bytes max len */
int i, ret;
struct i2c_msg msg = {
.addr = i2c_addr,
.buf = buf,
.len = reg_addr_width / 8 + len,
};
if (WARN_ON(len > 32))
return -EINVAL;
for (i = 0; i < (reg_addr_width / 8); i++)
buf[i] = (reg_addr >> (reg_addr_width - (i + 1) * 8)) & 0xff;
memcpy(buf + reg_addr_width / 8, data, len);
ret = i2c_transfer(client->adapter, &msg, 1);
if (ret != 1) {
if (ret >= 0)
ret = -EIO;
if (!silent)
dev_err(&client->dev,
"Error writing addr %#x reg %#x: %d\n",
Annotation
- Immediate include surface: `linux/unaligned.h`, `linux/acpi.h`, `linux/crc32.h`, `linux/delay.h`, `linux/firmware.h`, `linux/interrupt.h`, `linux/i2c.h`, `linux/input.h`.
- Detected declarations: `struct icn8505_touch`, `struct icn8505_touch_data`, `struct icn8505_data`, `function icn8505_read_xfer`, `function icn8505_write_xfer`, `function icn8505_read_data`, `function icn8505_read_reg_silent`, `function icn8505_write_reg`, `function icn8505_read_prog_data`, `function icn8505_write_prog_data`.
- 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.