* [PATCH 1/1] extcon: usb-gpio: add pinctrl operation during system PM
@ 2017-01-03 8:17 Peter Chen
2017-01-03 9:57 ` Roger Quadros
2017-01-03 14:55 ` kbuild test robot
0 siblings, 2 replies; 4+ messages in thread
From: Peter Chen @ 2017-01-03 8:17 UTC (permalink / raw)
To: myungjoo.ham, cw00.choi; +Cc: linux-kernel, rogerq, Peter Chen
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>
---
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);
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/1] extcon: usb-gpio: add pinctrl operation during system PM
2017-01-03 8:17 [PATCH 1/1] extcon: usb-gpio: add pinctrl operation during system PM Peter Chen
@ 2017-01-03 9:57 ` Roger Quadros
2017-01-04 6:43 ` Peter Chen
2017-01-03 14:55 ` kbuild test robot
1 sibling, 1 reply; 4+ messages in thread
From: Roger Quadros @ 2017-01-03 9:57 UTC (permalink / raw)
To: Peter Chen, myungjoo.ham, cw00.choi; +Cc: linux-kernel
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 <peter.chen@nxp.com>
> ---
> 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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/1] extcon: usb-gpio: add pinctrl operation during system PM
2017-01-03 8:17 [PATCH 1/1] extcon: usb-gpio: add pinctrl operation during system PM Peter Chen
2017-01-03 9:57 ` Roger Quadros
@ 2017-01-03 14:55 ` kbuild test robot
1 sibling, 0 replies; 4+ messages in thread
From: kbuild test robot @ 2017-01-03 14:55 UTC (permalink / raw)
To: Peter Chen
Cc: kbuild-all, myungjoo.ham, cw00.choi, linux-kernel, rogerq, Peter Chen
[-- Attachment #1: Type: text/plain, Size: 2176 bytes --]
Hi Peter,
[auto build test ERROR on chanwoo-extcon/extcon-next]
[also build test ERROR on v4.10-rc2 next-20170103]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Peter-Chen/extcon-usb-gpio-add-pinctrl-operation-during-system-PM/20170103-223852
base: https://git.kernel.org/pub/scm/linux/kernel/git/chanwoo/extcon.git extcon-next
config: i386-randconfig-x007-201701 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
# save the attached .config to linux build tree
make ARCH=i386
All errors (new ones prefixed by >>):
drivers/extcon/extcon-usb-gpio.c: In function 'usb_extcon_suspend':
>> drivers/extcon/extcon-usb-gpio.c:247:2: error: implicit declaration of function 'pinctrl_pm_select_sleep_state' [-Werror=implicit-function-declaration]
pinctrl_pm_select_sleep_state(dev);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/extcon/extcon-usb-gpio.c: In function 'usb_extcon_resume':
>> drivers/extcon/extcon-usb-gpio.c:257:2: error: implicit declaration of function 'pinctrl_pm_select_default_state' [-Werror=implicit-function-declaration]
pinctrl_pm_select_default_state(dev);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
vim +/pinctrl_pm_select_sleep_state +247 drivers/extcon/extcon-usb-gpio.c
241 * accessible until resume completes. So disable IRQ.
242 */
243 if (info->id_gpiod)
244 disable_irq(info->id_irq);
245 if (info->vbus_gpiod)
246 disable_irq(info->vbus_irq);
> 247 pinctrl_pm_select_sleep_state(dev);
248
249 return ret;
250 }
251
252 static int usb_extcon_resume(struct device *dev)
253 {
254 struct usb_extcon_info *info = dev_get_drvdata(dev);
255 int ret = 0;
256
> 257 pinctrl_pm_select_default_state(dev);
258 if (device_may_wakeup(dev)) {
259 if (info->id_gpiod) {
260 ret = disable_irq_wake(info->id_irq);
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 29415 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH 1/1] extcon: usb-gpio: add pinctrl operation during system PM
2017-01-03 9:57 ` Roger Quadros
@ 2017-01-04 6:43 ` Peter Chen
0 siblings, 0 replies; 4+ messages in thread
From: Peter Chen @ 2017-01-04 6:43 UTC (permalink / raw)
To: Roger Quadros, myungjoo.ham, cw00.choi; +Cc: linux-kernel
>
>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 <peter.chen@nxp.com>
>> ---
>> 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.
>
Oh, yes. I should consider wakeup condition. For GPIO pins,
if wakeup is requested by user, the pinctrl should NOT in
sleep state.
Peter
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-01-04 6:44 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-03 8:17 [PATCH 1/1] extcon: usb-gpio: add pinctrl operation during system PM Peter Chen
2017-01-03 9:57 ` Roger Quadros
2017-01-04 6:43 ` Peter Chen
2017-01-03 14:55 ` kbuild test robot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.