diff options
author | Vignesh R <vigneshr@ti.com> | 2018-06-30 06:33:16 -0400 |
---|---|---|
committer | Lee Jones <lee.jones@linaro.org> | 2018-10-09 06:28:07 -0400 |
commit | c974ac771479327b5424f60d58845e31daddadea (patch) | |
tree | d748d0d854eec971064d03d6868d0b46e8ba0e8c | |
parent | 333e07ec4b3397f16f34b2eabae703a2885f3558 (diff) |
mfd: ti_am335x_tscadc: Keep ADC interface on if child is wakeup capable
If a child device like touchscreen is wakeup capable, then keep ADC
interface on, so that a touching resistive screen will generate wakeup
event to the system.
Signed-off-by: Vignesh R <vigneshr@ti.com>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
-rw-r--r-- | drivers/mfd/ti_am335x_tscadc.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/drivers/mfd/ti_am335x_tscadc.c b/drivers/mfd/ti_am335x_tscadc.c index ee3ffd96f5d2..c2d47d78705b 100644 --- a/drivers/mfd/ti_am335x_tscadc.c +++ b/drivers/mfd/ti_am335x_tscadc.c | |||
@@ -293,11 +293,24 @@ static int ti_tscadc_remove(struct platform_device *pdev) | |||
293 | return 0; | 293 | return 0; |
294 | } | 294 | } |
295 | 295 | ||
296 | static int __maybe_unused ti_tscadc_can_wakeup(struct device *dev, void *data) | ||
297 | { | ||
298 | return device_may_wakeup(dev); | ||
299 | } | ||
300 | |||
296 | static int __maybe_unused tscadc_suspend(struct device *dev) | 301 | static int __maybe_unused tscadc_suspend(struct device *dev) |
297 | { | 302 | { |
298 | struct ti_tscadc_dev *tscadc = dev_get_drvdata(dev); | 303 | struct ti_tscadc_dev *tscadc = dev_get_drvdata(dev); |
299 | 304 | ||
300 | regmap_write(tscadc->regmap, REG_SE, 0x00); | 305 | regmap_write(tscadc->regmap, REG_SE, 0x00); |
306 | if (device_for_each_child(dev, NULL, ti_tscadc_can_wakeup)) { | ||
307 | u32 ctrl; | ||
308 | |||
309 | regmap_read(tscadc->regmap, REG_CTRL, &ctrl); | ||
310 | ctrl &= ~(CNTRLREG_POWERDOWN); | ||
311 | ctrl |= CNTRLREG_TSCSSENB; | ||
312 | regmap_write(tscadc->regmap, REG_CTRL, ctrl); | ||
313 | } | ||
301 | pm_runtime_put_sync(dev); | 314 | pm_runtime_put_sync(dev); |
302 | 315 | ||
303 | return 0; | 316 | return 0; |