All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Stefan Wahren <stefan.wahren-eS4NqCHxEME@public.gmane.org>
Cc: Marek Vasut <marex-ynQEQJNshbs@public.gmane.org>,
	Lars-Peter Clausen <lars-Qo5EllUWu/uELgA04lAiVw@public.gmane.org>,
	linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	Peter Meerwald-Stadler
	<pmeerw-jW+XmwGofnusTnJN9+BGXg@public.gmane.org>,
	Hartmut Knaack <knaack.h-Mmb7MZpHnFY@public.gmane.org>,
	Fabio Estevam <fabio.estevam-3arQi8VN3Tc@public.gmane.org>,
	Jonathan Cameron <jic23-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Subject: Re: [PATCH RFT V2 3/3] iio: mxs-lradc: implement suspend/resume support
Date: Mon, 25 Apr 2016 14:14:12 -0700	[thread overview]
Message-ID: <20160425211412.GF26059@dtor-ws> (raw)
In-Reply-To: <571A27FC.4030301-eS4NqCHxEME@public.gmane.org>

On Fri, Apr 22, 2016 at 03:32:44PM +0200, Stefan Wahren wrote:
> Hi Dmitry,
> 
> Am 21.04.2016 um 23:08 schrieb Dmitry Torokhov:
> > On Thu, Apr 21, 2016 at 08:11:18PM +0000, 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-eS4NqCHxEME@public.gmane.org>
> >> ---
> >>  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 cfc558f..6bd387f 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;
> > I'd rather we had it right after we do:
> >
> > 			ret = enable_irq_wake(lradc->irq[0]);
> 
> but we must unlock the mutex first before return. An option would be to
> place the return inside the input branch.

Ah, right, ignore me then.

-- 
Dmitry

WARNING: multiple messages have this Message-ID (diff)
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Stefan Wahren <stefan.wahren@i2se.com>
Cc: Marek Vasut <marex@denx.de>, Lars-Peter Clausen <lars@metafoo.de>,
	linux-iio@vger.kernel.org, linux-input@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
	Hartmut Knaack <knaack.h@gmx.de>,
	Fabio Estevam <fabio.estevam@nxp.com>,
	Jonathan Cameron <jic23@kernel.org>
Subject: Re: [PATCH RFT V2 3/3] iio: mxs-lradc: implement suspend/resume support
Date: Mon, 25 Apr 2016 14:14:12 -0700	[thread overview]
Message-ID: <20160425211412.GF26059@dtor-ws> (raw)
In-Reply-To: <571A27FC.4030301@i2se.com>

On Fri, Apr 22, 2016 at 03:32:44PM +0200, Stefan Wahren wrote:
> Hi Dmitry,
> 
> Am 21.04.2016 um 23:08 schrieb Dmitry Torokhov:
> > On Thu, Apr 21, 2016 at 08:11:18PM +0000, 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>
> >> ---
> >>  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 cfc558f..6bd387f 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;
> > I'd rather we had it right after we do:
> >
> > 			ret = enable_irq_wake(lradc->irq[0]);
> 
> but we must unlock the mutex first before return. An option would be to
> place the return inside the input branch.

Ah, right, ignore me then.

-- 
Dmitry

WARNING: multiple messages have this Message-ID (diff)
From: dmitry.torokhov@gmail.com (Dmitry Torokhov)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH RFT V2 3/3] iio: mxs-lradc: implement suspend/resume support
Date: Mon, 25 Apr 2016 14:14:12 -0700	[thread overview]
Message-ID: <20160425211412.GF26059@dtor-ws> (raw)
In-Reply-To: <571A27FC.4030301@i2se.com>

On Fri, Apr 22, 2016 at 03:32:44PM +0200, Stefan Wahren wrote:
> Hi Dmitry,
> 
> Am 21.04.2016 um 23:08 schrieb Dmitry Torokhov:
> > On Thu, Apr 21, 2016 at 08:11:18PM +0000, 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>
> >> ---
> >>  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 cfc558f..6bd387f 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;
> > I'd rather we had it right after we do:
> >
> > 			ret = enable_irq_wake(lradc->irq[0]);
> 
> but we must unlock the mutex first before return. An option would be to
> place the return inside the input branch.

Ah, right, ignore me then.

-- 
Dmitry

  parent reply	other threads:[~2016-04-25 21:14 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-21 20:11 [PATCH RFT V2 0/3] iio: mxs-lradc: implement PM ops Stefan Wahren
2016-04-21 20:11 ` Stefan Wahren
2016-04-21 20:11 ` Stefan Wahren
2016-04-21 20:11 ` [PATCH RFT V2 1/3] iio: mxs-lradc: simplify TS registration Stefan Wahren
2016-04-21 20:11   ` Stefan Wahren
     [not found]   ` <1461269478-449-2-git-send-email-stefan.wahren-eS4NqCHxEME@public.gmane.org>
2016-04-21 20:39     ` Marek Vasut
2016-04-21 20:39       ` Marek Vasut
2016-04-21 20:39       ` Marek Vasut
2016-04-21 21:06   ` Dmitry Torokhov
2016-04-21 21:06     ` Dmitry Torokhov
     [not found] ` <1461269478-449-1-git-send-email-stefan.wahren-eS4NqCHxEME@public.gmane.org>
2016-04-21 20:11   ` [PATCH RFT V2 2/3] iio: mxs-lradc: disable only masked channels in mxs_lradc_hw_stop Stefan Wahren
2016-04-21 20:11     ` Stefan Wahren
2016-04-21 20:11     ` Stefan Wahren
     [not found]     ` <1461269478-449-3-git-send-email-stefan.wahren-eS4NqCHxEME@public.gmane.org>
2016-04-21 20:44       ` Marek Vasut
2016-04-21 20:44         ` Marek Vasut
2016-04-21 20:44         ` Marek Vasut
2016-04-21 20:11 ` [PATCH RFT V2 3/3] iio: mxs-lradc: implement suspend/resume support Stefan Wahren
2016-04-21 20:11   ` Stefan Wahren
     [not found]   ` <1461269478-449-4-git-send-email-stefan.wahren-eS4NqCHxEME@public.gmane.org>
2016-04-21 20:45     ` Marek Vasut
2016-04-21 20:45       ` Marek Vasut
2016-04-21 20:45       ` Marek Vasut
     [not found]       ` <57193C01.20709-ynQEQJNshbs@public.gmane.org>
2016-04-22 13:57         ` Stefan Wahren
2016-04-22 13:57           ` Stefan Wahren
2016-04-22 13:57           ` Stefan Wahren
2016-04-22 15:47           ` Marek Vasut
2016-04-22 15:47             ` Marek Vasut
2016-04-21 21:08     ` Dmitry Torokhov
2016-04-21 21:08       ` Dmitry Torokhov
2016-04-21 21:08       ` Dmitry Torokhov
2016-04-22 13:32       ` Stefan Wahren
2016-04-22 13:32         ` Stefan Wahren
2016-04-22 13:32         ` Stefan Wahren
     [not found]         ` <571A27FC.4030301-eS4NqCHxEME@public.gmane.org>
2016-04-25 21:14           ` Dmitry Torokhov [this message]
2016-04-25 21:14             ` Dmitry Torokhov
2016-04-25 21:14             ` Dmitry Torokhov

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=20160425211412.GF26059@dtor-ws \
    --to=dmitry.torokhov-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=fabio.estevam-3arQi8VN3Tc@public.gmane.org \
    --cc=jic23-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=knaack.h-Mmb7MZpHnFY@public.gmane.org \
    --cc=lars-Qo5EllUWu/uELgA04lAiVw@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-iio-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-input-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=marex-ynQEQJNshbs@public.gmane.org \
    --cc=pmeerw-jW+XmwGofnusTnJN9+BGXg@public.gmane.org \
    --cc=stefan.wahren-eS4NqCHxEME@public.gmane.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.