linux-mediatek.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/4] Add mt7986 thermal
@ 2023-05-30 20:12 Frank Wunderlich
  2023-05-30 20:12 ` [PATCH v3 1/4] dt-bindings: nvmem: mediatek: efuse: add support for mt7986 Frank Wunderlich
                   ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Frank Wunderlich @ 2023-05-30 20:12 UTC (permalink / raw)
  To: linux-mediatek
  Cc: Andrew-CT Chen, Lars-Peter Clausen, Lala Lin, linux-iio,
	Zhiyong Tao, Hui.Liu, linux-kernel, Daniel Golle, devicetree,
	Rob Herring, Srinivas Kandagatla, linux-arm-kernel,
	Krzysztof Kozlowski, Matthias Brugger, Jonathan Cameron,
	AngeloGioacchino Del Regno

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

This series add thermal related devicetree-nodes and necessary
dt-bindings.

I left pwm-fan for r3 for now as i cannot test this completely due to
missing 2 pin-jack and 3v3 pwm-level which my fan cannot handle (starts
spinning at ~3V). Only checked voltage of pwm there.

changes in v3:
- efuse compatibles into one line

changes in v2:
- drop highest 2 trip points as they are not yet used
- leave already applied patches

Daniel Golle (3):
  arm64: dts: mt7986: add thermal and efuse
  arm64: dts: mt7986: add thermal-zones
  arm64: dts: mt7986: add pwm-fan and cooling-maps to BPI-R3 dts

Frank Wunderlich (1):
  dt-bindings: nvmem: mediatek: efuse: add support for mt7986

 .../bindings/nvmem/mediatek,efuse.yaml        |  1 +
 .../dts/mediatek/mt7986a-bananapi-bpi-r3.dts  | 31 ++++++++++
 arch/arm64/boot/dts/mediatek/mt7986a.dtsi     | 62 +++++++++++++++++++
 3 files changed, 94 insertions(+)

-- 
2.34.1



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

* [PATCH v3 1/4] dt-bindings: nvmem: mediatek: efuse: add support for mt7986
  2023-05-30 20:12 [PATCH v3 0/4] Add mt7986 thermal Frank Wunderlich
@ 2023-05-30 20:12 ` Frank Wunderlich
  2023-05-31 13:05   ` AngeloGioacchino Del Regno
  2023-05-30 20:12 ` [PATCH v3 2/4] arm64: dts: mt7986: add thermal and efuse Frank Wunderlich
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 7+ messages in thread
From: Frank Wunderlich @ 2023-05-30 20:12 UTC (permalink / raw)
  To: linux-mediatek
  Cc: Andrew-CT Chen, Lars-Peter Clausen, Lala Lin, linux-iio,
	Zhiyong Tao, Hui.Liu, linux-kernel, Daniel Golle, devicetree,
	Rob Herring, Srinivas Kandagatla, linux-arm-kernel,
	Krzysztof Kozlowski, Matthias Brugger, Rob Herring,
	Jonathan Cameron, AngeloGioacchino Del Regno

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

Add compatible string for mt7986 SoC.

Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
Acked-by: Rob Herring <robh@kernel.org>
---
 Documentation/devicetree/bindings/nvmem/mediatek,efuse.yaml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/nvmem/mediatek,efuse.yaml b/Documentation/devicetree/bindings/nvmem/mediatek,efuse.yaml
index d16d42fb98b6..7ec2988b597e 100644
--- a/Documentation/devicetree/bindings/nvmem/mediatek,efuse.yaml
+++ b/Documentation/devicetree/bindings/nvmem/mediatek,efuse.yaml
@@ -27,6 +27,7 @@ properties:
           - enum:
               - mediatek,mt7622-efuse
               - mediatek,mt7623-efuse
+              - mediatek,mt7986-efuse
               - mediatek,mt8173-efuse
               - mediatek,mt8183-efuse
               - mediatek,mt8186-efuse
-- 
2.34.1



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

* [PATCH v3 2/4] arm64: dts: mt7986: add thermal and efuse
  2023-05-30 20:12 [PATCH v3 0/4] Add mt7986 thermal Frank Wunderlich
  2023-05-30 20:12 ` [PATCH v3 1/4] dt-bindings: nvmem: mediatek: efuse: add support for mt7986 Frank Wunderlich
@ 2023-05-30 20:12 ` Frank Wunderlich
  2023-05-30 20:12 ` [PATCH v3 3/4] arm64: dts: mt7986: add thermal-zones Frank Wunderlich
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Frank Wunderlich @ 2023-05-30 20:12 UTC (permalink / raw)
  To: linux-mediatek
  Cc: Andrew-CT Chen, Lars-Peter Clausen, Lala Lin, linux-iio,
	Zhiyong Tao, Hui.Liu, linux-kernel, Daniel Golle, devicetree,
	Rob Herring, Srinivas Kandagatla, linux-arm-kernel,
	Krzysztof Kozlowski, Matthias Brugger, Jonathan Cameron,
	AngeloGioacchino Del Regno

From: Daniel Golle <daniel@makrotopia.org>

Add thermal related nodes to mt7986 devicetree.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
changes in v3:
- efuse compatibles in one line
---
 arch/arm64/boot/dts/mediatek/mt7986a.dtsi | 36 ++++++++++++++++++++++-
 1 file changed, 35 insertions(+), 1 deletion(-)

diff --git a/arch/arm64/boot/dts/mediatek/mt7986a.dtsi b/arch/arm64/boot/dts/mediatek/mt7986a.dtsi
index aa9e679b78e2..ad4fd77b65a7 100644
--- a/arch/arm64/boot/dts/mediatek/mt7986a.dtsi
+++ b/arch/arm64/boot/dts/mediatek/mt7986a.dtsi
@@ -337,6 +337,15 @@ spi1: spi@1100b000 {
 			status = "disabled";
 		};
 
+		auxadc: adc@1100d000 {
+			compatible = "mediatek,mt7986-auxadc";
+			reg = <0 0x1100d000 0 0x1000>;
+			clocks = <&infracfg CLK_INFRA_ADC_26M_CK>;
+			clock-names = "main";
+			#io-channel-cells = <1>;
+			status = "disabled";
+		};
+
 		ssusb: usb@11200000 {
 			compatible = "mediatek,mt7986-xhci",
 				     "mediatek,mtk-xhci";
@@ -375,6 +384,21 @@ mmc0: mmc@11230000 {
 			status = "disabled";
 		};
 
+		thermal: thermal@1100c800 {
+			#thermal-sensor-cells = <1>;
+			compatible = "mediatek,mt7986-thermal";
+			reg = <0 0x1100c800 0 0x800>;
+			interrupts = <GIC_SPI 138 IRQ_TYPE_LEVEL_HIGH>;
+			clocks = <&infracfg CLK_INFRA_THERM_CK>,
+				 <&infracfg CLK_INFRA_ADC_26M_CK>,
+				 <&infracfg CLK_INFRA_ADC_FRC_CK>;
+			clock-names = "therm", "auxadc", "adc_32k";
+			mediatek,auxadc = <&auxadc>;
+			mediatek,apmixedsys = <&apmixedsys>;
+			nvmem-cells = <&thermal_calibration>;
+			nvmem-cell-names = "calibration-data";
+		};
+
 		pcie: pcie@11280000 {
 			compatible = "mediatek,mt7986-pcie",
 				     "mediatek,mt8192-pcie";
@@ -426,6 +450,17 @@ pcie_port: pcie-phy@11c00000 {
 			};
 		};
 
+		efuse: efuse@11d00000 {
+			compatible = "mediatek,mt7986-efuse", "mediatek,efuse";
+			reg = <0 0x11d00000 0 0x1000>;
+			#address-cells = <1>;
+			#size-cells = <1>;
+
+			thermal_calibration: calib@274 {
+				reg = <0x274 0xc>;
+			};
+		};
+
 		usb_phy: t-phy@11e10000 {
 			compatible = "mediatek,mt7986-tphy",
 				     "mediatek,generic-tphy-v2";
@@ -567,5 +602,4 @@ wifi: wifi@18000000 {
 			memory-region = <&wmcpu_emi>;
 		};
 	};
-
 };
-- 
2.34.1



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

* [PATCH v3 3/4] arm64: dts: mt7986: add thermal-zones
  2023-05-30 20:12 [PATCH v3 0/4] Add mt7986 thermal Frank Wunderlich
  2023-05-30 20:12 ` [PATCH v3 1/4] dt-bindings: nvmem: mediatek: efuse: add support for mt7986 Frank Wunderlich
  2023-05-30 20:12 ` [PATCH v3 2/4] arm64: dts: mt7986: add thermal and efuse Frank Wunderlich
@ 2023-05-30 20:12 ` Frank Wunderlich
  2023-05-30 20:12 ` [PATCH v3 4/4] arm64: dts: mt7986: add pwm-fan and cooling-maps to BPI-R3 dts Frank Wunderlich
  2023-05-31 13:44 ` (subset) [PATCH v3 0/4] Add mt7986 thermal Srinivas Kandagatla
  4 siblings, 0 replies; 7+ messages in thread
From: Frank Wunderlich @ 2023-05-30 20:12 UTC (permalink / raw)
  To: linux-mediatek
  Cc: Andrew-CT Chen, Lars-Peter Clausen, Lala Lin, linux-iio,
	Zhiyong Tao, Hui.Liu, linux-kernel, Daniel Golle, devicetree,
	Rob Herring, Srinivas Kandagatla, linux-arm-kernel,
	Krzysztof Kozlowski, Matthias Brugger, Jonathan Cameron,
	AngeloGioacchino Del Regno

From: Daniel Golle <daniel@makrotopia.org>

Add thermal-zones to mt7986 devicetree.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
changes in v2:
- drop top 2 thermal trips as suggested by matthias
---
 arch/arm64/boot/dts/mediatek/mt7986a.dtsi | 28 +++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/arch/arm64/boot/dts/mediatek/mt7986a.dtsi b/arch/arm64/boot/dts/mediatek/mt7986a.dtsi
index ad4fd77b65a7..68539ea788df 100644
--- a/arch/arm64/boot/dts/mediatek/mt7986a.dtsi
+++ b/arch/arm64/boot/dts/mediatek/mt7986a.dtsi
@@ -602,4 +602,32 @@ wifi: wifi@18000000 {
 			memory-region = <&wmcpu_emi>;
 		};
 	};
+
+	thermal-zones {
+		cpu_thermal: cpu-thermal {
+			polling-delay-passive = <1000>;
+			polling-delay = <1000>;
+			thermal-sensors = <&thermal 0>;
+
+			trips {
+				cpu_trip_active_high: active-high {
+					temperature = <115000>;
+					hysteresis = <2000>;
+					type = "active";
+				};
+
+				cpu_trip_active_low: active-low {
+					temperature = <85000>;
+					hysteresis = <2000>;
+					type = "active";
+				};
+
+				cpu_trip_passive: passive {
+					temperature = <40000>;
+					hysteresis = <2000>;
+					type = "passive";
+				};
+			};
+		};
+	};
 };
-- 
2.34.1



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

* [PATCH v3 4/4] arm64: dts: mt7986: add pwm-fan and cooling-maps to BPI-R3 dts
  2023-05-30 20:12 [PATCH v3 0/4] Add mt7986 thermal Frank Wunderlich
                   ` (2 preceding siblings ...)
  2023-05-30 20:12 ` [PATCH v3 3/4] arm64: dts: mt7986: add thermal-zones Frank Wunderlich
@ 2023-05-30 20:12 ` Frank Wunderlich
  2023-05-31 13:44 ` (subset) [PATCH v3 0/4] Add mt7986 thermal Srinivas Kandagatla
  4 siblings, 0 replies; 7+ messages in thread
From: Frank Wunderlich @ 2023-05-30 20:12 UTC (permalink / raw)
  To: linux-mediatek
  Cc: Andrew-CT Chen, Lars-Peter Clausen, Lala Lin, linux-iio,
	Zhiyong Tao, Hui.Liu, linux-kernel, Daniel Golle, devicetree,
	Rob Herring, Srinivas Kandagatla, linux-arm-kernel,
	Krzysztof Kozlowski, Matthias Brugger, Jonathan Cameron,
	AngeloGioacchino Del Regno

From: Daniel Golle <daniel@makrotopia.org>

Add pwm-fan and cooling-maps to BananaPi-R3 devicetree.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
---
this is based on Patch from openwrt. as my PWM-fan seems to need 5v pwm
signal and r3 only provides 3v3 on 3pin-socket it does not work for me.
---
 .../dts/mediatek/mt7986a-bananapi-bpi-r3.dts  | 31 +++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3.dts b/arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3.dts
index 782519429497..29c018bbf29d 100644
--- a/arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3.dts
+++ b/arch/arm64/boot/dts/mediatek/mt7986a-bananapi-bpi-r3.dts
@@ -37,6 +37,15 @@ dcin: regulator-12vd {
 		regulator-always-on;
 	};
 
+	fan: pwm-fan {
+		compatible = "pwm-fan";
+		#cooling-cells = <2>;
+		/* cooling level (0, 1, 2) - pwm inverted */
+		cooling-levels = <255 96 0>;
+		pwms = <&pwm 0 10000 0>;
+		status = "okay";
+	};
+
 	gpio-keys {
 		compatible = "gpio-keys";
 
@@ -132,6 +141,28 @@ sfp2: sfp-2 {
 	};
 };
 
+&cpu_thermal {
+	cooling-maps {
+		cpu-active-high {
+			/* active: set fan to cooling level 2 */
+			cooling-device = <&fan 2 2>;
+			trip = <&cpu_trip_active_high>;
+		};
+
+		cpu-active-low {
+			/* active: set fan to cooling level 1 */
+			cooling-device = <&fan 1 1>;
+			trip = <&cpu_trip_active_low>;
+		};
+
+		cpu-passive {
+			/* passive: set fan to cooling level 0 */
+			cooling-device = <&fan 0 0>;
+			trip = <&cpu_trip_passive>;
+		};
+	};
+};
+
 &crypto {
 	status = "okay";
 };
-- 
2.34.1



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

* Re: [PATCH v3 1/4] dt-bindings: nvmem: mediatek: efuse: add support for mt7986
  2023-05-30 20:12 ` [PATCH v3 1/4] dt-bindings: nvmem: mediatek: efuse: add support for mt7986 Frank Wunderlich
@ 2023-05-31 13:05   ` AngeloGioacchino Del Regno
  0 siblings, 0 replies; 7+ messages in thread
From: AngeloGioacchino Del Regno @ 2023-05-31 13:05 UTC (permalink / raw)
  To: Frank Wunderlich, linux-mediatek
  Cc: Andrew-CT Chen, Lars-Peter Clausen, Lala Lin, linux-iio,
	Zhiyong Tao, Hui.Liu, linux-kernel, Daniel Golle, devicetree,
	Rob Herring, Srinivas Kandagatla, linux-arm-kernel,
	Krzysztof Kozlowski, Matthias Brugger, Rob Herring,
	Jonathan Cameron

Il 30/05/23 22:12, Frank Wunderlich ha scritto:
> From: Frank Wunderlich <frank-w@public-files.de>
> 
> Add compatible string for mt7986 SoC.
> 
> Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
> Acked-by: Rob Herring <robh@kernel.org>

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



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

* Re: (subset) [PATCH v3 0/4] Add mt7986 thermal
  2023-05-30 20:12 [PATCH v3 0/4] Add mt7986 thermal Frank Wunderlich
                   ` (3 preceding siblings ...)
  2023-05-30 20:12 ` [PATCH v3 4/4] arm64: dts: mt7986: add pwm-fan and cooling-maps to BPI-R3 dts Frank Wunderlich
@ 2023-05-31 13:44 ` Srinivas Kandagatla
  4 siblings, 0 replies; 7+ messages in thread
From: Srinivas Kandagatla @ 2023-05-31 13:44 UTC (permalink / raw)
  To: linux-mediatek, Frank Wunderlich
  Cc: Andrew-CT Chen, Lars-Peter Clausen, Lala Lin, linux-iio,
	Zhiyong Tao, Hui.Liu, linux-kernel, Daniel Golle, devicetree,
	Rob Herring, linux-arm-kernel, Krzysztof Kozlowski,
	Matthias Brugger, Jonathan Cameron, AngeloGioacchino Del Regno


On Tue, 30 May 2023 22:12:31 +0200, Frank Wunderlich wrote:
> From: Frank Wunderlich <frank-w@public-files.de>
> 
> This series add thermal related devicetree-nodes and necessary
> dt-bindings.
> 
> I left pwm-fan for r3 for now as i cannot test this completely due to
> missing 2 pin-jack and 3v3 pwm-level which my fan cannot handle (starts
> spinning at ~3V). Only checked voltage of pwm there.
> 
> [...]

Applied, thanks!

[1/4] dt-bindings: nvmem: mediatek: efuse: add support for mt7986
      commit: 05f53e3c22a71ed53e0e88432c3db31f2d27e6e1

Best regards,
-- 
Srinivas Kandagatla <srinivas.kandagatla@linaro.org>



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

end of thread, other threads:[~2023-05-31 13:44 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-30 20:12 [PATCH v3 0/4] Add mt7986 thermal Frank Wunderlich
2023-05-30 20:12 ` [PATCH v3 1/4] dt-bindings: nvmem: mediatek: efuse: add support for mt7986 Frank Wunderlich
2023-05-31 13:05   ` AngeloGioacchino Del Regno
2023-05-30 20:12 ` [PATCH v3 2/4] arm64: dts: mt7986: add thermal and efuse Frank Wunderlich
2023-05-30 20:12 ` [PATCH v3 3/4] arm64: dts: mt7986: add thermal-zones Frank Wunderlich
2023-05-30 20:12 ` [PATCH v3 4/4] arm64: dts: mt7986: add pwm-fan and cooling-maps to BPI-R3 dts Frank Wunderlich
2023-05-31 13:44 ` (subset) [PATCH v3 0/4] Add mt7986 thermal Srinivas Kandagatla

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).