drivers/input/touchscreen/mainstone-wm97xx.c
Source file repositories/reference/linux-study-clean/drivers/input/touchscreen/mainstone-wm97xx.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/input/touchscreen/mainstone-wm97xx.c- Extension
.c- Size
- 6944 bytes
- Lines
- 275
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/module.hlinux/moduleparam.hlinux/kernel.hlinux/delay.hlinux/gpio/consumer.hlinux/irq.hlinux/interrupt.hlinux/io.hlinux/soc/pxa/cpu.hlinux/wm97xx.hsound/pxa2xx-lib.hasm/mach-types.h
Detected Declarations
struct continuousfunction wm97xx_acc_pen_upfunction wm97xx_acc_pen_downfunction wm97xx_acc_startupfunction wm97xx_acc_shutdownfunction mainstone_wm97xx_probefunction mainstone_wm97xx_remove
Annotated Snippet
struct continuous {
u16 id; /* codec id */
u8 code; /* continuous code */
u8 reads; /* number of coord reads per read cycle */
u32 speed; /* number of coords per second */
};
#define WM_READS(sp) ((sp / HZ) + 1)
static const struct continuous cinfo[] = {
{ WM9705_ID2, 0, WM_READS(94), 94 },
{ WM9705_ID2, 1, WM_READS(188), 188 },
{ WM9705_ID2, 2, WM_READS(375), 375 },
{ WM9705_ID2, 3, WM_READS(750), 750 },
{ WM9712_ID2, 0, WM_READS(94), 94 },
{ WM9712_ID2, 1, WM_READS(188), 188 },
{ WM9712_ID2, 2, WM_READS(375), 375 },
{ WM9712_ID2, 3, WM_READS(750), 750 },
{ WM9713_ID2, 0, WM_READS(94), 94 },
{ WM9713_ID2, 1, WM_READS(120), 120 },
{ WM9713_ID2, 2, WM_READS(154), 154 },
{ WM9713_ID2, 3, WM_READS(188), 188 },
};
/* continuous speed index */
static int sp_idx;
static struct gpio_desc *gpiod_irq;
/*
* Pen sampling frequency (Hz) in continuous mode.
*/
static int cont_rate = 200;
module_param(cont_rate, int, 0);
MODULE_PARM_DESC(cont_rate, "Sampling rate in continuous mode (Hz)");
/*
* Pen down detection.
*
* This driver can either poll or use an interrupt to indicate a pen down
* event. If the irq request fails then it will fall back to polling mode.
*/
static int pen_int;
module_param(pen_int, int, 0);
MODULE_PARM_DESC(pen_int, "Pen down detection (1 = interrupt, 0 = polling)");
/*
* Pressure readback.
*
* Set to 1 to read back pen down pressure
*/
static int pressure;
module_param(pressure, int, 0);
MODULE_PARM_DESC(pressure, "Pressure readback (1 = pressure, 0 = no pressure)");
/*
* AC97 touch data slot.
*
* Touch screen readback data ac97 slot
*/
static int ac97_touch_slot = 5;
module_param(ac97_touch_slot, int, 0);
MODULE_PARM_DESC(ac97_touch_slot, "Touch screen data slot AC97 number");
/* flush AC97 slot 5 FIFO on pxa machines */
static void wm97xx_acc_pen_up(struct wm97xx *wm)
{
unsigned int count;
msleep(1);
if (cpu_is_pxa27x()) {
while (pxa2xx_ac97_read_misr() & (1 << 2))
pxa2xx_ac97_read_modr();
} else if (cpu_is_pxa3xx()) {
for (count = 0; count < 16; count++)
pxa2xx_ac97_read_modr();
}
}
static int wm97xx_acc_pen_down(struct wm97xx *wm)
{
u16 x, y, p = 0x100 | WM97XX_ADCSEL_PRES;
int reads = 0;
static u16 last, tries;
/* When the AC97 queue has been drained we need to allow time
* to buffer up samples otherwise we end up spinning polling
* for samples. The controller can't have a suitably low
* threshold set to use the notifications it gives.
Annotation
- Immediate include surface: `linux/module.h`, `linux/moduleparam.h`, `linux/kernel.h`, `linux/delay.h`, `linux/gpio/consumer.h`, `linux/irq.h`, `linux/interrupt.h`, `linux/io.h`.
- Detected declarations: `struct continuous`, `function wm97xx_acc_pen_up`, `function wm97xx_acc_pen_down`, `function wm97xx_acc_startup`, `function wm97xx_acc_shutdown`, `function mainstone_wm97xx_probe`, `function mainstone_wm97xx_remove`.
- 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.