History

extcon: gpio: Add power resume support

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

Rongjun Ying committed 12 years ago

Commit 6544dfa1 parent 962e56b2 files · +22 −0Browse files

Unified · Split

2 files
  1. drivers/extcon/extcon-gpio.c +21 −0
  2. include/linux/extcon/extcon-gpio.h +1 −0
drivers/extcon/extcon-gpio.c+21−0
@@ -40,6 +40,7 @@ struct gpio_extcon_data { · 39 unmodified lines
4040 int irq;
4141 struct delayed_work work;
4242 unsigned long debounce_jiffies;
43+ bool check_on_resume;
4344 };
4445
4546 static void gpio_extcon_work(struct work_struct *work)
@@ -103,6 +104,7 @@ static int gpio_extcon_probe(struct platform_device *pdev) · 57 unmodified lines
103104 extcon_data->gpio_active_low = pdata->gpio_active_low;
104105 extcon_data->state_on = pdata->state_on;
105106 extcon_data->state_off = pdata->state_off;
107+ extcon_data->check_on_resume = pdata->check_on_resume;
106108 if (pdata->state_on && pdata->state_off)
107109 extcon_data->edev.print_state = extcon_gpio_print_state;
108110
@@ -160,12 +162,31 @@ static int gpio_extcon_remove(struct platform_device *pdev) · 51 unmodified lines
160162 return 0;
161163 }
162164
165+#ifdef CONFIG_PM_SLEEP
166+static int gpio_extcon_resume(struct device *dev)
167+{
168+ struct gpio_extcon_data *extcon_data;
169+
170+ extcon_data = dev_get_drvdata(dev);
171+ if (extcon_data->check_on_resume)
172+ queue_delayed_work(system_power_efficient_wq,
173+ &extcon_data->work, extcon_data->debounce_jiffies);
174+
175+ return 0;
176+}
177+#endif
178+
179+static const struct dev_pm_ops gpio_extcon_pm_ops = {
180+ SET_SYSTEM_SLEEP_PM_OPS(NULL, gpio_extcon_resume)
181+};
182+
163183 static struct platform_driver gpio_extcon_driver = {
164184 .probe = gpio_extcon_probe,
165185 .remove = gpio_extcon_remove,
166186 .driver = {
167187 .name = "extcon-gpio",
168188 .owner = THIS_MODULE,
189+ .pm = &gpio_extcon_pm_ops,
169190 },
170191 };
171192
include/linux/extcon/extcon-gpio.h+1−0
@@ -51,6 +51,7 @@ struct gpio_extcon_platform_data { · 50 unmodified lines
5151 /* if NULL, "0" or "1" will be printed */
5252 const char *state_on;
5353 const char *state_off;
54+ bool check_on_resume;
5455 };
5556
5657 #endif /* __EXTCON_GPIO_H__ */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t