Skip to contentSkip to conversation

Optimize the cached regs in bq27xxx driver

DISCUSSION Hermes Zhang 1 participant 1 message Feb 1, 2024

lore
Share & tools
lore
#0 lore raw

Hi,

I want to ask a question regarding the regs cached in drivers/power/supply/bq27xxx_battery.c:

struct bq27xxx_reg_cache {
      int temperature;
      int time_to_empty;
      int time_to_empty_avg;
      int time_to_full;
      int charge_full;
      int cycle_count;
      int capacity;
      int energy;
      int flags;
      int health;
};

It will cache 9 regs and I see from the driver code each time if I fetch one property for the gauge chip (interval > 5s), it will call to fetch all the above regs (since the cache is out of date), that will result many i2c data transfer, even I only want to monitor one e.g. temperature value from gauge. So, I want to remove/disable some of them, e.g. TTE/TTF/TTECP/AE/CYCT which are low interest for us. Do we see if we could improve this? E.g. introduce a new module parameter to specify the regs which we want to cache or any good idea? Thanks.

Best Regards,
Hermes