linux-postmarketos-qcom-sdm670: backport the qcom-spmi-adc-tm5 scaling fix (MR 6298)

The thermal monitor measures an NTC thermistor which decreases voltage
when the temperature increases.

When fixing the scaling for the first time, a wrong division by 20 was
removed. The voltage code was still high by a factor of 28900/16384,
enough that the thermal monitor constantly signalled/interrupted at a
low voltage/high temperature trip point. The thermal monitor still
reports the correct temperature so the kernel keeps the wrong trip
points and lets the thermal monitor keep interrupting 1000 times/sec.
Fix the other scaling amount so the thermal monitor sends interrupts at
the right temperature (with some imprecision).
This commit is contained in:
Richard Acayan 2025-03-07 18:35:57 -05:00 committed by Alexey Minnekhanov
parent d1bbf43ab2
commit 7080a0627b
No known key found for this signature in database
GPG key ID: 6FE3B029D9D9FAFF
2 changed files with 38 additions and 1 deletions

View file

@ -0,0 +1,35 @@
From adadc2b690bfcb519ebc8b319d2ccc16abc5c153 Mon Sep 17 00:00:00 2001
From: Richard Acayan <mailingradian@gmail.com>
Date: Thu, 27 Feb 2025 17:16:07 -0500
Subject: [PATCH] thermal: qcom-spmi-adc-tm5: Correct the voltage-code scaling
for HC
When support was added for the HC variant, the full_scale_code_volt
value was copied from the tm5 variant. From the downstream kernel, the
scaling value is 0x70e4 on PMI632 (tm5 variant), but it is 0x4000 on
PM660 and PM8998 (HC variant). Correct the ADC code to voltage
scaling factor for the HC variant.
Fixes: f6c83676c6097 ("thermal/drivers/qcom/spmi-adc-tm5: Add support for HC variant")
Parent: dt-bindings: mfd: qcom,spmi-pmic: Allow PMIC4 thermal monitor on pm660
Signed-off-by: Richard Acayan <mailingradian@gmail.com>
---
drivers/thermal/qcom/qcom-spmi-adc-tm5.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/thermal/qcom/qcom-spmi-adc-tm5.c b/drivers/thermal/qcom/qcom-spmi-adc-tm5.c
index d7f2e6ca92c2..6ccd02fe0e4c 100644
--- a/drivers/thermal/qcom/qcom-spmi-adc-tm5.c
+++ b/drivers/thermal/qcom/qcom-spmi-adc-tm5.c
@@ -909,7 +909,7 @@ static const struct adc_tm5_data adc_tm5_data_pmic = {
};
static const struct adc_tm5_data adc_tm_hc_data_pmic = {
- .full_scale_code_volt = 0x70e4,
+ .full_scale_code_volt = 0x4000,
.decimation = (unsigned int []) { 256, 512, 1024 },
.hw_settle = (unsigned int []) { 0, 100, 200, 300, 400, 500, 600, 700,
1000, 2000, 4000, 6000, 8000, 10000 },
--
2.48.1

View file

@ -5,7 +5,7 @@
_flavor="postmarketos-qcom-sdm670"
pkgname=linux-$_flavor
pkgver=6.13.3
pkgrel=2
pkgrel=3
pkgdesc="Mainline Kernel fork for SDM670 devices"
arch="aarch64"
_carch="arm64"
@ -32,6 +32,7 @@ _tag="sdm670-v$pkgver"
# Source
source="
https://gitlab.com/sdm670-mainline/linux/-/archive/$_tag/linux-$_tag.tar.gz
0001-thermal-qcom-spmi-adc-tm5-Correct-the-voltage-code-s.patch
$_config
"
builddir="$srcdir/linux-$_tag"
@ -67,5 +68,6 @@ package() {
sha512sums="
9445ec12398f287bb120e5360e5757b28b4a353e948d1d04d2ca9106e9b5b16d8d931284e7a8aad7e8994bb5e4049130d75ba56c1e2886744dee4a43c802e3be linux-sdm670-v6.13.3.tar.gz
a458621296c0efd89e6bd71caa40b7cafbb91bf5fe8f8bed84b77ac383f8a13671e18d1206bd8c4cefa463b75085a5a68bdbf7f76294b67e71e996ebb354f1ef 0001-thermal-qcom-spmi-adc-tm5-Correct-the-voltage-code-s.patch
dabde4e290ade089ec2fcf97995975f496e33bd9f5f9ccfeee32fbda2c140ced47455d09a1f6ebedb472497a46fc4f3f816a768b16734b42a7d472b095dead60 config-postmarketos-qcom-sdm670.aarch64
"