drivers/input/touchscreen/ti_am335x_tsc.c
Source file repositories/reference/linux-study-clean/drivers/input/touchscreen/ti_am335x_tsc.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/input/touchscreen/ti_am335x_tsc.c- Extension
.c- Size
- 14380 bytes
- Lines
- 569
- 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/kernel.hlinux/err.hlinux/module.hlinux/input.hlinux/slab.hlinux/interrupt.hlinux/clk.hlinux/platform_device.hlinux/io.hlinux/delay.hlinux/of.hlinux/sort.hlinux/pm_wakeirq.hlinux/mfd/ti_am335x_tscadc.h
Detected Declarations
struct titscfunction titsc_readlfunction titsc_writelfunction titsc_config_wiresfunction titsc_step_configfunction titsc_cmp_coordfunction titsc_read_coordinatesfunction titsc_irqfunction titsc_parse_dtfunction titsc_probefunction titsc_removefunction titsc_suspendfunction titsc_resume
Annotated Snippet
struct titsc {
struct input_dev *input;
struct ti_tscadc_dev *mfd_tscadc;
struct device *dev;
unsigned int irq;
unsigned int wires;
unsigned int x_plate_resistance;
bool pen_down;
int coordinate_readouts;
u32 config_inp[4];
u32 bit_xp, bit_xn, bit_yp, bit_yn;
u32 inp_xp, inp_xn, inp_yp, inp_yn;
u32 step_mask;
u32 charge_delay;
};
static unsigned int titsc_readl(struct titsc *ts, unsigned int reg)
{
return readl(ts->mfd_tscadc->tscadc_base + reg);
}
static void titsc_writel(struct titsc *tsc, unsigned int reg,
unsigned int val)
{
writel(val, tsc->mfd_tscadc->tscadc_base + reg);
}
static int titsc_config_wires(struct titsc *ts_dev)
{
u32 analog_line[4];
u32 wire_order[4];
int i, bit_cfg;
for (i = 0; i < 4; i++) {
/*
* Get the order in which TSC wires are attached
* w.r.t. each of the analog input lines on the EVM.
*/
analog_line[i] = (ts_dev->config_inp[i] & 0xF0) >> 4;
wire_order[i] = ts_dev->config_inp[i] & 0x0F;
if (WARN_ON(analog_line[i] > 7))
return -EINVAL;
if (WARN_ON(wire_order[i] >= ARRAY_SIZE(config_pins)))
return -EINVAL;
}
for (i = 0; i < 4; i++) {
int an_line;
int wi_order;
an_line = analog_line[i];
wi_order = wire_order[i];
bit_cfg = config_pins[wi_order];
if (bit_cfg == 0)
return -EINVAL;
switch (wi_order) {
case 0:
ts_dev->bit_xp = bit_cfg;
ts_dev->inp_xp = an_line;
break;
case 1:
ts_dev->bit_xn = bit_cfg;
ts_dev->inp_xn = an_line;
break;
case 2:
ts_dev->bit_yp = bit_cfg;
ts_dev->inp_yp = an_line;
break;
case 3:
ts_dev->bit_yn = bit_cfg;
ts_dev->inp_yn = an_line;
break;
}
}
return 0;
}
static void titsc_step_config(struct titsc *ts_dev)
{
unsigned int config;
int i, n;
int end_step, first_step, tsc_steps;
u32 stepenable;
config = STEPCONFIG_MODE_HWSYNC |
STEPCONFIG_AVG_16 | ts_dev->bit_xp |
STEPCONFIG_INM_ADCREFM;
switch (ts_dev->wires) {
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/err.h`, `linux/module.h`, `linux/input.h`, `linux/slab.h`, `linux/interrupt.h`, `linux/clk.h`, `linux/platform_device.h`.
- Detected declarations: `struct titsc`, `function titsc_readl`, `function titsc_writel`, `function titsc_config_wires`, `function titsc_step_config`, `function titsc_cmp_coord`, `function titsc_read_coordinates`, `function titsc_irq`, `function titsc_parse_dt`, `function titsc_probe`.
- 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.