diff options
| author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2008-04-02 00:51:30 -0400 |
|---|---|---|
| committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2008-04-02 00:51:30 -0400 |
| commit | dca98e91fb83a43fc430893f349fd8248fa0ba38 (patch) | |
| tree | 4a79f88ce58fe2b02b423c5e41c44d16a0c41a17 /drivers/input/touchscreen | |
| parent | de22b9ef1020ffdb9e1ed6f4686e2e62eaeb0958 (diff) | |
Input: WM97xx - add chip driver for WM97123 touchscreen
Signed-off-by: Liam Girdwood <liam.girdwood@wolfsonmicro.com>
Signed-off-by: Graeme Gregory <gg@opensource.wolfsonmicro.com>
Signed-off-by: Mike Arthur <mike.arthur@wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Lars Munch <lars@segv.dk>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/touchscreen')
| -rw-r--r-- | drivers/input/touchscreen/Kconfig | 9 | ||||
| -rw-r--r-- | drivers/input/touchscreen/Makefile | 1 | ||||
| -rw-r--r-- | drivers/input/touchscreen/wm9713.c | 460 |
3 files changed, 470 insertions, 0 deletions
diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig index 240e441c118a..f6e8dad9726b 100644 --- a/drivers/input/touchscreen/Kconfig +++ b/drivers/input/touchscreen/Kconfig | |||
| @@ -217,6 +217,15 @@ config TOUCHSCREEN_WM9712 | |||
| 217 | 217 | ||
| 218 | If unsure, say N. | 218 | If unsure, say N. |
| 219 | 219 | ||
| 220 | config TOUCHSCREEN_WM9713 | ||
| 221 | bool "WM9713 Touchscreen interface support" | ||
| 222 | depends on TOUCHSCREEN_WM97XX | ||
| 223 | help | ||
| 224 | Say Y here if you have a Wolfson Microelectronics WM9713 touchscreen | ||
| 225 | controller connected to your system. | ||
| 226 | |||
| 227 | If unsure, say N. | ||
| 228 | |||
| 220 | config TOUCHSCREEN_USB_COMPOSITE | 229 | config TOUCHSCREEN_USB_COMPOSITE |
| 221 | tristate "USB Touchscreen Driver" | 230 | tristate "USB Touchscreen Driver" |
| 222 | depends on USB_ARCH_HAS_HCD | 231 | depends on USB_ARCH_HAS_HCD |
diff --git a/drivers/input/touchscreen/Makefile b/drivers/input/touchscreen/Makefile index eb57f66e57f3..f1bc82941cc6 100644 --- a/drivers/input/touchscreen/Makefile +++ b/drivers/input/touchscreen/Makefile | |||
| @@ -24,3 +24,4 @@ obj-$(CONFIG_TOUCHSCREEN_UCB1400) += ucb1400_ts.o | |||
| 24 | obj-$(CONFIG_TOUCHSCREEN_WM97XX) += wm97xx-ts.o | 24 | obj-$(CONFIG_TOUCHSCREEN_WM97XX) += wm97xx-ts.o |
| 25 | wm97xx-ts-$(CONFIG_TOUCHSCREEN_WM9705) += wm9705.o | 25 | wm97xx-ts-$(CONFIG_TOUCHSCREEN_WM9705) += wm9705.o |
| 26 | wm97xx-ts-$(CONFIG_TOUCHSCREEN_WM9712) += wm9712.o | 26 | wm97xx-ts-$(CONFIG_TOUCHSCREEN_WM9712) += wm9712.o |
| 27 | wm97xx-ts-$(CONFIG_TOUCHSCREEN_WM9713) += wm9713.o | ||
diff --git a/drivers/input/touchscreen/wm9713.c b/drivers/input/touchscreen/wm9713.c new file mode 100644 index 000000000000..01278bd7e65c --- /dev/null +++ b/drivers/input/touchscreen/wm9713.c | |||
| @@ -0,0 +1,460 @@ | |||
| 1 | /* | ||
| 2 | * wm9713.c -- Codec touch driver for Wolfson WM9713 AC97 Codec. | ||
| 3 | * | ||
| 4 | * Copyright 2003, 2004, 2005, 2006, 2007, 2008 Wolfson Microelectronics PLC. | ||
| 5 | * Author: Liam Girdwood | ||
| 6 | * liam.girdwood@wolfsonmicro.com or linux@wolfsonmicro.com | ||
| 7 | * Parts Copyright : Ian Molton <spyro@f2s.com> | ||
| 8 | * Andrew Zabolotny <zap@homelink.ru> | ||
| 9 | * Russell King <rmk@arm.linux.org.uk> | ||
| 10 | * | ||
| 11 | * This program is free software; you can redistribute it and/or modify it | ||
| 12 | * under the terms of the GNU General Public License as published by the | ||
| 13 | * Free Software Foundation; either version 2 of the License, or (at your | ||
| 14 | * option) any later version. | ||
| 15 | * | ||
| 16 | */ | ||
| 17 | |||
| 18 | #include <linux/module.h> | ||
| 19 | #include <linux/moduleparam.h> | ||
| 20 | #include <linux/version.h> | ||
| 21 | #include <linux/kernel.h> | ||
| 22 | #include <linux/input.h> | ||
| 23 | #include <linux/delay.h> | ||
| 24 | #include <linux/bitops.h> | ||
| 25 | #include <linux/wm97xx.h> | ||
| 26 | |||
| 27 | #define TS_NAME "wm97xx" | ||
| 28 | #define WM9713_VERSION "1.00" | ||
| 29 | #define DEFAULT_PRESSURE 0xb0c0 | ||
| 30 | |||
| 31 | /* | ||
| 32 | * Module parameters | ||
| 33 | */ | ||
| 34 | |||
| 35 | /* | ||
| 36 | * Set internal pull up for pen detect. | ||
| 37 | * | ||
| 38 | * Pull up is in the range 1.02k (least sensitive) to 64k (most sensitive) | ||
| 39 | * i.e. pull up resistance = 64k Ohms / rpu. | ||
| 40 | * | ||
| 41 | * Adjust this value if you are having problems with pen detect not | ||
| 42 | * detecting any down event. | ||
| 43 | */ | ||
| 44 | static int rpu = 8; | ||
| 45 | module_param(rpu, int, 0); | ||
| 46 | MODULE_PARM_DESC(rpu, "Set internal pull up resitor for pen detect."); | ||
| 47 | |||
| 48 | /* | ||
| 49 | * Set current used for pressure measurement. | ||
| 50 | * | ||
| 51 | * Set pil = 2 to use 400uA | ||
| 52 | * pil = 1 to use 200uA and | ||
| 53 | * pil = 0 to disable pressure measurement. | ||
| 54 | * | ||
| 55 | * This is used to increase the range of values returned by the adc | ||
| 56 | * when measureing touchpanel pressure. | ||
| 57 | */ | ||
| 58 | static int pil; | ||
| 59 | module_param(pil, int, 0); | ||
| 60 | MODULE_PARM_DESC(pil, "Set current used for pressure measurement."); | ||
| 61 | |||
| 62 | /* | ||
| 63 | * Set threshold for pressure measurement. | ||
| 64 | * | ||
| 65 | * Pen down pressure below threshold is ignored. | ||
| 66 | */ | ||
| 67 | static int pressure = DEFAULT_PRESSURE & 0xfff; | ||
| 68 | module_param(pressure, int, 0); | ||
| 69 | MODULE_PARM_DESC(pressure, "Set threshold for pressure measurement."); | ||
| 70 | |||
| 71 | /* | ||
| 72 | * Set adc sample delay. | ||
| 73 | * | ||
| 74 | * For accurate touchpanel measurements, some settling time may be | ||
| 75 | * required between the switch matrix applying a voltage across the | ||
| 76 | * touchpanel plate and the ADC sampling the signal. | ||
| 77 | * | ||
| 78 | * This delay can be set by setting delay = n, where n is the array | ||
| 79 | * position of the delay in the array delay_table below. | ||
| 80 | * Long delays > 1ms are supported for completeness, but are not | ||
| 81 | * recommended. | ||
| 82 | */ | ||
| 83 | static int delay = 4; | ||
| 84 | module_param(delay, int, 0); | ||
| 85 | MODULE_PARM_DESC(delay, "Set adc sample delay."); | ||
| 86 | |||
| 87 | /* | ||
| 88 | * Set adc mask function. | ||
| 89 | * | ||
| 90 | * Sources of glitch noise, such as signals driving an LCD display, may feed | ||
| 91 | * through to the touch screen plates and affect measurement accuracy. In | ||
| 92 | * order to minimise this, a signal may be applied to the MASK pin to delay or | ||
| 93 | * synchronise the sampling. | ||
| 94 | * | ||
| 95 | * 0 = No delay or sync | ||
| 96 | * 1 = High on pin stops conversions | ||
| 97 | * 2 = Edge triggered, edge on pin delays conversion by delay param (above) | ||
| 98 | * 3 = Edge triggered, edge on pin starts conversion after delay param | ||
| 99 | */ | ||
| 100 | static int mask; | ||
| 101 | module_param(mask, int, 0); | ||
| 102 | MODULE_PARM_DESC(mask, "Set adc mask function."); | ||
| 103 | |||
| 104 | /* | ||
| 105 | * Coordinate Polling Enable. | ||
| 106 | * | ||
| 107 | * Set to 1 to enable coordinate polling. e.g. x,y[,p] is sampled together | ||
| 108 | * for every poll. | ||
| 109 | */ | ||
| 110 | static int coord; | ||
| 111 | module_param(coord, int, 0); | ||
| 112 | MODULE_PARM_DESC(coord, "Polling coordinate mode"); | ||
| 113 | |||
| 114 | /* | ||
| 115 | * ADC sample delay times in uS | ||
| 116 | */ | ||
| 117 | static const int delay_table[] = { | ||
| 118 | 21, /* 1 AC97 Link frames */ | ||
| 119 | 42, /* 2 */ | ||
| 120 | 84, /* 4 */ | ||
| 121 | 167, /* 8 */ | ||
| 122 | 333, /* 16 */ | ||
| 123 | 667, /* 32 */ | ||
| 124 | 1000, /* 48 */ | ||
| 125 | 1333, /* 64 */ | ||
| 126 | 2000, /* 96 */ | ||
| 127 | 2667, /* 128 */ | ||
| 128 | 3333, /* 160 */ | ||
| 129 | 4000, /* 192 */ | ||
| 130 | 4667, /* 224 */ | ||
| 131 | 5333, /* 256 */ | ||
| 132 | 6000, /* 288 */ | ||
| 133 | 0 /* No delay, switch matrix always on */ | ||
| 134 | }; | ||
| 135 | |||
| 136 | /* | ||
| 137 | * Delay after issuing a POLL command. | ||
| 138 | * | ||
| 139 | * The delay is 3 AC97 link frames + the touchpanel settling delay | ||
| 140 | */ | ||
| 141 | static inline void poll_delay(int d) | ||
| 142 | { | ||
| 143 | udelay(3 * AC97_LINK_FRAME + delay_table[d]); | ||
| 144 | } | ||
| 145 | |||
| 146 | /* | ||
| 147 | * set up the physical settings of the WM9713 | ||
| 148 | */ | ||
| 149 | static void wm9713_phy_init(struct wm97xx *wm) | ||
| 150 | { | ||
| 151 | u16 dig1 = 0, dig2, dig3; | ||
| 152 | |||
| 153 | /* default values */ | ||
| 154 | dig2 = WM97XX_DELAY(4) | WM97XX_SLT(5); | ||
| 155 | dig3 = WM9712_RPU(1); | ||
| 156 | |||
| 157 | /* rpu */ | ||
| 158 | if (rpu) { | ||
| 159 | |||
