]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
mfd: ti_am335x_tscadc: Keep ADC interface on if child is wakeup capable
authorVignesh R <vigneshr@ti.com>
Sat, 30 Jun 2018 10:33:16 +0000 (16:03 +0530)
committerLee Jones <lee.jones@linaro.org>
Tue, 9 Oct 2018 10:28:07 +0000 (11:28 +0100)
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>
drivers/mfd/ti_am335x_tscadc.c

index ee3ffd96f5d2f84992abe604a8dcb8f53965c8dd..c2d47d78705b8358845fbf0c46908ebd2cce0438 100644 (file)
@@ -293,11 +293,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;