extcon: gpio: Add power resume support
PATCH 1/1 extcon: gpio: Add power resume support
From: Rongjun Ying <[email protected]>
After system resume, need send extcon uevent to userspace
Change-Id: I32a9e1c6646035f95765bba79a7acaccb8ce45a7
--- drivers/extcon/extcon-gpio.c | 17 +++++++++++++++++ 1 files changed, 17 insertions(+), 0 deletions(-)
drivers/extcon/extcon-gpio.c +17 -0
@@ -159,12 +159,29 @@ static int gpio_extcon_remove(struct platform_device *pdev)return 0 ; } +#ifdef CONFIG_PM_SLEEP +static int gpio_extcon_resume (struct device *dev) +{ +struct gpio_extcon_data *extcon_data; + + extcon_data =dev_get_drvdata (dev); +queue_delayed_work (system_power_efficient_wq, &extcon_data->work, + extcon_data->debounce_jiffies); +return 0 ; +} +#endif + +static const struct dev_pm_ops gpio_extcon_pm_ops = { +SET_SYSTEM_SLEEP_PM_OPS (NULL , gpio_extcon_resume) +}; +static struct platform_driver gpio_extcon_driver = { .probe = gpio_extcon_probe, .remove = gpio_extcon_remove, .driver = { .name ="extcon-gpio" , .owner =THIS_MODULE , + .pm = &gpio_extcon_pm_ops, }, };
Signature · 1 line
1.7.5.4
Chanwoo Choi
maintainerQuoted 3 lines · rjying
From: Rongjun Ying <[email protected]>
After system resume, need send extcon uevent to userspace
Why did extcon send uevent after wakeup from suspend?
If extcon cable is attatched or detached on suspend state, Kernel can detect the interrupt about changed state of extcon. So, kernel would execute proper operation about interrupt after wakeup from suspend state.
I think it isn't necessary.
Thanks,
Chanwoo Choi
Quoted 43 lines
Change-Id: I32a9e1c6646035f95765bba79a7acaccb8ce45a7
Signed-off-by Rongjun Ying <[email protected]>--- drivers/extcon/extcon-gpio.c | 17 +++++++++++++++++ 1 files changed, 17 insertions(+), 0 deletions(-)drivers/extcon/extcon-gpio.c +17
-0@@ -159,12 +159,29 @@ static int gpio_extcon_remove(struct platform_device *pdev)return 0 ; } +#ifdef CONFIG_PM_SLEEP +static int gpio_extcon_resume (struct device *dev) +{ +struct gpio_extcon_data *extcon_data; + + extcon_data =dev_get_drvdata (dev); +queue_delayed_work (system_power_efficient_wq, &extcon_data->work, + extcon_data->debounce_jiffies); +return 0 ; +} +#endif + +static const struct dev_pm_ops gpio_extcon_pm_ops = { +SET_SYSTEM_SLEEP_PM_OPS (NULL , gpio_extcon_resume) +}; +static struct platform_driver gpio_extcon_driver = { .probe = gpio_extcon_probe, .remove = gpio_extcon_remove, .driver = { .name ="extcon-gpio" , .owner =THIS_MODULE , + .pm = &gpio_extcon_pm_ops, }, };
2013/12/23 Chanwoo Choi <[email protected]>:
Quoted 9 lines · rjying
Quoted 3 lines
From: Rongjun Ying <[email protected]>
After system resume, need send extcon uevent to userspace
Why did extcon send uevent after wakeup from suspend?
If extcon cable is attatched or detached on suspend state, Kernel can detect the interrupt about changed state of extcon.
irq controller has lost power in suspend, so there is no pending interrupt. and HW will not pend any interrupt when we hotplug cable during sleep.
Quoted 2 lines
So, kernel would execute proper operation about interrupt after wakeup from suspend state.
kernel only save/restore the register status of gpio, how could it know whether there is a pending interrupt if the HW doesn't do it?
Quoted 41 lines
I think it isn't necessary.
Thanks,
Chanwoo ChoiQuoted 35 lines
Change-Id: I32a9e1c6646035f95765bba79a7acaccb8ce45a7
Signed-off-by Rongjun Ying <[email protected]>--- drivers/extcon/extcon-gpio.c | 17 +++++++++++++++++ 1 files changed, 17 insertions(+), 0 deletions(-)drivers/extcon/extcon-gpio.c +16
-0@@ -159,12 +159,29 @@ static int gpio_extcon_remove(struct platform_device *pdev)return 0 ; } +#ifdef CONFIG_PM_SLEEP +static int gpio_extcon_resume (struct device *dev) +{ +struct gpio_extcon_data *extcon_data; + + extcon_data =dev_get_drvdata (dev); +queue_delayed_work (system_power_efficient_wq, &extcon_data->work, + extcon_data->debounce_jiffies); +return 0 ; +} +#endif + +static const struct dev_pm_ops gpio_extcon_pm_ops = { +SET_SYSTEM_SLEEP_PM_OPS (NULL , gpio_extcon_resume) +}; +static struct platform_driver gpio_extcon_driver = { .probe = gpio_extcon_probe, .remove = gpio_extcon_remove,
Quoted 9 lines
drivers/extcon/extcon-gpio.c static int gpio_extcon_remove(struct platform_device *pdev) · line 187
Quoted 8 lines
drivers/extcon/extcon-gpio.c +1
-0.driver = { .name = "extcon-gpio", .owner = THIS_MODULE, + .pm = &gpio_extcon_pm_ops, }, };
-barry
Chanwoo Choi
maintainerQuoted 6 lines · Barry Song
2013/12/23 Chanwoo Choi <[email protected]>:
Quoted 5 lines · rjying
Quoted 3 lines
From: Rongjun Ying <[email protected]>
After system resume, need send extcon uevent to userspace
Quoted 7 lines
Quoted 4 lines
Why did extcon send uevent after wakeup from suspend?
If extcon cable is attatched or detached on suspend state, Kernel can detect the interrupt about changed state of extcon.
irq controller has lost power in suspend, so there is no pending interrupt. and HW will not pend any interrupt when we hotplug cable during sleep.
No, SoC in suspend state must maintain the minimum power under 1mA if completed the power-optimization on suspend state.
If user insert USB cable to target, the external interrupt connected to USB port is happened. And kernel would be waked up from suspend state to operate proper interrupt handler of external interrupt.
Also,
Input subsystem used gpio-keys driver for power button..
If user press power button in suspend state, target would be waked up from suspend state. It is same case both extcon gpio and gpio-keys of input subsystem.
Quoted 65 lines
Quoted 3 lines
So, kernel would execute proper operation about interrupt after wakeup from suspend state.
kernel only save/restore the register status of gpio, how could it know whether there is a pending interrupt if the HW doesn't do it?
Quoted 41 lines
I think it isn't necessary.
Thanks,
Chanwoo ChoiQuoted 35 lines
Change-Id: I32a9e1c6646035f95765bba79a7acaccb8ce45a7
Signed-off-by Rongjun Ying <[email protected]>--- drivers/extcon/extcon-gpio.c | 17 +++++++++++++++++ 1 files changed, 17 insertions(+), 0 deletions(-)drivers/extcon/extcon-gpio.c +16
-0@@ -159,12 +159,29 @@ static int gpio_extcon_remove(struct platform_device *pdev)return 0 ; } +#ifdef CONFIG_PM_SLEEP +static int gpio_extcon_resume (struct device *dev) +{ +struct gpio_extcon_data *extcon_data; + + extcon_data =dev_get_drvdata (dev); +queue_delayed_work (system_power_efficient_wq, &extcon_data->work, + extcon_data->debounce_jiffies); +return 0 ; +} +#endif + +static const struct dev_pm_ops gpio_extcon_pm_ops = { +SET_SYSTEM_SLEEP_PM_OPS (NULL , gpio_extcon_resume) +}; +static struct platform_driver gpio_extcon_driver = { .probe = gpio_extcon_probe, .remove = gpio_extcon_remove,Quoted 9 lines
drivers/extcon/extcon-gpio.c static int gpio_extcon_remove(struct platform_device *pdev) · line 187
Quoted 8 lines
drivers/extcon/extcon-gpio.c +1
-0.driver = { .name = "extcon-gpio", .owner = THIS_MODULE, + .pm = &gpio_extcon_pm_ops, }, };-barry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
2013/12/23 Chanwoo Choi <[email protected]>:
Quoted 15 lines · Barry Song
Quoted 6 lines
2013/12/23 Chanwoo Choi <[email protected]>:
Quoted 5 lines · rjying
Quoted 3 lines
From: Rongjun Ying <[email protected]>
After system resume, need send extcon uevent to userspace
Quoted 7 lines
Quoted 4 lines
Why did extcon send uevent after wakeup from suspend?
If extcon cable is attatched or detached on suspend state, Kernel can detect the interrupt about changed state of extcon.
irq controller has lost power in suspend, so there is no pending interrupt. and HW will not pend any interrupt when we hotplug cable during sleep.
Quoted 6 lines
No, SoC in suspend state must maintain the minimum power under 1mA if completed the power-optimization on suspend state.
If user insert USB cable to target, the external interrupt connected to USB port is happened. And kernel would be waked up from suspend state to operate proper interrupt handler of external interrupt.
no. not every USB supports that. that depends on the power domain design of SoC.
Quoted 5 lines
Also,
Input subsystem used gpio-keys driver for power button..
If user press power button in suspend state, target would be waked up from suspend state. It is same case both extcon gpio and gpio-keys of input subsystem.
no. it depends on the SoC design. many SoC only support 1 special key which can work as ON-KEY as wakeup source. and this kind of keys might not be GPIO at all.
there is a special power domain which is still open for it.
Quoted 59 lines
Quoted 59 lines
Quoted 4 lines
So, kernel would execute proper operation about interrupt after wakeup from suspend state.
kernel only save/restore the register status of gpio, how could it know whether there is a pending interrupt if the HW doesn't do it?
Quoted 50 lines
I think it isn't necessary.
Thanks,
Chanwoo ChoiQuoted 43 lines
Change-Id: I32a9e1c6646035f95765bba79a7acaccb8ce45a7
Signed-off-by Rongjun Ying <[email protected]>--- drivers/extcon/extcon-gpio.c | 17 +++++++++++++++++ 1 files changed, 17 insertions(+), 0 deletions(-)drivers/extcon/extcon-gpio.c +17
-0@@ -159,12 +159,29 @@ static int gpio_extcon_remove(struct platform_device *pdev)return 0 ; } +#ifdef CONFIG_PM_SLEEP +static int gpio_extcon_resume (struct device *dev) +{ +struct gpio_extcon_data *extcon_data; + + extcon_data =dev_get_drvdata (dev); +queue_delayed_work (system_power_efficient_wq, &extcon_data->work, + extcon_data->debounce_jiffies); +return 0 ; +} +#endif + +static const struct dev_pm_ops gpio_extcon_pm_ops = { +SET_SYSTEM_SLEEP_PM_OPS (NULL , gpio_extcon_resume) +}; +static struct platform_driver gpio_extcon_driver = { .probe = gpio_extcon_probe, .remove = gpio_extcon_remove, .driver = { .name ="extcon-gpio" , .owner =THIS_MODULE , + .pm = &gpio_extcon_pm_ops, }, };
Quoted 1 line
Quoted 1 line
-barry
-barry
Chanwoo Choi
maintainerQuoted 16 lines · Barry Song
2013/12/23 Chanwoo Choi <[email protected]>:
Quoted 15 lines · Barry Song
Quoted 13 lines
2013/12/23 Chanwoo Choi <[email protected]>:
Quoted 9 lines · rjying
Quoted 3 lines
From: Rongjun Ying <[email protected]>
After system resume, need send extcon uevent to userspace
Why did extcon send uevent after wakeup from suspend?
If extcon cable is attatched or detached on suspend state, Kernel can detect the interrupt about changed state of extcon.
irq controller has lost power in suspend, so there is no pending interrupt. and HW will not pend any interrupt when we hotplug cable during sleep.
Quoted 8 lines
Quoted 6 lines
No, SoC in suspend state must maintain the minimum power under 1mA if completed the power-optimization on suspend state.
If user insert USB cable to target, the external interrupt connected to USB port is happened. And kernel would be waked up from suspend state to operate proper interrupt handler of external interrupt.
no. not every USB supports that. that depends on the power domain design of SoC.
USB is only example for gpio control in suspend state.
Quoted 11 lines
Quoted 6 lines
Also,
Input subsystem used gpio-keys driver for power button..
If user press power button in suspend state, target would be waked up from suspend state. It is same case both extcon gpio and gpio-keys of input subsystem.no. it depends on the SoC design. many SoC only support 1 special key which can work as ON-KEY as wakeup source. and this kind of keys might not be GPIO at all.
there is a special power domain which is still open for it.
many SoC?
As I knew, most SoC has supported various wakeup source. As you comment, if specific SoC support only one special key for wakeup from suspend state, I think it isn't common.
Also,
This patch isn't necessary on SoCs which support various wakeup source (e.g., external interrupt). As you comment, this issue has dependecy on specific SoC. Why did you think this common code?
Quoted 69 lines
Quoted 60 lines
Quoted 60 lines
Quoted 5 lines
So, kernel would execute proper operation about interrupt after wakeup from suspend state.
kernel only save/restore the register status of gpio, how could it know whether there is a pending interrupt if the HW doesn't do it?
Quoted 50 lines
I think it isn't necessary.
Thanks,
Chanwoo ChoiQuoted 43 lines
Change-Id: I32a9e1c6646035f95765bba79a7acaccb8ce45a7
Signed-off-by Rongjun Ying <[email protected]>--- drivers/extcon/extcon-gpio.c | 17 +++++++++++++++++ 1 files changed, 17 insertions(+), 0 deletions(-)drivers/extcon/extcon-gpio.c +17
-0@@ -159,12 +159,29 @@ static int gpio_extcon_remove(struct platform_device *pdev)return 0 ; } +#ifdef CONFIG_PM_SLEEP +static int gpio_extcon_resume (struct device *dev) +{ +struct gpio_extcon_data *extcon_data; + + extcon_data =dev_get_drvdata (dev); +queue_delayed_work (system_power_efficient_wq, &extcon_data->work, + extcon_data->debounce_jiffies); +return 0 ; +} +#endif + +static const struct dev_pm_ops gpio_extcon_pm_ops = { +SET_SYSTEM_SLEEP_PM_OPS (NULL , gpio_extcon_resume) +}; +static struct platform_driver gpio_extcon_driver = { .probe = gpio_extcon_probe, .remove = gpio_extcon_remove, .driver = { .name ="extcon-gpio" , .owner =THIS_MODULE , + .pm = &gpio_extcon_pm_ops, }, };Quoted 1 line
Quoted 1 line
-barry
-barry
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
2013/12/23 Chanwoo Choi <[email protected]>:
Quoted 42 lines · Barry Song
Quoted 16 lines
2013/12/23 Chanwoo Choi <[email protected]>:
Quoted 15 lines · Barry Song
Quoted 13 lines
2013/12/23 Chanwoo Choi <[email protected]>:
Quoted 9 lines · rjying
Quoted 3 lines
From: Rongjun Ying <[email protected]>
After system resume, need send extcon uevent to userspace
Why did extcon send uevent after wakeup from suspend?
If extcon cable is attatched or detached on suspend state, Kernel can detect the interrupt about changed state of extcon.
irq controller has lost power in suspend, so there is no pending interrupt. and HW will not pend any interrupt when we hotplug cable during sleep.
Quoted 8 lines
Quoted 6 lines
No, SoC in suspend state must maintain the minimum power under 1mA if completed the power-optimization on suspend state.
If user insert USB cable to target, the external interrupt connected to USB port is happened. And kernel would be waked up from suspend state to operate proper interrupt handler of external interrupt.
no. not every USB supports that. that depends on the power domain design of SoC.
USB is only example for gpio control in suspend state.
Quoted 11 lines
Quoted 6 lines
Also,
Input subsystem used gpio-keys driver for power button..
If user press power button in suspend state, target would be waked up from suspend state. It is same case both extcon gpio and gpio-keys of input subsystem.no. it depends on the SoC design. many SoC only support 1 special key which can work as ON-KEY as wakeup source. and this kind of keys might not be GPIO at all.
there is a special power domain which is still open for it.many SoC?
Quoted 7 lines
As I knew, most SoC has supported various wakeup source. As you comment, if specific SoC support only one special key for wakeup from suspend state, I think it isn't common.
Also,
This patch isn't necessary on SoCs which support various wakeup source (e.g., external interrupt). As you comment, this issue has dependecy on specific SoC. Why did you think this common code?
i am not thinking this patch must be common codes but i think the extcon should provide common codes to support all chips. that is what a framework should consider.
if there is no this or things similar with this, how could extcon support the chips which don't support receiving sleep gpio interrupts?
Quoted 61 lines
Quoted 61 lines
Quoted 61 lines
Quoted 61 lines
Quoted 6 lines
So, kernel would execute proper operation about interrupt after wakeup from suspend state.
kernel only save/restore the register status of gpio, how could it know whether there is a pending interrupt if the HW doesn't do it?
Quoted 50 lines
I think it isn't necessary.
Thanks,
Chanwoo ChoiQuoted 43 lines
Change-Id: I32a9e1c6646035f95765bba79a7acaccb8ce45a7
Signed-off-by Rongjun Ying <[email protected]>--- drivers/extcon/extcon-gpio.c | 17 +++++++++++++++++ 1 files changed, 17 insertions(+), 0 deletions(-)drivers/extcon/extcon-gpio.c +17
-0@@ -159,12 +159,29 @@ static int gpio_extcon_remove(struct platform_device *pdev)return 0 ; } +#ifdef CONFIG_PM_SLEEP +static int gpio_extcon_resume (struct device *dev) +{ +struct gpio_extcon_data *extcon_data; + + extcon_data =dev_get_drvdata (dev); +queue_delayed_work (system_power_efficient_wq, &extcon_data->work, + extcon_data->debounce_jiffies); +return 0 ; +} +#endif + +static const struct dev_pm_ops gpio_extcon_pm_ops = { +SET_SYSTEM_SLEEP_PM_OPS (NULL , gpio_extcon_resume) +}; +static struct platform_driver gpio_extcon_driver = { .probe = gpio_extcon_probe, .remove = gpio_extcon_remove, .driver = { .name ="extcon-gpio" , .owner =THIS_MODULE , + .pm = &gpio_extcon_pm_ops, }, };
Quoted 3 lines
Quoted 3 lines
Quoted 1 line
Quoted 1 line
-barry
-barry
-barry
Chanwoo Choi
maintainerQuoted 51 lines · Barry Song
2013/12/23 Chanwoo Choi <[email protected]>:
Quoted 42 lines · Barry Song
Quoted 16 lines
2013/12/23 Chanwoo Choi <[email protected]>:
Quoted 15 lines · Barry Song
Quoted 13 lines
2013/12/23 Chanwoo Choi <[email protected]>:
Quoted 9 lines · rjying
Quoted 3 lines
From: Rongjun Ying <[email protected]>
After system resume, need send extcon uevent to userspace
Why did extcon send uevent after wakeup from suspend?
If extcon cable is attatched or detached on suspend state, Kernel can detect the interrupt about changed state of extcon.
irq controller has lost power in suspend, so there is no pending interrupt. and HW will not pend any interrupt when we hotplug cable during sleep.
Quoted 8 lines
Quoted 6 lines
No, SoC in suspend state must maintain the minimum power under 1mA if completed the power-optimization on suspend state.
If user insert USB cable to target, the external interrupt connected to USB port is happened. And kernel would be waked up from suspend state to operate proper interrupt handler of external interrupt.
no. not every USB supports that. that depends on the power domain design of SoC.
USB is only example for gpio control in suspend state.
Quoted 11 lines
Quoted 6 lines
Also,
Input subsystem used gpio-keys driver for power button..
If user press power button in suspend state, target would be waked up from suspend state. It is same case both extcon gpio and gpio-keys of input subsystem.no. it depends on the SoC design. many SoC only support 1 special key which can work as ON-KEY as wakeup source. and this kind of keys might not be GPIO at all.
there is a special power domain which is still open for it.many SoC?
Quoted 7 lines
As I knew, most SoC has supported various wakeup source. As you comment, if specific SoC support only one special key for wakeup from suspend state, I think it isn't common.
Also,
This patch isn't necessary on SoCs which support various wakeup source (e.g., external interrupt). As you comment, this issue has dependecy on specific SoC. Why did you think this common code?
Quoted 6 lines
i am not thinking this patch must be common codes but i think the extcon should provide common codes to support all chips. that is what a framework should consider.
if there is no this or things similar with this, how could extcon support the chips which don't support receiving sleep gpio interrupts?
Sure, subsystem should support all cases related to this issue.
I'd like to send common patch to support all cases as we discussed. If some patch support all case, I would review and apply it.
Chanwoo Choi
2013/12/23 Chanwoo Choi <[email protected]>:
Quoted 56 lines · Barry Song
Quoted 55 lines
2013/12/23 Chanwoo Choi <[email protected]>:
Quoted 42 lines · Barry Song
Quoted 16 lines
2013/12/23 Chanwoo Choi <[email protected]>:
Quoted 15 lines · Barry Song
Quoted 13 lines
2013/12/23 Chanwoo Choi <[email protected]>:
Quoted 9 lines · rjying
Quoted 3 lines
From: Rongjun Ying <[email protected]>
After system resume, need send extcon uevent to userspace
Why did extcon send uevent after wakeup from suspend?
If extcon cable is attatched or detached on suspend state, Kernel can detect the interrupt about changed state of extcon.
irq controller has lost power in suspend, so there is no pending interrupt. and HW will not pend any interrupt when we hotplug cable during sleep.
Quoted 8 lines
Quoted 6 lines
No, SoC in suspend state must maintain the minimum power under 1mA if completed the power-optimization on suspend state.
If user insert USB cable to target, the external interrupt connected to USB port is happened. And kernel would be waked up from suspend state to operate proper interrupt handler of external interrupt.
no. not every USB supports that. that depends on the power domain design of SoC.
USB is only example for gpio control in suspend state.
Quoted 11 lines
Quoted 6 lines
Also,
Input subsystem used gpio-keys driver for power button..
If user press power button in suspend state, target would be waked up from suspend state. It is same case both extcon gpio and gpio-keys of input subsystem.no. it depends on the SoC design. many SoC only support 1 special key which can work as ON-KEY as wakeup source. and this kind of keys might not be GPIO at all.
there is a special power domain which is still open for it.many SoC?
Quoted 7 lines
As I knew, most SoC has supported various wakeup source. As you comment, if specific SoC support only one special key for wakeup from suspend state, I think it isn't common.
Also,
This patch isn't necessary on SoCs which support various wakeup source (e.g., external interrupt). As you comment, this issue has dependecy on specific SoC. Why did you think this common code?i am not thinking this patch must be common codes but i think the extcon should provide common codes to support all chips. that is what a framework should consider.
Quoted 7 lines
Quoted 2 lines
if there is no this or things similar with this, how could extcon support the chips which don't support receiving sleep gpio interrupts?
Sure, subsystem should support all cases related to this issue.
I'd like to send common patch to support all cases as we discussed. If some patch support all case, I would review and apply it.
well. agree.
then, will you give comments about how to make this one common? will it be useful to differentiate two different kinds of chips and branch to two different code paths?
Quoted 4 lines
Chanwoo Choi
-barry