From: HongMin Son Date: Fri, 5 Oct 2012 04:22:31 +0000 (+0900) Subject: power: android-battery: Fix battery alarm timer not modified at suspend X-Git-Tag: firefly_0821_release~4090^2~658 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=148984e00a97cdb12882d1e71719907f51f03b5c;p=firefly-linux-kernel-4.4.55.git power: android-battery: Fix battery alarm timer not modified at suspend - Alarm Timer driver is suspended before battery driver, so alarm timer was not changed to slow poll speed at suspend. Use PM notifiers instead. - If charger is connected, keep 1 min alarm timer. Signed-off-by: HongMin Son Signed-off-by: Todd Poynor Change-Id: Id0f3bda5d0749fd90f1964073bc30c1a73fc317f --- diff --git a/drivers/power/android_battery.c b/drivers/power/android_battery.c index d7682d69e3ab..5001bba28f91 100644 --- a/drivers/power/android_battery.c +++ b/drivers/power/android_battery.c @@ -700,21 +700,24 @@ static int android_bat_suspend(struct device *dev) struct android_bat_data *battery = dev_get_drvdata(dev); cancel_work_sync(&battery->monitor_work); - android_bat_monitor_set_alarm(battery, SLOW_POLL); + android_bat_monitor_set_alarm( + battery, + battery->charge_source == CHARGE_SOURCE_NONE ? + SLOW_POLL : FAST_POLL); return 0; } -static int android_bat_resume(struct device *dev) +static void android_bat_resume(struct device *dev) { struct android_bat_data *battery = dev_get_drvdata(dev); android_bat_monitor_set_alarm(battery, FAST_POLL); - return 0; + return; } static const struct dev_pm_ops android_bat_pm_ops = { - .suspend = android_bat_suspend, - .resume = android_bat_resume, + .prepare = android_bat_suspend, + .complete = android_bat_resume, }; static struct platform_driver android_bat_driver = {