Skip to content

Commit

Permalink
gpio-charger: Add gpio_charger_resume
Browse files Browse the repository at this point in the history
Gpio charger should notify if the gpio state had changed
during suspend. This will send a CHANGED event each time
the system resumes, ensuring a plug/unplug of the charger
is not missed.

Signed-off-by: Benson Leung <[email protected]>
Acked-By: Lars-Peter Clausen <[email protected]>
Signed-off-by: Anton Vorontsov <[email protected]>
  • Loading branch information
bleungatchromium authored and enomsg committed Apr 20, 2011
1 parent b14a9cc commit f10513d
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions drivers/power/gpio-charger.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,12 +161,27 @@ static int __devexit gpio_charger_remove(struct platform_device *pdev)
return 0;
}

#ifdef CONFIG_PM_SLEEP
static int gpio_charger_resume(struct device *dev)
{
struct platform_device *pdev = to_platform_device(dev);
struct gpio_charger *gpio_charger = platform_get_drvdata(pdev);

power_supply_changed(&gpio_charger->charger);

return 0;
}
#endif

static SIMPLE_DEV_PM_OPS(gpio_charger_pm_ops, NULL, gpio_charger_resume);

static struct platform_driver gpio_charger_driver = {
.probe = gpio_charger_probe,
.remove = __devexit_p(gpio_charger_remove),
.driver = {
.name = "gpio-charger",
.owner = THIS_MODULE,
.pm = &gpio_charger_pm_ops,
},
};

Expand Down

0 comments on commit f10513d

Please sign in to comment.