aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/extcon/extcon-usb-gpio.c
diff options
context:
space:
mode:
authorPeter Chen <peter.chen@nxp.com>2017-01-04 02:19:51 -0500
committerChanwoo Choi <cw00.choi@samsung.com>2017-01-08 20:04:12 -0500
commitbcb7440e76a96c8a244bd683142a38f7d5cecb93 (patch)
treed10b19d22a15882c2f28d01319cd947af6dd278e /drivers/extcon/extcon-usb-gpio.c
parente6cf046543763878614d51e8283abd40d5e5327e (diff)
extcon: usb-gpio: Add pinctrl operation during system PM
At some systems, the pinctrl setting will be lost or needs to set as "sleep" state to save power consumption. So, we need to configure pinctrl as "sleep" state when system enters suspend, and as "default" state after system resumes. In this way, the pinctrl value can be recovered as "default" state after resuming. Signed-off-by: Peter Chen <peter.chen@nxp.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.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/extcon/extcon-usb-gpio.c b/drivers/extcon/extcon-usb-gpio.c
index d589c5feff3d..a5e1882b4ca6 100644
--- a/drivers/extcon/extcon-usb-gpio.c
+++ b/drivers/extcon/extcon-usb-gpio.c
@@ -27,6 +27,7 @@
27#include <linux/slab.h> 27#include <linux/slab.h>
28#include <linux/workqueue.h> 28#include <linux/workqueue.h>
29#include <linux/acpi.h> 29#include <linux/acpi.h>
30#include <linux/pinctrl/consumer.h>
30 31
31#define USB_GPIO_DEBOUNCE_MS 20 /* ms */ 32#define USB_GPIO_DEBOUNCE_MS 20 /* ms */
32 33
@@ -245,6 +246,9 @@ static int usb_extcon_suspend(struct device *dev)
245 if (info->vbus_gpiod) 246 if (info->vbus_gpiod)
246 disable_irq(info->vbus_irq); 247 disable_irq(info->vbus_irq);
247 248
249 if (!device_may_wakeup(dev))
250 pinctrl_pm_select_sleep_state(dev);
251
248 return ret; 252 return ret;
249} 253}
250 254
@@ -253,6 +257,9 @@ static int usb_extcon_resume(struct device *dev)
253 struct usb_extcon_info *info = dev_get_drvdata(dev); 257 struct usb_extcon_info *info = dev_get_drvdata(dev);
254 int ret = 0; 258 int ret = 0;
255 259
260 if (!device_may_wakeup(dev))
261 pinctrl_pm_select_default_state(dev);
262
256 if (device_may_wakeup(dev)) { 263 if (device_may_wakeup(dev)) {
257 if (info->id_gpiod) { 264 if (info->id_gpiod) {
258 ret = disable_irq_wake(info->id_irq); 265 ret = disable_irq_wake(info->id_irq);