drivers/input/touchscreen/silead.c
Source file repositories/reference/linux-study-clean/drivers/input/touchscreen/silead.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/input/touchscreen/silead.c- Extension
.c- Size
- 22097 bytes
- Lines
- 832
- 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/i2c.hlinux/module.hlinux/acpi.hlinux/interrupt.hlinux/gpio/consumer.hlinux/delay.hlinux/firmware.hlinux/input.hlinux/input/mt.hlinux/input/touchscreen.hlinux/pm.hlinux/pm_runtime.hlinux/irq.hlinux/regulator/consumer.hlinux/unaligned.h
Detected Declarations
struct silead_ts_datastruct silead_fw_dataenum silead_ts_powerfunction silead_apply_efi_fw_min_maxfunction silead_ts_request_input_devfunction silead_ts_request_pen_input_devfunction silead_ts_set_powerfunction silead_ts_handle_pen_datafunction silead_ts_read_datafunction silead_ts_initfunction silead_ts_resetfunction silead_ts_startupfunction silead_ts_load_fwfunction silead_ts_get_statusfunction silead_ts_get_idfunction silead_ts_setupfunction i2c_recover_busfunction silead_ts_threaded_irq_handlerfunction silead_ts_read_propsfunction silead_ts_set_default_fw_namefunction silead_ts_set_default_fw_namefunction silead_disable_regulatorfunction silead_ts_probefunction silead_ts_suspendfunction silead_ts_resume
Annotated Snippet
struct silead_ts_data {
struct i2c_client *client;
struct gpio_desc *gpio_power;
struct input_dev *input;
struct input_dev *pen_input;
struct regulator_bulk_data regulators[2];
char fw_name[64];
struct touchscreen_properties prop;
u32 chip_id;
struct input_mt_pos pos[SILEAD_MAX_FINGERS];
int slots[SILEAD_MAX_FINGERS];
int id[SILEAD_MAX_FINGERS];
u32 efi_fw_min_max[4];
bool efi_fw_min_max_set;
bool pen_supported;
bool pen_down;
u32 pen_x_res;
u32 pen_y_res;
int pen_up_count;
};
struct silead_fw_data {
u32 offset;
u32 val;
};
static void silead_apply_efi_fw_min_max(struct silead_ts_data *data)
{
struct input_absinfo *absinfo_x = &data->input->absinfo[ABS_MT_POSITION_X];
struct input_absinfo *absinfo_y = &data->input->absinfo[ABS_MT_POSITION_Y];
if (!data->efi_fw_min_max_set)
return;
absinfo_x->minimum = data->efi_fw_min_max[0];
absinfo_x->maximum = data->efi_fw_min_max[1];
absinfo_y->minimum = data->efi_fw_min_max[2];
absinfo_y->maximum = data->efi_fw_min_max[3];
if (data->prop.invert_x) {
absinfo_x->maximum -= absinfo_x->minimum;
absinfo_x->minimum = 0;
}
if (data->prop.invert_y) {
absinfo_y->maximum -= absinfo_y->minimum;
absinfo_y->minimum = 0;
}
if (data->prop.swap_x_y) {
swap(absinfo_x->minimum, absinfo_y->minimum);
swap(absinfo_x->maximum, absinfo_y->maximum);
}
}
static int silead_ts_request_input_dev(struct silead_ts_data *data)
{
struct device *dev = &data->client->dev;
int error;
data->input = devm_input_allocate_device(dev);
if (!data->input) {
dev_err(dev,
"Failed to allocate input device\n");
return -ENOMEM;
}
input_set_abs_params(data->input, ABS_MT_POSITION_X, 0, 4095, 0, 0);
input_set_abs_params(data->input, ABS_MT_POSITION_Y, 0, 4095, 0, 0);
touchscreen_parse_properties(data->input, true, &data->prop);
silead_apply_efi_fw_min_max(data);
input_mt_init_slots(data->input, SILEAD_MAX_FINGERS,
INPUT_MT_DIRECT | INPUT_MT_DROP_UNUSED |
INPUT_MT_TRACK);
if (device_property_read_bool(dev, "silead,home-button"))
input_set_capability(data->input, EV_KEY, KEY_LEFTMETA);
data->input->name = SILEAD_TS_NAME;
data->input->phys = "input/ts";
data->input->id.bustype = BUS_I2C;
error = input_register_device(data->input);
if (error) {
dev_err(dev, "Failed to register input device: %d\n", error);
return error;
}
return 0;
Annotation
- Immediate include surface: `linux/i2c.h`, `linux/module.h`, `linux/acpi.h`, `linux/interrupt.h`, `linux/gpio/consumer.h`, `linux/delay.h`, `linux/firmware.h`, `linux/input.h`.
- Detected declarations: `struct silead_ts_data`, `struct silead_fw_data`, `enum silead_ts_power`, `function silead_apply_efi_fw_min_max`, `function silead_ts_request_input_dev`, `function silead_ts_request_pen_input_dev`, `function silead_ts_set_power`, `function silead_ts_handle_pen_data`, `function silead_ts_read_data`, `function silead_ts_init`.
- 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.