linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vignesh R <vigneshr@ti.com>
To: Jonathan Cameron <jic23@kernel.org>,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	Lee Jones <lee.jones@linaro.org>
Cc: Vignesh R <vigneshr@ti.com>, <linux-iio@vger.kernel.org>,
	<linux-omap@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<linux-input@vger.kernel.org>
Subject: [PATCH 3/5] mfd: ti_am335x_tscadc: Keep ADC interface on if child is wakeup capable
Date: Sat, 30 Jun 2018 16:03:16 +0530	[thread overview]
Message-ID: <20180630103318.25355-4-vigneshr@ti.com> (raw)
In-Reply-To: <20180630103318.25355-1-vigneshr@ti.com>

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>
---
 drivers/mfd/ti_am335x_tscadc.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/mfd/ti_am335x_tscadc.c b/drivers/mfd/ti_am335x_tscadc.c
index 858c1a071a81..c21ed54d1662 100644
--- a/drivers/mfd/ti_am335x_tscadc.c
+++ b/drivers/mfd/ti_am335x_tscadc.c
@@ -294,11 +294,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;
-- 
2.18.0


  parent reply	other threads:[~2018-06-30 10:32 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-30 10:33 [PATCH 0/5] ti_am335x_tsc: Enable wakeup capability Vignesh R
2018-06-30 10:33 ` [PATCH 1/5] mfd: ti_am335x_tscadc: Don't mark TSCADC MFD as wakeup capable Vignesh R
2018-07-04  7:38   ` Lee Jones
2018-10-09 10:29   ` Lee Jones
2018-06-30 10:33 ` [PATCH 2/5] Input: ti_am335x_tsc: Mark TSC device as wakeup source Vignesh R
2018-07-18 17:06   ` Dmitry Torokhov
2018-10-09 10:29   ` Lee Jones
2018-06-30 10:33 ` Vignesh R [this message]
2018-07-04  7:39   ` [PATCH 3/5] mfd: ti_am335x_tscadc: Keep ADC interface on if child is wakeup capable Lee Jones
2018-10-09 10:30   ` Lee Jones
2018-06-30 10:33 ` [PATCH 4/5] iio: adc: ti_am335x_adc: Disable ADC during suspend unconditionally Vignesh R
2018-06-30 15:18   ` Jonathan Cameron
2018-07-04 14:40     ` Vignesh R
2018-10-09 10:30   ` Lee Jones
2018-06-30 10:33 ` [PATCH 5/5] Input: ti_am335x_tsc: Mark IRQ as wakeup capable Vignesh R
2018-07-18 17:06   ` Dmitry Torokhov
2018-10-09 10:30   ` Lee Jones
2018-07-17 11:45 ` [PATCH 0/5] ti_am335x_tsc: Enable wakeup capability Vignesh R
2018-07-18  7:47   ` Lee Jones
2018-07-18 17:09     ` Dmitry Torokhov
2018-07-21 18:09       ` Jonathan Cameron
2018-07-23  5:37       ` Lee Jones
2018-07-24 17:33         ` Vignesh R
2018-07-25  5:26           ` Lee Jones
2018-09-28  6:12             ` Vignesh R
2018-10-05  5:11               ` Vignesh R
2018-10-09 10:33 ` [GIT PULL] Immutable branch between MFD, IIO and Input due for the v4.20 merge window Lee Jones

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180630103318.25355-4-vigneshr@ti.com \
    --to=vigneshr@ti.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=jic23@kernel.org \
    --cc=lee.jones@linaro.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).