aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input
diff options
context:
space:
mode:
authorPatil, Rachna <rachna@ti.com>2013-01-23 22:45:05 -0500
committerSebastian Andrzej Siewior <bigeasy@linutronix.de>2013-06-12 12:03:55 -0400
commitabeccee40320245a2a6a006dc8466a703cbd1d5e (patch)
tree1c6709c2d53fd65f77a226abab9a552e5ce73fb5 /drivers/input
parenta9bce1b03c2199e66d36cda8aac675338bc074a7 (diff)
input: ti_am33x_tsc: Step enable bits made configurable
Current code has hard coded value written to step enable bits. Now the bits are updated based on how many steps are needed to be configured got from platform data. The user needs to take care not to exceed the count more than 16. While using ADC and TSC one should take care to set this parameter correctly. Sebastian added the common lock and moved the code, that manipulates the steps, from into the mfd module. Signed-off-by: Patil, Rachna <rachna@ti.com> Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Diffstat (limited to 'drivers/input')
-rw-r--r--drivers/input/touchscreen/ti_am335x_tsc.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/input/touchscreen/ti_am335x_tsc.c b/drivers/input/touchscreen/ti_am335x_tsc.c
index 16077d3d80ba..23d6a4dacc88 100644
--- a/drivers/input/touchscreen/ti_am335x_tsc.c
+++ b/drivers/input/touchscreen/ti_am335x_tsc.c
@@ -57,6 +57,7 @@ static void titsc_writel(struct titsc *tsc, unsigned int reg,
57static void titsc_step_config(struct titsc *ts_dev) 57static void titsc_step_config(struct titsc *ts_dev)
58{ 58{
59 unsigned int config; 59 unsigned int config;
60 unsigned int stepenable = 0;
60 int i, total_steps; 61 int i, total_steps;
61 62
62 /* Configure the Step registers */ 63 /* Configure the Step registers */
@@ -128,7 +129,9 @@ static void titsc_step_config(struct titsc *ts_dev)
128 titsc_writel(ts_dev, REG_STEPDELAY(total_steps + 2), 129 titsc_writel(ts_dev, REG_STEPDELAY(total_steps + 2),
129 STEPCONFIG_OPENDLY); 130 STEPCONFIG_OPENDLY);
130 131
131 titsc_writel(ts_dev, REG_SE, STPENB_STEPENB_TC); 132 /* The steps1 … end and bit 0 for TS_Charge */
133 stepenable = (1 << (total_steps + 2)) - 1;
134 am335x_tsc_se_set(ts_dev->mfd_tscadc, stepenable);
132} 135}
133 136
134static void titsc_read_coordinates(struct titsc *ts_dev, 137static void titsc_read_coordinates(struct titsc *ts_dev,
@@ -250,7 +253,7 @@ static irqreturn_t titsc_irq(int irq, void *dev)
250 253
251 titsc_writel(ts_dev, REG_IRQSTATUS, irqclr); 254 titsc_writel(ts_dev, REG_IRQSTATUS, irqclr);
252 255
253 titsc_writel(ts_dev, REG_SE, STPENB_STEPENB_TC); 256 am335x_tsc_se_update(ts_dev->mfd_tscadc);
254 return IRQ_HANDLED; 257 return IRQ_HANDLED;
255} 258}
256 259
@@ -334,6 +337,11 @@ static int titsc_remove(struct platform_device *pdev)
334 337
335 free_irq(ts_dev->irq, ts_dev); 338 free_irq(ts_dev->irq, ts_dev);
336 339
340 /* total steps followed by the enable mask */
341 steps = 2 * ts_dev->steps_to_configure + 2;
342 steps = (1 << steps) - 1;
343 am335x_tsc_se_clr(ts_dev->mfd_tscadc, steps);
344
337 input_unregister_device(ts_dev->input); 345 input_unregister_device(ts_dev->input);
338 346
339 platform_set_drvdata(pdev, NULL); 347 platform_set_drvdata(pdev, NULL);