drivers/input/touchscreen/elants_i2c.c
Source file repositories/reference/linux-study-clean/drivers/input/touchscreen/elants_i2c.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/input/touchscreen/elants_i2c.c- Extension
.c- Size
- 41703 bytes
- Lines
- 1659
- 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/module.hlinux/input.hlinux/interrupt.hlinux/irq.hlinux/platform_device.hlinux/async.hlinux/i2c.hlinux/delay.hlinux/uaccess.hlinux/buffer_head.hlinux/slab.hlinux/firmware.hlinux/input/mt.hlinux/input/touchscreen.hlinux/acpi.hlinux/of.hlinux/pm_wakeirq.hlinux/gpio/consumer.hlinux/regulator/consumer.hlinux/uuid.hlinux/unaligned.h
Detected Declarations
struct elants_datastruct elants_version_attributeenum elants_chip_idenum elants_stateenum elants_iap_modefunction elants_i2c_sendfunction elants_i2c_readfunction elants_i2c_execute_commandfunction elants_i2c_calibratefunction scoped_guardfunction elants_i2c_sw_resetfunction elants_i2c_parse_versionfunction elants_i2c_query_hw_versionfunction elants_i2c_query_fw_versionfunction elants_i2c_query_test_versionfunction elants_i2c_query_bc_versionfunction elants_i2c_query_ts_info_ektffunction elants_i2c_query_ts_info_ekthfunction elants_i2c_fastbootfunction elants_i2c_initializefunction elants_i2c_fw_write_pagefunction elants_i2c_validate_remark_idfunction elants_i2c_should_check_remark_idfunction elants_i2c_do_update_firmwarefunction elants_i2c_fw_updatefunction scoped_guardfunction elants_i2c_mt_eventfunction elants_i2c_calculate_checksumfunction elants_i2c_eventfunction elants_i2c_irqfunction calibrate_storefunction scoped_cond_guardfunction write_update_fwfunction scoped_cond_guardfunction show_iap_modefunction show_calibration_countfunction __ELANTS_FIELD_SIZEfunction elants_i2c_power_onfunction elants_i2c_power_offfunction elants_acpi_is_hid_devicefunction elants_acpi_is_hid_devicefunction elants_i2c_probefunction elants_i2c_suspendfunction elants_i2c_resume
Annotated Snippet
struct elants_data {
struct i2c_client *client;
struct input_dev *input;
struct regulator *vcc33;
struct regulator *vccio;
struct gpio_desc *reset_gpio;
u16 fw_version;
u8 test_version;
u8 solution_version;
u8 bc_version;
u8 iap_version;
u16 hw_version;
u8 major_res;
unsigned int x_res; /* resolution in units/mm */
unsigned int y_res;
unsigned int x_max;
unsigned int y_max;
unsigned int phy_x;
unsigned int phy_y;
struct touchscreen_properties prop;
enum elants_state state;
enum elants_chip_id chip_id;
enum elants_iap_mode iap_mode;
/* Guards against concurrent access to the device via sysfs */
struct mutex sysfs_mutex;
u8 cmd_resp[HEADER_SIZE];
struct completion cmd_done;
bool keep_power_in_suspend;
/* Must be last to be used for DMA operations */
u8 buf[MAX_PACKET_SIZE] ____cacheline_aligned;
};
static int elants_i2c_send(struct i2c_client *client,
const void *data, size_t size)
{
int ret;
ret = i2c_master_send(client, data, size);
if (ret == size)
return 0;
if (ret >= 0)
ret = -EIO;
dev_err(&client->dev, "%s failed (%*ph): %d\n",
__func__, (int)size, data, ret);
return ret;
}
static int elants_i2c_read(struct i2c_client *client, void *data, size_t size)
{
int ret;
ret = i2c_master_recv(client, data, size);
if (ret == size)
return 0;
if (ret >= 0)
ret = -EIO;
dev_err(&client->dev, "%s failed: %d\n", __func__, ret);
return ret;
}
static int elants_i2c_execute_command(struct i2c_client *client,
const u8 *cmd, size_t cmd_size,
u8 *resp, size_t resp_size,
int retries, const char *cmd_name)
{
struct i2c_msg msgs[2];
int ret;
u8 expected_response;
switch (cmd[0]) {
case CMD_HEADER_READ:
expected_response = CMD_HEADER_RESP;
break;
case CMD_HEADER_6B_READ:
expected_response = CMD_HEADER_6B_RESP;
break;
Annotation
- Immediate include surface: `linux/bits.h`, `linux/module.h`, `linux/input.h`, `linux/interrupt.h`, `linux/irq.h`, `linux/platform_device.h`, `linux/async.h`, `linux/i2c.h`.
- Detected declarations: `struct elants_data`, `struct elants_version_attribute`, `enum elants_chip_id`, `enum elants_state`, `enum elants_iap_mode`, `function elants_i2c_send`, `function elants_i2c_read`, `function elants_i2c_execute_command`, `function elants_i2c_calibrate`, `function scoped_guard`.
- 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.