diff options
author | Vignesh R <vigneshr@ti.com> | 2018-06-30 13:33:16 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-11-24 10:23:24 +0300 |
commit | 1faf8a9c7614303a5d29a047bbc9cc00c9412d67 (patch) | |
tree | 24ce6ece787f9b21033fac5efb6fd5a666991cb0 | |
parent | 0f07c78437601b01eb2a75589561bea050a045e7 (diff) | |
download | linux-1faf8a9c7614303a5d29a047bbc9cc00c9412d67.tar.xz |
mfd: ti_am335x_tscadc: Keep ADC interface on if child is wakeup capable
[ Upstream commit c974ac771479327b5424f60d58845e31daddadea ]
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>
Signed-off-by: Sasha Levin <sashal@kernel.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 5894d6c16fab..ca9f0c8d1ed0 100644 --- a/drivers/mfd/ti_am335x_tscadc.c +++ b/drivers/mfd/ti_am335x_tscadc.c @@ -296,11 +296,24 @@ static int ti_tscadc_remove(struct platform_device *pdev) return 0; } +static int __maybe_unused ti_tscadc_can_wakeup(struct device *dev, void *data) +{ + return device_may_wakeup(dev); +} + static int __maybe_unused tscadc_suspend(struct device *dev) { struct ti_tscadc_dev *tscadc = dev_get_drvdata(dev); regmap_write(tscadc->regmap, REG_SE, 0x00); + if (device_for_each_child(dev, NULL, ti_tscadc_can_wakeup)) { + u32 ctrl; + + regmap_read(tscadc->regmap, REG_CTRL, &ctrl); + ctrl &= ~(CNTRLREG_POWERDOWN); + ctrl |= CNTRLREG_TSCSSENB; + regmap_write(tscadc->regmap, REG_CTRL, ctrl); + } pm_runtime_put_sync(dev); return 0; |