lkml.org 
[lkml]   [2011]   [Apr]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH v2] gpio-charger: Add gpio_charger_resume
    Date
    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 <bleung@chromium.org>

    --
    Version history :
    v2 : Changed to use dev_pm_ops
    v1 : Initial
    ---
    drivers/power/gpio-charger.c | 20 ++++++++++++++++++++
    1 files changed, 20 insertions(+), 0 deletions(-)

    diff --git a/drivers/power/gpio-charger.c b/drivers/power/gpio-charger.c
    index 25b88ac..df29059 100644
    --- a/drivers/power/gpio-charger.c
    +++ b/drivers/power/gpio-charger.c
    @@ -161,12 +161,32 @@ static int __devexit gpio_charger_remove(struct platform_device *pdev)
    return 0;
    }

    +#if defined(CONFIG_PM)
    +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;
    +}
    +
    +static const struct dev_pm_ops gpio_charger_pm_ops = {
    + .resume = gpio_charger_resume,
    +};
    +#endif
    +
    +
    static struct platform_driver gpio_charger_driver = {
    .probe = gpio_charger_probe,
    .remove = __devexit_p(gpio_charger_remove),
    .driver = {
    .name = "gpio-charger",
    .owner = THIS_MODULE,
    +#if defined(CONFIG_PM)
    + .pm = &gpio_charger_pm_ops,
    +#endif
    },
    };

    --
    1.7.1


    \
     
     \ /
      Last update: 2011-04-03 04:17    [W:0.023 / U:61.572 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site