This series moves thermal files related to MediaTek to the mediatek folder.
And introduce the new architecture LVTS (low voltage thermal sensor) driver to report
the highest temperature in the SoC and record the highest temperature sensor,
each sensor as a hot zone.
The LVTS body is divided into two parts, the LVTS controller and the LVTS device.
The LVTS controller can connect up to 4 LVTS devices, and each LVTS device
can connect up to 7 TSMCUs.
The architecture will be the first to be used on mt8192 and mt8195.
Changelog:
Changes in v8:
- Fix Coding style issues
- Rebase to kernel-5.18.rc8
- Rebase on top of these series :
- [RESEND v8 00/19] Cleanup MediaTek clk reset drivers and support SoCs :
https://lore.kernel.org/all/[email protected]/
- [PATCH v6 00/12] thermal OF rework :
https://lore.kernel.org/all/[email protected]/
- Add multi-instance support and SRC Modularization :
- Rewrite DTS and DT bindings
- Add DT bindings for MT8195
- One LVTS node for each HW Domain (AP and MCU)
- One SW Instance for each HW Domain, for each SoC
- Add an SRC file for each SoC (MT8192 and MT8195)
- Add a Kconfig sub-menu entry for each SoC
- Shrink LVTS instance iospace length from 0x1000 to 0x400
- Replace platform_get_resource by platform_get_mem_or_io to get Base Address
- Replace platform_get_resource by platform_get_irq to get Interrupt Number
- Add "lvts_" prefix to functions and structs
Changes in v7:
- Fix coding style issues
- Rewrite dt bindings
- was not accurate
- Use mt8195 for example (instead of mt8192)
- Rename mt6873 to mt8192
- Remove clock name
- Rebased on top of to series:
- https://patchwork.kernel.org/project/linux-mediatek/list/?series=637849
- https://patchwork.kernel.org/project/linux-pm/list/?series=639386
Changes in v6:
- Remove temperature aggregation (it will be added in another series)
- Update the way to read the temperature (read one sensor instead of all)
- Add support of mt8195
Changes in v5:
- Use 'git mv' for the relocated file.
Changes in v4:
- Rebase to kernel-v5.13-rc1
- Resend
Changes in v3:
- change the expression in the lvts_temp_to_raw to dev_s64.
Changes in v2:
- Rebase to kernel-5.11-rc1.
- sort headers
- remove initial value 0 of msr_raw in the lvts_temp_to_raw.
- disconstruct the api of lvts_read_tc_msr_raw.
- add the initial value max_temp = 0 and compare e.q.
in the lvts_read_all_tc_temperature.
- add the return with an invalid number in the lvts_init.
This series depends on [1] and [2].
[1]https://lore.kernel.org/all/[email protected]/
[2]https://lore.kernel.org/all/[email protected]/
Alexandre Bailon (2):
dt-bindings: thermal: Add binding document for LVTS thermal
controllers
arm64: dts: mt8195: Add efuse node to mt8195
Michael Kao (3):
thermal: mediatek: Relocate driver to mediatek folder
thermal: mediatek: Add LVTS drivers for SoC theraml zones for mt8192
thermal: mediatek: Add thermal zone settings for mt8195
Tinghan Shen (1):
arm64: dts: mt8195: Add thermal zone
.../thermal/mediatek,mt8192-lvts.yaml | 73 ++
.../thermal/mediatek,mt8195-lvts.yaml | 75 ++
arch/arm64/boot/dts/mediatek/mt8195.dtsi | 131 ++-
drivers/thermal/Kconfig | 14 +-
drivers/thermal/Makefile | 2 +-
drivers/thermal/mediatek/Kconfig | 62 ++
drivers/thermal/mediatek/Makefile | 4 +
drivers/thermal/mediatek/lvts_mt8192.c | 241 +++++
drivers/thermal/mediatek/lvts_mt8195.c | 253 +++++
.../{mtk_thermal.c => mediatek/soc_temp.c} | 2 +-
drivers/thermal/mediatek/soc_temp_lvts.c | 928 ++++++++++++++++++
drivers/thermal/mediatek/soc_temp_lvts.h | 366 +++++++
12 files changed, 2138 insertions(+), 13 deletions(-)
create mode 100644 Documentation/devicetree/bindings/thermal/mediatek,mt8192-lvts.yaml
create mode 100644 Documentation/devicetree/bindings/thermal/mediatek,mt8195-lvts.yaml
create mode 100644 drivers/thermal/mediatek/Kconfig
create mode 100644 drivers/thermal/mediatek/Makefile
create mode 100644 drivers/thermal/mediatek/lvts_mt8192.c
create mode 100644 drivers/thermal/mediatek/lvts_mt8195.c
rename drivers/thermal/{mtk_thermal.c => mediatek/soc_temp.c} (99%)
create mode 100644 drivers/thermal/mediatek/soc_temp_lvts.c
create mode 100644 drivers/thermal/mediatek/soc_temp_lvts.h
--
2.34.1
This patch adds dt-binding documents for mt8192 and mt8195 thermal controllers.
Signed-off-by: Alexandre Bailon <[email protected]>
Signed-off-by: Balsam CHIHI <[email protected]>
---
.../thermal/mediatek,mt8192-lvts.yaml | 73 ++++++++++++++++++
.../thermal/mediatek,mt8195-lvts.yaml | 75 +++++++++++++++++++
2 files changed, 148 insertions(+)
create mode 100644 Documentation/devicetree/bindings/thermal/mediatek,mt8192-lvts.yaml
create mode 100644 Documentation/devicetree/bindings/thermal/mediatek,mt8195-lvts.yaml
diff --git a/Documentation/devicetree/bindings/thermal/mediatek,mt8192-lvts.yaml b/Documentation/devicetree/bindings/thermal/mediatek,mt8192-lvts.yaml
new file mode 100644
index 000000000000..8c5a02eb97c5
--- /dev/null
+++ b/Documentation/devicetree/bindings/thermal/mediatek,mt8192-lvts.yaml
@@ -0,0 +1,73 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/thermal/mediatek,mt8192-lvts.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: MediaTek SoC LVTS thermal controller
+
+maintainers:
+ - Yu-Chia Chang <[email protected]>
+ - Ben Tseng <[email protected]>
+
+properties:
+ compatible:
+ enum:
+ - mediatek,mt8192-lvts-ap
+ - mediatek,mt8192-lvts-mcu
+
+ "#thermal-sensor-cells":
+ const: 1
+
+ reg:
+ maxItems: 2
+
+ interrupts:
+ maxItems: 1
+
+ clocks:
+ maxItems: 1
+
+ resets:
+ items:
+ - description: SW reset HW AP/MCU domain for clean temporary data when HW initialization and resume.
+
+ nvmem-cells:
+ items:
+ - description: LVTS calibration data for thermal sensors
+
+ nvmem-cell-names:
+ items:
+ - const: lvts_calib_data
+
+required:
+ - compatible
+ - '#thermal-sensor-cells'
+ - reg
+ - interrupts
+ - clocks
+ - resets
+ - nvmem-cells
+ - nvmem-cell-names
+
+additionalProperties: false
+
+examples:
+ - |
+ #include <dt-bindings/thermal/thermal.h>
+ #include <dt-bindings/interrupt-controller/arm-gic.h>
+ #include <dt-bindings/clock/mt8192-clk.h>
+ #include <dt-bindings/reset/mt8192-resets.h>
+
+ lvtsmcu: thermal-sensor@11278000 {
+ compatible = "mediatek,mt8192-lvts-mcu";
+ #thermal-sensor-cells = <1>;
+ reg = <0 0x11278000 0 0x400>;
+ interrupts = <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH 0>;
+ clocks = <&infracfg_ao CLK_INFRA_THERM>;
+ resets = <&infracfg_ao MT8192_INFRA_RST4_THERM_CTRL_MCU_SWRST>;
+ nvmem-cells = <&lvts_efuse_data>;
+ nvmem-cell-names = "lvts_calib_data";
+ };
+
+...
diff --git a/Documentation/devicetree/bindings/thermal/mediatek,mt8195-lvts.yaml b/Documentation/devicetree/bindings/thermal/mediatek,mt8195-lvts.yaml
new file mode 100644
index 000000000000..6b0b53a33272
--- /dev/null
+++ b/Documentation/devicetree/bindings/thermal/mediatek,mt8195-lvts.yaml
@@ -0,0 +1,75 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/thermal/mediatek,mt8195-lvts.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: MediaTek SoC LVTS thermal controller
+
+maintainers:
+ - Yu-Chia Chang <[email protected]>
+ - Ben Tseng <[email protected]>
+
+properties:
+ compatible:
+ enum:
+ - mediatek,mt8195-lvts-ap
+ - mediatek,mt8195-lvts-mcu
+
+ "#thermal-sensor-cells":
+ const: 1
+
+ reg:
+ maxItems: 2
+
+ interrupts:
+ maxItems: 1
+
+ clocks:
+ maxItems: 1
+
+ resets:
+ items:
+ - description: SW reset HW AP/MCU domain for clean temporary data when HW initialization and resume.
+
+ nvmem-cells:
+ items:
+ - description: LVTS calibration data 1 for thermal sensors
+ - description: LVTS calibration data 2 for thermal sensors
+
+ nvmem-cell-names:
+ items:
+ - const: lvts_calib_data1
+ - const: lvts_calib_data2
+
+required:
+ - compatible
+ - '#thermal-sensor-cells'
+ - reg
+ - interrupts
+ - clocks
+ - resets
+ - nvmem-cells
+ - nvmem-cell-names
+
+additionalProperties: false
+
+examples:
+ - |
+ #include <dt-bindings/thermal/thermal.h>
+ #include <dt-bindings/interrupt-controller/arm-gic.h>
+ #include <dt-bindings/clock/mt8195-clk.h>
+ #include <dt-bindings/reset/mt8195-resets.h>
+
+ lvtsmcu: thermal-sensor@11278000 {
+ compatible = "mediatek,mt8195-lvts-mcu";
+ #thermal-sensor-cells = <1>;
+ reg = <0 0x11278000 0 0x400>;
+ interrupts = <GIC_SPI 170 IRQ_TYPE_LEVEL_HIGH 0>;
+ clocks = <&infracfg_ao CLK_INFRA_AO_THERM>;
+ resets = <&infracfg_ao MT8195_INFRA_RST4_THERM_CTRL_MCU_SWRST>;
+ nvmem-cells = <&lvts_efuse_data1 &lvts_efuse_data2>;
+ nvmem-cell-names = "lvts_calib_data1", "lvts_calib_data2";
+ };
+
+...
--
2.34.1
Add thermal zone settings for mt8195
Signed-off-by: Michael Kao <[email protected]>
Signed-off-by: Ben Tseng <[email protected]>
Signed-off-by: Alexandre Bailon <[email protected]>
Signed-off-by: Balsam CHIHI <[email protected]>
---
drivers/thermal/mediatek/Kconfig | 12 ++
drivers/thermal/mediatek/Makefile | 1 +
drivers/thermal/mediatek/lvts_mt8195.c | 253 +++++++++++++++++++++++
drivers/thermal/mediatek/soc_temp_lvts.h | 1 +
4 files changed, 267 insertions(+)
create mode 100644 drivers/thermal/mediatek/lvts_mt8195.c
diff --git a/drivers/thermal/mediatek/Kconfig b/drivers/thermal/mediatek/Kconfig
index 7fc04237dd50..df3b4a033fc2 100644
--- a/drivers/thermal/mediatek/Kconfig
+++ b/drivers/thermal/mediatek/Kconfig
@@ -47,4 +47,16 @@ config LVTS_MT8192
configures LVTS thermal controllers to collect temperatures
via ASIF.
+config LVTS_MT8195
+ tristate "LVTS driver for MediaTek MT8195 SoC"
+ depends on HAS_IOMEM
+ depends on NVMEM
+ depends on RESET_TI_SYSCON
+ depends on MTK_SOC_THERMAL_LVTS
+ help
+ Enable this option if you want to get SoC temperature
+ information for MT8195. This driver
+ configures LVTS thermal controllers to collect temperatures
+ via ASIF.
+
endif
diff --git a/drivers/thermal/mediatek/Makefile b/drivers/thermal/mediatek/Makefile
index 5ff1197e80ab..dada1bf13110 100644
--- a/drivers/thermal/mediatek/Makefile
+++ b/drivers/thermal/mediatek/Makefile
@@ -1,3 +1,4 @@
obj-$(CONFIG_MTK_SOC_THERMAL) += soc_temp.o
obj-$(CONFIG_MTK_SOC_THERMAL_LVTS) += soc_temp_lvts.o
obj-$(CONFIG_LVTS_MT8192) += lvts_mt8192.o
+obj-$(CONFIG_LVTS_MT8195) += lvts_mt8195.o
diff --git a/drivers/thermal/mediatek/lvts_mt8195.c b/drivers/thermal/mediatek/lvts_mt8195.c
new file mode 100644
index 000000000000..df69e2e79115
--- /dev/null
+++ b/drivers/thermal/mediatek/lvts_mt8195.c
@@ -0,0 +1,253 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * Copyright (c) 2022 MediaTek Inc.
+ */
+
+#include <linux/of_irq.h>
+#include <linux/platform_device.h>
+#include "soc_temp_lvts.h"
+
+enum mt8195_lvts_mcu_sensor_enum {
+ MT8195_TS1_0, // cpu_big1
+ MT8195_TS1_1, // cpu_big2
+ MT8195_TS2_0, // cpu_big3
+ MT8195_TS2_1, // cpu_big4
+ MT8195_TS3_0, // cpu_little1
+ MT8195_TS3_1, // cpu_little2
+ MT8195_TS3_2, // cpu_little3
+ MT8195_TS3_3, // cpu_little4
+ MT8195_NUM_TS_MCU
+};
+
+enum mt8195_lvts_ap_sensor_enum {
+ MT8195_TS4_0, // vpu1
+ MT8195_TS4_1, // vpu2
+ MT8195_TS5_0, // gpu1
+ MT8195_TS5_1, // gpu2
+ MT8195_TS6_0, // vdec
+ MT8195_TS6_1, // img
+ MT8195_TS6_2, // infra
+ MT8195_TS7_0, // cam1
+ MT8195_TS7_1, // cam2
+ MT8195_NUM_TS_AP
+};
+
+static void mt8195_mcu_efuse_to_cal_data(struct lvts_data *lvts_data)
+{
+ struct lvts_sensor_cal_data *cal_data = &lvts_data->cal_data;
+
+ cal_data->golden_temp = GET_CAL_DATA_BITMASK(0, lvts_data, 31, 24);
+
+ cal_data->count_r[MT8195_TS1_0] = GET_CAL_DATA_BITMASK(1, lvts_data, 23, 0);
+ cal_data->count_r[MT8195_TS1_1] = (GET_CAL_DATA_BITMASK(2, lvts_data, 15, 0) << 8) +
+ GET_CAL_DATA_BITMASK(1, lvts_data, 31, 24);
+ cal_data->count_r[MT8195_TS2_0] = GET_CAL_DATA_BITMASK(3, lvts_data, 31, 8);
+ cal_data->count_r[MT8195_TS2_1] = GET_CAL_DATA_BITMASK(4, lvts_data, 23, 0);
+ cal_data->count_r[MT8195_TS3_0] = (GET_CAL_DATA_BITMASK(6, lvts_data, 7, 0) << 16) +
+ GET_CAL_DATA_BITMASK(5, lvts_data, 31, 16);
+ cal_data->count_r[MT8195_TS3_1] = GET_CAL_DATA_BITMASK(6, lvts_data, 31, 8);
+ cal_data->count_r[MT8195_TS3_2] = GET_CAL_DATA_BITMASK(7, lvts_data, 23, 0);
+ cal_data->count_r[MT8195_TS3_3] = (GET_CAL_DATA_BITMASK(8, lvts_data, 15, 0) << 8) +
+ GET_CAL_DATA_BITMASK(7, lvts_data, 31, 24);
+
+ cal_data->count_rc[MT8195_TS1_0] = (GET_CAL_DATA_BITMASK(3, lvts_data, 7, 0) << 16) +
+ GET_CAL_DATA_BITMASK(2, lvts_data, 31, 16);
+ cal_data->count_rc[MT8195_TS2_0] = (GET_CAL_DATA_BITMASK(5, lvts_data, 15, 0) << 8) +
+ GET_CAL_DATA_BITMASK(4, lvts_data, 31, 24);
+ cal_data->count_rc[MT8195_TS3_0] = (GET_CAL_DATA_BITMASK(9, lvts_data, 7, 0) << 16) +
+ GET_CAL_DATA_BITMASK(8, lvts_data, 31, 16);
+}
+
+static void mt8195_ap_efuse_to_cal_data(struct lvts_data *lvts_data)
+{
+ struct lvts_sensor_cal_data *cal_data = &lvts_data->cal_data;
+
+ cal_data->golden_temp = GET_CAL_DATA_BITMASK(0, lvts_data, 31, 24);
+
+ cal_data->count_r[MT8195_TS4_0] = GET_CAL_DATA_BITMASK(9, lvts_data, 31, 8);
+ cal_data->count_r[MT8195_TS4_1] = GET_CAL_DATA_BITMASK(10, lvts_data, 23, 0);
+ cal_data->count_r[MT8195_TS5_0] = (GET_CAL_DATA_BITMASK(12, lvts_data, 7, 0) << 16) +
+ GET_CAL_DATA_BITMASK(11, lvts_data, 31, 16);
+ cal_data->count_r[MT8195_TS5_1] = GET_CAL_DATA_BITMASK(12, lvts_data, 31, 8);
+ cal_data->count_r[MT8195_TS6_0] = (GET_CAL_DATA_BITMASK(14, lvts_data, 15, 0) << 8) +
+ GET_CAL_DATA_BITMASK(13, lvts_data, 31, 24);
+ cal_data->count_r[MT8195_TS6_1] = (GET_CAL_DATA_BITMASK(15, lvts_data, 7, 0) << 16) +
+ GET_CAL_DATA_BITMASK(14, lvts_data, 31, 16);
+ cal_data->count_r[MT8195_TS6_2] = GET_CAL_DATA_BITMASK(15, lvts_data, 31, 8);
+ cal_data->count_r[MT8195_TS7_0] = (GET_CAL_DATA_BITMASK(17, lvts_data, 15, 0) << 8) +
+ GET_CAL_DATA_BITMASK(16, lvts_data, 31, 24);
+ cal_data->count_r[MT8195_TS7_1] = (GET_CAL_DATA_BITMASK(18, lvts_data, 7, 0) << 16) +
+ GET_CAL_DATA_BITMASK(17, lvts_data, 31, 16);
+
+ cal_data->count_rc[MT8195_TS4_0] = (GET_CAL_DATA_BITMASK(11, lvts_data, 15, 0) << 8) +
+ GET_CAL_DATA_BITMASK(10, lvts_data, 31, 24);
+ cal_data->count_rc[MT8195_TS5_0] = GET_CAL_DATA_BITMASK(13, lvts_data, 23, 0);
+ cal_data->count_rc[MT8195_TS6_0] = GET_CAL_DATA_BITMASK(16, lvts_data, 23, 0);
+ cal_data->count_rc[MT8195_TS7_0] = GET_CAL_DATA_BITMASK(18, lvts_data, 31, 8);
+}
+
+static struct lvts_speed_settings tc_speed_mt8195 = {
+ .period_unit = PERIOD_UNIT,
+ .group_interval_delay = GROUP_INTERVAL_DELAY,
+ .filter_interval_delay = FILTER_INTERVAL_DELAY,
+ .sensor_interval_delay = SENSOR_INTERVAL_DELAY,
+};
+
+static const struct lvts_tc_settings mt8195_tc_mcu_settings[] = {
+ [0] = {
+ .dev_id = 0x81,
+ .addr_offset = 0x0,
+ .num_sensor = 2,
+ .sensor_map = {MT8195_TS1_0, MT8195_TS1_1},
+ .tc_speed = &tc_speed_mt8195,
+ .hw_filter = LVTS_FILTER_2_OF_4,
+ .dominator_sensing_point = SENSING_POINT1,
+ .hw_reboot_trip_point = HW_REBOOT_TRIP_POINT,
+ .irq_bit = BIT(3),
+ },
+ [1] = {
+ .dev_id = 0x82,
+ .addr_offset = 0x100,
+ .num_sensor = 2,
+ .sensor_map = {MT8195_TS2_0, MT8195_TS2_1},
+ .tc_speed = &tc_speed_mt8195,
+ .hw_filter = LVTS_FILTER_2_OF_4,
+ .dominator_sensing_point = SENSING_POINT0,
+ .hw_reboot_trip_point = HW_REBOOT_TRIP_POINT,
+ .irq_bit = BIT(4),
+ },
+ [2] = {
+ .dev_id = 0x83,
+ .addr_offset = 0x200,
+ .num_sensor = 4,
+ .sensor_map = {MT8195_TS3_0, MT8195_TS3_1, MT8195_TS3_2, MT8195_TS3_3},
+ .tc_speed = &tc_speed_mt8195,
+ .hw_filter = LVTS_FILTER_2_OF_4,
+ .dominator_sensing_point = SENSING_POINT0,
+ .hw_reboot_trip_point = HW_REBOOT_TRIP_POINT,
+ .irq_bit = BIT(5),
+ }
+};
+
+static const struct lvts_tc_settings mt8195_tc_ap_settings[] = {
+ [0] = {
+ .dev_id = 0x84,
+ .addr_offset = 0x0,
+ .num_sensor = 2,
+ .sensor_map = {MT8195_TS4_0, MT8195_TS4_1},
+ .tc_speed = &tc_speed_mt8195,
+ .hw_filter = LVTS_FILTER_2_OF_4,
+ .dominator_sensing_point = SENSING_POINT0,
+ .hw_reboot_trip_point = HW_REBOOT_TRIP_POINT,
+ .irq_bit = BIT(3),
+ },
+ [1] = {
+ .dev_id = 0x85,
+ .addr_offset = 0x100,
+ .num_sensor = 2,
+ .sensor_map = {MT8195_TS5_0, MT8195_TS5_1},
+ .tc_speed = &tc_speed_mt8195,
+ .hw_filter = LVTS_FILTER_2_OF_4,
+ .dominator_sensing_point = SENSING_POINT1,
+ .hw_reboot_trip_point = HW_REBOOT_TRIP_POINT,
+ .irq_bit = BIT(4),
+ },
+ [2] = {
+ .dev_id = 0x86,
+ .addr_offset = 0x200,
+ .num_sensor = 3,
+ .sensor_map = {MT8195_TS6_0, MT8195_TS6_1, MT8195_TS6_2},
+ .tc_speed = &tc_speed_mt8195,
+ .hw_filter = LVTS_FILTER_2_OF_4,
+ .dominator_sensing_point = SENSING_POINT1,
+ .hw_reboot_trip_point = HW_REBOOT_TRIP_POINT,
+ .irq_bit = BIT(5),
+ },
+ [3] = {
+ .dev_id = 0x87,
+ .addr_offset = 0x300,
+ .num_sensor = 2,
+ .sensor_map = {MT8195_TS7_0, MT8195_TS7_1},
+ .tc_speed = &tc_speed_mt8195,
+ .hw_filter = LVTS_FILTER_2_OF_4,
+ .dominator_sensing_point = SENSING_POINT0,
+ .hw_reboot_trip_point = HW_REBOOT_TRIP_POINT,
+ .irq_bit = BIT(6),
+ }
+};
+
+static const struct lvts_data mt8195_lvts_mcu_data = {
+ .num_tc = (ARRAY_SIZE(mt8195_tc_mcu_settings)),
+ .tc = mt8195_tc_mcu_settings,
+ .num_sensor = MT8195_NUM_TS_MCU,
+ .ops = {
+ .efuse_to_cal_data = mt8195_mcu_efuse_to_cal_data,
+ .device_enable_and_init = lvts_device_enable_and_init_v4,
+ .device_enable_auto_rck = lvts_device_enable_auto_rck_v4,
+ .device_read_count_rc_n = lvts_device_read_count_rc_n_v4,
+ .set_cal_data = lvts_set_calibration_data_v4,
+ .init_controller = lvts_init_controller_v4,
+ },
+ .feature_bitmap = FEATURE_DEVICE_AUTO_RCK,
+ .num_efuse_addr = NUM_EFUSE_ADDR,
+ .num_efuse_block = NUM_EFUSE_BLOCK_MT8195,
+ .cal_data = {
+ .default_golden_temp = DEFAULT_GOLDEN_TEMP,
+ .default_count_r = DEFAULT_CUONT_R,
+ .default_count_rc = DEFAULT_CUONT_RC,
+ },
+ .coeff = {
+ .a = COEFF_A,
+ .b = COEFF_B,
+ },
+};
+
+static const struct lvts_data mt8195_lvts_ap_data = {
+ .num_tc = (ARRAY_SIZE(mt8195_tc_ap_settings)),
+ .tc = mt8195_tc_ap_settings,
+ .num_sensor = MT8195_NUM_TS_AP,
+ .ops = {
+ .efuse_to_cal_data = mt8195_ap_efuse_to_cal_data,
+ .device_enable_and_init = lvts_device_enable_and_init_v4,
+ .device_enable_auto_rck = lvts_device_enable_auto_rck_v4,
+ .device_read_count_rc_n = lvts_device_read_count_rc_n_v4,
+ .set_cal_data = lvts_set_calibration_data_v4,
+ .init_controller = lvts_init_controller_v4,
+ },
+ .feature_bitmap = FEATURE_DEVICE_AUTO_RCK,
+ .num_efuse_addr = NUM_EFUSE_ADDR,
+ .num_efuse_block = NUM_EFUSE_BLOCK_MT8195,
+ .cal_data = {
+ .default_golden_temp = DEFAULT_GOLDEN_TEMP,
+ .default_count_r = DEFAULT_CUONT_R,
+ .default_count_rc = DEFAULT_CUONT_RC,
+ },
+ .coeff = {
+ .a = COEFF_A,
+ .b = COEFF_B,
+ },
+};
+
+static const struct of_device_id lvts_of_match[] = {
+ { .compatible = "mediatek,mt8195-lvts-mcu", .data = &mt8195_lvts_mcu_data, },
+ { .compatible = "mediatek,mt8195-lvts-ap", .data = &mt8195_lvts_ap_data, },
+ {},
+};
+MODULE_DEVICE_TABLE(of, lvts_of_match);
+
+static struct platform_driver soc_temp_lvts = {
+ .probe = lvts_probe,
+ .remove = lvts_remove,
+ .suspend = lvts_suspend,
+ .resume = lvts_resume,
+ .driver = {
+ .name = "mtk-soc-temp-lvts-mt8195",
+ .of_match_table = lvts_of_match,
+ },
+};
+module_platform_driver(soc_temp_lvts);
+
+MODULE_AUTHOR("Yu-Chia Chang <[email protected]>");
+MODULE_AUTHOR("Michael Kao <[email protected]>");
+MODULE_DESCRIPTION("MediaTek soc temperature driver");
+MODULE_LICENSE("GPL v2");
diff --git a/drivers/thermal/mediatek/soc_temp_lvts.h b/drivers/thermal/mediatek/soc_temp_lvts.h
index 6f8b6e3af98c..c4acb7e26e5e 100644
--- a/drivers/thermal/mediatek/soc_temp_lvts.h
+++ b/drivers/thermal/mediatek/soc_temp_lvts.h
@@ -16,6 +16,7 @@
#define FEATURE_DEVICE_AUTO_RCK BIT(0)
#define NUM_EFUSE_ADDR 22
#define NUM_EFUSE_BLOCK_MT8192 1
+#define NUM_EFUSE_BLOCK_MT8195 2
#define DEFAULT_GOLDEN_TEMP 50
#define DEFAULT_CUONT_R 35000
#define DEFAULT_CUONT_RC 2750
--
2.34.1
Add Mediatek proprietary folder to upstream more thermal zone and cooler
drivers. Relocate the original thermal controller driver to it and rename
as soc_temp.c to show its purpose more clearly.
Signed-off-by: Michael Kao <[email protected]>
Signed-off-by: Ben Tseng <[email protected]>
Reviewed-by: Matthias Brugger <[email protected]>
Signed-off-by: Balsam CHIHI <[email protected]>
---
drivers/thermal/Kconfig | 14 ++++-------
drivers/thermal/Makefile | 2 +-
drivers/thermal/mediatek/Kconfig | 23 +++++++++++++++++++
drivers/thermal/mediatek/Makefile | 1 +
.../{mtk_thermal.c => mediatek/soc_temp.c} | 0
5 files changed, 29 insertions(+), 11 deletions(-)
create mode 100644 drivers/thermal/mediatek/Kconfig
create mode 100644 drivers/thermal/mediatek/Makefile
rename drivers/thermal/{mtk_thermal.c => mediatek/soc_temp.c} (100%)
diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig
index 0e5cc948373c..ecba8d6e313b 100644
--- a/drivers/thermal/Kconfig
+++ b/drivers/thermal/Kconfig
@@ -412,16 +412,10 @@ config DA9062_THERMAL
zone.
Compatible with the DA9062 and DA9061 PMICs.
-config MTK_THERMAL
- tristate "Temperature sensor driver for mediatek SoCs"
- depends on ARCH_MEDIATEK || COMPILE_TEST
- depends on HAS_IOMEM
- depends on NVMEM || NVMEM=n
- depends on RESET_CONTROLLER
- default y
- help
- Enable this option if you want to have support for thermal management
- controller present in Mediatek SoCs
+menu "Mediatek thermal drivers"
+depends on ARCH_MEDIATEK || COMPILE_TEST
+source "drivers/thermal/mediatek/Kconfig"
+endmenu
config AMLOGIC_THERMAL
tristate "Amlogic Thermal Support"
diff --git a/drivers/thermal/Makefile b/drivers/thermal/Makefile
index def8e1a0399c..3c00e864ad55 100644
--- a/drivers/thermal/Makefile
+++ b/drivers/thermal/Makefile
@@ -55,7 +55,7 @@ obj-y += st/
obj-$(CONFIG_QCOM_TSENS) += qcom/
obj-y += tegra/
obj-$(CONFIG_HISI_THERMAL) += hisi_thermal.o
-obj-$(CONFIG_MTK_THERMAL) += mtk_thermal.o
+obj-$(CONFIG_MTK_THERMAL) += mediatek/
obj-$(CONFIG_GENERIC_ADC_THERMAL) += thermal-generic-adc.o
obj-$(CONFIG_UNIPHIER_THERMAL) += uniphier_thermal.o
obj-$(CONFIG_AMLOGIC_THERMAL) += amlogic_thermal.o
diff --git a/drivers/thermal/mediatek/Kconfig b/drivers/thermal/mediatek/Kconfig
new file mode 100644
index 000000000000..9c41e9079fc3
--- /dev/null
+++ b/drivers/thermal/mediatek/Kconfig
@@ -0,0 +1,23 @@
+config MTK_THERMAL
+ tristate "MediaTek thermal drivers"
+ depends on THERMAL_OF
+ help
+ This is the option for MediaTek thermal software
+ solutions. Please enable corresponding options to
+ get temperature information from thermal sensors or
+ turn on throttle mechaisms for thermal mitigation.
+
+if MTK_THERMAL
+
+config MTK_SOC_THERMAL
+ tristate "Temperature sensor driver for MediaTek SoCs"
+ depends on HAS_IOMEM
+ depends on NVMEM
+ depends on RESET_CONTROLLER
+ help
+ Enable this option if you want to get SoC temperature
+ information for MediaTek platforms. This driver
+ configures thermal controllers to collect temperature
+ via AUXADC interface.
+
+endif
diff --git a/drivers/thermal/mediatek/Makefile b/drivers/thermal/mediatek/Makefile
new file mode 100644
index 000000000000..4b4cb04a358f
--- /dev/null
+++ b/drivers/thermal/mediatek/Makefile
@@ -0,0 +1 @@
+obj-$(CONFIG_MTK_SOC_THERMAL) += soc_temp.o
diff --git a/drivers/thermal/mtk_thermal.c b/drivers/thermal/mediatek/soc_temp.c
similarity index 100%
rename from drivers/thermal/mtk_thermal.c
rename to drivers/thermal/mediatek/soc_temp.c
--
2.34.1
On Tue, 26 Jul 2022 15:55:02 +0200, Balsam CHIHI wrote:
> This patch adds dt-binding documents for mt8192 and mt8195 thermal controllers.
>
> Signed-off-by: Alexandre Bailon <[email protected]>
> Signed-off-by: Balsam CHIHI <[email protected]>
> ---
> .../thermal/mediatek,mt8192-lvts.yaml | 73 ++++++++++++++++++
> .../thermal/mediatek,mt8195-lvts.yaml | 75 +++++++++++++++++++
> 2 files changed, 148 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/thermal/mediatek,mt8192-lvts.yaml
> create mode 100644 Documentation/devicetree/bindings/thermal/mediatek,mt8195-lvts.yaml
>
My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
on your patch (DT_CHECKER_FLAGS is new in v5.13):
yamllint warnings/errors:
dtschema/dtc warnings/errors:
Error: Documentation/devicetree/bindings/thermal/mediatek,mt8195-lvts.example.dts:32.36-37 syntax error
FATAL ERROR: Unable to parse input tree
make[1]: *** [scripts/Makefile.lib:383: Documentation/devicetree/bindings/thermal/mediatek,mt8195-lvts.example.dtb] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:1404: dt_binding_check] Error 2
doc reference errors (make refcheckdocs):
See https://patchwork.ozlabs.org/patch/
This check can fail if there are any dependencies. The base for a patch
series is generally the most recent rc1.
If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:
pip3 install dtschema --upgrade
Please check and re-submit.
Il 26/07/22 15:55, Balsam CHIHI ha scritto:
> Add Mediatek proprietary folder to upstream more thermal zone and cooler
> drivers. Relocate the original thermal controller driver to it and rename
> as soc_temp.c to show its purpose more clearly.
>
> Signed-off-by: Michael Kao <[email protected]>
> Signed-off-by: Ben Tseng <[email protected]>
> Reviewed-by: Matthias Brugger <[email protected]>
> Signed-off-by: Balsam CHIHI <[email protected]>
Reviewed-by: AngeloGioacchino Del Regno <[email protected]>
Il 26/07/22 15:55, Balsam CHIHI ha scritto:
> This patch adds dt-binding documents for mt8192 and mt8195 thermal controllers.
>
> Signed-off-by: Alexandre Bailon <[email protected]>
> Signed-off-by: Balsam CHIHI <[email protected]>
> ---
> .../thermal/mediatek,mt8192-lvts.yaml | 73 ++++++++++++++++++
> .../thermal/mediatek,mt8195-lvts.yaml | 75 +++++++++++++++++++
> 2 files changed, 148 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/thermal/mediatek,mt8192-lvts.yaml
> create mode 100644 Documentation/devicetree/bindings/thermal/mediatek,mt8195-lvts.yaml
>
Hello Balsam,
I don't think that having two separated files is necessary (and I don't know if
that's correct, even).
You're referring to variants of the same hardware (and using the same driver, but
that's not really relevant here), so my suggestion here is to have only one YAML,
named like "mediatek,lvts-thermal.yaml", where we list all of the compatibles for
both MT8192 and MT8195 (and future SoCs).
Regards,
Angelo
Il 26/07/22 15:55, Balsam CHIHI ha scritto:
> Add Mediatek proprietary folder to upstream more thermal zone and cooler
> drivers. Relocate the original thermal controller driver to it and rename
> as soc_temp.c to show its purpose more clearly.
>
> Signed-off-by: Michael Kao <[email protected]>
> Signed-off-by: Ben Tseng <[email protected]>
> Reviewed-by: Matthias Brugger <[email protected]>
> Signed-off-by: Balsam CHIHI <[email protected]>
> ---
> drivers/thermal/Kconfig | 14 ++++-------
> drivers/thermal/Makefile | 2 +-
> drivers/thermal/mediatek/Kconfig | 23 +++++++++++++++++++
> drivers/thermal/mediatek/Makefile | 1 +
> .../{mtk_thermal.c => mediatek/soc_temp.c} | 0
> 5 files changed, 29 insertions(+), 11 deletions(-)
> create mode 100644 drivers/thermal/mediatek/Kconfig
> create mode 100644 drivers/thermal/mediatek/Makefile
> rename drivers/thermal/{mtk_thermal.c => mediatek/soc_temp.c} (100%)
>
> diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig
> index 0e5cc948373c..ecba8d6e313b 100644
> --- a/drivers/thermal/Kconfig
> +++ b/drivers/thermal/Kconfig
> @@ -412,16 +412,10 @@ config DA9062_THERMAL
> zone.
> Compatible with the DA9062 and DA9061 PMICs.
>
> -config MTK_THERMAL
> - tristate "Temperature sensor driver for mediatek SoCs"
> - depends on ARCH_MEDIATEK || COMPILE_TEST
> - depends on HAS_IOMEM
> - depends on NVMEM || NVMEM=n
> - depends on RESET_CONTROLLER
> - default y
> - help
> - Enable this option if you want to have support for thermal management
> - controller present in Mediatek SoCs
> +menu "Mediatek thermal drivers"
> +depends on ARCH_MEDIATEK || COMPILE_TEST
> +source "drivers/thermal/mediatek/Kconfig"
> +endmenu
>
> config AMLOGIC_THERMAL
> tristate "Amlogic Thermal Support"
> diff --git a/drivers/thermal/Makefile b/drivers/thermal/Makefile
> index def8e1a0399c..3c00e864ad55 100644
> --- a/drivers/thermal/Makefile
> +++ b/drivers/thermal/Makefile
> @@ -55,7 +55,7 @@ obj-y += st/
> obj-$(CONFIG_QCOM_TSENS) += qcom/
> obj-y += tegra/
> obj-$(CONFIG_HISI_THERMAL) += hisi_thermal.o
> -obj-$(CONFIG_MTK_THERMAL) += mtk_thermal.o
> +obj-$(CONFIG_MTK_THERMAL) += mediatek/
> obj-$(CONFIG_GENERIC_ADC_THERMAL) += thermal-generic-adc.o
> obj-$(CONFIG_UNIPHIER_THERMAL) += uniphier_thermal.o
> obj-$(CONFIG_AMLOGIC_THERMAL) += amlogic_thermal.o
> diff --git a/drivers/thermal/mediatek/Kconfig b/drivers/thermal/mediatek/Kconfig
> new file mode 100644
> index 000000000000..9c41e9079fc3
> --- /dev/null
> +++ b/drivers/thermal/mediatek/Kconfig
> @@ -0,0 +1,23 @@
> +config MTK_THERMAL
> + tristate "MediaTek thermal drivers"
> + depends on THERMAL_OF
> + help
> + This is the option for MediaTek thermal software
> + solutions. Please enable corresponding options to
> + get temperature information from thermal sensors or
> + turn on throttle mechaisms for thermal mitigation.
Sorry, I just noticed that the indentation must be fixed.
help
This is the option .....
Thanks,
Angelo
On Wed, Jul 27, 2022 at 10:24 AM AngeloGioacchino Del Regno
<[email protected]> wrote:
>
> Il 26/07/22 15:55, Balsam CHIHI ha scritto:
> > Add Mediatek proprietary folder to upstream more thermal zone and cooler
> > drivers. Relocate the original thermal controller driver to it and rename
> > as soc_temp.c to show its purpose more clearly.
> >
> > Signed-off-by: Michael Kao <[email protected]>
> > Signed-off-by: Ben Tseng <[email protected]>
> > Reviewed-by: Matthias Brugger <[email protected]>
> > Signed-off-by: Balsam CHIHI <[email protected]>
> > ---
> > drivers/thermal/Kconfig | 14 ++++-------
> > drivers/thermal/Makefile | 2 +-
> > drivers/thermal/mediatek/Kconfig | 23 +++++++++++++++++++
> > drivers/thermal/mediatek/Makefile | 1 +
> > .../{mtk_thermal.c => mediatek/soc_temp.c} | 0
> > 5 files changed, 29 insertions(+), 11 deletions(-)
> > create mode 100644 drivers/thermal/mediatek/Kconfig
> > create mode 100644 drivers/thermal/mediatek/Makefile
> > rename drivers/thermal/{mtk_thermal.c => mediatek/soc_temp.c} (100%)
> >
> > diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig
> > index 0e5cc948373c..ecba8d6e313b 100644
> > --- a/drivers/thermal/Kconfig
> > +++ b/drivers/thermal/Kconfig
> > @@ -412,16 +412,10 @@ config DA9062_THERMAL
> > zone.
> > Compatible with the DA9062 and DA9061 PMICs.
> >
> > -config MTK_THERMAL
> > - tristate "Temperature sensor driver for mediatek SoCs"
> > - depends on ARCH_MEDIATEK || COMPILE_TEST
> > - depends on HAS_IOMEM
> > - depends on NVMEM || NVMEM=n
> > - depends on RESET_CONTROLLER
> > - default y
> > - help
> > - Enable this option if you want to have support for thermal management
> > - controller present in Mediatek SoCs
> > +menu "Mediatek thermal drivers"
> > +depends on ARCH_MEDIATEK || COMPILE_TEST
> > +source "drivers/thermal/mediatek/Kconfig"
> > +endmenu
> >
> > config AMLOGIC_THERMAL
> > tristate "Amlogic Thermal Support"
> > diff --git a/drivers/thermal/Makefile b/drivers/thermal/Makefile
> > index def8e1a0399c..3c00e864ad55 100644
> > --- a/drivers/thermal/Makefile
> > +++ b/drivers/thermal/Makefile
> > @@ -55,7 +55,7 @@ obj-y += st/
> > obj-$(CONFIG_QCOM_TSENS) += qcom/
> > obj-y += tegra/
> > obj-$(CONFIG_HISI_THERMAL) += hisi_thermal.o
> > -obj-$(CONFIG_MTK_THERMAL) += mtk_thermal.o
> > +obj-$(CONFIG_MTK_THERMAL) += mediatek/
> > obj-$(CONFIG_GENERIC_ADC_THERMAL) += thermal-generic-adc.o
> > obj-$(CONFIG_UNIPHIER_THERMAL) += uniphier_thermal.o
> > obj-$(CONFIG_AMLOGIC_THERMAL) += amlogic_thermal.o
> > diff --git a/drivers/thermal/mediatek/Kconfig b/drivers/thermal/mediatek/Kconfig
> > new file mode 100644
> > index 000000000000..9c41e9079fc3
> > --- /dev/null
> > +++ b/drivers/thermal/mediatek/Kconfig
> > @@ -0,0 +1,23 @@
> > +config MTK_THERMAL
> > + tristate "MediaTek thermal drivers"
> > + depends on THERMAL_OF
> > + help
> > + This is the option for MediaTek thermal software
> > + solutions. Please enable corresponding options to
> > + get temperature information from thermal sensors or
> > + turn on throttle mechaisms for thermal mitigation.
>
> Sorry, I just noticed that the indentation must be fixed.
>
> help
> This is the option .....
>
> Thanks,
> Angelo
OK, It will be fixed ASAP.
Thanks,
Balsam.
On Wed, Jul 27, 2022 at 10:17 AM AngeloGioacchino Del Regno
<[email protected]> wrote:
>
> Il 26/07/22 15:55, Balsam CHIHI ha scritto:
> > This patch adds dt-binding documents for mt8192 and mt8195 thermal controllers.
> >
> > Signed-off-by: Alexandre Bailon <[email protected]>
> > Signed-off-by: Balsam CHIHI <[email protected]>
> > ---
> > .../thermal/mediatek,mt8192-lvts.yaml | 73 ++++++++++++++++++
> > .../thermal/mediatek,mt8195-lvts.yaml | 75 +++++++++++++++++++
> > 2 files changed, 148 insertions(+)
> > create mode 100644 Documentation/devicetree/bindings/thermal/mediatek,mt8192-lvts.yaml
> > create mode 100644 Documentation/devicetree/bindings/thermal/mediatek,mt8195-lvts.yaml
> >
>
> Hello Balsam,
>
> I don't think that having two separated files is necessary (and I don't know if
> that's correct, even).
>
> You're referring to variants of the same hardware (and using the same driver, but
> that's not really relevant here), so my suggestion here is to have only one YAML,
> named like "mediatek,lvts-thermal.yaml", where we list all of the compatibles for
> both MT8192 and MT8195 (and future SoCs).
>
> Regards,
> Angelo
Hello AngeloGioacchino,
Thank you for the feedback.
Well received. I will resend ASAP.
Best regards,
Balsam.
On Tue, Jul 26, 2022 at 10:09 PM Rob Herring <[email protected]> wrote:
>
> On Tue, 26 Jul 2022 15:55:02 +0200, Balsam CHIHI wrote:
> > This patch adds dt-binding documents for mt8192 and mt8195 thermal controllers.
> >
> > Signed-off-by: Alexandre Bailon <[email protected]>
> > Signed-off-by: Balsam CHIHI <[email protected]>
> > ---
> > .../thermal/mediatek,mt8192-lvts.yaml | 73 ++++++++++++++++++
> > .../thermal/mediatek,mt8195-lvts.yaml | 75 +++++++++++++++++++
> > 2 files changed, 148 insertions(+)
> > create mode 100644 Documentation/devicetree/bindings/thermal/mediatek,mt8192-lvts.yaml
> > create mode 100644 Documentation/devicetree/bindings/thermal/mediatek,mt8195-lvts.yaml
> >
>
> My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
> on your patch (DT_CHECKER_FLAGS is new in v5.13):
>
> yamllint warnings/errors:
>
> dtschema/dtc warnings/errors:
> Error: Documentation/devicetree/bindings/thermal/mediatek,mt8195-lvts.example.dts:32.36-37 syntax error
> FATAL ERROR: Unable to parse input tree
> make[1]: *** [scripts/Makefile.lib:383: Documentation/devicetree/bindings/thermal/mediatek,mt8195-lvts.example.dtb] Error 1
> make[1]: *** Waiting for unfinished jobs....
> make: *** [Makefile:1404: dt_binding_check] Error 2
>
> doc reference errors (make refcheckdocs):
>
> See https://patchwork.ozlabs.org/patch/
>
> This check can fail if there are any dependencies. The base for a patch
> series is generally the most recent rc1.
>
> If you already ran 'make dt_binding_check' and didn't see the above
> error(s), then make sure 'yamllint' is installed and dt-schema is up to
> date:
>
> pip3 install dtschema --upgrade
>
> Please check and re-submit.
>
Hello Rob,
Thank you for the feedback.
I'm updating my dt-bindings check tools, fixing, and I will resend ASPA.
Best regards,
Balsam.
Hi Balsam,
On 26/07/2022 15:55, Balsam CHIHI wrote:
> Add Mediatek proprietary folder to upstream more thermal zone and cooler
> drivers. Relocate the original thermal controller driver to it and rename
> as soc_temp.c to show its purpose more clearly.
I realize the Kconfig, Makefiles format are not consistent across the
boards. Before I fix this, you can comply to the format:
drivers/thermal/Kconfig:
menu "Mediatek thermal drivers"
depends on ARCH_MEDIATEK || COMPILE_TEST
source "drivers/thermal/mediatek/Kconfig"
endmenu
drivers/thermal/Makefile:
-obj-$(CONFIG_MTK_THERMAL) += mtk_thermal.o
+obj-y += mediatek
drivers/thermal/mediatek/Kconfig:
config MTK_SOC_THERMAL
tristate "Temperature sensor driver for MediaTek SoCs"
depends on HAS_IOMEM
depends on NVMEM
depends on RESET_CONTROLLER
help
Enable this option if you want to get SoC temperature
information for MediaTek platforms. This driver
configures thermal controllers to collect temperature
via AUXADC interface.
drivers/thermal/mediatek/Makefile:
obj-$(MTK_SOC_THERMAL) += soc_temp.o
However, rename 'soc_temp' to something more SoC explicit, eg.
mtxxx_thermal.c
Thanks
-- Daniel
> Signed-off-by: Michael Kao <[email protected]>
> Signed-off-by: Ben Tseng <[email protected]>
> Reviewed-by: Matthias Brugger <[email protected]>
> Signed-off-by: Balsam CHIHI <[email protected]>
> ---
> drivers/thermal/Kconfig | 14 ++++-------
> drivers/thermal/Makefile | 2 +-
> drivers/thermal/mediatek/Kconfig | 23 +++++++++++++++++++
> drivers/thermal/mediatek/Makefile | 1 +
> .../{mtk_thermal.c => mediatek/soc_temp.c} | 0
> 5 files changed, 29 insertions(+), 11 deletions(-)
> create mode 100644 drivers/thermal/mediatek/Kconfig
> create mode 100644 drivers/thermal/mediatek/Makefile
> rename drivers/thermal/{mtk_thermal.c => mediatek/soc_temp.c} (100%)
>
> diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig
> index 0e5cc948373c..ecba8d6e313b 100644
> --- a/drivers/thermal/Kconfig
> +++ b/drivers/thermal/Kconfig
> @@ -412,16 +412,10 @@ config DA9062_THERMAL
> zone.
> Compatible with the DA9062 and DA9061 PMICs.
>
> -config MTK_THERMAL
> - tristate "Temperature sensor driver for mediatek SoCs"
> - depends on ARCH_MEDIATEK || COMPILE_TEST
> - depends on HAS_IOMEM
> - depends on NVMEM || NVMEM=n
> - depends on RESET_CONTROLLER
> - default y
> - help
> - Enable this option if you want to have support for thermal management
> - controller present in Mediatek SoCs
> +menu "Mediatek thermal drivers"
> +depends on ARCH_MEDIATEK || COMPILE_TEST
> +source "drivers/thermal/mediatek/Kconfig"
> +endmenu
>
> config AMLOGIC_THERMAL
> tristate "Amlogic Thermal Support"
> diff --git a/drivers/thermal/Makefile b/drivers/thermal/Makefile
> index def8e1a0399c..3c00e864ad55 100644
> --- a/drivers/thermal/Makefile
> +++ b/drivers/thermal/Makefile
> @@ -55,7 +55,7 @@ obj-y += st/
> obj-$(CONFIG_QCOM_TSENS) += qcom/
> obj-y += tegra/
> obj-$(CONFIG_HISI_THERMAL) += hisi_thermal.o
> -obj-$(CONFIG_MTK_THERMAL) += mtk_thermal.o
> +obj-$(CONFIG_MTK_THERMAL) += mediatek/
> obj-$(CONFIG_GENERIC_ADC_THERMAL) += thermal-generic-adc.o
> obj-$(CONFIG_UNIPHIER_THERMAL) += uniphier_thermal.o
> obj-$(CONFIG_AMLOGIC_THERMAL) += amlogic_thermal.o
> diff --git a/drivers/thermal/mediatek/Kconfig b/drivers/thermal/mediatek/Kconfig
> new file mode 100644
> index 000000000000..9c41e9079fc3
> --- /dev/null
> +++ b/drivers/thermal/mediatek/Kconfig
> @@ -0,0 +1,23 @@
> +config MTK_THERMAL
> + tristate "MediaTek thermal drivers"
> + depends on THERMAL_OF
> + help
> + This is the option for MediaTek thermal software
> + solutions. Please enable corresponding options to
> + get temperature information from thermal sensors or
> + turn on throttle mechaisms for thermal mitigation.
> +
> +if MTK_THERMAL
> +
> +config MTK_SOC_THERMAL
> + tristate "Temperature sensor driver for MediaTek SoCs"
> + depends on HAS_IOMEM
> + depends on NVMEM
> + depends on RESET_CONTROLLER
> + help
> + Enable this option if you want to get SoC temperature
> + information for MediaTek platforms. This driver
> + configures thermal controllers to collect temperature
> + via AUXADC interface.
> +
> +endif
> diff --git a/drivers/thermal/mediatek/Makefile b/drivers/thermal/mediatek/Makefile
> new file mode 100644
> index 000000000000..4b4cb04a358f
> --- /dev/null
> +++ b/drivers/thermal/mediatek/Makefile
> @@ -0,0 +1 @@
> +obj-$(CONFIG_MTK_SOC_THERMAL) += soc_temp.o
> diff --git a/drivers/thermal/mtk_thermal.c b/drivers/thermal/mediatek/soc_temp.c
> similarity index 100%
> rename from drivers/thermal/mtk_thermal.c
> rename to drivers/thermal/mediatek/soc_temp.c
--
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs
Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
On Fri, Jul 29, 2022 at 5:19 PM Balsam CHIHI <[email protected]> wrote:
>
> On Thu, Jul 28, 2022 at 10:53 AM Daniel Lezcano
> <[email protected]> wrote:
> >
> >
> > Hi Balsam,
> >
> > On 26/07/2022 15:55, Balsam CHIHI wrote:
> > > Add Mediatek proprietary folder to upstream more thermal zone and cooler
> > > drivers. Relocate the original thermal controller driver to it and rename
> > > as soc_temp.c to show its purpose more clearly.
> >
> > I realize the Kconfig, Makefiles format are not consistent across the
> > boards. Before I fix this, you can comply to the format:
> >
> > drivers/thermal/Kconfig:
> >
> > menu "Mediatek thermal drivers"
> > depends on ARCH_MEDIATEK || COMPILE_TEST
> > source "drivers/thermal/mediatek/Kconfig"
> > endmenu
> >
> > drivers/thermal/Makefile:
> >
> > -obj-$(CONFIG_MTK_THERMAL) += mtk_thermal.o
> > +obj-y += mediatek
> >
> > drivers/thermal/mediatek/Kconfig:
> >
> > config MTK_SOC_THERMAL
> > tristate "Temperature sensor driver for MediaTek SoCs"
> > depends on HAS_IOMEM
> > depends on NVMEM
> > depends on RESET_CONTROLLER
> > help
> > Enable this option if you want to get SoC temperature
> > information for MediaTek platforms. This driver
> > configures thermal controllers to collect temperature
> > via AUXADC interface.
> >
> > drivers/thermal/mediatek/Makefile:
> >
> > obj-$(MTK_SOC_THERMAL) += soc_temp.o
> >
> > However, rename 'soc_temp' to something more SoC explicit, eg.
> > mtxxx_thermal.c
> >
> > Thanks
> >
> > -- Daniel
>
> Hello Daniel,
>
> Thank you for the feedback.
> Changes have been made as you suggested.
> Resubmitting seen.
*soon.
>
> Best regards.
> Balsam.
On Tue, Jul 26, 2022 at 10:09 PM Rob Herring <[email protected]> wrote:
>
> On Tue, 26 Jul 2022 15:55:02 +0200, Balsam CHIHI wrote:
> > This patch adds dt-binding documents for mt8192 and mt8195 thermal controllers.
> >
> > Signed-off-by: Alexandre Bailon <[email protected]>
> > Signed-off-by: Balsam CHIHI <[email protected]>
> > ---
> > .../thermal/mediatek,mt8192-lvts.yaml | 73 ++++++++++++++++++
> > .../thermal/mediatek,mt8195-lvts.yaml | 75 +++++++++++++++++++
> > 2 files changed, 148 insertions(+)
> > create mode 100644 Documentation/devicetree/bindings/thermal/mediatek,mt8192-lvts.yaml
> > create mode 100644 Documentation/devicetree/bindings/thermal/mediatek,mt8195-lvts.yaml
> >
>
> My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
> on your patch (DT_CHECKER_FLAGS is new in v5.13):
>
> yamllint warnings/errors:
>
> dtschema/dtc warnings/errors:
> Error: Documentation/devicetree/bindings/thermal/mediatek,mt8195-lvts.example.dts:32.36-37 syntax error
> FATAL ERROR: Unable to parse input tree
> make[1]: *** [scripts/Makefile.lib:383: Documentation/devicetree/bindings/thermal/mediatek,mt8195-lvts.example.dtb] Error 1
> make[1]: *** Waiting for unfinished jobs....
> make: *** [Makefile:1404: dt_binding_check] Error 2
>
> doc reference errors (make refcheckdocs):
>
> See https://patchwork.ozlabs.org/patch/
>
> This check can fail if there are any dependencies. The base for a patch
> series is generally the most recent rc1.
>
> If you already ran 'make dt_binding_check' and didn't see the above
> error(s), then make sure 'yamllint' is installed and dt-schema is up to
> date:
>
> pip3 install dtschema --upgrade
>
> Please check and re-submit.
>
Hello Rob,
This error only appear when I apply my series directly on top of linux-5.19.rc8.
But, when I apply the other two series that mine depends on,
https://patchwork.kernel.org/project/linux-pm/cover/[email protected]/
https://patchwork.kernel.org/project/linux-mediatek/cover/[email protected]/
and run "dt_binding_check" again against my YAML file, it does not
print the error you found above.
Would you check it, please?
Thank you.
Best regards.
Balsam.
Hi Balsam,
On 29/07/2022 17:21, Balsam CHIHI wrote:
> On Fri, Jul 29, 2022 at 5:19 PM Balsam CHIHI <[email protected]> wrote:
[ ... ]
>>> config MTK_SOC_THERMAL
>>> tristate "Temperature sensor driver for MediaTek SoCs"
>>> depends on HAS_IOMEM
>>> depends on NVMEM
>>> depends on RESET_CONTROLLER
>>> help
>>> Enable this option if you want to get SoC temperature
>>> information for MediaTek platforms. This driver
>>> configures thermal controllers to collect temperature
>>> via AUXADC interface.
>>>
>>> drivers/thermal/mediatek/Makefile:
>>>
>>> obj-$(MTK_SOC_THERMAL) += soc_temp.o
>>>
>>> However, rename 'soc_temp' to something more SoC explicit, eg.
>>> mtxxx_thermal.c
>>>
>>> Thanks
>>>
>>> -- Daniel
>>
>> Hello Daniel,
>>
>> Thank you for the feedback.
>> Changes have been made as you suggested.
>> Resubmitting seen.
> *soon.
You may want to wait next week before sending a new version, I'm still
reviewing your series (note you can send it anyway if you prefer)
--
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs
Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
On Thu, Jul 28, 2022 at 10:53 AM Daniel Lezcano
<[email protected]> wrote:
>
>
> Hi Balsam,
>
> On 26/07/2022 15:55, Balsam CHIHI wrote:
> > Add Mediatek proprietary folder to upstream more thermal zone and cooler
> > drivers. Relocate the original thermal controller driver to it and rename
> > as soc_temp.c to show its purpose more clearly.
>
> I realize the Kconfig, Makefiles format are not consistent across the
> boards. Before I fix this, you can comply to the format:
>
> drivers/thermal/Kconfig:
>
> menu "Mediatek thermal drivers"
> depends on ARCH_MEDIATEK || COMPILE_TEST
> source "drivers/thermal/mediatek/Kconfig"
> endmenu
>
> drivers/thermal/Makefile:
>
> -obj-$(CONFIG_MTK_THERMAL) += mtk_thermal.o
> +obj-y += mediatek
>
> drivers/thermal/mediatek/Kconfig:
>
> config MTK_SOC_THERMAL
> tristate "Temperature sensor driver for MediaTek SoCs"
> depends on HAS_IOMEM
> depends on NVMEM
> depends on RESET_CONTROLLER
> help
> Enable this option if you want to get SoC temperature
> information for MediaTek platforms. This driver
> configures thermal controllers to collect temperature
> via AUXADC interface.
>
> drivers/thermal/mediatek/Makefile:
>
> obj-$(MTK_SOC_THERMAL) += soc_temp.o
>
> However, rename 'soc_temp' to something more SoC explicit, eg.
> mtxxx_thermal.c
>
> Thanks
>
> -- Daniel
Hello Daniel,
Thank you for the feedback.
Changes have been made as you suggested.
Resubmitting seen.
Best regards.
Balsam.
On Tue, Jul 26, 2022 at 03:55:00PM +0200, Balsam CHIHI wrote:
> This series moves thermal files related to MediaTek to the mediatek folder.
> And introduce the new architecture LVTS (low voltage thermal sensor) driver to report
> the highest temperature in the SoC and record the highest temperature sensor,
> each sensor as a hot zone.
> The LVTS body is divided into two parts, the LVTS controller and the LVTS device.
> The LVTS controller can connect up to 4 LVTS devices, and each LVTS device
> can connect up to 7 TSMCUs.
>
> The architecture will be the first to be used on mt8192 and mt8195.
>
> Changelog:
> Changes in v8:
> - Fix Coding style issues
> - Rebase to kernel-5.18.rc8
> - Rebase on top of these series :
> - [RESEND v8 00/19] Cleanup MediaTek clk reset drivers and support SoCs :
> https://lore.kernel.org/all/[email protected]/
> - [PATCH v6 00/12] thermal OF rework :
> https://lore.kernel.org/all/[email protected]/
> - Add multi-instance support and SRC Modularization :
> - Rewrite DTS and DT bindings
> - Add DT bindings for MT8195
> - One LVTS node for each HW Domain (AP and MCU)
> - One SW Instance for each HW Domain, for each SoC
> - Add an SRC file for each SoC (MT8192 and MT8195)
> - Add a Kconfig sub-menu entry for each SoC
> - Shrink LVTS instance iospace length from 0x1000 to 0x400
> - Replace platform_get_resource by platform_get_mem_or_io to get Base Address
> - Replace platform_get_resource by platform_get_irq to get Interrupt Number
> - Add "lvts_" prefix to functions and structs
>
> Changes in v7:
> - Fix coding style issues
> - Rewrite dt bindings
> - was not accurate
> - Use mt8195 for example (instead of mt8192)
> - Rename mt6873 to mt8192
> - Remove clock name
> - Rebased on top of to series:
> - https://patchwork.kernel.org/project/linux-mediatek/list/?series=637849
> - https://patchwork.kernel.org/project/linux-pm/list/?series=639386
>
> Changes in v6:
> - Remove temperature aggregation (it will be added in another series)
> - Update the way to read the temperature (read one sensor instead of all)
> - Add support of mt8195
>
> Changes in v5:
> - Use 'git mv' for the relocated file.
>
> Changes in v4:
> - Rebase to kernel-v5.13-rc1
> - Resend
>
> Changes in v3:
> - change the expression in the lvts_temp_to_raw to dev_s64.
>
> Changes in v2:
> - Rebase to kernel-5.11-rc1.
> - sort headers
> - remove initial value 0 of msr_raw in the lvts_temp_to_raw.
> - disconstruct the api of lvts_read_tc_msr_raw.
> - add the initial value max_temp = 0 and compare e.q.
> in the lvts_read_all_tc_temperature.
> - add the return with an invalid number in the lvts_init.
>
> This series depends on [1] and [2].
>
> [1]https://lore.kernel.org/all/[email protected]/
> [2]https://lore.kernel.org/all/[email protected]/
>
> Alexandre Bailon (2):
> dt-bindings: thermal: Add binding document for LVTS thermal
> controllers
> arm64: dts: mt8195: Add efuse node to mt8195
>
> Michael Kao (3):
> thermal: mediatek: Relocate driver to mediatek folder
> thermal: mediatek: Add LVTS drivers for SoC theraml zones for mt8192
> thermal: mediatek: Add thermal zone settings for mt8195
>
> Tinghan Shen (1):
> arm64: dts: mt8195: Add thermal zone
>
> .../thermal/mediatek,mt8192-lvts.yaml | 73 ++
> .../thermal/mediatek,mt8195-lvts.yaml | 75 ++
> arch/arm64/boot/dts/mediatek/mt8195.dtsi | 131 ++-
> drivers/thermal/Kconfig | 14 +-
> drivers/thermal/Makefile | 2 +-
> drivers/thermal/mediatek/Kconfig | 62 ++
> drivers/thermal/mediatek/Makefile | 4 +
> drivers/thermal/mediatek/lvts_mt8192.c | 241 +++++
> drivers/thermal/mediatek/lvts_mt8195.c | 253 +++++
> .../{mtk_thermal.c => mediatek/soc_temp.c} | 2 +-
> drivers/thermal/mediatek/soc_temp_lvts.c | 928 ++++++++++++++++++
> drivers/thermal/mediatek/soc_temp_lvts.h | 366 +++++++
> 12 files changed, 2138 insertions(+), 13 deletions(-)
> create mode 100644 Documentation/devicetree/bindings/thermal/mediatek,mt8192-lvts.yaml
> create mode 100644 Documentation/devicetree/bindings/thermal/mediatek,mt8195-lvts.yaml
> create mode 100644 drivers/thermal/mediatek/Kconfig
> create mode 100644 drivers/thermal/mediatek/Makefile
> create mode 100644 drivers/thermal/mediatek/lvts_mt8192.c
> create mode 100644 drivers/thermal/mediatek/lvts_mt8195.c
> rename drivers/thermal/{mtk_thermal.c => mediatek/soc_temp.c} (99%)
> create mode 100644 drivers/thermal/mediatek/soc_temp_lvts.c
> create mode 100644 drivers/thermal/mediatek/soc_temp_lvts.h
Given that you're adding a driver that supports both mt8192 and mt8195, and also
the DT thermal nodes for mt8195, maybe you could the DT nodes for mt8192 here as
well?
Thanks,
N?colas
On Fri, Jul 29, 2022 at 5:35 PM Daniel Lezcano
<[email protected]> wrote:
>
> Hi Balsam,
>
> On 29/07/2022 17:21, Balsam CHIHI wrote:
>
> [ ... ]
>
> You may want to wait next week before sending a new version, I'm still
> reviewing your series (note you can send it anyway if you prefer)
>
Hi Daniel,
Thank you for the review.
I have finished implementing the changes requested by the maintainers
and would like to resubmit the series.
Do I still have to wait for your feedback to send it again?
Best regards,
Balsam
Hi Balsam,
On 03/08/2022 10:41, Balsam CHIHI wrote:
> On Fri, Jul 29, 2022 at 5:35 PM Daniel Lezcano
> <[email protected]> wrote:
>>
>> Hi Balsam,
>>
>> On 29/07/2022 17:21, Balsam CHIHI wrote:
>>
>> [ ... ]
>>
>> You may want to wait next week before sending a new version, I'm still
>> reviewing your series (note you can send it anyway if you prefer)
>>
>
> Hi Daniel,
>
> Thank you for the review.
> I have finished implementing the changes requested by the maintainers
> and would like to resubmit the series.
> Do I still have to wait for your feedback to send it again?
At your convenience, I'll review the new version if you send it
--
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs
Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
On Fri, Jul 29, 2022 at 05:15:01PM +0200, Balsam CHIHI wrote:
> On Tue, Jul 26, 2022 at 10:09 PM Rob Herring <[email protected]> wrote:
> >
> > On Tue, 26 Jul 2022 15:55:02 +0200, Balsam CHIHI wrote:
> > > This patch adds dt-binding documents for mt8192 and mt8195 thermal controllers.
> > >
> > > Signed-off-by: Alexandre Bailon <[email protected]>
> > > Signed-off-by: Balsam CHIHI <[email protected]>
> > > ---
> > > .../thermal/mediatek,mt8192-lvts.yaml | 73 ++++++++++++++++++
> > > .../thermal/mediatek,mt8195-lvts.yaml | 75 +++++++++++++++++++
> > > 2 files changed, 148 insertions(+)
> > > create mode 100644 Documentation/devicetree/bindings/thermal/mediatek,mt8192-lvts.yaml
> > > create mode 100644 Documentation/devicetree/bindings/thermal/mediatek,mt8195-lvts.yaml
> > >
> >
> > My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check'
> > on your patch (DT_CHECKER_FLAGS is new in v5.13):
> >
> > yamllint warnings/errors:
> >
> > dtschema/dtc warnings/errors:
> > Error: Documentation/devicetree/bindings/thermal/mediatek,mt8195-lvts.example.dts:32.36-37 syntax error
> > FATAL ERROR: Unable to parse input tree
> > make[1]: *** [scripts/Makefile.lib:383: Documentation/devicetree/bindings/thermal/mediatek,mt8195-lvts.example.dtb] Error 1
> > make[1]: *** Waiting for unfinished jobs....
> > make: *** [Makefile:1404: dt_binding_check] Error 2
> >
> > doc reference errors (make refcheckdocs):
> >
> > See https://patchwork.ozlabs.org/patch/
> >
> > This check can fail if there are any dependencies. The base for a patch
> > series is generally the most recent rc1.
> >
> > If you already ran 'make dt_binding_check' and didn't see the above
> > error(s), then make sure 'yamllint' is installed and dt-schema is up to
> > date:
> >
> > pip3 install dtschema --upgrade
> >
> > Please check and re-submit.
> >
>
> Hello Rob,
>
> This error only appear when I apply my series directly on top of linux-5.19.rc8.
> But, when I apply the other two series that mine depends on,
>
> https://patchwork.kernel.org/project/linux-pm/cover/[email protected]/
> https://patchwork.kernel.org/project/linux-mediatek/cover/[email protected]/
How was I supposed to know that if you don't document that in the patch?
> and run "dt_binding_check" again against my YAML file, it does not
> print the error you found above.
> Would you check it, please?
No. Resend after rc1 and checks will be based on that.
Rob