Re: [PATCH] power: supply: bq27xxx: Introduce parameter to config cache regs

From: Hermes Zhang
Date: Fri Feb 23 2024 - 03:40:39 EST


Hi,

On 2024/2/22 7:03, Sebastian Reichel wrote:
Hi,

On Mon, Feb 19, 2024 at 06:05:40PM +0800, Hermes Zhang wrote:
Since all of the regs in the bq27xxx_reg_cache are now cached, a simple
property read (such as temperature) will need nine I2C transmissions.
Introduce a new module parameter to enable the reg cache to be configured,
which decrease the amount of unnecessary I2C transmission and preventing
the error -16 (EBUSY) happen when working on an I2C bus that is shared by
many devices.
So the problem is not the caching, but the grouping. So instead
of adding this hack, please change the code to do the caching
per register. That way you can just keep the caching enabled and
don't need any custom module parameters.

Thanks for the reply. Yes, the key is the grouping. So do you suggest to drop the bq27xxx_reg_cache struct totally and handle the cache for each register in e.g. bq27xxx_battery_get_property()? Then it will require an extra time info for each register, will that be a big cost? Or am I misunderstanding?

Best Regards,

Hermes