drivers/input/mouse/elan_i2c_i2c.c
Source file repositories/reference/linux-study-clean/drivers/input/mouse/elan_i2c_i2c.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/input/mouse/elan_i2c_i2c.c- Extension
.c- Size
- 18024 bytes
- Lines
- 778
- 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.
- 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/completion.hlinux/delay.hlinux/i2c.hlinux/interrupt.hlinux/jiffies.hlinux/kernel.hlinux/slab.hlinux/sched.hlinux/unaligned.helan_i2c.h
Detected Declarations
function Copyrightfunction elan_i2c_read_cmdfunction elan_i2c_write_cmdfunction elan_i2c_initializefunction elan_i2c_sleep_controlfunction elan_i2c_power_controlfunction elan_i2c_set_modefunction elan_i2c_calibratefunction elan_i2c_calibrate_resultfunction elan_i2c_get_baseline_datafunction elan_i2c_get_patternfunction elan_i2c_get_versionfunction elan_i2c_get_sm_versionfunction elan_i2c_get_product_idfunction elan_i2c_get_checksumfunction elan_i2c_get_maxfunction elan_i2c_get_resolutionfunction elan_i2c_get_num_tracesfunction elan_i2c_get_pressure_adjustmentfunction elan_i2c_iap_get_modefunction elan_i2c_iap_resetfunction elan_i2c_set_flash_keyfunction elan_read_write_iap_typefunction elan_i2c_prepare_fw_updatefunction elan_i2c_write_fw_blockfunction elan_i2c_finish_fw_updatefunction msecs_to_jiffiesfunction elan_i2c_get_report_featuresfunction elan_i2c_get_report
Annotated Snippet
if (error) {
dev_err(&client->dev, "failed to get ic type: %d\n",
error);
return error;
}
*ic_type = be16_to_cpup((__be16 *)val);
error = elan_i2c_read_cmd(client, ETP_I2C_NSM_VERSION_CMD,
val);
if (error) {
dev_err(&client->dev, "failed to get SM version: %d\n",
error);
return error;
}
*version = val[1];
*clickpad = val[0] & 0x10;
} else {
error = elan_i2c_read_cmd(client, ETP_I2C_OSM_VERSION_CMD, val);
if (error) {
dev_err(&client->dev, "failed to get SM version: %d\n",
error);
return error;
}
*version = val[0];
error = elan_i2c_read_cmd(client, ETP_I2C_IC_TYPE_P0_CMD, val);
if (error) {
dev_err(&client->dev, "failed to get ic type: %d\n",
error);
return error;
}
*ic_type = val[0];
error = elan_i2c_read_cmd(client, ETP_I2C_NSM_VERSION_CMD,
val);
if (error) {
dev_err(&client->dev, "failed to get SM version: %d\n",
error);
return error;
}
*clickpad = val[0] & 0x10;
}
return 0;
}
static int elan_i2c_get_product_id(struct i2c_client *client, u16 *id)
{
int error;
u8 val[3];
error = elan_i2c_read_cmd(client, ETP_I2C_UNIQUEID_CMD, val);
if (error) {
dev_err(&client->dev, "failed to get product ID: %d\n", error);
return error;
}
*id = le16_to_cpup((__le16 *)val);
return 0;
}
static int elan_i2c_get_checksum(struct i2c_client *client,
bool iap, u16 *csum)
{
int error;
u8 val[3];
error = elan_i2c_read_cmd(client,
iap ? ETP_I2C_IAP_CHECKSUM_CMD :
ETP_I2C_FW_CHECKSUM_CMD,
val);
if (error) {
dev_err(&client->dev, "failed to get %s checksum: %d\n",
iap ? "IAP" : "FW", error);
return error;
}
*csum = le16_to_cpup((__le16 *)val);
return 0;
}
static int elan_i2c_get_max(struct i2c_client *client,
unsigned int *max_x, unsigned int *max_y)
{
int error;
u8 val[3];
error = elan_i2c_read_cmd(client, ETP_I2C_MAX_X_AXIS_CMD, val);
if (error) {
dev_err(&client->dev, "failed to get X dimension: %d\n", error);
Annotation
- Immediate include surface: `linux/completion.h`, `linux/delay.h`, `linux/i2c.h`, `linux/interrupt.h`, `linux/jiffies.h`, `linux/kernel.h`, `linux/slab.h`, `linux/sched.h`.
- Detected declarations: `function Copyright`, `function elan_i2c_read_cmd`, `function elan_i2c_write_cmd`, `function elan_i2c_initialize`, `function elan_i2c_sleep_control`, `function elan_i2c_power_control`, `function elan_i2c_set_mode`, `function elan_i2c_calibrate`, `function elan_i2c_calibrate_result`, `function elan_i2c_get_baseline_data`.
- Atlas domain: Driver Families / drivers/input.
- Implementation status: source implementation candidate.
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.