Re: [PATCH 2/3] power: supply: bq27xxx: retry a failed register read once
From: Michael Auer
Date: Sun Nov 22 2026 - 15:17:12 EST
Hi Pali,
On Sun, Nov 22, 2026 at 01:03:41PM +0100, Pali Rohár wrote:
> So... should not be there rather a resume hook in the driver which waits
> until the battery is ready (instead of adding retires on many places in
> the driver)?
Thanks for looking at it.
The read that fails is the first one after resume: the flags read of
the update that bq27xxx_battery_resume() queues without a delay. The
OnePlus vendor driver waits 1 s after resume before it reads the
gauge, so a delay there would probably avoid it too.
What I do not know is how long the gauge needs. It failed in about 1
of 350 resumes, and the NAK is the only sign, so I could not measure
it. A fixed delay would be a guess, the retry does not depend on one.
The retry is in one place, bq27xxx_read(), which all register reads go
through.
For v2 I can either delay the update queued at resume (for example by
1 s) instead of the retry, or do both. Which do you prefer? I will
also log on the phone when the retry fires, which should show how long
the gauge is not ready after resume.
Michael