drivers/input/touchscreen/edt-ft5x06.c
Source file repositories/reference/linux-study-clean/drivers/input/touchscreen/edt-ft5x06.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/input/touchscreen/edt-ft5x06.c- Extension
.c- Size
- 40573 bytes
- Lines
- 1535
- Domain
- Driver Families
- Bucket
- drivers/input
- Inferred role
- Driver Families: operation-table or driver-model contract
- Status
- pattern 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.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- 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/debugfs.hlinux/delay.hlinux/gpio/consumer.hlinux/i2c.hlinux/interrupt.hlinux/input.hlinux/input/mt.hlinux/input/touchscreen.hlinux/irq.hlinux/kernel.hlinux/module.hlinux/property.hlinux/ratelimit.hlinux/regmap.hlinux/regulator/consumer.hlinux/slab.hlinux/uaccess.hlinux/unaligned.h
Detected Declarations
struct edt_reg_addrstruct edt_ft5x06_ts_datastruct edt_i2c_chip_datastruct edt_ft5x06_attributeenum edt_pmodeenum edt_verfunction edt_ft5x06_ts_check_crcfunction edt_M06_i2c_readfunction edt_M06_i2c_writefunction edt_ft5x06_ts_isrfunction edt_ft5x06_setting_showfunction edt_ft5x06_setting_storefunction model_showfunction fw_version_showfunction header_errors_showfunction crc_errors_showfunction edt_ft5x06_restore_reg_parametersfunction edt_ft5x06_factory_modefunction edt_ft5x06_work_modefunction edt_ft5x06_debugfs_mode_getfunction edt_ft5x06_debugfs_mode_setfunction edt_ft5x06_debugfs_raw_data_readfunction edt_ft5x06_ts_prepare_debugfsfunction edt_ft5x06_ts_teardown_debugfsfunction edt_ft5x06_factory_modefunction edt_ft5x06_ts_prepare_debugfsfunction edt_ft5x06_ts_get_defaultsfunction edt_ft5x06_ts_get_parametersfunction edt_ft5x06_ts_set_tdata_parametersfunction edt_ft5x06_ts_set_regsfunction edt_ft5x06_exit_regmapfunction edt_ft5x06_disable_regulatorsfunction edt_ft5x06_ts_probefunction edt_ft5x06_ts_removefunction edt_ft5x06_ts_suspendfunction edt_ft5x06_ts_resume
Annotated Snippet
static const struct file_operations debugfs_raw_data_fops = {
.open = simple_open,
.read = edt_ft5x06_debugfs_raw_data_read,
};
static void edt_ft5x06_ts_prepare_debugfs(struct edt_ft5x06_ts_data *tsdata)
{
struct dentry *debug_dir = tsdata->client->debugfs;
debugfs_create_u16("num_x", S_IRUSR, debug_dir, &tsdata->num_x);
debugfs_create_u16("num_y", S_IRUSR, debug_dir, &tsdata->num_y);
debugfs_create_file("mode", S_IRUSR | S_IWUSR,
debug_dir, tsdata, &debugfs_mode_fops);
debugfs_create_file("raw_data", S_IRUSR,
debug_dir, tsdata, &debugfs_raw_data_fops);
}
static void edt_ft5x06_ts_teardown_debugfs(struct edt_ft5x06_ts_data *tsdata)
{
guard(mutex)(&tsdata->mutex);
kfree(tsdata->raw_buffer);
tsdata->raw_buffer = NULL;
}
#else
static int edt_ft5x06_factory_mode(struct edt_ft5x06_ts_data *tsdata)
{
return -ENOSYS;
}
static void edt_ft5x06_ts_prepare_debugfs(struct edt_ft5x06_ts_data *tsdata)
{
}
static void edt_ft5x06_ts_teardown_debugfs(struct edt_ft5x06_ts_data *tsdata)
{
}
#endif /* CONFIG_DEBUGFS */
static int edt_ft5x06_ts_identify(struct i2c_client *client,
struct edt_ft5x06_ts_data *tsdata)
{
u8 rdbuf[EDT_NAME_LEN];
char *p;
int error;
char *model_name = tsdata->name;
char *fw_version = tsdata->fw_version;
/* see what we find if we assume it is a M06 *
* if we get less than EDT_NAME_LEN, we don't want
* to have garbage in there
*/
memset(rdbuf, 0, sizeof(rdbuf));
error = regmap_bulk_read(tsdata->regmap, 0xBB, rdbuf, EDT_NAME_LEN - 1);
if (error)
return error;
/* Probe content for something consistent.
* M06 starts with a response byte, M12 gives the data directly.
* M09/Generic does not provide model number information.
*/
if (!strncasecmp(rdbuf + 1, "EP0", 3)) {
tsdata->version = EDT_M06;
/* remove last '$' end marker */
rdbuf[EDT_NAME_LEN - 1] = '\0';
if (rdbuf[EDT_NAME_LEN - 2] == '$')
rdbuf[EDT_NAME_LEN - 2] = '\0';
/* look for Model/Version separator */
p = strchr(rdbuf, '*');
if (p)
*p++ = '\0';
strscpy(model_name, rdbuf + 1, EDT_NAME_LEN);
strscpy(fw_version, p ? p : "", EDT_NAME_LEN);
regmap_exit(tsdata->regmap);
tsdata->regmap = regmap_init_i2c(client,
&edt_M06_i2c_regmap_config);
if (IS_ERR(tsdata->regmap)) {
dev_err(&client->dev, "regmap allocation failed\n");
return PTR_ERR(tsdata->regmap);
}
} else if (!strncasecmp(rdbuf, "EP0", 3)) {
tsdata->version = EDT_M12;
Annotation
- Immediate include surface: `linux/debugfs.h`, `linux/delay.h`, `linux/gpio/consumer.h`, `linux/i2c.h`, `linux/interrupt.h`, `linux/input.h`, `linux/input/mt.h`, `linux/input/touchscreen.h`.
- Detected declarations: `struct edt_reg_addr`, `struct edt_ft5x06_ts_data`, `struct edt_i2c_chip_data`, `struct edt_ft5x06_attribute`, `enum edt_pmode`, `enum edt_ver`, `function edt_ft5x06_ts_check_crc`, `function edt_M06_i2c_read`, `function edt_M06_i2c_write`, `function edt_ft5x06_ts_isr`.
- Atlas domain: Driver Families / drivers/input.
- Implementation status: pattern implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
- 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.