Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bcb7440e authored by Peter Chen's avatar Peter Chen Committed by Chanwoo Choi
Browse files

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: default avatarPeter Chen <peter.chen@nxp.com>
Signed-off-by: default avatarChanwoo Choi <cw00.choi@samsung.com>
parent e6cf0465
Loading
Loading
Loading
Loading
+7 −0
Original line number Original line Diff line number Diff line
@@ -27,6 +27,7 @@
#include <linux/slab.h>
#include <linux/slab.h>
#include <linux/workqueue.h>
#include <linux/workqueue.h>
#include <linux/acpi.h>
#include <linux/acpi.h>
#include <linux/pinctrl/consumer.h>


#define USB_GPIO_DEBOUNCE_MS	20	/* ms */
#define USB_GPIO_DEBOUNCE_MS	20	/* ms */


@@ -245,6 +246,9 @@ static int usb_extcon_suspend(struct device *dev)
	if (info->vbus_gpiod)
	if (info->vbus_gpiod)
		disable_irq(info->vbus_irq);
		disable_irq(info->vbus_irq);


	if (!device_may_wakeup(dev))
		pinctrl_pm_select_sleep_state(dev);

	return ret;
	return ret;
}
}


@@ -253,6 +257,9 @@ static int usb_extcon_resume(struct device *dev)
	struct usb_extcon_info *info = dev_get_drvdata(dev);
	struct usb_extcon_info *info = dev_get_drvdata(dev);
	int ret = 0;
	int ret = 0;


	if (!device_may_wakeup(dev))
		pinctrl_pm_select_default_state(dev);

	if (device_may_wakeup(dev)) {
	if (device_may_wakeup(dev)) {
		if (info->id_gpiod) {
		if (info->id_gpiod) {
			ret = disable_irq_wake(info->id_irq);
			ret = disable_irq_wake(info->id_irq);