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
40 int irq;40 int irq;
41 struct delayed_work work;41 struct delayed_work work;
42 unsigned long debounce_jiffies;42 unsigned long debounce_jiffies;
43 bool check_on_resume;
43};44};
44 45
45static void gpio_extcon_work(struct work_struct *work)46static void gpio_extcon_work(struct work_struct *work)
@@ -103,6 +104,7 @@ static int gpio_extcon_probe(struct platform_device *pdev) · 57 unmodified lines
103 extcon_data->gpio_active_low = pdata->gpio_active_low;104 extcon_data->gpio_active_low = pdata->gpio_active_low;
104 extcon_data->state_on = pdata->state_on;105 extcon_data->state_on = pdata->state_on;
105 extcon_data->state_off = pdata->state_off;106 extcon_data->state_off = pdata->state_off;
107 extcon_data->check_on_resume = pdata->check_on_resume;
106 if (pdata->state_on && pdata->state_off)108 if (pdata->state_on && pdata->state_off)
107 extcon_data->edev.print_state = extcon_gpio_print_state;109 extcon_data->edev.print_state = extcon_gpio_print_state;
108 110
@@ -160,12 +162,31 @@ static int gpio_extcon_remove(struct platform_device *pdev) · 51 unmodified lines
160 return 0;162 return 0;
161}163}
162 164
165#ifdef CONFIG_PM_SLEEP
166static 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
179static const struct dev_pm_ops gpio_extcon_pm_ops = {
180 SET_SYSTEM_SLEEP_PM_OPS(NULL, gpio_extcon_resume)
181};
182
163static struct platform_driver gpio_extcon_driver = {183static struct platform_driver gpio_extcon_driver = {
164 .probe = gpio_extcon_probe,184 .probe = gpio_extcon_probe,
165 .remove = gpio_extcon_remove,185 .remove = gpio_extcon_remove,
166 .driver = {186 .driver = {
167 .name = "extcon-gpio",187 .name = "extcon-gpio",
168 .owner = THIS_MODULE,188 .owner = THIS_MODULE,
189 .pm = &gpio_extcon_pm_ops,
169 },190 },
170};191};
171 192
include/linux/extcon/extcon-gpio.h+1−0
@@ -51,6 +51,7 @@ struct gpio_extcon_platform_data { · 50 unmodified lines
51 /* if NULL, "0" or "1" will be printed */51 /* if NULL, "0" or "1" will be printed */
52 const char *state_on;52 const char *state_on;
53 const char *state_off;53 const char *state_off;
54 bool check_on_resume;
54};55};
55 56
56#endif /* __EXTCON_GPIO_H__ */57#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