bq27x00: Cache battery registers
authorLars-Peter Clausen <lars@metafoo.de>
Fri, 7 Jan 2011 19:12:47 +0000 (20:12 +0100)
committerLars-Peter Clausen <lars@metafoo.de>
Tue, 22 Feb 2011 10:02:43 +0000 (11:02 +0100)
commit297a533b3e621be520d44d8baf3bb72ce15c4110
tree4fa3bd12e2ef2eb731a81670e7dfe9fc85bdc0b4
parent7fb7ba588c0f276609609565b21fcc853284a9a0
bq27x00: Cache battery registers

This patch adds a register cache to the bq27x00 battery driver.
Usually multiple, if not all, power_supply properties are queried at once,
for example when an uevent is generated. Since some registers are used by
multiple properties caching the registers should reduce the number of
reads.

The cache is valid for 5 seconds this roughly matches the internal update
interval of the current register for the bq27000/bq27200.

Fast changing properties(*_NOW) which can be obtained by reading a single
register are not cached.

It will also be used in the follow up patch to check if the battery status
has been changed since the last update to emit power_supply_changed events.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Tested-by: Grazvydas Ignotas <notasas@gmail.com>
drivers/power/bq27x00_battery.c