thermal/drivers/sun8i: Add SRAM register access code
authorAndre Przywara <andre.przywara@arm.com>
Mon, 19 Feb 2024 15:36:37 +0000 (15:36 +0000)
committerDaniel Lezcano <daniel.lezcano@linaro.org>
Mon, 11 Mar 2024 16:14:46 +0000 (17:14 +0100)
commitbd0b451bd40fbe42d5d36e3740c489d503636d48
treebc8be3356edd8b37059def0d6b14b4f2d808ec76
parent63e39fcaa6db821b05103b55483a44d0c5b43abb
thermal/drivers/sun8i: Add SRAM register access code

The Allwinner H616 SoC needs to clear a bit in one register in the SRAM
controller, to report reasonable temperature values. On reset, bit 16 in
register 0x3000000 is set, which leads to the driver reporting
temperatures around 200C. Clearing this bit brings the values down to the
expected range. The BSP code does a one-time write in U-Boot, with a
comment just mentioning the effect on the THS, but offering no further
explanation.

To not rely on firmware to set things up for us, add code that queries
the SRAM controller device via a DT phandle link, then clear just this
single bit.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Vasily Khoruzhick <anarsoul@gmail.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20240219153639.179814-6-andre.przywara@arm.com
drivers/thermal/sun8i_thermal.c