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. 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> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
This commit is contained in:
parent
962e56bfcf
commit
6544dfa579
2 changed files with 22 additions and 0 deletions
|
@ -40,6 +40,7 @@ struct gpio_extcon_data {
|
||||||
int irq;
|
int irq;
|
||||||
struct delayed_work work;
|
struct delayed_work work;
|
||||||
unsigned long debounce_jiffies;
|
unsigned long debounce_jiffies;
|
||||||
|
bool check_on_resume;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void gpio_extcon_work(struct work_struct *work)
|
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->gpio_active_low = pdata->gpio_active_low;
|
||||||
extcon_data->state_on = pdata->state_on;
|
extcon_data->state_on = pdata->state_on;
|
||||||
extcon_data->state_off = pdata->state_off;
|
extcon_data->state_off = pdata->state_off;
|
||||||
|
extcon_data->check_on_resume = pdata->check_on_resume;
|
||||||
if (pdata->state_on && pdata->state_off)
|
if (pdata->state_on && pdata->state_off)
|
||||||
extcon_data->edev.print_state = extcon_gpio_print_state;
|
extcon_data->edev.print_state = extcon_gpio_print_state;
|
||||||
|
|
||||||
|
@ -160,12 +162,31 @@ static int gpio_extcon_remove(struct platform_device *pdev)
|
||||||
return 0;
|
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 = {
|
static struct platform_driver gpio_extcon_driver = {
|
||||||
.probe = gpio_extcon_probe,
|
.probe = gpio_extcon_probe,
|
||||||
.remove = gpio_extcon_remove,
|
.remove = gpio_extcon_remove,
|
||||||
.driver = {
|
.driver = {
|
||||||
.name = "extcon-gpio",
|
.name = "extcon-gpio",
|
||||||
.owner = THIS_MODULE,
|
.owner = THIS_MODULE,
|
||||||
|
.pm = &gpio_extcon_pm_ops,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -51,6 +51,7 @@ struct gpio_extcon_platform_data {
|
||||||
/* if NULL, "0" or "1" will be printed */
|
/* if NULL, "0" or "1" will be printed */
|
||||||
const char *state_on;
|
const char *state_on;
|
||||||
const char *state_off;
|
const char *state_off;
|
||||||
|
bool check_on_resume;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* __EXTCON_GPIO_H__ */
|
#endif /* __EXTCON_GPIO_H__ */
|
||||||
|
|
Loading…
Add table
Reference in a new issue