When system on the suspend state, Some SoC can't get gpio interrupt. After system resume, need send extcon uevent to userspace.
Unified · Split
| @@ -40,6 +40,7 @@ struct gpio_extcon_data { · 39 unmodified lines | ||
| 40 | 40 | int irq; |
| 41 | 41 | struct delayed_work work; |
| 42 | 42 | unsigned long debounce_jiffies; |
| 43 | + bool check_on_resume; | |
| 43 | 44 | }; |
| 44 | 45 | |
| 45 | 46 | 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 | ||
| 103 | 104 | extcon_data->gpio_active_low = pdata->gpio_active_low; |
| 104 | 105 | extcon_data->state_on = pdata->state_on; |
| 105 | 106 | extcon_data->state_off = pdata->state_off; |
| 107 | + extcon_data->check_on_resume = pdata->check_on_resume; | |
| 106 | 108 | if (pdata->state_on && pdata->state_off) |
| 107 | 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 | 162 | return 0; |
| 161 | 163 | } |
| 162 | 164 | |
| 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 | + | |
| 163 | 183 | static struct platform_driver gpio_extcon_driver = { |
| 164 | 184 | .probe = gpio_extcon_probe, |
| 165 | 185 | .remove = gpio_extcon_remove, |
| 166 | 186 | .driver = { |
| 167 | 187 | .name = "extcon-gpio", |
| 168 | 188 | .owner = THIS_MODULE, |
| 189 | + .pm = &gpio_extcon_pm_ops, | |
| 169 | 190 | }, |
| 170 | 191 | }; |
| 171 | 192 | |
| @@ -51,6 +51,7 @@ struct gpio_extcon_platform_data { · 50 unmodified lines | ||
| 51 | 51 | /* if NULL, "0" or "1" will be printed */ |
| 52 | 52 | const char *state_on; |
| 53 | 53 | const char *state_off; |
| 54 | + bool check_on_resume; | |
| 54 | 55 | }; |
| 55 | 56 | |
| 56 | 57 | #endif /* __EXTCON_GPIO_H__ */ |