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=1795049030; b=TtKH3NXFNKHA22nz0DDai4/UOgdT6Oen7Ib1IRHG57HQTNDmUpOIlPQ7uJbPUKBE7nNk 1z2ZVcHCf36aXy7ZBDyRL3E4rLaAvkev79DoK7vNUE0hCJgZlBqimVnCpJcUSS2z8hd41 G7n58LDGLzNxDAq1a3izGJu3pQRFAf8WAzVM3VK0dDnZnEVN40Lh2EqWsLSf6bHb6pMSH s7cgktLIa3NU5AiN62VRgLIpupWqjRPV0SZiCZNNLLjQhU8ZkumGW9IzdczFyLTjEM44+ nPsnes7WaOKVfLZN5I46ssRhtxGtYmLIrJoKa6IDpCE6BySIS7YGmdenrK377zrbBkw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795049030; 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=EBEgoJC6HdUde3PJlxgw1kyogbpbeVOvsYY6gb104Tk=; b=ev8XAyWd7i1QoTzqp7i6u1Krh4SnGqsJIo1hgGoKUjDvRU+jydiWGNdxnruxlpmt2df0 fylHgAVWIGnw4AkA0SPVh7vIbCCk1nbvBZOnV2GFR1rt3/Nj+mqCM9Yq1RRlkRqzJoMjz K66/b2rhPp4n0OK5zIqtQtioriRNoZXHbA+4rj3vkgiRx47e0tq9TZK9hF67Aofu48wzX RsCVkO3uAOB7QZKq/Q+y4Mfm3Ua9Cd6YT+Q6HEoff/zrSBpkK4KOj0FPv20OwVu3Aikxf 3wbdbdisE5Inbdq1EY12AXz/EvCFAMvxg0o+v34ZnxBfZ7N2f7TScT/EkB1wiEyJeIQ== 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=rUgGJLZK; 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 799AE60A260F; Thu, 19 Nov 2026 00:43:50 +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=rUgGJLZK Received: by smtp.kernel.org (Postfix) with ESMTPSA id CC4E71F000C5; Thu, 19 Nov 2026 00:43:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1795049030; bh=EBEgoJC6HdUde3PJlxgw1kyogbpbeVOvsYY6gb104Tk=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=rUgGJLZKcCphd19/gWT+3EsMscCZT4tZ5/aVr34dQGmf4fFDEmmOduGlb5adoVROS 0MgiXuf9t7CTFRdTtjbo1kC4et838RxYIHcalH8iSxZW46eZIED9cchckqMIjt+rK1 LoPqsAjaXxaG3+TzHaYx6Q1kLIfosznz/Fgx4mxc= 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.1 2206/2857] power: supply: ab8500_btemp: Fix event temperature reporting Date: Wed, 18 Nov 2026 15:54:00 +0100 Message-ID: <20261118150320.852926414@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261118150201.293410965@linuxfoundation.org> References: <20261118150201.293410965@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.1-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 ce36d6ca34226..8ba475b55e6db 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