mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Michael Auer <mick@yoxcu.de>
To: "Pali Rohár" <pali@kernel.org>
Cc: Sebastian Reichel <sre@kernel.org>,
	linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/3] power: supply: bq27xxx: retry a failed register read once
Date: Sun, 22 Nov 2026 21:16:46 +0100	[thread overview]
Message-ID: <20261122201650.1155371-1-mick@yoxcu.de> (raw)
In-Reply-To: <20261122120341.runjq4rjjgvob5y6@pali>

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

  reply	other threads:[~2026-11-22 20:17 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-21 20:41 [PATCH 0/3] power: supply: bq27xxx: fix wrong battery states after resume Michael Auer
2026-11-21 20:41 ` [PATCH 1/3] power: supply: bq27xxx: report discharging at zero current without a charger Michael Auer
2026-11-21 21:33   ` Michael Auer
2026-11-21 20:41 ` [PATCH 2/3] power: supply: bq27xxx: retry a failed register read once Michael Auer
2026-11-22 12:03   ` Pali Rohár
2026-11-22 20:16     ` Michael Auer [this message]
2026-11-21 20:41 ` [PATCH 3/3] power: supply: bq27xxx: keep the last values over a short read failure Michael Auer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261122201650.1155371-1-mick@yoxcu.de \
    --to=mick@yoxcu.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=pali@kernel.org \
    --cc=sre@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®