Skip to content

Commit

Permalink
bq27x00: Cache battery registers
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Lars-Peter Clausen committed Feb 22, 2011
1 parent 7fb7ba5 commit 297a533
Showing 1 changed file with 150 additions and 121 deletions.
Loading

0 comments on commit 297a533

Please sign in to comment.