linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] extcon: usb-gpio: switch to use pm wakeirq apis
@ 2016-04-06 17:32 Grygorii Strashko
  2016-04-06 22:41 ` Tony Lindgren
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Grygorii Strashko @ 2016-04-06 17:32 UTC (permalink / raw)
  To: MyungJoo Ham, Chanwoo Choi
  Cc: nsekhar, nm, rogerq, linux-pm, linux-arm-kernel, linux-kernel,
	tony, Grygorii Strashko

Switch to use PM wakeirq APIs which automates wakeup IRQs
enabling/disabling and so allows to make code simpler.

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
---
Unfortunately this simple patch depends on:
"[RFC PATCH] PM / wakeirq: fix wakeirq setting after wakup re-configuration from sysfs"
https://lkml.org/lkml/2016/4/6/296

 drivers/extcon/extcon-usb-gpio.c | 19 ++++++-------------
 1 file changed, 6 insertions(+), 13 deletions(-)

diff --git a/drivers/extcon/extcon-usb-gpio.c b/drivers/extcon/extcon-usb-gpio.c
index 2b2fecf..bc61d11 100644
--- a/drivers/extcon/extcon-usb-gpio.c
+++ b/drivers/extcon/extcon-usb-gpio.c
@@ -24,6 +24,7 @@
 #include <linux/module.h>
 #include <linux/of_gpio.h>
 #include <linux/platform_device.h>
+#include <linux/pm_wakeirq.h>
 #include <linux/slab.h>
 #include <linux/workqueue.h>
 
@@ -141,7 +142,8 @@ static int usb_extcon_probe(struct platform_device *pdev)
 	}
 
 	platform_set_drvdata(pdev, info);
-	device_init_wakeup(dev, 1);
+	device_init_wakeup(dev, true);
+	dev_pm_set_wake_irq(dev, info->id_irq);
 
 	/* Perform initial detection */
 	usb_extcon_detect_cable(&info->wq_detcable.work);
@@ -155,6 +157,9 @@ static int usb_extcon_remove(struct platform_device *pdev)
 
 	cancel_delayed_work_sync(&info->wq_detcable);
 
+	dev_pm_clear_wake_irq(&pdev->dev);
+	device_init_wakeup(&pdev->dev, false);
+
 	return 0;
 }
 
@@ -164,12 +169,6 @@ static int usb_extcon_suspend(struct device *dev)
 	struct usb_extcon_info *info = dev_get_drvdata(dev);
 	int ret = 0;
 
-	if (device_may_wakeup(dev)) {
-		ret = enable_irq_wake(info->id_irq);
-		if (ret)
-			return ret;
-	}
-
 	/*
 	 * We don't want to process any IRQs after this point
 	 * as GPIOs used behind I2C subsystem might not be
@@ -185,12 +184,6 @@ static int usb_extcon_resume(struct device *dev)
 	struct usb_extcon_info *info = dev_get_drvdata(dev);
 	int ret = 0;
 
-	if (device_may_wakeup(dev)) {
-		ret = disable_irq_wake(info->id_irq);
-		if (ret)
-			return ret;
-	}
-
 	enable_irq(info->id_irq);
 
 	return ret;
-- 
2.8.0

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

* Re: [PATCH] extcon: usb-gpio: switch to use pm wakeirq apis
  2016-04-06 17:32 [PATCH] extcon: usb-gpio: switch to use pm wakeirq apis Grygorii Strashko
@ 2016-04-06 22:41 ` Tony Lindgren
  2016-04-07  8:23 ` Roger Quadros
  2016-04-07 23:04 ` Chanwoo Choi
  2 siblings, 0 replies; 4+ messages in thread
From: Tony Lindgren @ 2016-04-06 22:41 UTC (permalink / raw)
  To: Grygorii Strashko
  Cc: MyungJoo Ham, Chanwoo Choi, nsekhar, nm, rogerq, linux-pm,
	linux-arm-kernel, linux-kernel

* Grygorii Strashko <grygorii.strashko@ti.com> [160406 10:33]:
> Switch to use PM wakeirq APIs which automates wakeup IRQs
> enabling/disabling and so allows to make code simpler.
> 
> Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>

Looks good to me:

Acked-by: Tony Lindgren <tony@atomide.com>

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

* Re: [PATCH] extcon: usb-gpio: switch to use pm wakeirq apis
  2016-04-06 17:32 [PATCH] extcon: usb-gpio: switch to use pm wakeirq apis Grygorii Strashko
  2016-04-06 22:41 ` Tony Lindgren
@ 2016-04-07  8:23 ` Roger Quadros
  2016-04-07 23:04 ` Chanwoo Choi
  2 siblings, 0 replies; 4+ messages in thread
From: Roger Quadros @ 2016-04-07  8:23 UTC (permalink / raw)
  To: Grygorii Strashko, MyungJoo Ham, Chanwoo Choi
  Cc: nsekhar, nm, linux-pm, linux-arm-kernel, linux-kernel, tony

On 06/04/16 20:32, Grygorii Strashko wrote:
> Switch to use PM wakeirq APIs which automates wakeup IRQs
> enabling/disabling and so allows to make code simpler.
> 
> Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>

Acked-by: Roger Quadros <rogerq@ti.com>

cheers,
-roger

> ---
> Unfortunately this simple patch depends on:
> "[RFC PATCH] PM / wakeirq: fix wakeirq setting after wakup re-configuration from sysfs"
> https://lkml.org/lkml/2016/4/6/296
> 
>  drivers/extcon/extcon-usb-gpio.c | 19 ++++++-------------
>  1 file changed, 6 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/extcon/extcon-usb-gpio.c b/drivers/extcon/extcon-usb-gpio.c
> index 2b2fecf..bc61d11 100644
> --- a/drivers/extcon/extcon-usb-gpio.c
> +++ b/drivers/extcon/extcon-usb-gpio.c
> @@ -24,6 +24,7 @@
>  #include <linux/module.h>
>  #include <linux/of_gpio.h>
>  #include <linux/platform_device.h>
> +#include <linux/pm_wakeirq.h>
>  #include <linux/slab.h>
>  #include <linux/workqueue.h>
>  
> @@ -141,7 +142,8 @@ static int usb_extcon_probe(struct platform_device *pdev)
>  	}
>  
>  	platform_set_drvdata(pdev, info);
> -	device_init_wakeup(dev, 1);
> +	device_init_wakeup(dev, true);
> +	dev_pm_set_wake_irq(dev, info->id_irq);
>  
>  	/* Perform initial detection */
>  	usb_extcon_detect_cable(&info->wq_detcable.work);
> @@ -155,6 +157,9 @@ static int usb_extcon_remove(struct platform_device *pdev)
>  
>  	cancel_delayed_work_sync(&info->wq_detcable);
>  
> +	dev_pm_clear_wake_irq(&pdev->dev);
> +	device_init_wakeup(&pdev->dev, false);
> +
>  	return 0;
>  }
>  
> @@ -164,12 +169,6 @@ static int usb_extcon_suspend(struct device *dev)
>  	struct usb_extcon_info *info = dev_get_drvdata(dev);
>  	int ret = 0;
>  
> -	if (device_may_wakeup(dev)) {
> -		ret = enable_irq_wake(info->id_irq);
> -		if (ret)
> -			return ret;
> -	}
> -
>  	/*
>  	 * We don't want to process any IRQs after this point
>  	 * as GPIOs used behind I2C subsystem might not be
> @@ -185,12 +184,6 @@ static int usb_extcon_resume(struct device *dev)
>  	struct usb_extcon_info *info = dev_get_drvdata(dev);
>  	int ret = 0;
>  
> -	if (device_may_wakeup(dev)) {
> -		ret = disable_irq_wake(info->id_irq);
> -		if (ret)
> -			return ret;
> -	}
> -
>  	enable_irq(info->id_irq);
>  
>  	return ret;
> 

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

* Re: [PATCH] extcon: usb-gpio: switch to use pm wakeirq apis
  2016-04-06 17:32 [PATCH] extcon: usb-gpio: switch to use pm wakeirq apis Grygorii Strashko
  2016-04-06 22:41 ` Tony Lindgren
  2016-04-07  8:23 ` Roger Quadros
@ 2016-04-07 23:04 ` Chanwoo Choi
  2 siblings, 0 replies; 4+ messages in thread
From: Chanwoo Choi @ 2016-04-07 23:04 UTC (permalink / raw)
  To: Grygorii Strashko, MyungJoo Ham
  Cc: nsekhar, nm, rogerq, linux-pm, linux-arm-kernel, linux-kernel, tony

On 2016년 04월 07일 02:32, Grygorii Strashko wrote:
> Switch to use PM wakeirq APIs which automates wakeup IRQs
> enabling/disabling and so allows to make code simpler.
> 
> Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>

Applied it.

Thanks,
Chanwoo Choi

> ---
> Unfortunately this simple patch depends on:
> "[RFC PATCH] PM / wakeirq: fix wakeirq setting after wakup re-configuration from sysfs"
> https://lkml.org/lkml/2016/4/6/296
> 
>  drivers/extcon/extcon-usb-gpio.c | 19 ++++++-------------
>  1 file changed, 6 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/extcon/extcon-usb-gpio.c b/drivers/extcon/extcon-usb-gpio.c
> index 2b2fecf..bc61d11 100644
> --- a/drivers/extcon/extcon-usb-gpio.c
> +++ b/drivers/extcon/extcon-usb-gpio.c
> @@ -24,6 +24,7 @@
>  #include <linux/module.h>
>  #include <linux/of_gpio.h>
>  #include <linux/platform_device.h>
> +#include <linux/pm_wakeirq.h>
>  #include <linux/slab.h>
>  #include <linux/workqueue.h>
>  
> @@ -141,7 +142,8 @@ static int usb_extcon_probe(struct platform_device *pdev)
>  	}
>  
>  	platform_set_drvdata(pdev, info);
> -	device_init_wakeup(dev, 1);
> +	device_init_wakeup(dev, true);
> +	dev_pm_set_wake_irq(dev, info->id_irq);
>  
>  	/* Perform initial detection */
>  	usb_extcon_detect_cable(&info->wq_detcable.work);
> @@ -155,6 +157,9 @@ static int usb_extcon_remove(struct platform_device *pdev)
>  
>  	cancel_delayed_work_sync(&info->wq_detcable);
>  
> +	dev_pm_clear_wake_irq(&pdev->dev);
> +	device_init_wakeup(&pdev->dev, false);
> +
>  	return 0;
>  }
>  
> @@ -164,12 +169,6 @@ static int usb_extcon_suspend(struct device *dev)
>  	struct usb_extcon_info *info = dev_get_drvdata(dev);
>  	int ret = 0;
>  
> -	if (device_may_wakeup(dev)) {
> -		ret = enable_irq_wake(info->id_irq);
> -		if (ret)
> -			return ret;
> -	}
> -
>  	/*
>  	 * We don't want to process any IRQs after this point
>  	 * as GPIOs used behind I2C subsystem might not be
> @@ -185,12 +184,6 @@ static int usb_extcon_resume(struct device *dev)
>  	struct usb_extcon_info *info = dev_get_drvdata(dev);
>  	int ret = 0;
>  
> -	if (device_may_wakeup(dev)) {
> -		ret = disable_irq_wake(info->id_irq);
> -		if (ret)
> -			return ret;
> -	}
> -
>  	enable_irq(info->id_irq);
>  
>  	return ret;
> 

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

end of thread, other threads:[~2016-04-07 23:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-06 17:32 [PATCH] extcon: usb-gpio: switch to use pm wakeirq apis Grygorii Strashko
2016-04-06 22:41 ` Tony Lindgren
2016-04-07  8:23 ` Roger Quadros
2016-04-07 23:04 ` Chanwoo Choi

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