From 31ccb31608c72960cbe1e77c83f12a9718a4cc4c Mon Sep 17 00:00:00 2001 From: Jianqun Xu Date: Fri, 9 Mar 2018 17:36:39 +0800 Subject: [PATCH] thermal: rockchip: add tsadc support for rk3308 Cherry-picked from v4.19 also fix rk_tsadcv4_initialize to rk_tsadcv2_initialize, which committed by Finley Xiao: commit: 875a83545151 ("thermal: rockchip: Fix initialize for rk3308") The rk_tsadcv4_initialize is used to fix channal invertion issue for px30, but there isn't the issue on rk3308. Change-Id: Ibf1782ca471c8ad4b14d6fd64eeb123181903adc Signed-off-by: Elaine Zhang Signed-off-by: Jianqun Xu --- .../bindings/thermal/rockchip-thermal.txt | 1 + drivers/thermal/rockchip_thermal.c | 30 +++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/Documentation/devicetree/bindings/thermal/rockchip-thermal.txt b/Documentation/devicetree/bindings/thermal/rockchip-thermal.txt index f614ed2ddd16..b12272df9b61 100644 --- a/Documentation/devicetree/bindings/thermal/rockchip-thermal.txt +++ b/Documentation/devicetree/bindings/thermal/rockchip-thermal.txt @@ -8,6 +8,7 @@ Required properties: "rockchip,rk1808-tsadc": found on RK1808 SoCs "rockchip,rk3228-tsadc": found on RK3228 SoCs "rockchip,rk3288-tsadc": found on RK3288 SoCs + "rockchip,rk3308-tsadc": found on RK3308 SoCs "rockchip,rk3328-tsadc": found on RK3328 SoCs "rockchip,rk3368-tsadc": found on RK3368 SoCs "rockchip,rk3399-tsadc": found on RK3399 SoCs diff --git a/drivers/thermal/rockchip_thermal.c b/drivers/thermal/rockchip_thermal.c index e1f431c34e79..a2138594cf43 100644 --- a/drivers/thermal/rockchip_thermal.c +++ b/drivers/thermal/rockchip_thermal.c @@ -1504,6 +1504,30 @@ static const struct rockchip_tsadc_chip rk3288_tsadc_data = { }, }; +static const struct rockchip_tsadc_chip rk3308_tsadc_data = { + .chn_id[SENSOR_CPU] = 0, /* cpu sensor is channel 0 */ + .chn_id[SENSOR_GPU] = 1, /* gpu sensor is channel 1 */ + .chn_num = 2, /* 2 channels for tsadc */ + + .tshut_mode = TSHUT_MODE_CRU, /* default TSHUT via CRU */ + .tshut_temp = 95000, + + .initialize = rk_tsadcv2_initialize, + .irq_ack = rk_tsadcv3_irq_ack, + .control = rk_tsadcv3_control, + .get_temp = rk_tsadcv2_get_temp, + .set_alarm_temp = rk_tsadcv2_alarm_temp, + .set_tshut_temp = rk_tsadcv2_tshut_temp, + .set_tshut_mode = rk_tsadcv2_tshut_mode, + + .table = { + .id = rk3328_code_table, + .length = ARRAY_SIZE(rk3328_code_table), + .data_mask = TSADCV2_DATA_MASK, + .mode = ADC_INCREMENT, + }, +}; + static const struct rockchip_tsadc_chip rk3328_tsadc_data = { .chn_id[SENSOR_CPU] = 0, /* cpu sensor is channel 0 */ .chn_num = 1, /* one channels for tsadc */ @@ -1694,6 +1718,12 @@ static const struct of_device_id of_rockchip_thermal_match[] = { .data = (void *)&rk3288_tsadc_data, }, #endif +#ifdef CONFIG_CPU_RK3308 + { + .compatible = "rockchip,rk3308-tsadc", + .data = (void *)&rk3308_tsadc_data, + }, +#endif #ifdef CONFIG_CPU_RK3328 { .compatible = "rockchip,rk3328-tsadc",