OSDN Git Service

power: supply: axp288_fuel_gauge: Optimize get_current()
authorHans de Goede <hdegoede@redhat.com>
Tue, 26 Dec 2017 12:59:12 +0000 (13:59 +0100)
committerSebastian Reichel <sre@kernel.org>
Tue, 9 Jan 2018 16:45:08 +0000 (17:45 +0100)
commitceb40831c94115134581ee6eaaa26001e00def5f
treebdf2b7a99ef32c7d3cbd0393b2afad703f6b55cf
parent2b5a4b4bf2224f4f6b6631091bd51cb08d3094be
power: supply: axp288_fuel_gauge: Optimize get_current()

First check the discharge current, and when that is non 0 use that without
also checking the charge current (which will be 0 then). This makes
get_current() do only 1 i2c read instead of 2 when on battery.

This is esp. important given the pmic i2c bus mutex stuff used on boards
with an axp288 because the SoC's own punit also may access the axp288,
which makes i2c accesses more expensive then normal.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
drivers/power/supply/axp288_fuel_gauge.c