drivers/input/touchscreen/cyttsp_core.c
Source file repositories/reference/linux-study-clean/drivers/input/touchscreen/cyttsp_core.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/input/touchscreen/cyttsp_core.c- Extension
.c- Size
- 16418 bytes
- Lines
- 710
- Domain
- Driver Families
- Bucket
- drivers/input
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- 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/delay.hlinux/export.hlinux/input.hlinux/input/mt.hlinux/input/touchscreen.hlinux/interrupt.hlinux/slab.hlinux/property.hlinux/gpio/consumer.hlinux/regulator/consumer.hcyttsp_core.h
Detected Declarations
function ttsp_read_block_datafunction ttsp_write_block_datafunction ttsp_send_commandfunction cyttsp_handshakefunction cyttsp_load_bl_regsfunction cyttsp_exit_bl_modefunction cyttsp_set_operational_modefunction cyttsp_set_sysinfo_modefunction cyttsp_set_sysinfo_regsfunction cyttsp_hard_resetfunction cyttsp_soft_resetfunction cyttsp_act_dist_setupfunction cyttsp_extract_track_idsfunction cyttsp_report_tchdatafunction cyttsp_irqfunction cyttsp_power_onfunction cyttsp_enablefunction cyttsp_disablefunction cyttsp_suspendfunction cyttsp_resumefunction cyttsp_openfunction cyttsp_closefunction cyttsp_parse_propertiesexport cyttsp_probe
Annotated Snippet
msecs_to_jiffies(CY_DELAY_DFLT * CY_DELAY_MAX))) {
dev_err(ts->dev, "timeout waiting for soft reset\n");
retval = -EIO;
}
out:
ts->state = CY_IDLE_STATE;
disable_irq(ts->irq);
return retval;
}
static int cyttsp_act_dist_setup(struct cyttsp *ts)
{
u8 act_dist_setup = ts->act_dist;
/* Init gesture; active distance setup */
return ttsp_write_block_data(ts, CY_REG_ACT_DIST,
sizeof(act_dist_setup), &act_dist_setup);
}
static void cyttsp_extract_track_ids(struct cyttsp_xydata *xy_data, int *ids)
{
ids[0] = xy_data->touch12_id >> 4;
ids[1] = xy_data->touch12_id & 0xF;
ids[2] = xy_data->touch34_id >> 4;
ids[3] = xy_data->touch34_id & 0xF;
}
static const struct cyttsp_tch *cyttsp_get_tch(struct cyttsp_xydata *xy_data,
int idx)
{
switch (idx) {
case 0:
return &xy_data->tch1;
case 1:
return &xy_data->tch2;
case 2:
return &xy_data->tch3;
case 3:
return &xy_data->tch4;
default:
return NULL;
}
}
static void cyttsp_report_tchdata(struct cyttsp *ts)
{
struct cyttsp_xydata *xy_data = &ts->xy_data;
struct input_dev *input = ts->input;
int num_tch = GET_NUM_TOUCHES(xy_data->tt_stat);
const struct cyttsp_tch *tch;
int ids[CY_MAX_ID];
int i;
DECLARE_BITMAP(used, CY_MAX_ID);
if (IS_LARGE_AREA(xy_data->tt_stat) == 1) {
/* terminate all active tracks */
num_tch = 0;
dev_dbg(ts->dev, "%s: Large area detected\n", __func__);
} else if (num_tch > CY_MAX_FINGER) {
/* terminate all active tracks */
num_tch = 0;
dev_dbg(ts->dev, "%s: Num touch error detected\n", __func__);
} else if (IS_BAD_PKT(xy_data->tt_mode)) {
/* terminate all active tracks */
num_tch = 0;
dev_dbg(ts->dev, "%s: Invalid buffer detected\n", __func__);
}
cyttsp_extract_track_ids(xy_data, ids);
bitmap_zero(used, CY_MAX_ID);
for (i = 0; i < num_tch; i++) {
tch = cyttsp_get_tch(xy_data, i);
input_mt_slot(input, ids[i]);
input_mt_report_slot_state(input, MT_TOOL_FINGER, true);
input_report_abs(input, ABS_MT_POSITION_X, be16_to_cpu(tch->x));
input_report_abs(input, ABS_MT_POSITION_Y, be16_to_cpu(tch->y));
input_report_abs(input, ABS_MT_TOUCH_MAJOR, tch->z);
__set_bit(ids[i], used);
}
for (i = 0; i < CY_MAX_ID; i++) {
if (test_bit(i, used))
continue;
input_mt_slot(input, i);
Annotation
- Immediate include surface: `linux/delay.h`, `linux/export.h`, `linux/input.h`, `linux/input/mt.h`, `linux/input/touchscreen.h`, `linux/interrupt.h`, `linux/slab.h`, `linux/property.h`.
- Detected declarations: `function ttsp_read_block_data`, `function ttsp_write_block_data`, `function ttsp_send_command`, `function cyttsp_handshake`, `function cyttsp_load_bl_regs`, `function cyttsp_exit_bl_mode`, `function cyttsp_set_operational_mode`, `function cyttsp_set_sysinfo_mode`, `function cyttsp_set_sysinfo_regs`, `function cyttsp_hard_reset`.
- Atlas domain: Driver Families / drivers/input.
- Implementation status: integration 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.