All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jerry Lv <jerrylv@axis.com>
To: "H. Nikolaus Schaller" <hns@goldelico.com>,
	Sebastian Reichel <sre@kernel.org>, Jerry Lv <Jerry.Lv@axis.com>
Cc: "Pali Rohár" <pali@kernel.org>,
	linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
	letux-kernel@openphoenux.org, stable@vger.kernel.org,
	kernel@pyra-handheld.com, andreas@kemnade.info
Subject: Re: [PATCH v2 2/2] power: supply: bq27xxx: restrict no-battery detection to bq27000
Date: Thu, 28 Aug 2025 15:33:32 +0800	[thread overview]
Message-ID: <6162e560-1b60-4e30-8d1e-210ba9e132cd@axis.com> (raw)
In-Reply-To: <dd979fa6855fd051ee5117016c58daaa05966e24.1755945297.git.hns@goldelico.com>

On 8/23/2025 6:34 PM, H. Nikolaus Schaller wrote:
> There are fuel gauges in the bq27xxx series (e.g. bq27z561) which may in some
> cases report 0xff as the value of BQ27XXX_REG_FLAGS that should not be
> interpreted as "no battery" like for a disconnected battery with some built
> in bq27000 chip.
>
> So restrict the no-battery detection originally introduced by
>
>      commit 3dd843e1c26a ("bq27000: report missing device better.")
>
> to the bq27000.
>
> There is no need to backport further because this was hidden before
>
> 	commit f16d9fb6cf03 ("power: supply: bq27xxx: Retrieve again when busy")
>
> Fixes: f16d9fb6cf03 ("power: supply: bq27xxx: Retrieve again when busy")
> Suggested-by: Jerry Lv <Jerry.Lv@axis.com>
> Cc: stable@vger.kernel.org
> Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
> ---
>   drivers/power/supply/bq27xxx_battery.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/power/supply/bq27xxx_battery.c b/drivers/power/supply/bq27xxx_battery.c
> index dadd8754a73a8..3363af24017ae 100644
> --- a/drivers/power/supply/bq27xxx_battery.c
> +++ b/drivers/power/supply/bq27xxx_battery.c
> @@ -1944,8 +1944,8 @@ static void bq27xxx_battery_update_unlocked(struct bq27xxx_device_info *di)
>   	bool has_singe_flag = di->opts & BQ27XXX_O_ZERO;
>   
>   	cache.flags = bq27xxx_read(di, BQ27XXX_REG_FLAGS, has_singe_flag);
> -	if ((cache.flags & 0xff) == 0xff)
> -		cache.flags = -ENODEV; /* read error */
> +	if (di->chip == BQ27000 && (cache.flags & 0xff) == 0xff)
> +		cache.flags = -ENODEV; /* bq27000 hdq read error */
>   	if (cache.flags >= 0) {
>   		cache.capacity = bq27xxx_battery_read_soc(di);
>   

This change works fine for BQ27z561


  reply	other threads:[~2025-08-28  7:33 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-23 10:34 [PATCH v2 0/2] power: supply: bq27xxx: bug fixes H. Nikolaus Schaller
2025-08-23 10:34 ` [PATCH v2 1/2] power: supply: bq27xxx: fix error return in case of no bq27000 hdq battery H. Nikolaus Schaller
2025-08-23 14:46   ` Markus Elfring
2025-08-23 14:54     ` Greg KH
2025-08-23 10:34 ` [PATCH v2 2/2] power: supply: bq27xxx: restrict no-battery detection to bq27000 H. Nikolaus Schaller
2025-08-28  7:33   ` Jerry Lv [this message]
2025-08-28 11:45     ` [Letux-kernel] " H. Nikolaus Schaller
2025-08-28 18:24 ` [PATCH v2 0/2] power: supply: bq27xxx: bug fixes Andreas Kemnade
2025-08-28 20:11   ` H. Nikolaus Schaller
2025-09-06  0:32 ` Sebastian Reichel

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=6162e560-1b60-4e30-8d1e-210ba9e132cd@axis.com \
    --to=jerrylv@axis.com \
    --cc=Jerry.Lv@axis.com \
    --cc=andreas@kemnade.info \
    --cc=hns@goldelico.com \
    --cc=kernel@pyra-handheld.com \
    --cc=letux-kernel@openphoenux.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=pali@kernel.org \
    --cc=sre@kernel.org \
    --cc=stable@vger.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.