From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757953AbdACJ5h (ORCPT ); Tue, 3 Jan 2017 04:57:37 -0500 Received: from lelnx193.ext.ti.com ([198.47.27.77]:35736 "EHLO lelnx193.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750879AbdACJ52 (ORCPT ); Tue, 3 Jan 2017 04:57:28 -0500 Subject: Re: [PATCH 1/1] extcon: usb-gpio: add pinctrl operation during system PM To: Peter Chen , , References: <1483431473-24813-1-git-send-email-peter.chen@nxp.com> CC: From: Roger Quadros Message-ID: Date: Tue, 3 Jan 2017 11:57:19 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: <1483431473-24813-1-git-send-email-peter.chen@nxp.com> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Peter, On 03/01/17 10:17, Peter Chen wrote: > 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 > --- > drivers/extcon/extcon-usb-gpio.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/extcon/extcon-usb-gpio.c b/drivers/extcon/extcon-usb-gpio.c > index d589c5f..f7172ae 100644 > --- a/drivers/extcon/extcon-usb-gpio.c > +++ b/drivers/extcon/extcon-usb-gpio.c > @@ -244,6 +244,7 @@ static int usb_extcon_suspend(struct device *dev) > disable_irq(info->id_irq); > if (info->vbus_gpiod) > disable_irq(info->vbus_irq); > + pinctrl_pm_select_sleep_state(dev); > > return ret; > } > @@ -253,6 +254,7 @@ static int usb_extcon_resume(struct device *dev) > struct usb_extcon_info *info = dev_get_drvdata(dev); > int ret = 0; > > + pinctrl_pm_select_default_state(dev); > if (device_may_wakeup(dev)) { > if (info->id_gpiod) { > ret = disable_irq_wake(info->id_irq); > How does this work if wake from suspend is desired? pinctrl sleep state might not support wakeup. cheers, -roger