2023-05-29 20:59:17

by Frank Wunderlich

[permalink] [raw]
Subject: Subject: [PATCH v2 0/4] Add mt7986 thermal and pwm

From: Frank Wunderlich <[email protected]>

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 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 | 63 +++++++++++++++++++
3 files changed, 95 insertions(+)

--
2.34.1



2023-05-29 21:00:13

by Frank Wunderlich

[permalink] [raw]
Subject: [PATCH v2 4/4] arm64: dts: mt7986: add pwm-fan and cooling-maps to BPI-R3 dts

From: Daniel Golle <[email protected]>

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

Signed-off-by: Daniel Golle <[email protected]>
Signed-off-by: Frank Wunderlich <[email protected]>
---
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


2023-05-29 21:00:46

by Frank Wunderlich

[permalink] [raw]
Subject: [PATCH v2 1/4] dt-bindings: nvmem: mediatek: efuse: add support for mt7986

From: Frank Wunderlich <[email protected]>

Add compatible string for mt7986 SoC.

Signed-off-by: Frank Wunderlich <[email protected]>
Acked-by: Rob Herring <[email protected]>
---
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


2023-05-29 21:52:33

by Frank Wunderlich

[permalink] [raw]
Subject: [PATCH v2 3/4] arm64: dts: mt7986: add thermal-zones

From: Daniel Golle <[email protected]>

Add thermal-zones to mt7986 devicetree.

Signed-off-by: Daniel Golle <[email protected]>
Signed-off-by: Frank Wunderlich <[email protected]>
---
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 a409d5e845c2..a059fcdaa8b7 100644
--- a/arch/arm64/boot/dts/mediatek/mt7986a.dtsi
+++ b/arch/arm64/boot/dts/mediatek/mt7986a.dtsi
@@ -603,4 +603,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


Subject: Re: [PATCH v2 3/4] arm64: dts: mt7986: add thermal-zones

Il 29/05/23 22:42, Frank Wunderlich ha scritto:
> From: Daniel Golle <[email protected]>
>
> Add thermal-zones to mt7986 devicetree.
>
> Signed-off-by: Daniel Golle <[email protected]>
> Signed-off-by: Frank Wunderlich <[email protected]>

Reviewed-by: AngeloGioacchino Del Regno <[email protected]>



Subject: Re: [PATCH v2 4/4] arm64: dts: mt7986: add pwm-fan and cooling-maps to BPI-R3 dts

Il 29/05/23 22:42, Frank Wunderlich ha scritto:
> From: Daniel Golle <[email protected]>
>
> Add pwm-fan and cooling-maps to BananaPi-R3 devicetree.
>
> Signed-off-by: Daniel Golle <[email protected]>
> Signed-off-by: Frank Wunderlich <[email protected]>

Reviewed-by: AngeloGioacchino Del Regno <[email protected]>