aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVignesh R <vigneshr@ti.com>2018-06-30 06:33:15 -0400
committerLee Jones <lee.jones@linaro.org>2018-10-09 06:27:40 -0400
commit333e07ec4b3397f16f34b2eabae703a2885f3558 (patch)
tree9519c54be065740b7823539d70c326ee632a9938
parentcec945c293fb52ac1a1ac88703422d3bc1d8f10a (diff)
Input: ti_am335x_tsc: Mark TSC device as wakeup source
Instead of TSCADC MFD device, mark TSC as wakeup source and change all wakeup related PM calls to operate on TSC device. Signed-off-by: Vignesh R <vigneshr@ti.com> Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: Lee Jones <lee.jones@linaro.org>
-rw-r--r--drivers/input/touchscreen/ti_am335x_tsc.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/drivers/input/touchscreen/ti_am335x_tsc.c b/drivers/input/touchscreen/ti_am335x_tsc.c
index b86c1e5fbc11..a4f25a915ffc 100644
--- a/drivers/input/touchscreen/ti_am335x_tsc.c
+++ b/drivers/input/touchscreen/ti_am335x_tsc.c
@@ -46,6 +46,7 @@ static const int config_pins[] = {
46struct titsc { 46struct titsc {
47 struct input_dev *input; 47 struct input_dev *input;
48 struct ti_tscadc_dev *mfd_tscadc; 48 struct ti_tscadc_dev *mfd_tscadc;
49 struct device *dev;
49 unsigned int irq; 50 unsigned int irq;
50 unsigned int wires; 51 unsigned int wires;
51 unsigned int x_plate_resistance; 52 unsigned int x_plate_resistance;
@@ -276,7 +277,7 @@ static irqreturn_t titsc_irq(int irq, void *dev)
276 if (status & IRQENB_HW_PEN) { 277 if (status & IRQENB_HW_PEN) {
277 ts_dev->pen_down = true; 278 ts_dev->pen_down = true;
278 irqclr |= IRQENB_HW_PEN; 279 irqclr |= IRQENB_HW_PEN;
279 pm_stay_awake(ts_dev->mfd_tscadc->dev); 280 pm_stay_awake(ts_dev->dev);
280 } 281 }
281 282
282 if (status & IRQENB_PENUP) { 283 if (status & IRQENB_PENUP) {
@@ -286,7 +287,7 @@ static irqreturn_t titsc_irq(int irq, void *dev)
286 input_report_key(input_dev, BTN_TOUCH, 0); 287 input_report_key(input_dev, BTN_TOUCH, 0);
287 input_report_abs(input_dev, ABS_PRESSURE, 0); 288 input_report_abs(input_dev, ABS_PRESSURE, 0);
288 input_sync(input_dev); 289 input_sync(input_dev);
289 pm_relax(ts_dev->mfd_tscadc->dev); 290 pm_relax(ts_dev->dev);
290 } else { 291 } else {
291 ts_dev->pen_down = true; 292 ts_dev->pen_down = true;
292 } 293 }
@@ -422,6 +423,7 @@ static int titsc_probe(struct platform_device *pdev)
422 ts_dev->mfd_tscadc = tscadc_dev; 423 ts_dev->mfd_tscadc = tscadc_dev;
423 ts_dev->input = input_dev; 424 ts_dev->input = input_dev;
424 ts_dev->irq = tscadc_dev->irq; 425 ts_dev->irq = tscadc_dev->irq;
426 ts_dev->dev = &pdev->dev;
425 427
426 err = titsc_parse_dt(pdev, ts_dev); 428 err = titsc_parse_dt(pdev, ts_dev);
427 if (err) { 429 if (err) {
@@ -436,6 +438,8 @@ static int titsc_probe(struct platform_device *pdev)
436 goto err_free_mem; 438 goto err_free_mem;
437 } 439 }
438 440
441 device_init_wakeup(&pdev->dev, true);
442
439 titsc_writel(ts_dev, REG_IRQSTATUS, TSC_IRQENB_MASK); 443 titsc_writel(ts_dev, REG_IRQSTATUS, TSC_IRQENB_MASK);
440 titsc_writel(ts_dev, REG_IRQENABLE, IRQENB_FIFO0THRES); 444 titsc_writel(ts_dev, REG_IRQENABLE, IRQENB_FIFO0THRES);
441 titsc_writel(ts_dev, REG_IRQENABLE, IRQENB_EOS); 445 titsc_writel(ts_dev, REG_IRQENABLE, IRQENB_EOS);
@@ -467,6 +471,7 @@ static int titsc_probe(struct platform_device *pdev)
467 return 0; 471 return 0;
468 472
469err_free_irq: 473err_free_irq:
474 device_init_wakeup(&pdev->dev, false);
470 free_irq(ts_dev->irq, ts_dev); 475 free_irq(ts_dev->irq, ts_dev);
471err_free_mem: 476err_free_mem:
472 input_free_device(input_dev); 477 input_free_device(input_dev);
@@ -479,6 +484,7 @@ static int titsc_remove(struct platform_device *pdev)
479 struct titsc *ts_dev = platform_get_drvdata(pdev); 484 struct titsc *ts_dev = platform_get_drvdata(pdev);
480 u32 steps; 485 u32 steps;
481 486
487 device_init_wakeup(&pdev->dev, false);
482 free_irq(ts_dev->irq, ts_dev); 488 free_irq(ts_dev->irq, ts_dev);
483 489
484 /* total steps followed by the enable mask */ 490 /* total steps followed by the enable mask */
@@ -499,7 +505,7 @@ static int __maybe_unused titsc_suspend(struct device *dev)
499 unsigned int idle; 505 unsigned int idle;
500 506
501 tscadc_dev = ti_tscadc_dev_get(to_platform_device(dev)); 507 tscadc_dev = ti_tscadc_dev_get(to_platform_device(dev));
502 if (device_may_wakeup(tscadc_dev->dev)) { 508 if (device_may_wakeup(dev)) {
503 titsc_writel(ts_dev, REG_IRQSTATUS, TSC_IRQENB_MASK); 509 titsc_writel(ts_dev, REG_IRQSTATUS, TSC_IRQENB_MASK);
504 idle = titsc_readl(ts_dev, REG_IRQENABLE); 510 idle = titsc_readl(ts_dev, REG_IRQENABLE);
505 titsc_writel(ts_dev, REG_IRQENABLE, 511 titsc_writel(ts_dev, REG_IRQENABLE,
@@ -515,11 +521,11 @@ static int __maybe_unused titsc_resume(struct device *dev)
515 struct ti_tscadc_dev *tscadc_dev; 521 struct ti_tscadc_dev *tscadc_dev;
516 522
517 tscadc_dev = ti_tscadc_dev_get(to_platform_device(dev)); 523 tscadc_dev = ti_tscadc_dev_get(to_platform_device(dev));
518 if (device_may_wakeup(tscadc_dev->dev)) { 524 if (device_may_wakeup(dev)) {
519 titsc_writel(ts_dev, REG_IRQWAKEUP, 525 titsc_writel(ts_dev, REG_IRQWAKEUP,
520 0x00); 526 0x00);
521 titsc_writel(ts_dev, REG_IRQCLR, IRQENB_HW_PEN); 527 titsc_writel(ts_dev, REG_IRQCLR, IRQENB_HW_PEN);
522 pm_relax(ts_dev->mfd_tscadc->dev); 528 pm_relax(dev);
523 } 529 }
524 titsc_step_config(ts_dev); 530 titsc_step_config(ts_dev);
525 titsc_writel(ts_dev, REG_FIFO0THR, 531 titsc_writel(ts_dev, REG_FIFO0THR,