// SPDX-License-Identifier: GPL-2.0-or-later /* * wm9705.c -- Codec driver for Wolfson WM9705 AC97 Codec. * * Copyright 2003, 2004, 2005, 2006, 2007 Wolfson Microelectronics PLC. * Author: Liam Girdwood <[email protected]> * Parts Copyright : Ian Molton <[email protected]> * Andrew Zabolotny <[email protected]> * Russell King <[email protected]> */ #include <linux/module.h> #include <linux/moduleparam.h> #include <linux/kernel.h> #include <linux/input.h> #include <linux/delay.h> #include <linux/bitops.h> #include <linux/wm97xx.h> #define TS_NAME … #define WM9705_VERSION … #define DEFAULT_PRESSURE … /* * Module parameters */ /* * Set current used for pressure measurement. * * Set pil = 2 to use 400uA * pil = 1 to use 200uA and * pil = 0 to disable pressure measurement. * * This is used to increase the range of values returned by the adc * when measureing touchpanel pressure. */ static int pil; module_param(pil, int, 0); MODULE_PARM_DESC(…) …; /* * Set threshold for pressure measurement. * * Pen down pressure below threshold is ignored. */ static int pressure = …; module_param(pressure, int, 0); MODULE_PARM_DESC(…) …; /* * Set adc sample delay. * * For accurate touchpanel measurements, some settling time may be * required between the switch matrix applying a voltage across the * touchpanel plate and the ADC sampling the signal. * * This delay can be set by setting delay = n, where n is the array * position of the delay in the array delay_table below. * Long delays > 1ms are supported for completeness, but are not * recommended. */ static int delay = …; module_param(delay, int, 0); MODULE_PARM_DESC(…) …; /* * Pen detect comparator threshold. * * 0 to Vmid in 15 steps, 0 = use zero power comparator with Vmid threshold * i.e. 1 = Vmid/15 threshold * 15 = Vmid/1 threshold * * Adjust this value if you are having problems with pen detect not * detecting any down events. */ static int pdd = …; module_param(pdd, int, 0); MODULE_PARM_DESC(…) …; /* * Set adc mask function. * * Sources of glitch noise, such as signals driving an LCD display, may feed * through to the touch screen plates and affect measurement accuracy. In * order to minimise this, a signal may be applied to the MASK pin to delay or * synchronise the sampling. * * 0 = No delay or sync * 1 = High on pin stops conversions * 2 = Edge triggered, edge on pin delays conversion by delay param (above) * 3 = Edge triggered, edge on pin starts conversion after delay param */ static int mask; module_param(mask, int, 0); MODULE_PARM_DESC(…) …; /* * ADC sample delay times in uS */ static const int delay_table[] = …; /* * Delay after issuing a POLL command. * * The delay is 3 AC97 link frames + the touchpanel settling delay */ static inline void poll_delay(int d) { … } /* * set up the physical settings of the WM9705 */ static void wm9705_phy_init(struct wm97xx *wm) { … } static void wm9705_dig_enable(struct wm97xx *wm, int enable) { … } static void wm9705_aux_prepare(struct wm97xx *wm) { … } static void wm9705_dig_restore(struct wm97xx *wm) { … } static inline int is_pden(struct wm97xx *wm) { … } /* * Read a sample from the WM9705 adc in polling mode. */ static int wm9705_poll_sample(struct wm97xx *wm, int adcsel, int *sample) { … } /* * Sample the WM9705 touchscreen in polling mode */ static int wm9705_poll_touch(struct wm97xx *wm, struct wm97xx_data *data) { … } /* * Enable WM9705 continuous mode, i.e. touch data is streamed across * an AC97 slot */ static int wm9705_acc_enable(struct wm97xx *wm, int enable) { … } struct wm97xx_codec_drv wm9705_codec = …; EXPORT_SYMBOL_GPL(…); /* Module information */ MODULE_AUTHOR(…) …; MODULE_DESCRIPTION(…) …; MODULE_LICENSE(…) …;