* Weird interaction between thermal and cpufreq drivers
@ 2016-04-28 15:24 Mason
2016-05-03 15:34 ` Mason
0 siblings, 1 reply; 3+ messages in thread
From: Mason @ 2016-04-28 15:24 UTC (permalink / raw)
To: linux-pm; +Cc: Viresh Kumar, Javi Merino, Eduardo Valentin, Sebastian Frias
Hello linux-pm,
I'm seeing a weird bug, where the thermal driver(*) returns bogus
temperatures once I lower the CPU frequency.
(*) drivers/thermal/tango_thermal.c
The setup: I'm using next-20160428
(Is it a good idea to test on linux-next?
Are there bugs lurking there that get sorted out later?)
I have a script which prints /sys/class/thermal/thermal_zone0/temp
every second.
When the CPU is running at nominal speed, these values seem correct.
("seem" because I don't have the HW to calibrate the thermometer.)
But once I lower the frequency of the CPU(*), the script starts
printing bogus values like 29000 (my driver's minimum) and very
high temps like 100000 or even 137000!
(*) echo 135000 > /sys/devices/system/cpu/cpufreq/scaling_max_freq
I'm using the performance governor, so everything should be manual,
if I understand correctly.
I looked at timing issues in my driver. I do have an obvious
usleep_range(10, 20); in my code. IIUC, this primitive will use
the underlying Cortex A9 twd block, which does introduce errors
on frequency changes, so I switched it to udelay(100); This one
should only use the platform tick counter, which ticks at a
constant speed. But I still have the issues.
Any idea what could be going wrong?
I guess I can test on v4.6-rc5
Regards.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Weird interaction between thermal and cpufreq drivers
2016-04-28 15:24 Weird interaction between thermal and cpufreq drivers Mason
@ 2016-05-03 15:34 ` Mason
2016-05-03 15:40 ` [PATCH] thermal: tango: initialize TEMPSI_CFG Mason
0 siblings, 1 reply; 3+ messages in thread
From: Mason @ 2016-05-03 15:34 UTC (permalink / raw)
To: linux-pm; +Cc: Viresh Kumar, Javi Merino, Eduardo Valentin, Sebastian Frias
On 28/04/2016 17:24, Mason wrote:
> I'm seeing a weird bug, where the thermal driver(*) returns bogus
> temperatures once I lower the CPU frequency.
Egg on my face...
cpufreq was a red herring. I simply failed to initialize TEMPSI_CFG.
(And the hardware playfully sets it to an arbitrary value at reset.)
Patch incoming.
Regards.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] thermal: tango: initialize TEMPSI_CFG
2016-05-03 15:34 ` Mason
@ 2016-05-03 15:40 ` Mason
0 siblings, 0 replies; 3+ messages in thread
From: Mason @ 2016-05-03 15:40 UTC (permalink / raw)
To: Eduardo Valentin; +Cc: linux-pm, Viresh Kumar, Javi Merino, Sebastian Frias
From: Marc Gonzalez <marc_gonzalez@sigmadesigns.com>
TEMPSI_CFG is not equal to 0 at reset. It must be initialized.
Signed-off-by: Marc Gonzalez <marc_gonzalez@sigmadesigns.com>
---
drivers/thermal/tango_thermal.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/thermal/tango_thermal.c b/drivers/thermal/tango_thermal.c
index 22f9b1e92db1..70e0d9f406e9 100644
--- a/drivers/thermal/tango_thermal.c
+++ b/drivers/thermal/tango_thermal.c
@@ -80,6 +80,7 @@ static int tango_thermal_probe(struct platform_device *pdev)
return PTR_ERR(priv->base);
priv->thresh_idx = IDX_MIN;
+ writel(0, priv->base + TEMPSI_CFG);
writel(CMD_ON, priv->base + TEMPSI_CMD);
tzdev = devm_thermal_zone_of_sensor_register(&pdev->dev, 0, priv, &ops);
--
2.8.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-05-03 15:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-28 15:24 Weird interaction between thermal and cpufreq drivers Mason
2016-05-03 15:34 ` Mason
2016-05-03 15:40 ` [PATCH] thermal: tango: initialize TEMPSI_CFG Mason
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.