• Lars-Peter Clausen's avatar
    bq27x00: Cache battery registers · 297a533b
    Lars-Peter Clausen authored
    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: default avatarLars-Peter Clausen <lars@metafoo.de>
    Tested-by: default avatarGrazvydas Ignotas <notasas@gmail.com>
    297a533b
bq27x00_battery.c 14.4 KB