linux-mediatek.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/4] add LVTS support for mt7988
@ 2023-09-20 17:49 Frank Wunderlich
  2023-09-20 17:49 ` [PATCH v2 1/4] dt-bindings: thermal: mediatek: add mt7988 lvts compatible Frank Wunderlich
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: Frank Wunderlich @ 2023-09-20 17:49 UTC (permalink / raw)
  To: linux-mediatek
  Cc: devicetree, Daniel Lezcano, Rafael J. Wysocki, linux-pm,
	Amit Kucheria, Conor Dooley, linux-kernel, Rob Herring,
	Krzysztof Kozlowski, Matthias Brugger, Zhang Rui,
	linux-arm-kernel, AngeloGioacchino Del Regno

From: Frank Wunderlich <frank-w@public-files.de>

This series makes allows soc specific temperature coefficients
and adds support for mt7988 which has a different one.

Frank Wunderlich (4):
  dt-bindings: thermal: mediatek: add mt7988 lvts compatible
  dt-bindings: thermal: mediatek: Add LVTS thermal sensors for mt7988
  thermal/drivers/mediatek/lvts_thermal: make coeff configurable
  thermal/drivers/mediatek/lvts_thermal: add mt7988 support

 .../thermal/mediatek,lvts-thermal.yaml        |  1 +
 drivers/thermal/mediatek/lvts_thermal.c       | 97 +++++++++++++++----
 .../thermal/mediatek,lvts-thermal.h           |  9 ++
 3 files changed, 90 insertions(+), 17 deletions(-)

-- 
2.34.1



^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH v2 1/4] dt-bindings: thermal: mediatek: add mt7988 lvts compatible
  2023-09-20 17:49 [PATCH v2 0/4] add LVTS support for mt7988 Frank Wunderlich
@ 2023-09-20 17:49 ` Frank Wunderlich
  2023-09-21  7:55   ` AngeloGioacchino Del Regno
  2023-09-21 10:06   ` Krzysztof Kozlowski
  2023-09-20 17:49 ` [PATCH v2 2/4] dt-bindings: thermal: mediatek: Add LVTS thermal sensors for mt7988 Frank Wunderlich
                   ` (2 subsequent siblings)
  3 siblings, 2 replies; 13+ messages in thread
From: Frank Wunderlich @ 2023-09-20 17:49 UTC (permalink / raw)
  To: linux-mediatek
  Cc: devicetree, Daniel Lezcano, Rafael J. Wysocki, linux-pm,
	Amit Kucheria, Conor Dooley, linux-kernel, Rob Herring,
	Krzysztof Kozlowski, Matthias Brugger, Zhang Rui,
	linux-arm-kernel, AngeloGioacchino Del Regno

From: Frank Wunderlich <frank-w@public-files.de>

Add compatible string for mt7988 lvts application processor.

Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
---
v2:
- change mt7988-lvts to mt7988-lvts-ap (Application Processor)
- not added Ack from Rob because of this change
---
 .../devicetree/bindings/thermal/mediatek,lvts-thermal.yaml       | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/thermal/mediatek,lvts-thermal.yaml b/Documentation/devicetree/bindings/thermal/mediatek,lvts-thermal.yaml
index fe9ae4c425c0..e6665af52ee6 100644
--- a/Documentation/devicetree/bindings/thermal/mediatek,lvts-thermal.yaml
+++ b/Documentation/devicetree/bindings/thermal/mediatek,lvts-thermal.yaml
@@ -18,6 +18,7 @@ description: |
 properties:
   compatible:
     enum:
+      - mediatek,mt7988-lvts-ap
       - mediatek,mt8192-lvts-ap
       - mediatek,mt8192-lvts-mcu
       - mediatek,mt8195-lvts-ap
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 2/4] dt-bindings: thermal: mediatek: Add LVTS thermal sensors for mt7988
  2023-09-20 17:49 [PATCH v2 0/4] add LVTS support for mt7988 Frank Wunderlich
  2023-09-20 17:49 ` [PATCH v2 1/4] dt-bindings: thermal: mediatek: add mt7988 lvts compatible Frank Wunderlich
@ 2023-09-20 17:49 ` Frank Wunderlich
  2023-09-21  7:55   ` AngeloGioacchino Del Regno
  2023-09-20 17:50 ` [PATCH v2 3/4] thermal/drivers/mediatek/lvts_thermal: make coeff configurable Frank Wunderlich
  2023-09-20 17:50 ` [PATCH v2 4/4] thermal/drivers/mediatek/lvts_thermal: add mt7988 support Frank Wunderlich
  3 siblings, 1 reply; 13+ messages in thread
From: Frank Wunderlich @ 2023-09-20 17:49 UTC (permalink / raw)
  To: linux-mediatek
  Cc: devicetree, Daniel Lezcano, Rafael J. Wysocki, linux-pm,
	Amit Kucheria, Conor Dooley, linux-kernel, Rob Herring,
	Krzysztof Kozlowski, Matthias Brugger, Zhang Rui,
	linux-arm-kernel, AngeloGioacchino Del Regno

From: Frank Wunderlich <frank-w@public-files.de>

Add sensor constants for MT7988.

Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
---
v2:
- new patch (moved from driver code to binding header)
- give sensors more meaningful names
---
 include/dt-bindings/thermal/mediatek,lvts-thermal.h | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/include/dt-bindings/thermal/mediatek,lvts-thermal.h b/include/dt-bindings/thermal/mediatek,lvts-thermal.h
index 8fa5a46675c4..8c1fdc18cf34 100644
--- a/include/dt-bindings/thermal/mediatek,lvts-thermal.h
+++ b/include/dt-bindings/thermal/mediatek,lvts-thermal.h
@@ -7,6 +7,15 @@
 #ifndef __MEDIATEK_LVTS_DT_H
 #define __MEDIATEK_LVTS_DT_H
 
+#define MT7988_CPU_0		0
+#define MT7988_CPU_1		1
+#define MT7988_ETH2P5G_0	2
+#define MT7988_ETH2P5G_1	3
+#define MT7988_TOPS_0		4
+#define MT7988_TOPS_1		5
+#define MT7988_ETHWARP_0	6
+#define MT7988_ETHWARP_1	7
+
 #define MT8195_MCU_BIG_CPU0     0
 #define MT8195_MCU_BIG_CPU1     1
 #define MT8195_MCU_BIG_CPU2     2
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 3/4] thermal/drivers/mediatek/lvts_thermal: make coeff configurable
  2023-09-20 17:49 [PATCH v2 0/4] add LVTS support for mt7988 Frank Wunderlich
  2023-09-20 17:49 ` [PATCH v2 1/4] dt-bindings: thermal: mediatek: add mt7988 lvts compatible Frank Wunderlich
  2023-09-20 17:49 ` [PATCH v2 2/4] dt-bindings: thermal: mediatek: Add LVTS thermal sensors for mt7988 Frank Wunderlich
@ 2023-09-20 17:50 ` Frank Wunderlich
  2023-09-21  7:54   ` AngeloGioacchino Del Regno
  2023-09-20 17:50 ` [PATCH v2 4/4] thermal/drivers/mediatek/lvts_thermal: add mt7988 support Frank Wunderlich
  3 siblings, 1 reply; 13+ messages in thread
From: Frank Wunderlich @ 2023-09-20 17:50 UTC (permalink / raw)
  To: linux-mediatek
  Cc: devicetree, Daniel Lezcano, Rafael J. Wysocki, linux-pm,
	Amit Kucheria, Conor Dooley, linux-kernel, Rob Herring,
	Krzysztof Kozlowski, Matthias Brugger, Zhang Rui,
	linux-arm-kernel, AngeloGioacchino Del Regno

From: Frank Wunderlich <frank-w@public-files.de>

The upcoming mt7988 has different temperature coefficients so we
cannot use constants in the functions lvts_golden_temp_init,
lvts_golden_temp_init and lvts_raw_to_temp anymore.

Add a field in the lvts_ctrl pointing to the lvts_data which now
contains the soc-specific temperature coefficents.

To make the code better readable, rename static int coeff_b to
golden_temp_offset, COEFF_A to temp_factor and COEFF_B to temp_offset.

Signed-off-by: Frank Wunderlich <frank-w@public-files.de>

---
v2:
- rename static int coeff_b to golden_temp_offset
- rename coeff.a to temp_factor and coeff.b to temp_offset
---
 drivers/thermal/mediatek/lvts_thermal.c | 51 ++++++++++++++++---------
 1 file changed, 34 insertions(+), 17 deletions(-)

diff --git a/drivers/thermal/mediatek/lvts_thermal.c b/drivers/thermal/mediatek/lvts_thermal.c
index effd9b00a424..c2669f405a94 100644
--- a/drivers/thermal/mediatek/lvts_thermal.c
+++ b/drivers/thermal/mediatek/lvts_thermal.c
@@ -80,8 +80,8 @@
 #define LVTS_SENSOR_MAX				4
 #define LVTS_GOLDEN_TEMP_MAX		62
 #define LVTS_GOLDEN_TEMP_DEFAULT	50
-#define LVTS_COEFF_A				-250460
-#define LVTS_COEFF_B				250460
+#define LVTS_COEFF_A_MT8195			-250460
+#define LVTS_COEFF_B_MT8195			250460
 
 #define LVTS_MSR_IMMEDIATE_MODE		0
 #define LVTS_MSR_FILTERED_MODE		1
@@ -94,7 +94,7 @@
 #define LVTS_MINIMUM_THRESHOLD		20000
 
 static int golden_temp = LVTS_GOLDEN_TEMP_DEFAULT;
-static int coeff_b = LVTS_COEFF_B;
+static int golden_temp_offset;
 
 struct lvts_sensor_data {
 	int dt_id;
@@ -112,6 +112,8 @@ struct lvts_ctrl_data {
 struct lvts_data {
 	const struct lvts_ctrl_data *lvts_ctrl;
 	int num_lvts_ctrl;
+	int temp_factor;
+	int temp_offset;
 };
 
 struct lvts_sensor {
@@ -126,6 +128,7 @@ struct lvts_sensor {
 
 struct lvts_ctrl {
 	struct lvts_sensor sensors[LVTS_SENSOR_MAX];
+	const struct lvts_data *lvts_data;
 	u32 calibration[LVTS_SENSOR_MAX];
 	u32 hw_tshut_raw_temp;
 	int num_lvts_sensor;
@@ -247,21 +250,21 @@ static void lvts_debugfs_exit(struct lvts_domain *lvts_td) { }
 
 #endif
 
-static int lvts_raw_to_temp(u32 raw_temp)
+static int lvts_raw_to_temp(u32 raw_temp, int temp_factor)
 {
 	int temperature;
 
-	temperature = ((s64)(raw_temp & 0xFFFF) * LVTS_COEFF_A) >> 14;
-	temperature += coeff_b;
+	temperature = ((s64)(raw_temp & 0xFFFF) * temp_factor) >> 14;
+	temperature += golden_temp_offset;
 
 	return temperature;
 }
 
-static u32 lvts_temp_to_raw(int temperature)
+static u32 lvts_temp_to_raw(int temperature, int temp_factor)
 {
-	u32 raw_temp = ((s64)(coeff_b - temperature)) << 14;
+	u32 raw_temp = ((s64)(golden_temp_offset - temperature)) << 14;
 
-	raw_temp = div_s64(raw_temp, -LVTS_COEFF_A);
+	raw_temp = div_s64(raw_temp, -temp_factor);
 
 	return raw_temp;
 }
@@ -269,6 +272,9 @@ static u32 lvts_temp_to_raw(int temperature)
 static int lvts_get_temp(struct thermal_zone_device *tz, int *temp)
 {
 	struct lvts_sensor *lvts_sensor = thermal_zone_device_priv(tz);
+	struct lvts_ctrl *lvts_ctrl = container_of(lvts_sensor, struct lvts_ctrl,
+						   sensors[lvts_sensor->id]);
+	const struct lvts_data *lvts_data = lvts_ctrl->lvts_data;
 	void __iomem *msr = lvts_sensor->msr;
 	u32 value;
 	int rc;
@@ -301,7 +307,7 @@ static int lvts_get_temp(struct thermal_zone_device *tz, int *temp)
 	if (rc)
 		return -EAGAIN;
 
-	*temp = lvts_raw_to_temp(value & 0xFFFF);
+	*temp = lvts_raw_to_temp(value & 0xFFFF, lvts_data->temp_factor);
 
 	return 0;
 }
@@ -348,10 +354,13 @@ static bool lvts_should_update_thresh(struct lvts_ctrl *lvts_ctrl, int high)
 static int lvts_set_trips(struct thermal_zone_device *tz, int low, int high)
 {
 	struct lvts_sensor *lvts_sensor = thermal_zone_device_priv(tz);
-	struct lvts_ctrl *lvts_ctrl = container_of(lvts_sensor, struct lvts_ctrl, sensors[lvts_sensor->id]);
+	struct lvts_ctrl *lvts_ctrl = container_of(lvts_sensor, struct lvts_ctrl,
+						   sensors[lvts_sensor->id]);
+	const struct lvts_data *lvts_data = lvts_ctrl->lvts_data;
 	void __iomem *base = lvts_sensor->base;
-	u32 raw_low = lvts_temp_to_raw(low != -INT_MAX ? low : LVTS_MINIMUM_THRESHOLD);
-	u32 raw_high = lvts_temp_to_raw(high);
+	u32 raw_low = lvts_temp_to_raw(low != -INT_MAX ? low : LVTS_MINIMUM_THRESHOLD,
+				       lvts_data->temp_factor);
+	u32 raw_high = lvts_temp_to_raw(high, lvts_data->temp_factor);
 	bool should_update_thresh;
 
 	lvts_sensor->low_thresh = low;
@@ -692,7 +701,7 @@ static int lvts_calibration_read(struct device *dev, struct lvts_domain *lvts_td
 	return 0;
 }
 
-static int lvts_golden_temp_init(struct device *dev, u32 *value)
+static int lvts_golden_temp_init(struct device *dev, u32 *value, int temp_offset)
 {
 	u32 gt;
 
@@ -701,7 +710,7 @@ static int lvts_golden_temp_init(struct device *dev, u32 *value)
 	if (gt && gt < LVTS_GOLDEN_TEMP_MAX)
 		golden_temp = gt;
 
-	coeff_b = golden_temp * 500 + LVTS_COEFF_B;
+	golden_temp_offset = golden_temp * 500 + temp_offset;
 
 	return 0;
 }
@@ -724,7 +733,7 @@ static int lvts_ctrl_init(struct device *dev, struct lvts_domain *lvts_td,
 	 * The golden temp information is contained in the first chunk
 	 * of efuse data.
 	 */
-	ret = lvts_golden_temp_init(dev, (u32 *)lvts_td->calib);
+	ret = lvts_golden_temp_init(dev, (u32 *)lvts_td->calib, lvts_data->temp_offset);
 	if (ret)
 		return ret;
 
@@ -735,6 +744,7 @@ static int lvts_ctrl_init(struct device *dev, struct lvts_domain *lvts_td,
 	for (i = 0; i < lvts_data->num_lvts_ctrl; i++) {
 
 		lvts_ctrl[i].base = lvts_td->base + lvts_data->lvts_ctrl[i].offset;
+		lvts_ctrl[i].lvts_data = lvts_data;
 
 		ret = lvts_sensor_init(dev, &lvts_ctrl[i],
 				       &lvts_data->lvts_ctrl[i]);
@@ -758,7 +768,8 @@ static int lvts_ctrl_init(struct device *dev, struct lvts_domain *lvts_td,
 		 * after initializing the calibration.
 		 */
 		lvts_ctrl[i].hw_tshut_raw_temp =
-			lvts_temp_to_raw(lvts_data->lvts_ctrl[i].hw_tshut_temp);
+			lvts_temp_to_raw(lvts_data->lvts_ctrl[i].hw_tshut_temp,
+					 lvts_data->temp_factor);
 
 		lvts_ctrl[i].low_thresh = INT_MIN;
 		lvts_ctrl[i].high_thresh = INT_MIN;
@@ -1223,6 +1234,8 @@ static int lvts_probe(struct platform_device *pdev)
 	if (irq < 0)
 		return irq;
 
+	golden_temp_offset = lvts_data->temp_offset;
+
 	ret = lvts_domain_init(dev, lvts_td, lvts_data);
 	if (ret)
 		return dev_err_probe(dev, ret, "Failed to initialize the lvts domain\n");
@@ -1338,11 +1351,15 @@ static const struct lvts_ctrl_data mt8195_lvts_ap_data_ctrl[] = {
 static const struct lvts_data mt8195_lvts_mcu_data = {
 	.lvts_ctrl	= mt8195_lvts_mcu_data_ctrl,
 	.num_lvts_ctrl	= ARRAY_SIZE(mt8195_lvts_mcu_data_ctrl),
+	.temp_factor	= LVTS_COEFF_A_MT8195,
+	.temp_offset	= LVTS_COEFF_B_MT8195,
 };
 
 static const struct lvts_data mt8195_lvts_ap_data = {
 	.lvts_ctrl	= mt8195_lvts_ap_data_ctrl,
 	.num_lvts_ctrl	= ARRAY_SIZE(mt8195_lvts_ap_data_ctrl),
+	.temp_factor	= LVTS_COEFF_A_MT8195,
+	.temp_offset	= LVTS_COEFF_B_MT8195,
 };
 
 static const struct of_device_id lvts_of_match[] = {
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH v2 4/4] thermal/drivers/mediatek/lvts_thermal: add mt7988 support
  2023-09-20 17:49 [PATCH v2 0/4] add LVTS support for mt7988 Frank Wunderlich
                   ` (2 preceding siblings ...)
  2023-09-20 17:50 ` [PATCH v2 3/4] thermal/drivers/mediatek/lvts_thermal: make coeff configurable Frank Wunderlich
@ 2023-09-20 17:50 ` Frank Wunderlich
  2023-09-21  7:54   ` AngeloGioacchino Del Regno
  3 siblings, 1 reply; 13+ messages in thread
From: Frank Wunderlich @ 2023-09-20 17:50 UTC (permalink / raw)
  To: linux-mediatek
  Cc: devicetree, Daniel Lezcano, Rafael J. Wysocki, linux-pm,
	Amit Kucheria, Conor Dooley, linux-kernel, Rob Herring,
	Krzysztof Kozlowski, Matthias Brugger, Zhang Rui,
	linux-arm-kernel, AngeloGioacchino Del Regno

From: Frank Wunderlich <frank-w@public-files.de>

Add Support for Mediatek Filogic 880/MT7988 LVTS.

Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
---
v2:
- use 105°C for hw shutdown
- move constants to binding file
- change coeff.a to temp_factor and coeff.b to temp_offset
- change to lvts to lvts-ap (Application Processor)
- drop comments about efuse offsets
- change comment of mt8195 to be similar to mt7988
---
 drivers/thermal/mediatek/lvts_thermal.c | 46 +++++++++++++++++++++++++
 1 file changed, 46 insertions(+)

diff --git a/drivers/thermal/mediatek/lvts_thermal.c b/drivers/thermal/mediatek/lvts_thermal.c
index c2669f405a94..8fd1dc5adb16 100644
--- a/drivers/thermal/mediatek/lvts_thermal.c
+++ b/drivers/thermal/mediatek/lvts_thermal.c
@@ -82,6 +82,8 @@
 #define LVTS_GOLDEN_TEMP_DEFAULT	50
 #define LVTS_COEFF_A_MT8195			-250460
 #define LVTS_COEFF_B_MT8195			250460
+#define LVTS_COEFF_A_MT7988			-204650
+#define LVTS_COEFF_B_MT7988			204650
 
 #define LVTS_MSR_IMMEDIATE_MODE		0
 #define LVTS_MSR_FILTERED_MODE		1
@@ -89,6 +91,7 @@
 #define LVTS_MSR_READ_TIMEOUT_US	400
 #define LVTS_MSR_READ_WAIT_US		(LVTS_MSR_READ_TIMEOUT_US / 2)
 
+#define LVTS_HW_SHUTDOWN_MT7988		105000
 #define LVTS_HW_SHUTDOWN_MT8195		105000
 
 #define LVTS_MINIMUM_THRESHOLD		20000
@@ -1269,6 +1272,41 @@ static int lvts_remove(struct platform_device *pdev)
 	return 0;
 }
 
+/*
+ * LVTS MT7988
+ */
+
+static const struct lvts_ctrl_data mt7988_lvts_ap_data_ctrl[] = {
+	{
+		.cal_offset = { 0x00, 0x04, 0x08, 0x0c }, //918,91C,920,924
+		.lvts_sensor = {
+			{ .dt_id = MT7988_CPU_0 }, // CPU 0,1
+			{ .dt_id = MT7988_CPU_1 }, // CPU 2,3
+			{ .dt_id = MT7988_ETH2P5G_0 }, // internal 2.5G Phy 1
+			{ .dt_id = MT7988_ETH2P5G_1 }  // internal 2.5G Phy 2
+		},
+		.num_lvts_sensor = 4,
+		.offset = 0x0,
+		.hw_tshut_temp = LVTS_HW_SHUTDOWN_MT7988,
+	},
+	{
+		.cal_offset = { 0x14, 0x18, 0x1c, 0x20 }, //92C,930,934,938
+		.lvts_sensor = {
+			{ .dt_id = MT7988_TOPS_0}, // TOPS
+			{ .dt_id = MT7988_TOPS_1}, // TOPS
+			{ .dt_id = MT7988_ETHWARP_0}, // WED 1
+			{ .dt_id = MT7988_ETHWARP_1}  // WED 2
+		},
+		.num_lvts_sensor = 4,
+		.offset = 0x100,
+		.hw_tshut_temp = LVTS_HW_SHUTDOWN_MT7988,
+	}
+};
+
+/*
+ * LVTS MT8195
+ */
+
 static const struct lvts_ctrl_data mt8195_lvts_mcu_data_ctrl[] = {
 	{
 		.cal_offset = { 0x04, 0x07 },
@@ -1348,6 +1386,13 @@ static const struct lvts_ctrl_data mt8195_lvts_ap_data_ctrl[] = {
 	}
 };
 
+static const struct lvts_data mt7988_lvts_ap_data = {
+	.lvts_ctrl	= mt7988_lvts_ap_data_ctrl,
+	.num_lvts_ctrl	= ARRAY_SIZE(mt7988_lvts_ap_data_ctrl),
+	.temp_factor	= LVTS_COEFF_A_MT7988,
+	.temp_offset	= LVTS_COEFF_B_MT7988,
+};
+
 static const struct lvts_data mt8195_lvts_mcu_data = {
 	.lvts_ctrl	= mt8195_lvts_mcu_data_ctrl,
 	.num_lvts_ctrl	= ARRAY_SIZE(mt8195_lvts_mcu_data_ctrl),
@@ -1363,6 +1408,7 @@ static const struct lvts_data mt8195_lvts_ap_data = {
 };
 
 static const struct of_device_id lvts_of_match[] = {
+	{ .compatible = "mediatek,mt7988-lvts-ap", .data = &mt7988_lvts_ap_data },
 	{ .compatible = "mediatek,mt8195-lvts-mcu", .data = &mt8195_lvts_mcu_data },
 	{ .compatible = "mediatek,mt8195-lvts-ap", .data = &mt8195_lvts_ap_data },
 	{},
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 4/4] thermal/drivers/mediatek/lvts_thermal: add mt7988 support
  2023-09-20 17:50 ` [PATCH v2 4/4] thermal/drivers/mediatek/lvts_thermal: add mt7988 support Frank Wunderlich
@ 2023-09-21  7:54   ` AngeloGioacchino Del Regno
  2023-09-21 10:39     ` Frank Wunderlich
  0 siblings, 1 reply; 13+ messages in thread
From: AngeloGioacchino Del Regno @ 2023-09-21  7:54 UTC (permalink / raw)
  To: Frank Wunderlich, linux-mediatek
  Cc: devicetree, Daniel Lezcano, Rafael J. Wysocki, linux-pm,
	Amit Kucheria, Conor Dooley, linux-kernel, Rob Herring,
	Krzysztof Kozlowski, Matthias Brugger, Zhang Rui,
	linux-arm-kernel

Il 20/09/23 19:50, Frank Wunderlich ha scritto:
> From: Frank Wunderlich <frank-w@public-files.de>
> 
> Add Support for Mediatek Filogic 880/MT7988 LVTS.
> 
> Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
> ---
> v2:
> - use 105°C for hw shutdown
> - move constants to binding file
> - change coeff.a to temp_factor and coeff.b to temp_offset
> - change to lvts to lvts-ap (Application Processor)
> - drop comments about efuse offsets
> - change comment of mt8195 to be similar to mt7988
> ---
>   drivers/thermal/mediatek/lvts_thermal.c | 46 +++++++++++++++++++++++++
>   1 file changed, 46 insertions(+)
> 
> diff --git a/drivers/thermal/mediatek/lvts_thermal.c b/drivers/thermal/mediatek/lvts_thermal.c
> index c2669f405a94..8fd1dc5adb16 100644
> --- a/drivers/thermal/mediatek/lvts_thermal.c
> +++ b/drivers/thermal/mediatek/lvts_thermal.c
> @@ -82,6 +82,8 @@
>   #define LVTS_GOLDEN_TEMP_DEFAULT	50
>   #define LVTS_COEFF_A_MT8195			-250460
>   #define LVTS_COEFF_B_MT8195			250460
> +#define LVTS_COEFF_A_MT7988			-204650
> +#define LVTS_COEFF_B_MT7988			204650
>   
>   #define LVTS_MSR_IMMEDIATE_MODE		0
>   #define LVTS_MSR_FILTERED_MODE		1
> @@ -89,6 +91,7 @@
>   #define LVTS_MSR_READ_TIMEOUT_US	400
>   #define LVTS_MSR_READ_WAIT_US		(LVTS_MSR_READ_TIMEOUT_US / 2)
>   
> +#define LVTS_HW_SHUTDOWN_MT7988		105000

I would simply reuse the definition of LVTS_HW_SHUTDOWN_MT8195....

>   #define LVTS_HW_SHUTDOWN_MT8195		105000
>   
>   #define LVTS_MINIMUM_THRESHOLD		20000
> @@ -1269,6 +1272,41 @@ static int lvts_remove(struct platform_device *pdev)
>   	return 0;
>   }
>   
> +/*
> + * LVTS MT7988
> + */
> +

Please remove this big comment block, that's not needed.

> +static const struct lvts_ctrl_data mt7988_lvts_ap_data_ctrl[] = {
> +	{
> +		.cal_offset = { 0x00, 0x04, 0x08, 0x0c }, //918,91C,920,924

This 918,91c,etc comment is not necessary

> +		.lvts_sensor = {
> +			{ .dt_id = MT7988_CPU_0 }, // CPU 0,1

If you want to retain those comments, you shall use the right style.

{ .dt_id = MT7988_CPU_0 }, /* CPU 0,1 */
{ .. } /* CPU 2,3 */
{ .. } /* Internal 2.5G PHY 1 */

etc

> +			{ .dt_id = MT7988_CPU_1 }, // CPU 2,3
> +			{ .dt_id = MT7988_ETH2P5G_0 }, // internal 2.5G Phy 1
> +			{ .dt_id = MT7988_ETH2P5G_1 }  // internal 2.5G Phy 2
> +		},
> +		.num_lvts_sensor = 4,
> +		.offset = 0x0,
> +		.hw_tshut_temp = LVTS_HW_SHUTDOWN_MT7988,
> +	},
> +	{
> +		.cal_offset = { 0x14, 0x18, 0x1c, 0x20 }, //92C,930,934,938

comment not needed

> +		.lvts_sensor = {
> +			{ .dt_id = MT7988_TOPS_0}, // TOPS > +			{ .dt_id = MT7988_TOPS_1}, // TOPS

The dt_id definition already says "TOPS", this comment is not needed.

> +			{ .dt_id = MT7988_ETHWARP_0}, // WED 1
> +			{ .dt_id = MT7988_ETHWARP_1}  // WED 2

Same comment about the format; /* WED 1 */

> +		},
> +		.num_lvts_sensor = 4,
> +		.offset = 0x100,
> +		.hw_tshut_temp = LVTS_HW_SHUTDOWN_MT7988,
> +	}
> +};
> +
> +/*
> + * LVTS MT8195
> + */

Please also remove this big comment block, it's not needed.

Apart from that, this patch looks good; v3 will be the golden one :-)

Cheers,
Angelo

> +
>   static const struct lvts_ctrl_data mt8195_lvts_mcu_data_ctrl[] = {
>   	{
>   		.cal_offset = { 0x04, 0x07 },
> @@ -1348,6 +1386,13 @@ static const struct lvts_ctrl_data mt8195_lvts_ap_data_ctrl[] = {
>   	}
>   };
>   
> +static const struct lvts_data mt7988_lvts_ap_data = {
> +	.lvts_ctrl	= mt7988_lvts_ap_data_ctrl,
> +	.num_lvts_ctrl	= ARRAY_SIZE(mt7988_lvts_ap_data_ctrl),
> +	.temp_factor	= LVTS_COEFF_A_MT7988,
> +	.temp_offset	= LVTS_COEFF_B_MT7988,
> +};
> +
>   static const struct lvts_data mt8195_lvts_mcu_data = {
>   	.lvts_ctrl	= mt8195_lvts_mcu_data_ctrl,
>   	.num_lvts_ctrl	= ARRAY_SIZE(mt8195_lvts_mcu_data_ctrl),
> @@ -1363,6 +1408,7 @@ static const struct lvts_data mt8195_lvts_ap_data = {
>   };
>   
>   static const struct of_device_id lvts_of_match[] = {
> +	{ .compatible = "mediatek,mt7988-lvts-ap", .data = &mt7988_lvts_ap_data },
>   	{ .compatible = "mediatek,mt8195-lvts-mcu", .data = &mt8195_lvts_mcu_data },
>   	{ .compatible = "mediatek,mt8195-lvts-ap", .data = &mt8195_lvts_ap_data },
>   	{},



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 3/4] thermal/drivers/mediatek/lvts_thermal: make coeff configurable
  2023-09-20 17:50 ` [PATCH v2 3/4] thermal/drivers/mediatek/lvts_thermal: make coeff configurable Frank Wunderlich
@ 2023-09-21  7:54   ` AngeloGioacchino Del Regno
  0 siblings, 0 replies; 13+ messages in thread
From: AngeloGioacchino Del Regno @ 2023-09-21  7:54 UTC (permalink / raw)
  To: Frank Wunderlich, linux-mediatek
  Cc: devicetree, Daniel Lezcano, Rafael J. Wysocki, linux-pm,
	Amit Kucheria, Conor Dooley, linux-kernel, Rob Herring,
	Krzysztof Kozlowski, Matthias Brugger, Zhang Rui,
	linux-arm-kernel

Il 20/09/23 19:50, Frank Wunderlich ha scritto:
> From: Frank Wunderlich <frank-w@public-files.de>
> 
> The upcoming mt7988 has different temperature coefficients so we
> cannot use constants in the functions lvts_golden_temp_init,
> lvts_golden_temp_init and lvts_raw_to_temp anymore.
> 
> Add a field in the lvts_ctrl pointing to the lvts_data which now
> contains the soc-specific temperature coefficents.
> 
> To make the code better readable, rename static int coeff_b to
> golden_temp_offset, COEFF_A to temp_factor and COEFF_B to temp_offset.
> 
> Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
> 

Now, that's good!

Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>




^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 1/4] dt-bindings: thermal: mediatek: add mt7988 lvts compatible
  2023-09-20 17:49 ` [PATCH v2 1/4] dt-bindings: thermal: mediatek: add mt7988 lvts compatible Frank Wunderlich
@ 2023-09-21  7:55   ` AngeloGioacchino Del Regno
  2023-09-21 10:06   ` Krzysztof Kozlowski
  1 sibling, 0 replies; 13+ messages in thread
From: AngeloGioacchino Del Regno @ 2023-09-21  7:55 UTC (permalink / raw)
  To: Frank Wunderlich, linux-mediatek
  Cc: devicetree, Daniel Lezcano, Rafael J. Wysocki, linux-pm,
	Amit Kucheria, Conor Dooley, linux-kernel, Rob Herring,
	Krzysztof Kozlowski, Matthias Brugger, Zhang Rui,
	linux-arm-kernel

Il 20/09/23 19:49, Frank Wunderlich ha scritto:
> From: Frank Wunderlich <frank-w@public-files.de>
> 
> Add compatible string for mt7988 lvts application processor.
> 
> Signed-off-by: Frank Wunderlich <frank-w@public-files.de>

Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>

> ---
> v2:
> - change mt7988-lvts to mt7988-lvts-ap (Application Processor)
> - not added Ack from Rob because of this change
> ---
>   .../devicetree/bindings/thermal/mediatek,lvts-thermal.yaml       | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/Documentation/devicetree/bindings/thermal/mediatek,lvts-thermal.yaml b/Documentation/devicetree/bindings/thermal/mediatek,lvts-thermal.yaml
> index fe9ae4c425c0..e6665af52ee6 100644
> --- a/Documentation/devicetree/bindings/thermal/mediatek,lvts-thermal.yaml
> +++ b/Documentation/devicetree/bindings/thermal/mediatek,lvts-thermal.yaml
> @@ -18,6 +18,7 @@ description: |
>   properties:
>     compatible:
>       enum:
> +      - mediatek,mt7988-lvts-ap
>         - mediatek,mt8192-lvts-ap
>         - mediatek,mt8192-lvts-mcu
>         - mediatek,mt8195-lvts-ap




^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 2/4] dt-bindings: thermal: mediatek: Add LVTS thermal sensors for mt7988
  2023-09-20 17:49 ` [PATCH v2 2/4] dt-bindings: thermal: mediatek: Add LVTS thermal sensors for mt7988 Frank Wunderlich
@ 2023-09-21  7:55   ` AngeloGioacchino Del Regno
  2023-09-21  9:16     ` Conor Dooley
  0 siblings, 1 reply; 13+ messages in thread
From: AngeloGioacchino Del Regno @ 2023-09-21  7:55 UTC (permalink / raw)
  To: Frank Wunderlich, linux-mediatek
  Cc: devicetree, Daniel Lezcano, Rafael J. Wysocki, linux-pm,
	Amit Kucheria, Conor Dooley, linux-kernel, Rob Herring,
	Krzysztof Kozlowski, Matthias Brugger, Zhang Rui,
	linux-arm-kernel

Il 20/09/23 19:49, Frank Wunderlich ha scritto:
> From: Frank Wunderlich <frank-w@public-files.de>
> 
> Add sensor constants for MT7988.
> 
> Signed-off-by: Frank Wunderlich <frank-w@public-files.de>

Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>

> ---
> v2:
> - new patch (moved from driver code to binding header)
> - give sensors more meaningful names
> ---
>   include/dt-bindings/thermal/mediatek,lvts-thermal.h | 9 +++++++++
>   1 file changed, 9 insertions(+)
> 
> diff --git a/include/dt-bindings/thermal/mediatek,lvts-thermal.h b/include/dt-bindings/thermal/mediatek,lvts-thermal.h
> index 8fa5a46675c4..8c1fdc18cf34 100644
> --- a/include/dt-bindings/thermal/mediatek,lvts-thermal.h
> +++ b/include/dt-bindings/thermal/mediatek,lvts-thermal.h
> @@ -7,6 +7,15 @@
>   #ifndef __MEDIATEK_LVTS_DT_H
>   #define __MEDIATEK_LVTS_DT_H
>   
> +#define MT7988_CPU_0		0
> +#define MT7988_CPU_1		1
> +#define MT7988_ETH2P5G_0	2
> +#define MT7988_ETH2P5G_1	3
> +#define MT7988_TOPS_0		4
> +#define MT7988_TOPS_1		5
> +#define MT7988_ETHWARP_0	6
> +#define MT7988_ETHWARP_1	7
> +
>   #define MT8195_MCU_BIG_CPU0     0
>   #define MT8195_MCU_BIG_CPU1     1
>   #define MT8195_MCU_BIG_CPU2     2



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 2/4] dt-bindings: thermal: mediatek: Add LVTS thermal sensors for mt7988
  2023-09-21  7:55   ` AngeloGioacchino Del Regno
@ 2023-09-21  9:16     ` Conor Dooley
  0 siblings, 0 replies; 13+ messages in thread
From: Conor Dooley @ 2023-09-21  9:16 UTC (permalink / raw)
  To: AngeloGioacchino Del Regno
  Cc: devicetree, Daniel Lezcano, Rafael J. Wysocki, linux-pm,
	Amit Kucheria, Conor Dooley, linux-kernel, Rob Herring,
	linux-mediatek, Krzysztof Kozlowski, Matthias Brugger,
	Frank Wunderlich, Zhang Rui, linux-arm-kernel

[-- Attachment #1: Type: text/plain, Size: 460 bytes --]

On Thu, Sep 21, 2023 at 09:55:46AM +0200, AngeloGioacchino Del Regno wrote:
> Il 20/09/23 19:49, Frank Wunderlich ha scritto:
> > From: Frank Wunderlich <frank-w@public-files.de>
> > 
> > Add sensor constants for MT7988.
> > 
> > Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
> 
> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>

Acked-by: Conor Dooley <conor.dooley@microchip.com>

Thanks,
Conor.


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 1/4] dt-bindings: thermal: mediatek: add mt7988 lvts compatible
  2023-09-20 17:49 ` [PATCH v2 1/4] dt-bindings: thermal: mediatek: add mt7988 lvts compatible Frank Wunderlich
  2023-09-21  7:55   ` AngeloGioacchino Del Regno
@ 2023-09-21 10:06   ` Krzysztof Kozlowski
  1 sibling, 0 replies; 13+ messages in thread
From: Krzysztof Kozlowski @ 2023-09-21 10:06 UTC (permalink / raw)
  To: Frank Wunderlich, linux-mediatek
  Cc: devicetree, Daniel Lezcano, Rafael J. Wysocki, linux-pm,
	Amit Kucheria, Conor Dooley, linux-kernel, Rob Herring,
	Krzysztof Kozlowski, Matthias Brugger, Zhang Rui,
	linux-arm-kernel, AngeloGioacchino Del Regno

On 20/09/2023 19:49, Frank Wunderlich wrote:
> From: Frank Wunderlich <frank-w@public-files.de>
> 
> Add compatible string for mt7988 lvts application processor.
> 
> Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
> ---


Acked-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>

Best regards,
Krzysztof



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 4/4] thermal/drivers/mediatek/lvts_thermal: add mt7988 support
  2023-09-21  7:54   ` AngeloGioacchino Del Regno
@ 2023-09-21 10:39     ` Frank Wunderlich
  2023-09-21 11:17       ` AngeloGioacchino Del Regno
  0 siblings, 1 reply; 13+ messages in thread
From: Frank Wunderlich @ 2023-09-21 10:39 UTC (permalink / raw)
  To: AngeloGioacchino Del Regno, linux-mediatek
  Cc: devicetree, Daniel Lezcano, Rafael J. Wysocki, linux-pm,
	Amit Kucheria, Conor Dooley, linux-kernel, Rob Herring,
	Krzysztof Kozlowski, Matthias Brugger, Zhang Rui,
	linux-arm-kernel

Am 21. September 2023 09:54:35 MESZ schrieb AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>:
>Il 20/09/23 19:50, Frank Wunderlich ha scritto:
>> From: Frank Wunderlich <frank-w@public-files.de>
 
>> diff --git a/drivers/thermal/mediatek/lvts_thermal.c b/drivers/thermal/mediatek/lvts_thermal.c
>> index c2669f405a94..8fd1dc5adb16 100644
>> --- a/drivers/thermal/mediatek/lvts_thermal.c
>> +++ b/drivers/thermal/mediatek/lvts_thermal.c
>> @@ -82,6 +82,8 @@
>>   #define LVTS_GOLDEN_TEMP_DEFAULT	50
>>   #define LVTS_COEFF_A_MT8195			-250460
>>   #define LVTS_COEFF_B_MT8195			250460
>> +#define LVTS_COEFF_A_MT7988			-204650
>> +#define LVTS_COEFF_B_MT7988			204650
>>     #define LVTS_MSR_IMMEDIATE_MODE		0
>>   #define LVTS_MSR_FILTERED_MODE		1
>> @@ -89,6 +91,7 @@
>>   #define LVTS_MSR_READ_TIMEOUT_US	400
>>   #define LVTS_MSR_READ_WAIT_US		(LVTS_MSR_READ_TIMEOUT_US / 2)
>>   +#define LVTS_HW_SHUTDOWN_MT7988		105000
>
>I would simply reuse the definition of LVTS_HW_SHUTDOWN_MT8195....

Hi angelo,
thanks for review.

Imho it should be separated...if someone thinks it needs to be changed later it will be changed not only for mt8195...a generic name can also cause problems if the next soc has different value.

>>   #define LVTS_HW_SHUTDOWN_MT8195		105000
>>     #define LVTS_MINIMUM_THRESHOLD		20000
>> @@ -1269,6 +1272,41 @@ static int lvts_remove(struct platform_device *pdev)
>>   	return 0;
>>   }
>>   +/*
>> + * LVTS MT7988
>> + */
>> +
>
>Please remove this big comment block, that's not needed.

Ok,i drop the comments (maybe except the wed one where the name in technical document (i used for constants) does not point to wed function.

>> +static const struct lvts_ctrl_data mt7988_lvts_ap_data_ctrl[] = {
>> +	{
>> +		.cal_offset = { 0x00, 0x04, 0x08, 0x0c }, //918,91C,920,924
>
>This 918,91c,etc comment is not necessary
>
>> +		.lvts_sensor = {
>> +			{ .dt_id = MT7988_CPU_0 }, // CPU 0,1
>
>If you want to retain those comments, you shall use the right style.
>
>{ .dt_id = MT7988_CPU_0 }, /* CPU 0,1 */
>{ .. } /* CPU 2,3 */
>{ .. } /* Internal 2.5G PHY 1 */
>
>etc
>
>> +			{ .dt_id = MT7988_CPU_1 }, // CPU 2,3
>> +			{ .dt_id = MT7988_ETH2P5G_0 }, // internal 2.5G Phy 1
>> +			{ .dt_id = MT7988_ETH2P5G_1 }  // internal 2.5G Phy 2
>> +		},
>> +		.num_lvts_sensor = 4,
>> +		.offset = 0x0,
>> +		.hw_tshut_temp = LVTS_HW_SHUTDOWN_MT7988,
>> +	},
>> +	{
>> +		.cal_offset = { 0x14, 0x18, 0x1c, 0x20 }, //92C,930,934,938
>
>comment not needed
>
>> +		.lvts_sensor = {
>> +			{ .dt_id = MT7988_TOPS_0}, // TOPS > +			{ .dt_id = MT7988_TOPS_1}, // TOPS
>
>The dt_id definition already says "TOPS", this comment is not needed.
>
>> +			{ .dt_id = MT7988_ETHWARP_0}, // WED 1
>> +			{ .dt_id = MT7988_ETHWARP_1}  // WED 2
>
>Same comment about the format; /* WED 1 */
>
>> +		},
>> +		.num_lvts_sensor = 4,
>> +		.offset = 0x100,
>> +		.hw_tshut_temp = LVTS_HW_SHUTDOWN_MT7988,
>> +	}
>> +};
>> +
>> +/*
>> + * LVTS MT8195
>> + */
>
>Please also remove this big comment block, it's not needed.
>
>Apart from that, this patch looks good; v3 will be the golden one :-)
>
>Cheers,
>Angelo
>

regards Frank


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH v2 4/4] thermal/drivers/mediatek/lvts_thermal: add mt7988 support
  2023-09-21 10:39     ` Frank Wunderlich
@ 2023-09-21 11:17       ` AngeloGioacchino Del Regno
  0 siblings, 0 replies; 13+ messages in thread
From: AngeloGioacchino Del Regno @ 2023-09-21 11:17 UTC (permalink / raw)
  To: Frank Wunderlich, linux-mediatek
  Cc: devicetree, Daniel Lezcano, Rafael J. Wysocki, linux-pm,
	Amit Kucheria, Conor Dooley, linux-kernel, Rob Herring,
	Krzysztof Kozlowski, Matthias Brugger, Zhang Rui,
	linux-arm-kernel

Il 21/09/23 12:39, Frank Wunderlich ha scritto:
> Am 21. September 2023 09:54:35 MESZ schrieb AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>:
>> Il 20/09/23 19:50, Frank Wunderlich ha scritto:
>>> From: Frank Wunderlich <frank-w@public-files.de>
>   
>>> diff --git a/drivers/thermal/mediatek/lvts_thermal.c b/drivers/thermal/mediatek/lvts_thermal.c
>>> index c2669f405a94..8fd1dc5adb16 100644
>>> --- a/drivers/thermal/mediatek/lvts_thermal.c
>>> +++ b/drivers/thermal/mediatek/lvts_thermal.c
>>> @@ -82,6 +82,8 @@
>>>    #define LVTS_GOLDEN_TEMP_DEFAULT	50
>>>    #define LVTS_COEFF_A_MT8195			-250460
>>>    #define LVTS_COEFF_B_MT8195			250460
>>> +#define LVTS_COEFF_A_MT7988			-204650
>>> +#define LVTS_COEFF_B_MT7988			204650
>>>      #define LVTS_MSR_IMMEDIATE_MODE		0
>>>    #define LVTS_MSR_FILTERED_MODE		1
>>> @@ -89,6 +91,7 @@
>>>    #define LVTS_MSR_READ_TIMEOUT_US	400
>>>    #define LVTS_MSR_READ_WAIT_US		(LVTS_MSR_READ_TIMEOUT_US / 2)
>>>    +#define LVTS_HW_SHUTDOWN_MT7988		105000
>>
>> I would simply reuse the definition of LVTS_HW_SHUTDOWN_MT8195....
> 
> Hi angelo,
> thanks for review.
> 
> Imho it should be separated...if someone thinks it needs to be changed later it will be changed not only for mt8195...a generic name can also cause problems if the next soc has different value.
> 

Okay, I don't really have strong opinions against that anyway.

Cheers
Angelo

>>>    #define LVTS_HW_SHUTDOWN_MT8195		105000
>>>      #define LVTS_MINIMUM_THRESHOLD		20000
>>> @@ -1269,6 +1272,41 @@ static int lvts_remove(struct platform_device *pdev)
>>>    	return 0;
>>>    }
>>>    +/*
>>> + * LVTS MT7988
>>> + */
>>> +
>>
>> Please remove this big comment block, that's not needed.
> 
> Ok,i drop the comments (maybe except the wed one where the name in technical document (i used for constants) does not point to wed function.
> 
>>> +static const struct lvts_ctrl_data mt7988_lvts_ap_data_ctrl[] = {
>>> +	{
>>> +		.cal_offset = { 0x00, 0x04, 0x08, 0x0c }, //918,91C,920,924
>>
>> This 918,91c,etc comment is not necessary
>>
>>> +		.lvts_sensor = {
>>> +			{ .dt_id = MT7988_CPU_0 }, // CPU 0,1
>>
>> If you want to retain those comments, you shall use the right style.
>>
>> { .dt_id = MT7988_CPU_0 }, /* CPU 0,1 */
>> { .. } /* CPU 2,3 */
>> { .. } /* Internal 2.5G PHY 1 */
>>
>> etc
>>
>>> +			{ .dt_id = MT7988_CPU_1 }, // CPU 2,3
>>> +			{ .dt_id = MT7988_ETH2P5G_0 }, // internal 2.5G Phy 1
>>> +			{ .dt_id = MT7988_ETH2P5G_1 }  // internal 2.5G Phy 2
>>> +		},
>>> +		.num_lvts_sensor = 4,
>>> +		.offset = 0x0,
>>> +		.hw_tshut_temp = LVTS_HW_SHUTDOWN_MT7988,
>>> +	},
>>> +	{
>>> +		.cal_offset = { 0x14, 0x18, 0x1c, 0x20 }, //92C,930,934,938
>>
>> comment not needed
>>
>>> +		.lvts_sensor = {
>>> +			{ .dt_id = MT7988_TOPS_0}, // TOPS > +			{ .dt_id = MT7988_TOPS_1}, // TOPS
>>
>> The dt_id definition already says "TOPS", this comment is not needed.
>>
>>> +			{ .dt_id = MT7988_ETHWARP_0}, // WED 1
>>> +			{ .dt_id = MT7988_ETHWARP_1}  // WED 2
>>
>> Same comment about the format; /* WED 1 */
>>
>>> +		},
>>> +		.num_lvts_sensor = 4,
>>> +		.offset = 0x100,
>>> +		.hw_tshut_temp = LVTS_HW_SHUTDOWN_MT7988,
>>> +	}
>>> +};
>>> +
>>> +/*
>>> + * LVTS MT8195
>>> + */
>>
>> Please also remove this big comment block, it's not needed.
>>
>> Apart from that, this patch looks good; v3 will be the golden one :-)
>>
>> Cheers,
>> Angelo
>>
> 
> regards Frank





^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2023-09-21 11:17 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-20 17:49 [PATCH v2 0/4] add LVTS support for mt7988 Frank Wunderlich
2023-09-20 17:49 ` [PATCH v2 1/4] dt-bindings: thermal: mediatek: add mt7988 lvts compatible Frank Wunderlich
2023-09-21  7:55   ` AngeloGioacchino Del Regno
2023-09-21 10:06   ` Krzysztof Kozlowski
2023-09-20 17:49 ` [PATCH v2 2/4] dt-bindings: thermal: mediatek: Add LVTS thermal sensors for mt7988 Frank Wunderlich
2023-09-21  7:55   ` AngeloGioacchino Del Regno
2023-09-21  9:16     ` Conor Dooley
2023-09-20 17:50 ` [PATCH v2 3/4] thermal/drivers/mediatek/lvts_thermal: make coeff configurable Frank Wunderlich
2023-09-21  7:54   ` AngeloGioacchino Del Regno
2023-09-20 17:50 ` [PATCH v2 4/4] thermal/drivers/mediatek/lvts_thermal: add mt7988 support Frank Wunderlich
2023-09-21  7:54   ` AngeloGioacchino Del Regno
2023-09-21 10:39     ` Frank Wunderlich
2023-09-21 11:17       ` AngeloGioacchino Del Regno

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).