drivers/input/touchscreen/wm9712.c
Source file repositories/reference/linux-study-clean/drivers/input/touchscreen/wm9712.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/input/touchscreen/wm9712.c- Extension
.c- Size
- 12002 bytes
- Lines
- 468
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/export.hlinux/module.hlinux/moduleparam.hlinux/kernel.hlinux/input.hlinux/delay.hlinux/bitops.hlinux/wm97xx.h
Detected Declarations
function poll_delayfunction wm9712_phy_initfunction wm9712_dig_enablefunction wm9712_aux_preparefunction wm9712_dig_restorefunction is_pdenfunction wm9712_poll_samplefunction wm9712_poll_coordfunction wm9712_poll_touchfunction wm9712_acc_enableexport wm9712_codec
Annotated Snippet
if (pil) {
dev_warn(wm->dev, "pressure measurement is not "
"supported in 5-wire mode\n");
pil = 0;
}
}
/* touchpanel pressure current*/
if (pil == 2) {
dig2 |= WM9712_PIL;
dev_dbg(wm->dev,
"setting pressure measurement current to 400uA.\n");
} else if (pil)
dev_dbg(wm->dev,
"setting pressure measurement current to 200uA.\n");
if (!pil)
pressure = 0;
/* polling mode sample settling delay */
if (delay < 0 || delay > 15) {
dev_dbg(wm->dev, "supplied delay out of range.\n");
delay = 4;
}
dig1 &= 0xff0f;
dig1 |= WM97XX_DELAY(delay);
dev_dbg(wm->dev, "setting adc sample delay to %d u Secs.\n",
delay_table[delay]);
/* mask */
dig2 |= ((mask & 0x3) << 6);
if (mask) {
u16 reg;
/* Set GPIO4 as Mask Pin*/
reg = wm97xx_reg_read(wm, AC97_MISC_AFE);
wm97xx_reg_write(wm, AC97_MISC_AFE, reg | WM97XX_GPIO_4);
reg = wm97xx_reg_read(wm, AC97_GPIO_CFG);
wm97xx_reg_write(wm, AC97_GPIO_CFG, reg | WM97XX_GPIO_4);
}
/* wait - coord mode */
if (coord)
dig2 |= WM9712_WAIT;
wm97xx_reg_write(wm, AC97_WM97XX_DIGITISER1, dig1);
wm97xx_reg_write(wm, AC97_WM97XX_DIGITISER2, dig2);
}
static void wm9712_dig_enable(struct wm97xx *wm, int enable)
{
u16 dig2 = wm->dig[2];
if (enable) {
wm97xx_reg_write(wm, AC97_WM97XX_DIGITISER2,
dig2 | WM97XX_PRP_DET_DIG);
wm97xx_reg_read(wm, AC97_WM97XX_DIGITISER_RD); /* dummy read */
} else
wm97xx_reg_write(wm, AC97_WM97XX_DIGITISER2,
dig2 & ~WM97XX_PRP_DET_DIG);
}
static void wm9712_aux_prepare(struct wm97xx *wm)
{
memcpy(wm->dig_save, wm->dig, sizeof(wm->dig));
wm97xx_reg_write(wm, AC97_WM97XX_DIGITISER1, 0);
wm97xx_reg_write(wm, AC97_WM97XX_DIGITISER2, WM97XX_PRP_DET_DIG);
}
static void wm9712_dig_restore(struct wm97xx *wm)
{
wm97xx_reg_write(wm, AC97_WM97XX_DIGITISER1, wm->dig_save[1]);
wm97xx_reg_write(wm, AC97_WM97XX_DIGITISER2, wm->dig_save[2]);
}
static inline int is_pden(struct wm97xx *wm)
{
return wm->dig[2] & WM9712_PDEN;
}
/*
* Read a sample from the WM9712 adc in polling mode.
*/
static int wm9712_poll_sample(struct wm97xx *wm, int adcsel, int *sample)
{
int timeout = 5 * delay;
bool wants_pen = adcsel & WM97XX_PEN_DOWN;
if (wants_pen && !wm->pen_probably_down) {
u16 data = wm97xx_reg_read(wm, AC97_WM97XX_DIGITISER_RD);
if (!(data & WM97XX_PEN_DOWN))
return RC_PENUP;
Annotation
- Immediate include surface: `linux/export.h`, `linux/module.h`, `linux/moduleparam.h`, `linux/kernel.h`, `linux/input.h`, `linux/delay.h`, `linux/bitops.h`, `linux/wm97xx.h`.
- Detected declarations: `function poll_delay`, `function wm9712_phy_init`, `function wm9712_dig_enable`, `function wm9712_aux_prepare`, `function wm9712_dig_restore`, `function is_pden`, `function wm9712_poll_sample`, `function wm9712_poll_coord`, `function wm9712_poll_touch`, `function wm9712_acc_enable`.
- Atlas domain: Driver Families / drivers/input.
- Implementation status: integration 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.