diff options
author | Grygorii Strashko <grygorii.strashko@ti.com> | 2016-04-06 13:32:37 -0400 |
---|---|---|
committer | Chanwoo Choi <cw00.choi@samsung.com> | 2016-06-21 01:09:53 -0400 |
commit | 12bd0f323b855ee548367f48062cf58cae5acda8 (patch) | |
tree | 67c257afd1242c2529bb376cbb0157aa29360f66 /drivers/extcon/extcon-usb-gpio.c | |
parent | 33688abb2802ff3a230bd2441f765477b94cc89e (diff) |
extcon: usb-gpio: switch to use pm wakeirq apis
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: Tony Lindgren <tony@atomide.com>
Acked-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Diffstat (limited to 'drivers/extcon/extcon-usb-gpio.c')
-rw-r--r-- | drivers/extcon/extcon-usb-gpio.c | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/drivers/extcon/extcon-usb-gpio.c b/drivers/extcon/extcon-usb-gpio.c index 2b2fecffb1ad..bc61d1165d73 100644 --- a/drivers/extcon/extcon-usb-gpio.c +++ b/drivers/extcon/extcon-usb-gpio.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/module.h> | 24 | #include <linux/module.h> |
25 | #include <linux/of_gpio.h> | 25 | #include <linux/of_gpio.h> |
26 | #include <linux/platform_device.h> | 26 | #include <linux/platform_device.h> |
27 | #include <linux/pm_wakeirq.h> | ||
27 | #include <linux/slab.h> | 28 | #include <linux/slab.h> |
28 | #include <linux/workqueue.h> | 29 | #include <linux/workqueue.h> |
29 | 30 | ||
@@ -141,7 +142,8 @@ static int usb_extcon_probe(struct platform_device *pdev) | |||
141 | } | 142 | } |
142 | 143 | ||
143 | platform_set_drvdata(pdev, info); | 144 | platform_set_drvdata(pdev, info); |
144 | device_init_wakeup(dev, 1); | 145 | device_init_wakeup(dev, true); |
146 | dev_pm_set_wake_irq(dev, info->id_irq); | ||
145 | 147 | ||
146 | /* Perform initial detection */ | 148 | /* Perform initial detection */ |
147 | usb_extcon_detect_cable(&info->wq_detcable.work); | 149 | usb_extcon_detect_cable(&info->wq_detcable.work); |
@@ -155,6 +157,9 @@ static int usb_extcon_remove(struct platform_device *pdev) | |||
155 | 157 | ||
156 | cancel_delayed_work_sync(&info->wq_detcable); | 158 | cancel_delayed_work_sync(&info->wq_detcable); |
157 | 159 | ||
160 | dev_pm_clear_wake_irq(&pdev->dev); | ||
161 | device_init_wakeup(&pdev->dev, false); | ||
162 | |||
158 | return 0; | 163 | return 0; |
159 | } | 164 | } |
160 | 165 | ||
@@ -164,12 +169,6 @@ static int usb_extcon_suspend(struct device *dev) | |||
164 | struct usb_extcon_info *info = dev_get_drvdata(dev); | 169 | struct usb_extcon_info *info = dev_get_drvdata(dev); |
165 | int ret = 0; | 170 | int ret = 0; |
166 | 171 | ||
167 | if (device_may_wakeup(dev)) { | ||
168 | ret = enable_irq_wake(info->id_irq); | ||
169 | if (ret) | ||
170 | return ret; | ||
171 | } | ||
172 | |||
173 | /* | 172 | /* |
174 | * We don't want to process any IRQs after this point | 173 | * We don't want to process any IRQs after this point |
175 | * as GPIOs used behind I2C subsystem might not be | 174 | * as GPIOs used behind I2C subsystem might not be |
@@ -185,12 +184,6 @@ static int usb_extcon_resume(struct device *dev) | |||
185 | struct usb_extcon_info *info = dev_get_drvdata(dev); | 184 | struct usb_extcon_info *info = dev_get_drvdata(dev); |
186 | int ret = 0; | 185 | int ret = 0; |
187 | 186 | ||
188 | if (device_may_wakeup(dev)) { | ||
189 | ret = disable_irq_wake(info->id_irq); | ||
190 | if (ret) | ||
191 | return ret; | ||
192 | } | ||
193 | |||
194 | enable_irq(info->id_irq); | 187 | enable_irq(info->id_irq); |
195 | 188 | ||
196 | return ret; | 189 | return ret; |