e743d344c6e97daa2ba2af2c67780846ba71acce
[openwrt/staging/xback.git] /
1 From e7dbfa19572a1440a2e67ef70f94ff204849a0a8 Mon Sep 17 00:00:00 2001
2 From: Martin Botka <martin.botka@somainline.org>
3 Date: Mon, 19 Feb 2024 15:36:38 +0000
4 Subject: [PATCH] thermal/drivers/sun8i: Add support for H616 THS controller
5
6 Add support for the thermal sensor found in H616 SoCs, is the same as
7 the H6 thermal sensor controller, but with four sensors.
8 Also the registers readings are wrong, unless a bit in the first SYS_CFG
9 register cleared, so set exercise the SRAM regmap to take care of that.
10
11 Signed-off-by: Martin Botka <martin.botka@somainline.org>
12 Signed-off-by: Andre Przywara <andre.przywara@arm.com>
13 Acked-by: Vasily Khoruzhick <anarsoul@gmail.com>
14 Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
15 Link: https://lore.kernel.org/r/20240219153639.179814-7-andre.przywara@arm.com
16 ---
17 drivers/thermal/sun8i_thermal.c | 15 +++++++++++++++
18 1 file changed, 15 insertions(+)
19
20 --- a/drivers/thermal/sun8i_thermal.c
21 +++ b/drivers/thermal/sun8i_thermal.c
22 @@ -688,6 +688,20 @@ static const struct ths_thermal_chip sun
23 .calc_temp = sun8i_ths_calc_temp,
24 };
25
26 +static const struct ths_thermal_chip sun50i_h616_ths = {
27 + .sensor_num = 4,
28 + .has_bus_clk_reset = true,
29 + .needs_sram = true,
30 + .ft_deviation = 8000,
31 + .offset = 263655,
32 + .scale = 810,
33 + .temp_data_base = SUN50I_H6_THS_TEMP_DATA,
34 + .calibrate = sun50i_h6_ths_calibrate,
35 + .init = sun50i_h6_thermal_init,
36 + .irq_ack = sun50i_h6_irq_ack,
37 + .calc_temp = sun8i_ths_calc_temp,
38 +};
39 +
40 static const struct of_device_id of_ths_match[] = {
41 { .compatible = "allwinner,sun8i-a83t-ths", .data = &sun8i_a83t_ths },
42 { .compatible = "allwinner,sun8i-h3-ths", .data = &sun8i_h3_ths },
43 @@ -697,6 +711,7 @@ static const struct of_device_id of_ths_
44 { .compatible = "allwinner,sun50i-h5-ths", .data = &sun50i_h5_ths },
45 { .compatible = "allwinner,sun50i-h6-ths", .data = &sun50i_h6_ths },
46 { .compatible = "allwinner,sun20i-d1-ths", .data = &sun20i_d1_ths },
47 + { .compatible = "allwinner,sun50i-h616-ths", .data = &sun50i_h616_ths },
48 { /* sentinel */ },
49 };
50 MODULE_DEVICE_TABLE(of, of_ths_match);