linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3] extcon: gpio: Add power resume support
@ 2014-01-07  4:56 RongJun Ying
  2014-01-07  6:07 ` Chanwoo Choi
  2014-01-07  6:09 ` Chanwoo Choi
  0 siblings, 2 replies; 7+ messages in thread
From: RongJun Ying @ 2014-01-07  4:56 UTC (permalink / raw)
  To: MyungJoo Ham, Chanwoo Choi, Barry Song
  Cc: linux-arm-kernel, linux-kernel, Workgroup.linux, Rongjun Ying

From: Rongjun Ying <rongjun.ying@csr.com>

When system on the suspend state, Some SoC can't get gpio interrupt.
After system resume, need send extcon uevent to userspace.

Signed-off-by: Rongjun Ying <rongjun.ying@csr.com>
Reviewed-by: Barry Song <Baohua.Song@csr.com>
---
 -v3:
 'check_on_resume' instead of 'load_sleep_irq' as Chanwoo Choi's proposal.

 drivers/extcon/extcon-gpio.c       |   20 ++++++++++++++++++++
 include/linux/extcon/extcon-gpio.h |    1 +
 2 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/drivers/extcon/extcon-gpio.c b/drivers/extcon/extcon-gpio.c
index 7e0dff5..fde52c1 100644
--- a/drivers/extcon/extcon-gpio.c
+++ b/drivers/extcon/extcon-gpio.c
@@ -40,6 +40,7 @@ struct gpio_extcon_data {
 	int irq;
 	struct delayed_work work;
 	unsigned long debounce_jiffies;
+	bool check_on_resume;
 };

 static void gpio_extcon_work(struct work_struct *work)
@@ -103,6 +104,7 @@ static int gpio_extcon_probe(struct platform_device *pdev)
 	extcon_data->gpio_active_low = pdata->gpio_active_low;
 	extcon_data->state_on = pdata->state_on;
 	extcon_data->state_off = pdata->state_off;
+	extcon_data->check_on_resume = pdata->check_on_resume;
 	if (pdata->state_on && pdata->state_off)
 		extcon_data->edev.print_state = extcon_gpio_print_state;
 	if (pdata->debounce) {
@@ -159,12 +161,30 @@ 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);
+	if (extcon_data->check_on_resume)
+		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,
 	},
 };

diff --git a/include/linux/extcon/extcon-gpio.h b/include/linux/extcon/extcon-gpio.h
index 4195810..c7f0c3e 100644
--- a/include/linux/extcon/extcon-gpio.h
+++ b/include/linux/extcon/extcon-gpio.h
@@ -51,6 +51,7 @@ struct gpio_extcon_platform_data {
 	/* if NULL, "0" or "1" will be printed */
 	const char *state_on;
 	const char *state_off;
+	bool check_on_resume;
 };

 #endif /* __EXTCON_GPIO_H__ */
--
1.7.5.4


^ permalink raw reply related	[flat|nested] 7+ messages in thread
* Re: [PATCH v3] extcon: gpio: Add power resume support
@ 2014-01-07  5:51 MyungJoo Ham
  0 siblings, 0 replies; 7+ messages in thread
From: MyungJoo Ham @ 2014-01-07  5:51 UTC (permalink / raw)
  To: RongJun Ying, 최찬우, Barry Song
  Cc: linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, Workgroup.linux@csr.com,
	Rongjun Ying

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=euc-kr, Size: 771 bytes --]

> From: Rongjun Ying <rongjun.ying@csr.com>
> 
> When system on the suspend state, Some SoC can't get gpio interrupt.
> After system resume, need send extcon uevent to userspace.
> 
> Signed-off-by: Rongjun Ying <rongjun.ying@csr.com>
> Reviewed-by: Barry Song <Baohua.Song@csr.com>

Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com>

Thanks!

> ---
>  -v3:
>  'check_on_resume' instead of 'load_sleep_irq' as Chanwoo Choi's proposal.
> 
>  drivers/extcon/extcon-gpio.c       |   20 ++++++++++++++++++++
>  include/linux/extcon/extcon-gpio.h |    1 +
>  2 files changed, 21 insertions(+), 0 deletions(-)
>  
> 
ÿôèº{.nÇ+‰·Ÿ®‰­†+%ŠËÿ±éݶ\x17¥Šwÿº{.nÇ+‰·¥Š{±þG«éÿŠ{ayº\x1dʇڙë,j\a­¢f£¢·hšïêÿ‘êçz_è®\x03(­éšŽŠÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?™¨è­Ú&£ø§~á¶iO•æ¬z·švØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?–I¥

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-01-09  0:54 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-07  4:56 [PATCH v3] extcon: gpio: Add power resume support RongJun Ying
2014-01-07  6:07 ` Chanwoo Choi
2014-01-07  9:48   ` Rongjun Ying
2014-01-07  6:09 ` Chanwoo Choi
2014-01-07  9:02   ` Rongjun Ying
2014-01-09  0:54     ` Chanwoo Choi
  -- strict thread matches above, loose matches on Subject: below --
2014-01-07  5:51 MyungJoo Ham

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).