^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) * Hisilicon thermal sensor driver
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * Copyright (c) 2014-2015 Hisilicon Limited.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * Copyright (c) 2014-2015 Linaro Limited.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) * Xinwei Kong <kong.kongxinwei@hisilicon.com>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) * Leo Yan <leo.yan@linaro.org>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) * This program is free software; you can redistribute it and/or modify
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) * it under the terms of the GNU General Public License version 2 as
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12) * published by the Free Software Foundation.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) * This program is distributed "as is" WITHOUT ANY WARRANTY of any
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) * kind, whether express or implied; without even the implied warranty
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) * GNU General Public License for more details.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) #include <linux/cpufreq.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) #include <linux/delay.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) #include <linux/interrupt.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23) #include <linux/module.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) #include <linux/platform_device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) #include <linux/io.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) #include <linux/of_device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28) #include "thermal_core.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) #define HI6220_TEMP0_LAG (0x0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) #define HI6220_TEMP0_TH (0x4)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) #define HI6220_TEMP0_RST_TH (0x8)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) #define HI6220_TEMP0_CFG (0xC)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) #define HI6220_TEMP0_CFG_SS_MSK (0xF000)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) #define HI6220_TEMP0_CFG_HDAK_MSK (0x30)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) #define HI6220_TEMP0_EN (0x10)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) #define HI6220_TEMP0_INT_EN (0x14)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) #define HI6220_TEMP0_INT_CLR (0x18)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) #define HI6220_TEMP0_RST_MSK (0x1C)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) #define HI6220_TEMP0_VALUE (0x28)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) #define HI3660_OFFSET(chan) ((chan) * 0x40)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) #define HI3660_TEMP(chan) (HI3660_OFFSET(chan) + 0x1C)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) #define HI3660_TH(chan) (HI3660_OFFSET(chan) + 0x20)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) #define HI3660_LAG(chan) (HI3660_OFFSET(chan) + 0x28)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) #define HI3660_INT_EN(chan) (HI3660_OFFSET(chan) + 0x2C)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) #define HI3660_INT_CLR(chan) (HI3660_OFFSET(chan) + 0x30)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) #define HI6220_TEMP_BASE (-60000)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50) #define HI6220_TEMP_RESET (100000)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) #define HI6220_TEMP_STEP (785)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) #define HI6220_TEMP_LAG (3500)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) #define HI3660_TEMP_BASE (-63780)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) #define HI3660_TEMP_STEP (205)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56) #define HI3660_TEMP_LAG (4000)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) #define HI6220_CLUSTER0_SENSOR 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59) #define HI6220_CLUSTER1_SENSOR 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) #define HI3660_LITTLE_SENSOR 0
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 62) #define HI3660_BIG_SENSOR 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 63) #define HI3660_G3D_SENSOR 2
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 64) #define HI3660_MODEM_SENSOR 3
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 65)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 66) struct hisi_thermal_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 67)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 68) struct hisi_thermal_sensor {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 69) struct hisi_thermal_data *data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 70) struct thermal_zone_device *tzd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 71) const char *irq_name;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 72) uint32_t id;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 73) uint32_t thres_temp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 74) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 75)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 76) struct hisi_thermal_ops {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 77) int (*get_temp)(struct hisi_thermal_sensor *sensor);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 78) int (*enable_sensor)(struct hisi_thermal_sensor *sensor);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 79) int (*disable_sensor)(struct hisi_thermal_sensor *sensor);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 80) int (*irq_handler)(struct hisi_thermal_sensor *sensor);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 81) int (*probe)(struct hisi_thermal_data *data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 82) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 83)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 84) struct hisi_thermal_data {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 85) const struct hisi_thermal_ops *ops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 86) struct hisi_thermal_sensor *sensor;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 87) struct platform_device *pdev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 88) struct clk *clk;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 89) void __iomem *regs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 90) int nr_sensors;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 91) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 92)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 93) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 94) * The temperature computation on the tsensor is as follow:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 95) * Unit: millidegree Celsius
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 96) * Step: 200/255 (0.7843)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 97) * Temperature base: -60°C
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 98) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 99) * The register is programmed in temperature steps, every step is 785
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) * millidegree and begins at -60 000 m°C
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) * The temperature from the steps:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) * Temp = TempBase + (steps x 785)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) * and the steps from the temperature:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) * steps = (Temp - TempBase) / 785
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) static inline int hi6220_thermal_step_to_temp(int step)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) return HI6220_TEMP_BASE + (step * HI6220_TEMP_STEP);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) static inline int hi6220_thermal_temp_to_step(int temp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) return DIV_ROUND_UP(temp - HI6220_TEMP_BASE, HI6220_TEMP_STEP);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) * for Hi3660,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) * Step: 189/922 (0.205)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) * Temperature base: -63.780°C
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) * The register is programmed in temperature steps, every step is 205
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) * millidegree and begins at -63 780 m°C
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) static inline int hi3660_thermal_step_to_temp(int step)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) return HI3660_TEMP_BASE + step * HI3660_TEMP_STEP;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) static inline int hi3660_thermal_temp_to_step(int temp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) return DIV_ROUND_UP(temp - HI3660_TEMP_BASE, HI3660_TEMP_STEP);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) * The lag register contains 5 bits encoding the temperature in steps.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) * Each time the temperature crosses the threshold boundary, an
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) * interrupt is raised. It could be when the temperature is going
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) * above the threshold or below. However, if the temperature is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) * fluctuating around this value due to the load, we can receive
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) * several interrupts which may not desired.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) * We can setup a temperature representing the delta between the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) * threshold and the current temperature when the temperature is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) * decreasing.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) * For instance: the lag register is 5°C, the threshold is 65°C, when
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) * the temperature reaches 65°C an interrupt is raised and when the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) * temperature decrease to 65°C - 5°C another interrupt is raised.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) * A very short lag can lead to an interrupt storm, a long lag
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) * increase the latency to react to the temperature changes. In our
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) * case, that is not really a problem as we are polling the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) * temperature.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) * [0:4] : lag register
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) * The temperature is coded in steps, cf. HI6220_TEMP_STEP.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) * Min : 0x00 : 0.0 °C
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) * Max : 0x1F : 24.3 °C
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) * The 'value' parameter is in milliCelsius.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) static inline void hi6220_thermal_set_lag(void __iomem *addr, int value)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) writel(DIV_ROUND_UP(value, HI6220_TEMP_STEP) & 0x1F,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) addr + HI6220_TEMP0_LAG);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) static inline void hi6220_thermal_alarm_clear(void __iomem *addr, int value)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) writel(value, addr + HI6220_TEMP0_INT_CLR);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) static inline void hi6220_thermal_alarm_enable(void __iomem *addr, int value)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) writel(value, addr + HI6220_TEMP0_INT_EN);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) static inline void hi6220_thermal_alarm_set(void __iomem *addr, int temp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) writel(hi6220_thermal_temp_to_step(temp) | 0x0FFFFFF00,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) addr + HI6220_TEMP0_TH);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) static inline void hi6220_thermal_reset_set(void __iomem *addr, int temp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) writel(hi6220_thermal_temp_to_step(temp), addr + HI6220_TEMP0_RST_TH);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) static inline void hi6220_thermal_reset_enable(void __iomem *addr, int value)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) writel(value, addr + HI6220_TEMP0_RST_MSK);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) static inline void hi6220_thermal_enable(void __iomem *addr, int value)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) writel(value, addr + HI6220_TEMP0_EN);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) static inline int hi6220_thermal_get_temperature(void __iomem *addr)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) return hi6220_thermal_step_to_temp(readl(addr + HI6220_TEMP0_VALUE));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) * [0:6] lag register
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) * The temperature is coded in steps, cf. HI3660_TEMP_STEP.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) * Min : 0x00 : 0.0 °C
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) * Max : 0x7F : 26.0 °C
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) static inline void hi3660_thermal_set_lag(void __iomem *addr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) int id, int value)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) writel(DIV_ROUND_UP(value, HI3660_TEMP_STEP) & 0x7F,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) addr + HI3660_LAG(id));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) static inline void hi3660_thermal_alarm_clear(void __iomem *addr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) int id, int value)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) writel(value, addr + HI3660_INT_CLR(id));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) static inline void hi3660_thermal_alarm_enable(void __iomem *addr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) int id, int value)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) writel(value, addr + HI3660_INT_EN(id));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) static inline void hi3660_thermal_alarm_set(void __iomem *addr,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) int id, int value)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) writel(value, addr + HI3660_TH(id));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) static inline int hi3660_thermal_get_temperature(void __iomem *addr, int id)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) return hi3660_thermal_step_to_temp(readl(addr + HI3660_TEMP(id)));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) * Temperature configuration register - Sensor selection
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) * Bits [19:12]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) * 0x0: local sensor (default)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) * 0x1: remote sensor 1 (ACPU cluster 1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) * 0x2: remote sensor 2 (ACPU cluster 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) * 0x3: remote sensor 3 (G3D)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) static inline void hi6220_thermal_sensor_select(void __iomem *addr, int sensor)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) writel((readl(addr + HI6220_TEMP0_CFG) & ~HI6220_TEMP0_CFG_SS_MSK) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) (sensor << 12), addr + HI6220_TEMP0_CFG);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) * Temperature configuration register - Hdak conversion polling interval
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) * Bits [5:4]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) * 0x0 : 0.768 ms
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) * 0x1 : 6.144 ms
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) * 0x2 : 49.152 ms
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) * 0x3 : 393.216 ms
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) static inline void hi6220_thermal_hdak_set(void __iomem *addr, int value)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) writel((readl(addr + HI6220_TEMP0_CFG) & ~HI6220_TEMP0_CFG_HDAK_MSK) |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) (value << 4), addr + HI6220_TEMP0_CFG);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) static int hi6220_thermal_irq_handler(struct hisi_thermal_sensor *sensor)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) struct hisi_thermal_data *data = sensor->data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) hi6220_thermal_alarm_clear(data->regs, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) static int hi3660_thermal_irq_handler(struct hisi_thermal_sensor *sensor)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) struct hisi_thermal_data *data = sensor->data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) hi3660_thermal_alarm_clear(data->regs, sensor->id, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 296) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 297) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 298)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 299) static int hi6220_thermal_get_temp(struct hisi_thermal_sensor *sensor)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 300) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 301) struct hisi_thermal_data *data = sensor->data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 302)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 303) return hi6220_thermal_get_temperature(data->regs);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 304) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 305)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 306) static int hi3660_thermal_get_temp(struct hisi_thermal_sensor *sensor)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 307) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 308) struct hisi_thermal_data *data = sensor->data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 309)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 310) return hi3660_thermal_get_temperature(data->regs, sensor->id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 311) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 312)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 313) static int hi6220_thermal_disable_sensor(struct hisi_thermal_sensor *sensor)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 314) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 315) struct hisi_thermal_data *data = sensor->data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 316)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 317) /* disable sensor module */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 318) hi6220_thermal_enable(data->regs, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 319) hi6220_thermal_alarm_enable(data->regs, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 320) hi6220_thermal_reset_enable(data->regs, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 321)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 322) clk_disable_unprepare(data->clk);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 323)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 324) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 325) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 326)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 327) static int hi3660_thermal_disable_sensor(struct hisi_thermal_sensor *sensor)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 328) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 329) struct hisi_thermal_data *data = sensor->data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 330)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 331) /* disable sensor module */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 332) hi3660_thermal_alarm_enable(data->regs, sensor->id, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 333) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 334) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 335)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 336) static int hi6220_thermal_enable_sensor(struct hisi_thermal_sensor *sensor)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 337) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 338) struct hisi_thermal_data *data = sensor->data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 339) int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 340)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 341) /* enable clock for tsensor */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 342) ret = clk_prepare_enable(data->clk);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 343) if (ret)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 344) return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 345)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 346) /* disable module firstly */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 347) hi6220_thermal_reset_enable(data->regs, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 348) hi6220_thermal_enable(data->regs, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 349)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 350) /* select sensor id */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 351) hi6220_thermal_sensor_select(data->regs, sensor->id);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 352)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 353) /* setting the hdak time */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 354) hi6220_thermal_hdak_set(data->regs, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 355)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 356) /* setting lag value between current temp and the threshold */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 357) hi6220_thermal_set_lag(data->regs, HI6220_TEMP_LAG);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 358)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 359) /* enable for interrupt */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 360) hi6220_thermal_alarm_set(data->regs, sensor->thres_temp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 361)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 362) hi6220_thermal_reset_set(data->regs, HI6220_TEMP_RESET);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 363)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 364) /* enable module */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 365) hi6220_thermal_reset_enable(data->regs, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 366) hi6220_thermal_enable(data->regs, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 367)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 368) hi6220_thermal_alarm_clear(data->regs, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 369) hi6220_thermal_alarm_enable(data->regs, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 370)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 371) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 372) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 373)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 374) static int hi3660_thermal_enable_sensor(struct hisi_thermal_sensor *sensor)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 375) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 376) unsigned int value;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 377) struct hisi_thermal_data *data = sensor->data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 378)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 379) /* disable interrupt */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 380) hi3660_thermal_alarm_enable(data->regs, sensor->id, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 381)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 382) /* setting lag value between current temp and the threshold */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 383) hi3660_thermal_set_lag(data->regs, sensor->id, HI3660_TEMP_LAG);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 384)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 385) /* set interrupt threshold */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 386) value = hi3660_thermal_temp_to_step(sensor->thres_temp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 387) hi3660_thermal_alarm_set(data->regs, sensor->id, value);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 388)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 389) /* enable interrupt */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 390) hi3660_thermal_alarm_clear(data->regs, sensor->id, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 391) hi3660_thermal_alarm_enable(data->regs, sensor->id, 1);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 392)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 393) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 394) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 395)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 396) static int hi6220_thermal_probe(struct hisi_thermal_data *data)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 397) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 398) struct platform_device *pdev = data->pdev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 399) struct device *dev = &pdev->dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 400) int ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 401)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 402) data->clk = devm_clk_get(dev, "thermal_clk");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 403) if (IS_ERR(data->clk)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 404) ret = PTR_ERR(data->clk);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 405) if (ret != -EPROBE_DEFER)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 406) dev_err(dev, "failed to get thermal clk: %d\n", ret);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 407) return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 408) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 409)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 410) data->sensor = devm_kzalloc(dev, sizeof(*data->sensor), GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 411) if (!data->sensor)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 412) return -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 413)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 414) data->sensor[0].id = HI6220_CLUSTER0_SENSOR;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 415) data->sensor[0].irq_name = "tsensor_intr";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 416) data->sensor[0].data = data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 417) data->nr_sensors = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 418)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 419) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 420) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 421)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 422) static int hi3660_thermal_probe(struct hisi_thermal_data *data)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 423) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 424) struct platform_device *pdev = data->pdev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 425) struct device *dev = &pdev->dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 426)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 427) data->nr_sensors = 1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 428)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 429) data->sensor = devm_kzalloc(dev, sizeof(*data->sensor) *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 430) data->nr_sensors, GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 431) if (!data->sensor)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 432) return -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 433)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 434) data->sensor[0].id = HI3660_BIG_SENSOR;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 435) data->sensor[0].irq_name = "tsensor_a73";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 436) data->sensor[0].data = data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 437)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 438) data->sensor[1].id = HI3660_LITTLE_SENSOR;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 439) data->sensor[1].irq_name = "tsensor_a53";
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 440) data->sensor[1].data = data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 441)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 442) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 443) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 444)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 445) static int hisi_thermal_get_temp(void *__data, int *temp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 446) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 447) struct hisi_thermal_sensor *sensor = __data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 448) struct hisi_thermal_data *data = sensor->data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 449)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 450) *temp = data->ops->get_temp(sensor);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 451)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 452) dev_dbg(&data->pdev->dev, "tzd=%p, id=%d, temp=%d, thres=%d\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 453) sensor->tzd, sensor->id, *temp, sensor->thres_temp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 454)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 455) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 456) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 457)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 458) static const struct thermal_zone_of_device_ops hisi_of_thermal_ops = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 459) .get_temp = hisi_thermal_get_temp,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 460) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 461)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 462) static irqreturn_t hisi_thermal_alarm_irq_thread(int irq, void *dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 463) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 464) struct hisi_thermal_sensor *sensor = dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 465) struct hisi_thermal_data *data = sensor->data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 466) int temp = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 467)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 468) data->ops->irq_handler(sensor);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 469)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 470) hisi_thermal_get_temp(sensor, &temp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 471)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 472) if (temp >= sensor->thres_temp) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 473) dev_crit(&data->pdev->dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 474) "sensor <%d> THERMAL ALARM: %d > %d\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 475) sensor->id, temp, sensor->thres_temp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 476)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 477) thermal_zone_device_update(sensor->tzd,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 478) THERMAL_EVENT_UNSPECIFIED);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 479)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 480) } else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 481) dev_crit(&data->pdev->dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 482) "sensor <%d> THERMAL ALARM stopped: %d < %d\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 483) sensor->id, temp, sensor->thres_temp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 484) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 485)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 486) return IRQ_HANDLED;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 487) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 488)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 489) static int hisi_thermal_register_sensor(struct platform_device *pdev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 490) struct hisi_thermal_sensor *sensor)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 491) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 492) int ret, i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 493) const struct thermal_trip *trip;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 494)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 495) sensor->tzd = devm_thermal_zone_of_sensor_register(&pdev->dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 496) sensor->id, sensor,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 497) &hisi_of_thermal_ops);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 498) if (IS_ERR(sensor->tzd)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 499) ret = PTR_ERR(sensor->tzd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 500) sensor->tzd = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 501) dev_err(&pdev->dev, "failed to register sensor id %d: %d\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 502) sensor->id, ret);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 503) return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 504) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 505)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 506) trip = of_thermal_get_trip_points(sensor->tzd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 507)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 508) for (i = 0; i < of_thermal_get_ntrips(sensor->tzd); i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 509) if (trip[i].type == THERMAL_TRIP_PASSIVE) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 510) sensor->thres_temp = trip[i].temperature;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 511) break;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 512) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 513) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 514)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 515) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 516) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 517)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 518) static const struct hisi_thermal_ops hi6220_ops = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 519) .get_temp = hi6220_thermal_get_temp,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 520) .enable_sensor = hi6220_thermal_enable_sensor,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 521) .disable_sensor = hi6220_thermal_disable_sensor,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 522) .irq_handler = hi6220_thermal_irq_handler,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 523) .probe = hi6220_thermal_probe,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 524) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 525)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 526) static const struct hisi_thermal_ops hi3660_ops = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 527) .get_temp = hi3660_thermal_get_temp,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 528) .enable_sensor = hi3660_thermal_enable_sensor,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 529) .disable_sensor = hi3660_thermal_disable_sensor,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 530) .irq_handler = hi3660_thermal_irq_handler,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 531) .probe = hi3660_thermal_probe,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 532) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 533)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 534) static const struct of_device_id of_hisi_thermal_match[] = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 535) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 536) .compatible = "hisilicon,tsensor",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 537) .data = &hi6220_ops,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 538) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 539) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 540) .compatible = "hisilicon,hi3660-tsensor",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 541) .data = &hi3660_ops,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 542) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 543) { /* end */ }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 544) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 545) MODULE_DEVICE_TABLE(of, of_hisi_thermal_match);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 546)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 547) static void hisi_thermal_toggle_sensor(struct hisi_thermal_sensor *sensor,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 548) bool on)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 549) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 550) struct thermal_zone_device *tzd = sensor->tzd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 551)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 552) if (on)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 553) thermal_zone_device_enable(tzd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 554) else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 555) thermal_zone_device_disable(tzd);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 556) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 557)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 558) static int hisi_thermal_probe(struct platform_device *pdev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 559) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 560) struct hisi_thermal_data *data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 561) struct device *dev = &pdev->dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 562) struct resource *res;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 563) int i, ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 564)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 565) data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 566) if (!data)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 567) return -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 568)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 569) data->pdev = pdev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 570) platform_set_drvdata(pdev, data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 571) data->ops = of_device_get_match_data(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 572)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 573) res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 574) data->regs = devm_ioremap_resource(dev, res);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 575) if (IS_ERR(data->regs)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 576) dev_err(dev, "failed to get io address\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 577) return PTR_ERR(data->regs);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 578) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 579)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 580) ret = data->ops->probe(data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 581) if (ret)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 582) return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 583)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 584) for (i = 0; i < data->nr_sensors; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 585) struct hisi_thermal_sensor *sensor = &data->sensor[i];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 586)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 587) ret = hisi_thermal_register_sensor(pdev, sensor);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 588) if (ret) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 589) dev_err(dev, "failed to register thermal sensor: %d\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 590) ret);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 591) return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 592) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 593)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 594) ret = platform_get_irq(pdev, 0);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 595) if (ret < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 596) return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 597)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 598) ret = devm_request_threaded_irq(dev, ret, NULL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 599) hisi_thermal_alarm_irq_thread,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 600) IRQF_ONESHOT, sensor->irq_name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 601) sensor);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 602) if (ret < 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 603) dev_err(dev, "Failed to request alarm irq: %d\n", ret);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 604) return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 605) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 606)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 607) ret = data->ops->enable_sensor(sensor);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 608) if (ret) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 609) dev_err(dev, "Failed to setup the sensor: %d\n", ret);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 610) return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 611) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 612)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 613) hisi_thermal_toggle_sensor(sensor, true);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 614) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 615)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 616) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 617) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 618)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 619) static int hisi_thermal_remove(struct platform_device *pdev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 620) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 621) struct hisi_thermal_data *data = platform_get_drvdata(pdev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 622) int i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 623)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 624) for (i = 0; i < data->nr_sensors; i++) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 625) struct hisi_thermal_sensor *sensor = &data->sensor[i];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 626)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 627) hisi_thermal_toggle_sensor(sensor, false);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 628) data->ops->disable_sensor(sensor);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 629) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 630)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 631) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 632) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 633)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 634) #ifdef CONFIG_PM_SLEEP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 635) static int hisi_thermal_suspend(struct device *dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 636) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 637) struct hisi_thermal_data *data = dev_get_drvdata(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 638) int i;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 639)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 640) for (i = 0; i < data->nr_sensors; i++)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 641) data->ops->disable_sensor(&data->sensor[i]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 642)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 643) return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 644) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 645)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 646) static int hisi_thermal_resume(struct device *dev)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 647) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 648) struct hisi_thermal_data *data = dev_get_drvdata(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 649) int i, ret = 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 650)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 651) for (i = 0; i < data->nr_sensors; i++)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 652) ret |= data->ops->enable_sensor(&data->sensor[i]);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 653)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 654) return ret;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 655) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 656) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 657)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 658) static SIMPLE_DEV_PM_OPS(hisi_thermal_pm_ops,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 659) hisi_thermal_suspend, hisi_thermal_resume);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 660)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 661) static struct platform_driver hisi_thermal_driver = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 662) .driver = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 663) .name = "hisi_thermal",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 664) .pm = &hisi_thermal_pm_ops,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 665) .of_match_table = of_hisi_thermal_match,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 666) },
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 667) .probe = hisi_thermal_probe,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 668) .remove = hisi_thermal_remove,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 669) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 670)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 671) module_platform_driver(hisi_thermal_driver);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 672)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 673) MODULE_AUTHOR("Xinwei Kong <kong.kongxinwei@hisilicon.com>");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 674) MODULE_AUTHOR("Leo Yan <leo.yan@linaro.org>");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 675) MODULE_DESCRIPTION("Hisilicon thermal driver");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 676) MODULE_LICENSE("GPL v2");