1 From b93889b200a963acde20e559dbf51886ad6b6229 Mon Sep 17 00:00:00 2001
2 From: Sean Wang <sean.wang@mediatek.com>
3 Date: Tue, 16 Jan 2018 23:50:48 +0800
4 Subject: [PATCH 200/224] thermal: mediatek: add support for MT7622 SoC
6 MT7622 SoC has built-in thermal controller with one sensing point, the
7 patch just is to extend the functionality of the existing logic.
9 Changes v1 -> v2: rebase to 4.16-rc1
11 Signed-off-by: Sean Wang <sean.wang@mediatek.com>
12 Signed-off-by: Shunli Wang <shunli.wang@mediatek.com>
14 drivers/thermal/mtk_thermal.c | 35 +++++++++++++++++++++++++++++++++++
15 1 file changed, 35 insertions(+)
17 --- a/drivers/thermal/mtk_thermal.c
18 +++ b/drivers/thermal/mtk_thermal.c
20 /* The number of sensing points per bank */
21 #define MT2712_NUM_SENSORS_PER_ZONE 4
23 +#define MT7622_TEMP_AUXADC_CHANNEL 11
24 +#define MT7622_NUM_SENSORS 1
25 +#define MT7622_NUM_ZONES 1
26 +#define MT7622_NUM_SENSORS_PER_ZONE 1
31 struct thermal_bank_cfg {
32 @@ -242,6 +248,12 @@ static const int mt2712_adcpnp[MT2712_NU
34 static const int mt2712_mux_values[MT2712_NUM_SENSORS] = { 0, 1, 2, 3 };
36 +/* MT7622 thermal sensor data */
37 +static const int mt7622_bank_data[MT7622_NUM_SENSORS] = { MT7622_TS1, };
38 +static const int mt7622_msr[MT7622_NUM_SENSORS_PER_ZONE] = { TEMP_MSR0, };
39 +static const int mt7622_adcpnp[MT7622_NUM_SENSORS_PER_ZONE] = { TEMP_ADCPNP0, };
40 +static const int mt7622_mux_values[MT7622_NUM_SENSORS] = { 0, };
43 * The MT8173 thermal controller has four banks. Each bank can read up to
44 * four temperature sensors simultaneously. The MT8173 has a total of 5
45 @@ -329,6 +341,25 @@ static const struct mtk_thermal_data mt2
46 .sensor_mux_values = mt2712_mux_values,
50 + * MT7622 have only one sensing point which uses AUXADC Channel 11 for raw data
53 +static const struct mtk_thermal_data mt7622_thermal_data = {
54 + .auxadc_channel = MT7622_TEMP_AUXADC_CHANNEL,
55 + .num_banks = MT7622_NUM_ZONES,
56 + .num_sensors = MT7622_NUM_SENSORS,
60 + .sensors = mt7622_bank_data,
64 + .adcpnp = mt7622_adcpnp,
65 + .sensor_mux_values = mt7622_mux_values,
69 * raw_to_mcelsius - convert a raw ADC value to mcelsius
70 * @mt: The thermal controller
71 @@ -633,6 +664,10 @@ static const struct of_device_id mtk_the
73 .compatible = "mediatek,mt2712-thermal",
74 .data = (void *)&mt2712_thermal_data,
77 + .compatible = "mediatek,mt7622-thermal",
78 + .data = (void *)&mt7622_thermal_data,