From: jic23@kernel.org (Jonathan Cameron)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH RFT 5/5] iio: mxs-lradc: implement suspend/resume support
Date: Sun, 17 Apr 2016 11:48:27 +0100 [thread overview]
Message-ID: <571369FB.8010803@kernel.org> (raw)
In-Reply-To: <1460648909-2657-6-git-send-email-stefan.wahren@i2se.com>
On 14/04/16 16:48, Stefan Wahren wrote:
> This patch implements suspend/resume support for mxs-lradc.
> It's possible to use the touchscreen as wakeup source.
>
> Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Looks good to me pending replies to the previous patch comments.
> ---
> drivers/iio/adc/mxs-lradc.c | 61 +++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 61 insertions(+)
>
> diff --git a/drivers/iio/adc/mxs-lradc.c b/drivers/iio/adc/mxs-lradc.c
> index 97c993f..64704c9 100644
> --- a/drivers/iio/adc/mxs-lradc.c
> +++ b/drivers/iio/adc/mxs-lradc.c
> @@ -29,6 +29,7 @@
> #include <linux/of.h>
> #include <linux/of_device.h>
> #include <linux/platform_device.h>
> +#include <linux/pm.h>
> #include <linux/slab.h>
> #include <linux/stmp_device.h>
> #include <linux/sysfs.h>
> @@ -1745,10 +1746,70 @@ static int mxs_lradc_remove(struct platform_device *pdev)
> return 0;
> }
>
> +static int __maybe_unused mxs_lradc_suspend(struct device *dev)
> +{
> + struct iio_dev *iio = dev_get_drvdata(dev);
> + struct mxs_lradc *lradc = iio_priv(iio);
> + struct input_dev *input = lradc->ts_input;
> + int ret = 0;
> +
> + if (input) {
> + mutex_lock(&input->mutex);
> +
> + /* Enable touchscreen wakeup irq */
> + if (input->users && device_may_wakeup(dev))
> + ret = enable_irq_wake(lradc->irq[0]);
> + else
> + mxs_lradc_disable_ts(lradc);
> +
> + mutex_unlock(&input->mutex);
> + }
> +
> + if (ret)
> + return ret;
> +
> + mxs_lradc_hw_stop(lradc);
> +
> + clk_disable_unprepare(lradc->clk);
> +
> + return ret;
> +}
> +
> +static int __maybe_unused mxs_lradc_resume(struct device *dev)
> +{
> + struct iio_dev *iio = dev_get_drvdata(dev);
> + struct mxs_lradc *lradc = iio_priv(iio);
> + struct input_dev *input = lradc->ts_input;
> + int ret;
> +
> + ret = clk_prepare_enable(lradc->clk);
> + if (ret)
> + return ret;
> +
> + mxs_lradc_hw_init(lradc);
> +
> + if (input) {
> + mutex_lock(&input->mutex);
> +
> + /* Disable touchscreen wakeup irq */
> + if (input->users && device_may_wakeup(dev))
> + ret = disable_irq_wake(lradc->irq[0]);
> + else
> + mxs_lradc_enable_touch_detection(lradc);
> +
> + mutex_unlock(&input->mutex);
> + }
> +
> + return ret;
> +}
> +
> +static SIMPLE_DEV_PM_OPS(mxs_lradc_pm_ops, mxs_lradc_suspend, mxs_lradc_resume);
> +
> static struct platform_driver mxs_lradc_driver = {
> .driver = {
> .name = DRIVER_NAME,
> .of_match_table = mxs_lradc_dt_ids,
> + .pm = &mxs_lradc_pm_ops,
> },
> .probe = mxs_lradc_probe,
> .remove = mxs_lradc_remove,
>
next prev parent reply other threads:[~2016-04-17 10:48 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-14 15:48 [PATCH RFT 0/5] iio: mxs-lradc: fix leak and implement PM ops Stefan Wahren
2016-04-14 15:48 ` [PATCH RFT 1/5] iio: mxs-lradc: fix memory leak Stefan Wahren
2016-04-14 20:01 ` Marek Vasut
2016-04-17 10:08 ` Jonathan Cameron
2016-04-18 17:16 ` Marek Vasut
2016-04-19 6:33 ` Stefan Wahren
2016-04-19 10:32 ` Marek Vasut
2016-04-19 13:37 ` Stefan Wahren
2016-04-19 18:58 ` Jonathan Cameron
2016-04-19 19:29 ` Marek Vasut
2016-04-18 6:19 ` Stefan Wahren
2016-04-18 10:45 ` Marek Vasut
2016-04-14 15:48 ` [PATCH RFT 2/5] iio: mxs-lradc: move TS config into suitable function Stefan Wahren
2016-04-14 20:01 ` Marek Vasut
2016-04-17 10:13 ` Jonathan Cameron
2016-04-17 12:19 ` Torokhov
2016-04-18 6:26 ` Stefan Wahren
2016-04-14 15:48 ` [PATCH RFT 3/5] iio: mxs-lradc: move STMP reset out of ADC init Stefan Wahren
2016-04-15 6:48 ` Juergen Borleis
2016-04-15 10:12 ` Marek Vasut
2016-04-17 10:24 ` Jonathan Cameron
2016-04-14 15:48 ` [PATCH RFT 4/5] iio: mxs-lradc: disable only mapped channels in mxs_lradc_hw_stop Stefan Wahren
2016-04-17 10:47 ` Jonathan Cameron
2016-04-18 6:36 ` Stefan Wahren
2016-04-14 15:48 ` [PATCH RFT 5/5] iio: mxs-lradc: implement suspend/resume support Stefan Wahren
2016-04-17 10:48 ` Jonathan Cameron [this message]
2016-04-14 19:55 ` [PATCH RFT 0/5] iio: mxs-lradc: fix leak and implement PM ops Marek Vasut
2016-04-18 6:17 ` Stefan Wahren
2016-04-18 10:44 ` Marek Vasut
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=571369FB.8010803@kernel.org \
--to=jic23@kernel.org \
--cc=linux-arm-kernel@lists.infradead.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).