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 690A72F0C52; Mon, 22 Sep 2025 19:44:06 +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=1758570246; cv=none; b=TPjwYeTkAchRlOBlkOT9QGNyYWec0tIG5AjuihP8FVaBwGfAraGWsPHxgrqB1gqjJjSKkMFuqB3EqvwvWnVO77cQMN30jlRYOHvC5muKfsDwxTvYhbw9d20Y/RxS9IdUmu1gCNvEiRLA+egE4F1qgdrUZkG9y7ktiNKh6MJlSi0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758570246; c=relaxed/simple; bh=G8PmkeiUMNDn0aN+UInXhte93C1Z0HNx8e9iLjk7ijA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=k7VynoFJBia8/MIj80hPlEde2j6i6MqCx/jcnOkNdOZl9b7gnAIRP/n6BvNOyenSAhq1CLKZ+/Bvc0l6vJXVqnVG0sLrYobPv0pNX47+Znh3dXfeFfhJ5WKopUpmYEBpC5PAnDLSyJOSKtPnCyKSIvtTm6RZFepTMBWhGiYhKPs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=vRYFmZsy; 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="vRYFmZsy" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 01861C4CEF0; Mon, 22 Sep 2025 19:44:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1758570246; bh=G8PmkeiUMNDn0aN+UInXhte93C1Z0HNx8e9iLjk7ijA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vRYFmZsyg6WK7cFT8l3QH+1y33GwA++YDR1Ms9UmS5XbLFx4xLgXZzFXwYRnvAk04 Ed9pWqiPSkoK/lm+mPGtL4MM42YxpNXbgyrC5c6lwbcPMQXxEGtxRd5A/w3m8CEahj /Cbo1ASDxzD2vosYy2KM1c7a3dGxNcE1Gi3/Ee18= 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.16 053/149] power: supply: bq27xxx: restrict no-battery detection to bq27000 Date: Mon, 22 Sep 2025 21:29:13 +0200 Message-ID: <20250922192414.192896502@linuxfoundation.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20250922192412.885919229@linuxfoundation.org> References: <20250922192412.885919229@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.16-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 @@ -1919,8 +1919,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.capacity = bq27xxx_battery_read_soc(di);