From: Frank Praznik Date: Thu, 6 Feb 2014 01:03:48 +0000 (-0500) Subject: HID: sony: Set initial battery level to 100% to avoid false low battery warnings X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=d9a293a951d5cc44842acf340af51ace8e0cfdbe;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git HID: sony: Set initial battery level to 100% to avoid false low battery warnings Set the initial battery level to 100% to avoid false low battery warnings if the battery state is polled before a report with the actual battery level is received. Signed-off-by: Frank Praznik Reviewed-by: David Herrmann Signed-off-by: Jiri Kosina --- diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c index 40dfa4b4252e..24ce8cd556e7 100644 --- a/drivers/hid/hid-sony.c +++ b/drivers/hid/hid-sony.c @@ -1402,6 +1402,11 @@ static int sony_battery_probe(struct sony_sc *sc) struct hid_device *hdev = sc->hdev; int ret; + /* Set the default battery level to 100% to avoid low battery warnings + * if the battery is polled before the first device report is received. + */ + sc->battery_capacity = 100; + power_id = (unsigned long)atomic_inc_return(&power_id_seq); sc->battery.properties = sony_battery_props;