From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 10F641FDA89; Mon, 22 Sep 2025 19:31:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758569519; cv=none; b=Y3CrxV32QIDLgSuuZQehGXsvDbX6xnYMqqW0AxlA9x4MH5dWU7G298uMjqf9+c7X699siJ64atRiC8KkGcbuesoDImmCNnw4lVOTiW+8OOq3lsq4xUC7xCLWizM/3c2H3Wv8Hs0lFdKwXmf7Y0Pebs2/1iPHdCpDvGHklxEWsMQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758569519; c=relaxed/simple; bh=6f5ZxwgtlD0LXzpj3kHJNAVOWKNiKLTOoYZBER6nwM4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qAZyRcD7aVLTClUl/oBYDb8rwnsRNUZEGEtlJFc3Zi7hVy4w84TblxTQPZmEoelJJomYgsisi1xAhPrMnsea6CZmB5q6ed8SsruiMCMCuc9Tk+tJ86l+yexW5e/RZAljCSS01wGLU5uffn0T7qM0otJtMThHSH3L6HVxrDj7WBA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=g6Awb21K; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="g6Awb21K" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9BF33C4CEF0; Mon, 22 Sep 2025 19:31:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1758569518; bh=6f5ZxwgtlD0LXzpj3kHJNAVOWKNiKLTOoYZBER6nwM4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=g6Awb21Kcx4MlPLuElvB4Mmzllier8gcbtwqju6zdbRrzX5iH5ngaD2zDsU8ZIsj5 qb4396uvH7uZMXZ6TbVVyJ7qIWGsR3f/tU/1Z9YxmLV/K3/aou77pvHhIdxLx2Tq/V h+aCI7tjJEjR7nxhPfL7P+qme9rfijzaRYeQMLBY= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Jerry Lv , "H. Nikolaus Schaller" , Sebastian Reichel Subject: [PATCH 6.1 24/61] power: supply: bq27xxx: restrict no-battery detection to bq27000 Date: Mon, 22 Sep 2025 21:29:17 +0200 Message-ID: <20250922192404.217909867@linuxfoundation.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20250922192403.524848428@linuxfoundation.org> References: <20250922192403.524848428@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: H. Nikolaus Schaller commit 1e451977e1703b6db072719b37cd1b8e250b9cc9 upstream. 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 Cc: stable@vger.kernel.org Signed-off-by: H. Nikolaus Schaller Link: https://lore.kernel.org/r/dd979fa6855fd051ee5117016c58daaa05966e24.1755945297.git.hns@goldelico.com Signed-off-by: Sebastian Reichel Signed-off-by: Greg Kroah-Hartman --- drivers/power/supply/bq27xxx_battery.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/power/supply/bq27xxx_battery.c +++ b/drivers/power/supply/bq27xxx_battery.c @@ -1872,8 +1872,8 @@ static void bq27xxx_battery_update_unloc 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.temperature = bq27xxx_battery_read_temperature(di); if (di->regs[BQ27XXX_REG_TTE] != INVALID_REG_ADDR)