The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Christian Loehle <christian.loehle@arm.com>
To: Alexey Klimov <alexey.klimov@linaro.org>, tudor.ambarus@linaro.org
Cc: bzolnier@gmail.com, krzk@kernel.org, rafael@kernel.org,
	daniel.lezcano@kernel.org, lukasz.luba@arm.com,
	linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org,
	linux-pm@vger.kernel.org
Subject: Re: [PATCHv3] thermal/drivers/samsung/acpm-tmu: Fix spurious CPU throttling
Date: Thu, 26 Nov 2026 10:50:34 +0000	[thread overview]
Message-ID: <2162b02c-642a-446c-973e-ca80607da294@arm.com> (raw)
In-Reply-To: <CANgGJDp02H7-wLv6DoaPMeiy4UvDUC2nvSR=+mngEZ+Z4Hqgog@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1705 bytes --]

On 11/26/26 09:16, Alexey Klimov wrote:
> Hi Christian, Tudor,
> 
> On Wed, 25 Nov 2026 at 17:40, Christian Loehle <christian.loehle@arm.com> wrote:
>>
>> acpm_tmu_set_trips() supplies two thresholds, but the ACPM command writes
>> all eight slots, zero-filling the rest. On GS101, slot 7 limits CPU clocks
>> independently of its interrupt mask. Setting it to 0 C limits all three
>> clusters to about 200 MHz while cpufreq reports the requested frequencies.
>> This was found through trial and error while tracking EAS regressions.
> 
> Cpufreq reports the requested frequencies — are these cached values
> being reported?
> Or is this what the kernel gets via the ACPM call?

Requested frequencies are reported. The 200MHz I only deduced from PMU counters.

> 
>> Program slot 7 from the lowest active hot trip so hardware throttling can
>> precede the critical trip's system shutdown. Cache the low/high window and
>> update the hot limit from set_trip_temp(), because the thermal core skips
>> set_trips() when that window is unchanged.
> 
> FWIW, Exynos850 control register for TMU has bits to enabled/disable
> such behaviour (and it probably works).
> Maybe gs101 also has it.
> But it seems that cpufreq scaling feature itself is explicitly enabled.

Thanks for the hint Alexey!
THERM_TRIP_EN is bit12 on Exynos850, clearing that on gs101 still stays on 200MHz
for me. The downstream driver doesn't define it either.
Clearing bit16, i.e. 0x09003 instead of 0x19003 does indeed remove the throttling
even with all zeroes in slot7.
I would probably still go with $SUBJECT, as I'd say the risk of this having unwanted
side effects is lower IMHO, but I'm also happy with either.
See attached patch.

[-- Attachment #2: 0001-thermal-drivers-samsung-acpm-tmu-Disable-hardware-CP.patch --]
[-- Type: text/x-patch, Size: 1886 bytes --]

From 2ca500c0d1b766241170fb8a4f4b2002b42250cc Mon Sep 17 00:00:00 2001
From: Christian Loehle <christian.loehle@arm.com>
Date: Thu, 26 Nov 2026 10:46:34 +0000
Subject: [PATCH] thermal/drivers/samsung/acpm-tmu: Disable hardware CPU
 throttling

acpm_tmu_set_trips() supplies two thresholds, but the ACPM command writes
all eight slots, zero-filling the rest. On GS101, slot 7 limits CPU clocks
independently of its interrupt mask. Setting it to 0 C limits all three
clusters to 200 MHz while cpufreq reports the requested frequencies.

Clear the CPU throttling enable bit in CONTROL after ACPM initialization,
leaving CPU cooling and critical shutdown to the thermal core.

Fixes: 50a2c5d4062a ("thermal/drivers/samsung: Add Exynos ACPM TMU driver GS101")
Signed-off-by: Christian Loehle <christian.loehle@arm.com>
---
 drivers/thermal/samsung/acpm-tmu.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/thermal/samsung/acpm-tmu.c b/drivers/thermal/samsung/acpm-tmu.c
index 4799ef518a7a..fa1bfc0d1070 100644
--- a/drivers/thermal/samsung/acpm-tmu.c
+++ b/drivers/thermal/samsung/acpm-tmu.c
@@ -37,6 +37,8 @@
 #define GS101_CPUCL0_SENSOR_MASK (EXYNOS_TMU_SENSOR(1) |	\
 				  EXYNOS_TMU_SENSOR(2))
 
+#define GS101_REG_CONTROL		0x50
+#define GS101_CONTROL_CPU_THROTTLE_EN	BIT(16)
 #define GS101_REG_INTPEND(i)		((i) * 0x50 + 0xf8)
 
 enum {
@@ -470,6 +472,14 @@ static int acpm_tmu_probe(struct platform_device *pdev)
 		goto out_pm_put;
 	}
 
+	/* Disable slot 7 CPU throttling; the thermal core manages cooling. */
+	ret = regmap_clear_bits(regmap, GS101_REG_CONTROL,
+				GS101_CONTROL_CPU_THROTTLE_EN);
+	if (ret) {
+		ret = dev_err_probe(dev, ret, "Failed to disable CPU throttling\n");
+		goto out_pm_put;
+	}
+
 	for (i = 0; i < priv->num_sensors; i++) {
 		struct acpm_tmu_sensor *sensor = &priv->sensors[i];
 		struct thermal_zone_device *tzd;
-- 
2.34.1


  reply	other threads:[~2026-11-26 10:50 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-25 17:39 [PATCHv3] thermal/drivers/samsung/acpm-tmu: Fix spurious CPU throttling Christian Loehle
2026-11-26  9:16 ` Alexey Klimov
2026-11-26 10:50   ` Christian Loehle [this message]
2026-11-26 11:03     ` Tudor Ambarus
2026-11-26 11:51     ` Alexey Klimov
2026-11-26 14:43       ` Tudor Ambarus
2026-11-26 14:50         ` Alexey Klimov
2026-11-26 15:01           ` Tudor Ambarus
2026-11-26 15:21             ` Alexey Klimov
2026-11-26 15:55               ` Tudor Ambarus
2026-11-26 15:31     ` Alexey Klimov
2026-11-26 11:33 ` Tudor Ambarus
2026-11-26 12:58 ` André Draszik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2162b02c-642a-446c-973e-ca80607da294@arm.com \
    --to=christian.loehle@arm.com \
    --cc=alexey.klimov@linaro.org \
    --cc=bzolnier@gmail.com \
    --cc=daniel.lezcano@kernel.org \
    --cc=krzk@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=lukasz.luba@arm.com \
    --cc=rafael@kernel.org \
    --cc=tudor.ambarus@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox