kernel: bump 4.14 to 4.14.169
[openwrt/openwrt.git] / target / linux / mediatek / patches-4.14 / 0200-thermal-mediatek-add-support-for-MT7622-SoC.patch
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
5
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.
8
9 Changes v1 -> v2: rebase to 4.16-rc1
10
11 Signed-off-by: Sean Wang <sean.wang@mediatek.com>
12 Signed-off-by: Shunli Wang <shunli.wang@mediatek.com>
13 ---
14 drivers/thermal/mtk_thermal.c | 35 +++++++++++++++++++++++++++++++++++
15 1 file changed, 35 insertions(+)
16
17 --- a/drivers/thermal/mtk_thermal.c
18 +++ b/drivers/thermal/mtk_thermal.c
19 @@ -153,6 +153,12 @@
20 /* The number of sensing points per bank */
21 #define MT2712_NUM_SENSORS_PER_ZONE 4
22
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
27 +#define MT7622_TS1 0
28 +
29 struct mtk_thermal;
30
31 struct thermal_bank_cfg {
32 @@ -242,6 +248,12 @@ static const int mt2712_adcpnp[MT2712_NU
33
34 static const int mt2712_mux_values[MT2712_NUM_SENSORS] = { 0, 1, 2, 3 };
35
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, };
41 +
42 /**
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,
47 };
48
49 +/*
50 + * MT7622 have only one sensing point which uses AUXADC Channel 11 for raw data
51 + * access.
52 + */
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,
57 + .bank_data = {
58 + {
59 + .num_sensors = 1,
60 + .sensors = mt7622_bank_data,
61 + },
62 + },
63 + .msr = mt7622_msr,
64 + .adcpnp = mt7622_adcpnp,
65 + .sensor_mux_values = mt7622_mux_values,
66 +};
67 +
68 /**
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
72 {
73 .compatible = "mediatek,mt2712-thermal",
74 .data = (void *)&mt2712_thermal_data,
75 + },
76 + {
77 + .compatible = "mediatek,mt7622-thermal",
78 + .data = (void *)&mt7622_thermal_data,
79 }, {
80 },
81 };