* [PATCH v2 2/2] thermal: mediatek: add support for MT7622 SoC
2018-02-17 8:49 [PATCH v2 1/2] dt-bindings: thermal: add binding for MT7622 SoC sean.wang
@ 2018-02-17 8:49 ` sean.wang
2018-03-07 9:12 ` [PATCH v2 1/2] dt-bindings: thermal: add binding " Sean Wang
1 sibling, 0 replies; 4+ messages in thread
From: sean.wang @ 2018-02-17 8:49 UTC (permalink / raw)
To: robh+dt, rui.zhang, edubezval
Cc: devicetree, linux-pm, linux-mediatek, linux-arm-kernel,
linux-kernel, Sean Wang, Shunli Wang
From: Sean Wang <sean.wang@mediatek.com>
MT7622 SoC has built-in thermal controller with one sensing point, the
patch just is to extend the functionality of the existing logic.
Changes v1 -> v2: rebase to 4.16-rc1
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Signed-off-by: Shunli Wang <shunli.wang@mediatek.com>
---
drivers/thermal/mtk_thermal.c | 35 +++++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
diff --git a/drivers/thermal/mtk_thermal.c b/drivers/thermal/mtk_thermal.c
index c75661a..e709acb 100644
--- a/drivers/thermal/mtk_thermal.c
+++ b/drivers/thermal/mtk_thermal.c
@@ -153,6 +153,12 @@
/* The number of sensing points per bank */
#define MT2712_NUM_SENSORS_PER_ZONE 4
+#define MT7622_TEMP_AUXADC_CHANNEL 11
+#define MT7622_NUM_SENSORS 1
+#define MT7622_NUM_ZONES 1
+#define MT7622_NUM_SENSORS_PER_ZONE 1
+#define MT7622_TS1 0
+
struct mtk_thermal;
struct thermal_bank_cfg {
@@ -242,6 +248,12 @@ static const int mt2712_adcpnp[MT2712_NUM_SENSORS_PER_ZONE] = {
static const int mt2712_mux_values[MT2712_NUM_SENSORS] = { 0, 1, 2, 3 };
+/* MT7622 thermal sensor data */
+static const int mt7622_bank_data[MT7622_NUM_SENSORS] = { MT7622_TS1, };
+static const int mt7622_msr[MT7622_NUM_SENSORS_PER_ZONE] = { TEMP_MSR0, };
+static const int mt7622_adcpnp[MT7622_NUM_SENSORS_PER_ZONE] = { TEMP_ADCPNP0, };
+static const int mt7622_mux_values[MT7622_NUM_SENSORS] = { 0, };
+
/**
* The MT8173 thermal controller has four banks. Each bank can read up to
* four temperature sensors simultaneously. The MT8173 has a total of 5
@@ -329,6 +341,25 @@ static const struct mtk_thermal_data mt2712_thermal_data = {
.sensor_mux_values = mt2712_mux_values,
};
+/*
+ * MT7622 have only one sensing point which uses AUXADC Channel 11 for raw data
+ * access.
+ */
+static const struct mtk_thermal_data mt7622_thermal_data = {
+ .auxadc_channel = MT7622_TEMP_AUXADC_CHANNEL,
+ .num_banks = MT7622_NUM_ZONES,
+ .num_sensors = MT7622_NUM_SENSORS,
+ .bank_data = {
+ {
+ .num_sensors = 1,
+ .sensors = mt7622_bank_data,
+ },
+ },
+ .msr = mt7622_msr,
+ .adcpnp = mt7622_adcpnp,
+ .sensor_mux_values = mt7622_mux_values,
+};
+
/**
* raw_to_mcelsius - convert a raw ADC value to mcelsius
* @mt: The thermal controller
@@ -631,6 +662,10 @@ static const struct of_device_id mtk_thermal_of_match[] = {
{
.compatible = "mediatek,mt2712-thermal",
.data = (void *)&mt2712_thermal_data,
+ },
+ {
+ .compatible = "mediatek,mt7622-thermal",
+ .data = (void *)&mt7622_thermal_data,
}, {
},
};
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2 1/2] dt-bindings: thermal: add binding for MT7622 SoC
2018-02-17 8:49 [PATCH v2 1/2] dt-bindings: thermal: add binding for MT7622 SoC sean.wang
2018-02-17 8:49 ` [PATCH v2 2/2] thermal: mediatek: add support " sean.wang
@ 2018-03-07 9:12 ` Sean Wang
2018-03-15 0:04 ` Eduardo Valentin
1 sibling, 1 reply; 4+ messages in thread
From: Sean Wang @ 2018-03-07 9:12 UTC (permalink / raw)
To: robh+dt
Cc: rui.zhang, edubezval, devicetree, linux-pm, linux-mediatek,
linux-arm-kernel, linux-kernel, Shunli Wang
Hi, Rui
just a gentle ping to the both patches
Sean
On Sat, 2018-02-17 at 16:49 +0800, sean.wang@mediatek.com wrote:
> From: Sean Wang <sean.wang@mediatek.com>
>
> Add devicetree bindings for MediaTek MT7622 thermal controller
>
> Changes v1 -> v2: add tag from Rob
>
> Signed-off-by: Sean Wang <sean.wang@mediatek.com>
> Signed-off-by: Shunli Wang <shunli.wang@mediatek.com>
> Reviewed-by: Rob Herring <robh@kernel.org>
> ---
> Documentation/devicetree/bindings/thermal/mediatek-thermal.txt | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/Documentation/devicetree/bindings/thermal/mediatek-thermal.txt b/Documentation/devicetree/bindings/thermal/mediatek-thermal.txt
> index 0d73ea5..41d6a44 100644
> --- a/Documentation/devicetree/bindings/thermal/mediatek-thermal.txt
> +++ b/Documentation/devicetree/bindings/thermal/mediatek-thermal.txt
> @@ -12,6 +12,7 @@ Required properties:
> - "mediatek,mt8173-thermal" : For MT8173 family of SoCs
> - "mediatek,mt2701-thermal" : For MT2701 family of SoCs
> - "mediatek,mt2712-thermal" : For MT2712 family of SoCs
> + - "mediatek,mt7622-thermal" : For MT7622 SoC
> - reg: Address range of the thermal controller
> - interrupts: IRQ for the thermal controller
> - clocks, clock-names: Clocks needed for the thermal controller. required
^ permalink raw reply [flat|nested] 4+ messages in thread