linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 14/17] media: st-rc: remove misuse of IRQF_NO_SUSPEND flag
       [not found] <1442850433-5903-1-git-send-email-sudeep.holla@arm.com>
@ 2015-09-21 15:47 ` Sudeep Holla
  2015-10-19 17:40   ` Sudeep Holla
  2015-09-21 15:47 ` [PATCH 15/17] ir-hix5hd2: drop the use of IRQF_NO_SUSPEND Sudeep Holla
  1 sibling, 1 reply; 6+ messages in thread
From: Sudeep Holla @ 2015-09-21 15:47 UTC (permalink / raw)
  To: linux-pm, linux-kernel
  Cc: Sudeep Holla, Thomas Gleixner, Rafael J. Wysocki,
	Srinivas Kandagatla, Maxime Coquelin, Patrice Chotard,
	Mauro Carvalho Chehab, linux-arm-kernel, kernel, linux-media

The device is set as wakeup capable using proper wakeup API but the
driver misuses IRQF_NO_SUSPEND to set the interrupt as wakeup source
which is incorrect.

This patch removes the use of IRQF_NO_SUSPEND flags replacing it with
enable_irq_wake instead.

Cc: Srinivas Kandagatla <srinivas.kandagatla@gmail.com>
Cc: Maxime Coquelin <maxime.coquelin@st.com>
Cc: Patrice Chotard <patrice.chotard@st.com>
Cc: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: kernel@stlinux.com
Cc: linux-media@vger.kernel.org
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
---
 drivers/media/rc/st_rc.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/drivers/media/rc/st_rc.c b/drivers/media/rc/st_rc.c
index 37d040158dff..1fa0c9d1c508 100644
--- a/drivers/media/rc/st_rc.c
+++ b/drivers/media/rc/st_rc.c
@@ -16,6 +16,7 @@
 #include <linux/reset.h>
 #include <media/rc-core.h>
 #include <linux/pinctrl/consumer.h>
+#include <linux/pm_wakeirq.h>
 
 struct st_rc_device {
 	struct device			*dev;
@@ -190,6 +191,9 @@ static void st_rc_hardware_init(struct st_rc_device *dev)
 static int st_rc_remove(struct platform_device *pdev)
 {
 	struct st_rc_device *rc_dev = platform_get_drvdata(pdev);
+
+	dev_pm_clear_wake_irq(&pdev->dev);
+	device_init_wakeup(&pdev->dev, false);
 	clk_disable_unprepare(rc_dev->sys_clock);
 	rc_unregister_device(rc_dev->rdev);
 	return 0;
@@ -298,22 +302,22 @@ static int st_rc_probe(struct platform_device *pdev)
 	rdev->map_name = RC_MAP_LIRC;
 	rdev->input_name = "ST Remote Control Receiver";
 
-	/* enable wake via this device */
-	device_set_wakeup_capable(dev, true);
-	device_set_wakeup_enable(dev, true);
-
 	ret = rc_register_device(rdev);
 	if (ret < 0)
 		goto clkerr;
 
 	rc_dev->rdev = rdev;
 	if (devm_request_irq(dev, rc_dev->irq, st_rc_rx_interrupt,
-			IRQF_NO_SUSPEND, IR_ST_NAME, rc_dev) < 0) {
+			     0, IR_ST_NAME, rc_dev) < 0) {
 		dev_err(dev, "IRQ %d register failed\n", rc_dev->irq);
 		ret = -EINVAL;
 		goto rcerr;
 	}
 
+	/* enable wake via this device */
+	device_init_wakeup(dev, true);
+	dev_pm_set_wake_irq(dev, rc_dev->irq);
+
 	/**
 	 * for LIRC_MODE_MODE2 or LIRC_MODE_PULSE or LIRC_MODE_RAW
 	 * lircd expects a long space first before a signal train to sync.
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 15/17] ir-hix5hd2: drop the use of IRQF_NO_SUSPEND
       [not found] <1442850433-5903-1-git-send-email-sudeep.holla@arm.com>
  2015-09-21 15:47 ` [PATCH 14/17] media: st-rc: remove misuse of IRQF_NO_SUSPEND flag Sudeep Holla
@ 2015-09-21 15:47 ` Sudeep Holla
  2015-09-23 14:26   ` zhangfei
  1 sibling, 1 reply; 6+ messages in thread
From: Sudeep Holla @ 2015-09-21 15:47 UTC (permalink / raw)
  To: linux-pm, linux-kernel
  Cc: Sudeep Holla, Thomas Gleixner, Rafael J. Wysocki,
	Mauro Carvalho Chehab, Zhangfei Gao, Patrice Chotard,
	Fabio Estevam, Guoxiong Yan, linux-media

This driver doesn't claim the IR transmitter to be wakeup source. It
even disables the clock and the IR during suspend-resume cycle.

This patch removes yet another misuse of IRQF_NO_SUSPEND.

Cc: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Cc: Zhangfei Gao <zhangfei.gao@linaro.org>
Cc: Patrice Chotard <patrice.chotard@st.com>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Guoxiong Yan <yanguoxiong@huawei.com>
Cc: linux-media@vger.kernel.org
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
---
 drivers/media/rc/ir-hix5hd2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/rc/ir-hix5hd2.c b/drivers/media/rc/ir-hix5hd2.c
index 1c087cb76815..d0549fba711c 100644
--- a/drivers/media/rc/ir-hix5hd2.c
+++ b/drivers/media/rc/ir-hix5hd2.c
@@ -257,7 +257,7 @@ static int hix5hd2_ir_probe(struct platform_device *pdev)
 		goto clkerr;
 
 	if (devm_request_irq(dev, priv->irq, hix5hd2_ir_rx_interrupt,
-			     IRQF_NO_SUSPEND, pdev->name, priv) < 0) {
+			     0, pdev->name, priv) < 0) {
 		dev_err(dev, "IRQ %d register failed\n", priv->irq);
 		ret = -EINVAL;
 		goto regerr;
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 15/17] ir-hix5hd2: drop the use of IRQF_NO_SUSPEND
  2015-09-21 15:47 ` [PATCH 15/17] ir-hix5hd2: drop the use of IRQF_NO_SUSPEND Sudeep Holla
@ 2015-09-23 14:26   ` zhangfei
  2015-09-23 14:37     ` Sudeep Holla
  0 siblings, 1 reply; 6+ messages in thread
From: zhangfei @ 2015-09-23 14:26 UTC (permalink / raw)
  To: Sudeep Holla, linux-pm, linux-kernel
  Cc: Thomas Gleixner, Rafael J. Wysocki, Mauro Carvalho Chehab,
	Patrice Chotard, Fabio Estevam, Guoxiong Yan, linux-media



On 09/21/2015 08:47 AM, Sudeep Holla wrote:
> This driver doesn't claim the IR transmitter to be wakeup source. It
> even disables the clock and the IR during suspend-resume cycle.
>
> This patch removes yet another misuse of IRQF_NO_SUSPEND.
>
> Cc: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
> Cc: Zhangfei Gao <zhangfei.gao@linaro.org>
> Cc: Patrice Chotard <patrice.chotard@st.com>
> Cc: Fabio Estevam <fabio.estevam@freescale.com>
> Cc: Guoxiong Yan <yanguoxiong@huawei.com>
> Cc: linux-media@vger.kernel.org
> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
> ---
>   drivers/media/rc/ir-hix5hd2.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/media/rc/ir-hix5hd2.c b/drivers/media/rc/ir-hix5hd2.c
> index 1c087cb76815..d0549fba711c 100644
> --- a/drivers/media/rc/ir-hix5hd2.c
> +++ b/drivers/media/rc/ir-hix5hd2.c
> @@ -257,7 +257,7 @@ static int hix5hd2_ir_probe(struct platform_device *pdev)
>   		goto clkerr;
>
>   	if (devm_request_irq(dev, priv->irq, hix5hd2_ir_rx_interrupt,
> -			     IRQF_NO_SUSPEND, pdev->name, priv) < 0) {
> +			     0, pdev->name, priv) < 0) {
>   		dev_err(dev, "IRQ %d register failed\n", priv->irq);
>   		ret = -EINVAL;
>   		goto regerr;
>

ir is wakeup source for hix5hd2, so we use IRQF_NO_SUSPEND.
However, it is true the wakeup mechanism is not realized on hix5hd2 yet.
I am fine with either using IRQF_NO_SUSPEND or not.

Thanks for the patch.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 15/17] ir-hix5hd2: drop the use of IRQF_NO_SUSPEND
  2015-09-23 14:26   ` zhangfei
@ 2015-09-23 14:37     ` Sudeep Holla
  2015-09-23 14:50       ` zhangfei
  0 siblings, 1 reply; 6+ messages in thread
From: Sudeep Holla @ 2015-09-23 14:37 UTC (permalink / raw)
  To: zhangfei, linux-pm, linux-kernel
  Cc: Sudeep Holla, Thomas Gleixner, Rafael J. Wysocki,
	Mauro Carvalho Chehab, Patrice Chotard, Fabio Estevam,
	Guoxiong Yan, linux-media



On 23/09/15 15:26, zhangfei wrote:
>
>
> On 09/21/2015 08:47 AM, Sudeep Holla wrote:
>> This driver doesn't claim the IR transmitter to be wakeup source. It
>> even disables the clock and the IR during suspend-resume cycle.
>>
>> This patch removes yet another misuse of IRQF_NO_SUSPEND.
>>
>> Cc: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
>> Cc: Zhangfei Gao <zhangfei.gao@linaro.org>
>> Cc: Patrice Chotard <patrice.chotard@st.com>
>> Cc: Fabio Estevam <fabio.estevam@freescale.com>
>> Cc: Guoxiong Yan <yanguoxiong@huawei.com>
>> Cc: linux-media@vger.kernel.org
>> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
>> ---
>>    drivers/media/rc/ir-hix5hd2.c | 2 +-
>>    1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/media/rc/ir-hix5hd2.c b/drivers/media/rc/ir-hix5hd2.c
>> index 1c087cb76815..d0549fba711c 100644
>> --- a/drivers/media/rc/ir-hix5hd2.c
>> +++ b/drivers/media/rc/ir-hix5hd2.c
>> @@ -257,7 +257,7 @@ static int hix5hd2_ir_probe(struct platform_device *pdev)
>>    		goto clkerr;
>>
>>    	if (devm_request_irq(dev, priv->irq, hix5hd2_ir_rx_interrupt,
>> -			     IRQF_NO_SUSPEND, pdev->name, priv) < 0) {
>> +			     0, pdev->name, priv) < 0) {
>>    		dev_err(dev, "IRQ %d register failed\n", priv->irq);
>>    		ret = -EINVAL;
>>    		goto regerr;
>>
>
> ir is wakeup source for hix5hd2, so we use IRQF_NO_SUSPEND.

OK, but from the existing implementation of suspend/resume callbacks, I
read that the clocks as well as the IP block is powered off. Is part of
the logic always-on ?

> However, it is true the wakeup mechanism is not realized on hix5hd2 yet.

OK, then I assume you can add the right APIs(enable_irq_wake and
friends) when you add that feature.

> I am fine with either using IRQF_NO_SUSPEND or not.
>

No using IRQF_NO_SUSPEND for wakeup is simply wrong and hence this patch
series removes all those misuse. If you need it as wakeup, then you need
to use right APIs for that. Since I don't see any support for wakeup in
this driver I decided to just remove the flag. Please feel free to add
the support making use of right APIs.

Regards,
Sudeep

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 15/17] ir-hix5hd2: drop the use of IRQF_NO_SUSPEND
  2015-09-23 14:37     ` Sudeep Holla
@ 2015-09-23 14:50       ` zhangfei
  0 siblings, 0 replies; 6+ messages in thread
From: zhangfei @ 2015-09-23 14:50 UTC (permalink / raw)
  To: Sudeep Holla, linux-pm, linux-kernel
  Cc: Thomas Gleixner, Rafael J. Wysocki, Mauro Carvalho Chehab,
	Patrice Chotard, Fabio Estevam, Guoxiong Yan, linux-media



On 09/23/2015 07:37 AM, Sudeep Holla wrote:
>
>
> On 23/09/15 15:26, zhangfei wrote:
>>
>>
>> On 09/21/2015 08:47 AM, Sudeep Holla wrote:
>>> This driver doesn't claim the IR transmitter to be wakeup source. It
>>> even disables the clock and the IR during suspend-resume cycle.
>>>
>>> This patch removes yet another misuse of IRQF_NO_SUSPEND.
>>>
>>> Cc: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
>>> Cc: Zhangfei Gao <zhangfei.gao@linaro.org>
>>> Cc: Patrice Chotard <patrice.chotard@st.com>
>>> Cc: Fabio Estevam <fabio.estevam@freescale.com>
>>> Cc: Guoxiong Yan <yanguoxiong@huawei.com>
>>> Cc: linux-media@vger.kernel.org
>>> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>

Acked-by: Zhangfei Gao <zhangfei.gao@linaro.org>

>>> ---
>>>    drivers/media/rc/ir-hix5hd2.c | 2 +-
>>>    1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/media/rc/ir-hix5hd2.c
>>> b/drivers/media/rc/ir-hix5hd2.c
>>> index 1c087cb76815..d0549fba711c 100644
>>> --- a/drivers/media/rc/ir-hix5hd2.c
>>> +++ b/drivers/media/rc/ir-hix5hd2.c
>>> @@ -257,7 +257,7 @@ static int hix5hd2_ir_probe(struct
>>> platform_device *pdev)
>>>            goto clkerr;
>>>
>>>        if (devm_request_irq(dev, priv->irq, hix5hd2_ir_rx_interrupt,
>>> -                 IRQF_NO_SUSPEND, pdev->name, priv) < 0) {
>>> +                 0, pdev->name, priv) < 0) {
>>>            dev_err(dev, "IRQ %d register failed\n", priv->irq);
>>>            ret = -EINVAL;
>>>            goto regerr;
>>>
>>
>> ir is wakeup source for hix5hd2, so we use IRQF_NO_SUSPEND.
>
> OK, but from the existing implementation of suspend/resume callbacks, I
> read that the clocks as well as the IP block is powered off. Is part of
> the logic always-on ?
>
>> However, it is true the wakeup mechanism is not realized on hix5hd2 yet.
>
> OK, then I assume you can add the right APIs(enable_irq_wake and
> friends) when you add that feature.
>
>> I am fine with either using IRQF_NO_SUSPEND or not.
>>
>
> No using IRQF_NO_SUSPEND for wakeup is simply wrong and hence this patch
> series removes all those misuse. If you need it as wakeup, then you need
> to use right APIs for that. Since I don't see any support for wakeup in
> this driver I decided to just remove the flag. Please feel free to add
> the support making use of right APIs.

Thanks Sudeep for the kind info.
Yes, you are right.

Thanks

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 14/17] media: st-rc: remove misuse of IRQF_NO_SUSPEND flag
  2015-09-21 15:47 ` [PATCH 14/17] media: st-rc: remove misuse of IRQF_NO_SUSPEND flag Sudeep Holla
@ 2015-10-19 17:40   ` Sudeep Holla
  0 siblings, 0 replies; 6+ messages in thread
From: Sudeep Holla @ 2015-10-19 17:40 UTC (permalink / raw)
  To: linux-pm, linux-kernel, Mauro Carvalho Chehab
  Cc: Sudeep Holla, Thomas Gleixner, Rafael J. Wysocki,
	Srinivas Kandagatla, Maxime Coquelin, Patrice Chotard,
	linux-arm-kernel, kernel, linux-media

Hi,

On 21/09/15 16:47, Sudeep Holla wrote:
> The device is set as wakeup capable using proper wakeup API but the
> driver misuses IRQF_NO_SUSPEND to set the interrupt as wakeup source
> which is incorrect.
>
> This patch removes the use of IRQF_NO_SUSPEND flags replacing it with
> enable_irq_wake instead.
>
> Cc: Srinivas Kandagatla <srinivas.kandagatla@gmail.com>
> Cc: Maxime Coquelin <maxime.coquelin@st.com>
> Cc: Patrice Chotard <patrice.chotard@st.com>
> Cc: Mauro Carvalho Chehab <mchehab@osg.samsung.com>

Can you pick couple of these media patches ?

-- 
Regards,
Sudeep

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-10-19 17:40 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1442850433-5903-1-git-send-email-sudeep.holla@arm.com>
2015-09-21 15:47 ` [PATCH 14/17] media: st-rc: remove misuse of IRQF_NO_SUSPEND flag Sudeep Holla
2015-10-19 17:40   ` Sudeep Holla
2015-09-21 15:47 ` [PATCH 15/17] ir-hix5hd2: drop the use of IRQF_NO_SUSPEND Sudeep Holla
2015-09-23 14:26   ` zhangfei
2015-09-23 14:37     ` Sudeep Holla
2015-09-23 14:50       ` zhangfei

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).