Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795025363; b=JzZjplL2AObhMJGMcCWeUtsFmeXuxAT8nIdTrPNWxAQJL4Xq163CJxKwr9mrstOPr1LH 4S0LVttJG5KsUk96jVRb8nLtVwbUJr/pgCLOeCe8nZitZW2SFM+iSh3DaakGrizW+p691 hFqQ9Bt91SZVWHMSHRGGBZJCla2Y5WzLRRmqY5PFoCet96+c0x7u6iQhwBuI2PTqrTMII wrihvuk+21ashlQLRF5WCWyT8VKanXvn6EEyEp0frw4xrnyf4FgWmdQYBrqOCRz9LZFB0 nyXH5PKJmxXhgTgqqc6pVK5Z4H6tDlYU7h7gDOkEvKtMGJBLAPsiSB2wMIvEilRXYmg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795025363; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=gL93j183ntPn7/3M9BBKv3FMMot20yi9hFvqo5n8yw4=; b=L2jvxmGlwNbrvGIINctcV1fVhzCjTInH9/72AjjtmRFhjccky8n/ay0gqk1N2DXRKKTF 3i5o1fP3bxZucrBUhEZG3rL1CMqCOc3NaRaN8CWnfiRsflEGDXQGrGWIY1Vp4D6bPc9Iz Sw378rw1boCyw/wIoeVd8iDZLnV2wyz37jBctfiKWJWZkiAbnexSkRcNZHd3CZ8AftHfr MgypR8XbFad+006HAekeqqncUdwvmqg5ZGrkX22fmgyAV24zQUQFGq/XgowN23+5jFwIi l3o20qs7BeLy8jX4zVkOrCh5XDLih4KRJ/TtpAzq2AWHHHMMXWd19iAtmboRxyuQJ+g== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=JuAhMoab; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E17ED606A331; Wed, 18 Nov 2026 18:09:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=JuAhMoab Received: by smtp.kernel.org (Postfix) with ESMTPSA id 47A251F000C4; Wed, 18 Nov 2026 18:09:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1795025362; bh=gL93j183ntPn7/3M9BBKv3FMMot20yi9hFvqo5n8yw4=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=JuAhMoab/eA3jieamy10DSQ5i+aSc8795SRNpxHCYWkJVVd5ax6yQONH4fqvT2eR0 9psjpy8+5qdfzE1ITowCyIuxZmXVTipopR8qoQslJDd/xD9YZj9aCw85uiIdsrYPdW QqSV6QZ/g5GZ2A/FmfDkwgJpnPrGi8EWrca6SvJI= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Linus Walleij , Sebastian Reichel , Sasha Levin Subject: [PATCH 6.18 1052/2151] power: supply: ab8500_btemp: Fix event temperature reporting Date: Wed, 18 Nov 2026 15:46:27 +0100 Message-ID: <20261118150200.633617785@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261118150121.603863898@linuxfoundation.org> References: <20261118150121.603863898@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Linus Walleij [ Upstream commit 95990cda8e42dda4bd3f1475d578323981bd8579 ] The event-aware path initializes its local temperature to zero and compares that zero against the thermal thresholds. Consequently some events report the measured temperature after it crosses the event threshold, while others always report the threshold. Start with the measured temperature, clamp it according to the active event, and convert to tenths of a degree only once. This path is used by AB8505 and later variants. Fixes: 1f855824757e ("ab8500-btemp: AB8500 battery temperature driver") Assisted-by: LLM Signed-off-by: Linus Walleij Link: https://patch.msgid.link/20260916-ab8500-charging-v1-5-e986ed321cc6@kernel.org Signed-off-by: Sebastian Reichel Signed-off-by: Sasha Levin --- drivers/power/supply/ab8500_btemp.c | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/drivers/power/supply/ab8500_btemp.c b/drivers/power/supply/ab8500_btemp.c index e5202a7b6209b..0079eca548573 100644 --- a/drivers/power/supply/ab8500_btemp.c +++ b/drivers/power/supply/ab8500_btemp.c @@ -468,39 +468,29 @@ static void ab8500_btemp_periodic(struct ab8500_btemp *di, */ static int ab8500_btemp_get_temp(struct ab8500_btemp *di) { - int temp = 0; + int temp = di->bat_temp; /* * The BTEMP events are not reliabe on AB8500 cut3.3 * and prior versions */ - if (is_ab8500_3p3_or_earlier(di->parent)) { - temp = di->bat_temp * 10; - } else { + if (!is_ab8500_3p3_or_earlier(di->parent)) { if (di->events.btemp_low) { if (temp > di->btemp_ranges.btemp_low_limit) - temp = di->btemp_ranges.btemp_low_limit * 10; - else - temp = di->bat_temp * 10; + temp = di->btemp_ranges.btemp_low_limit; } else if (di->events.btemp_high) { if (temp < di->btemp_ranges.btemp_high_limit) - temp = di->btemp_ranges.btemp_high_limit * 10; - else - temp = di->bat_temp * 10; + temp = di->btemp_ranges.btemp_high_limit; } else if (di->events.btemp_lowmed) { if (temp > di->btemp_ranges.btemp_med_limit) - temp = di->btemp_ranges.btemp_med_limit * 10; - else - temp = di->bat_temp * 10; + temp = di->btemp_ranges.btemp_med_limit; } else if (di->events.btemp_medhigh) { if (temp < di->btemp_ranges.btemp_med_limit) - temp = di->btemp_ranges.btemp_med_limit * 10; - else - temp = di->bat_temp * 10; - } else - temp = di->bat_temp * 10; + temp = di->btemp_ranges.btemp_med_limit; + } } - return temp; + + return temp * 10; } /** -- 2.53.0