diff options
author | Patil, Rachna <rachna@ti.com> | 2012-10-16 03:25:39 -0400 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2012-11-05 17:50:26 -0500 |
commit | d1fb57435c108b8dd66d7f47b4c60c1798dcae4c (patch) | |
tree | 12db90050dc6957a319f63f6b6bf9f000250ca8f /drivers/input/touchscreen | |
parent | 33f5cc605d28bd82be8a728090063203947158f3 (diff) |
input: TSC: ti_tscadc: Add Step configuration as platform data
There are 16 programmable Step Configuration
registers which are used by the sequencer.
Program the Steps in order to configure a channel
input to be sampled. If the same step is applied
several times, the coordinate values read are more
accurate.
Hence we provide the user an option of how many steps
should be configured.
For ex: If this value is assigned as 4, This means that
4 steps are applied to read x co-ordinate and 4 steps to read
y co-ordinate. Furtheron the interrupt handler already
holds code to use delta filter and report the best value
out of these values to the input sub-system.
Signed-off-by: Patil, Rachna <rachna@ti.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/input/touchscreen')
-rw-r--r-- | drivers/input/touchscreen/ti_tscadc.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/drivers/input/touchscreen/ti_tscadc.c b/drivers/input/touchscreen/ti_tscadc.c index d198cab61a69..c1bd8e5c132c 100644 --- a/drivers/input/touchscreen/ti_tscadc.c +++ b/drivers/input/touchscreen/ti_tscadc.c | |||
@@ -41,10 +41,6 @@ | |||
41 | #define REG_CHARGEDELAY 0x060 | 41 | #define REG_CHARGEDELAY 0x060 |
42 | #define REG_STEPCONFIG(n) (0x64 + ((n - 1) * 8)) | 42 | #define REG_STEPCONFIG(n) (0x64 + ((n - 1) * 8)) |
43 | #define REG_STEPDELAY(n) (0x68 + ((n - 1) * 8)) | 43 | #define REG_STEPDELAY(n) (0x68 + ((n - 1) * 8)) |
44 | #define REG_STEPCONFIG13 0x0C4 | ||
45 | #define REG_STEPDELAY13 0x0C8 | ||
46 | #define REG_STEPCONFIG14 0x0CC | ||
47 | #define REG_STEPDELAY14 0x0D0 | ||
48 | #define REG_FIFO0CNT 0xE4 | 44 | #define REG_FIFO0CNT 0xE4 |
49 | #define REG_FIFO1THR 0xF4 | 45 | #define REG_FIFO1THR 0xF4 |
50 | #define REG_FIFO0 0x100 | 46 | #define REG_FIFO0 0x100 |
@@ -134,6 +130,7 @@ struct tscadc { | |||
134 | unsigned int wires; | 130 | unsigned int wires; |
135 | unsigned int x_plate_resistance; | 131 | unsigned int x_plate_resistance; |
136 | bool pen_down; | 132 | bool pen_down; |
133 | int steps_to_configure; | ||
137 | }; | 134 | }; |
138 | 135 | ||
139 | static unsigned int tscadc_readl(struct tscadc *ts, unsigned int reg) | 136 | static unsigned int tscadc_readl(struct tscadc *ts, unsigned int reg) |
@@ -150,9 +147,10 @@ static void tscadc_writel(struct tscadc *tsc, unsigned int reg, | |||
150 | static void tscadc_step_config(struct tscadc *ts_dev) | 147 | static void tscadc_step_config(struct tscadc *ts_dev) |
151 | { | 148 | { |
152 | unsigned int config; | 149 | unsigned int config; |
153 | int i; | 150 | int i, total_steps; |
154 | 151 | ||
155 | /* Configure the Step registers */ | 152 | /* Configure the Step registers */ |
153 | total_steps = 2 * ts_dev->steps_to_configure; | ||
156 | 154 | ||
157 | config = STEPCONFIG_MODE_HWSYNC | | 155 | config = STEPCONFIG_MODE_HWSYNC | |
158 | STEPCONFIG_AVG_16 | STEPCONFIG_XPP; | 156 | STEPCONFIG_AVG_16 | STEPCONFIG_XPP; |
@@ -170,7 +168,7 @@ static void tscadc_step_config(struct tscadc *ts_dev) | |||
170 | break; | 168 | break; |
171 | } | 169 | } |
172 | 170 | ||
173 | for (i = 1; i < 7; i++) { | 171 | for (i = 1; i <= ts_dev->steps_to_configure; i++) { |
174 | tscadc_writel(ts_dev, REG_STEPCONFIG(i), config); | 172 | tscadc_writel(ts_dev, REG_STEPCONFIG(i), config); |
175 | tscadc_writel(ts_dev, REG_STEPDELAY(i), STEPCONFIG_OPENDLY); | 173 | tscadc_writel(ts_dev, REG_STEPDELAY(i), STEPCONFIG_OPENDLY); |
176 | } | 174 | } |
@@ -192,7 +190,7 @@ static void tscadc_step_config(struct tscadc *ts_dev) | |||
192 | break; | 190 | break; |
193 | } | 191 | } |
194 | 192 | ||
195 | for (i = 7; i < 13; i++) { | 193 | for (i = (ts_dev->steps_to_configure + 1); i <= total_steps; i++) { |
196 | tscadc_writel(ts_dev, REG_STEPCONFIG(i), config); | 194 | tscadc_writel(ts_dev, REG_STEPCONFIG(i), config); |
197 | tscadc_writel(ts_dev, REG_STEPDELAY(i), STEPCONFIG_OPENDLY); | 195 | tscadc_writel(ts_dev, REG_STEPDELAY(i), STEPCONFIG_OPENDLY); |
198 | } | 196 | } |
@@ -211,12 +209,14 @@ static void tscadc_step_config(struct tscadc *ts_dev) | |||
211 | config = STEPCONFIG_MODE_HWSYNC | | 209 | config = STEPCONFIG_MODE_HWSYNC | |
212 | STEPCONFIG_AVG_16 | STEPCONFIG_YPP | | 210 | STEPCONFIG_AVG_16 | STEPCONFIG_YPP | |
213 | STEPCONFIG_XNN | STEPCONFIG_INM_ADCREFM; | 211 | STEPCONFIG_XNN | STEPCONFIG_INM_ADCREFM; |
214 | tscadc_writel(ts_dev, REG_STEPCONFIG13, config); | 212 | tscadc_writel(ts_dev, REG_STEPCONFIG(total_steps + 1), config); |
215 | tscadc_writel(ts_dev, REG_STEPDELAY13, STEPCONFIG_OPENDLY); | 213 | tscadc_writel(ts_dev, REG_STEPDELAY(total_steps + 1), |
214 | STEPCONFIG_OPENDLY); | ||
216 | 215 | ||
217 | config |= STEPCONFIG_INP_AN3 | STEPCONFIG_FIFO1; | 216 | config |= STEPCONFIG_INP_AN3 | STEPCONFIG_FIFO1; |
218 | tscadc_writel(ts_dev, REG_STEPCONFIG14, config); | 217 | tscadc_writel(ts_dev, REG_STEPCONFIG(total_steps + 2), config); |
219 | tscadc_writel(ts_dev, REG_STEPDELAY14, STEPCONFIG_OPENDLY); | 218 | tscadc_writel(ts_dev, REG_STEPDELAY(total_steps + 2), |
219 | STEPCONFIG_OPENDLY); | ||
220 | 220 | ||
221 | tscadc_writel(ts_dev, REG_SE, STPENB_STEPENB); | 221 | tscadc_writel(ts_dev, REG_SE, STPENB_STEPENB); |
222 | } | 222 | } |
@@ -379,6 +379,7 @@ static int __devinit tscadc_probe(struct platform_device *pdev) | |||
379 | ts_dev->irq = irq; | 379 | ts_dev->irq = irq; |
380 | ts_dev->wires = pdata->wires; | 380 | ts_dev->wires = pdata->wires; |
381 | ts_dev->x_plate_resistance = pdata->x_plate_resistance; | 381 | ts_dev->x_plate_resistance = pdata->x_plate_resistance; |
382 | ts_dev->steps_to_configure = pdata->steps_to_configure; | ||
382 | 383 | ||
383 | res = request_mem_region(res->start, resource_size(res), pdev->name); | 384 | res = request_mem_region(res->start, resource_size(res), pdev->name); |
384 | if (!res) { | 385 | if (!res) { |
@@ -447,7 +448,7 @@ static int __devinit tscadc_probe(struct platform_device *pdev) | |||
447 | tscadc_idle_config(ts_dev); | 448 | tscadc_idle_config(ts_dev); |
448 | tscadc_writel(ts_dev, REG_IRQENABLE, IRQENB_FIFO1THRES); | 449 | tscadc_writel(ts_dev, REG_IRQENABLE, IRQENB_FIFO1THRES); |
449 | tscadc_step_config(ts_dev); | 450 | tscadc_step_config(ts_dev); |
450 | tscadc_writel(ts_dev, REG_FIFO1THR, 6); | 451 | tscadc_writel(ts_dev, REG_FIFO1THR, ts_dev->steps_to_configure); |
451 | 452 | ||
452 | ctrl |= CNTRLREG_TSCSSENB; | 453 | ctrl |= CNTRLREG_TSCSSENB; |
453 | tscadc_writel(ts_dev, REG_CTRL, ctrl); | 454 | tscadc_writel(ts_dev, REG_CTRL, ctrl); |