[PATCH 1/2] ipq807x: ZyXEL NBG7815: add fan support

Robert Marko robimarko at gmail.com
Sat Feb 18 03:50:19 PST 2023


On Sat, 18 Feb 2023 at 00:58, Enrico Mioso <mrkiko.rs at gmail.com> wrote:
>
> Add on/off fan support for the ZyXEL NBG7815. Single CPU cores, cluster
> CPU temperatures and the Aquantia PHY temperature sensor are monitored. The
> tmp103 sensor is missing from this patch, and can be added later, when kernel
> is bumped to 6.x, as it seems to require non-trivial hwmon backporting.
> Add kmod-phy-aquantia as default package while at it.
>
> Note: this patch has been marked RFT, since temperature values tuning is
> needed from someone actively using this device in high load conditions.
> Thanks to robimarko for helping me out.
>
> CC: Andre Valentin <avalentin at marcant.net>
> CC: Karol Przybylski <karol.przybylski at esm-technology.pl>
> Signed-off-by: Enrico Mioso <mrkiko.rs at gmail.com>
> ---
>  .../arm64/boot/dts/qcom/ipq8074-nbg7815.dts   | 119 ++++++++++++++++++
>  target/linux/ipq807x/image/generic.mk         |   2 +-
>  2 files changed, 120 insertions(+), 1 deletion(-)
>
> diff --git a/target/linux/ipq807x/files/arch/arm64/boot/dts/qcom/ipq8074-nbg7815.dts b/target/linux/ipq807x/files/arch/arm64/boot/dts/qcom/ipq8074-nbg7815.dts
> index 537dd52032..0ec602cf31 100644
> --- a/target/linux/ipq807x/files/arch/arm64/boot/dts/qcom/ipq8074-nbg7815.dts
> +++ b/target/linux/ipq807x/files/arch/arm64/boot/dts/qcom/ipq8074-nbg7815.dts
> @@ -39,6 +39,22 @@
>                         gpios = <&tlmm 54 GPIO_ACTIVE_LOW>;
>                 };
>         };
> +
> +       fan: gpio_fan {
> +               compatible = "gpio-fan";
> +               gpios = <&tlmm 21 GPIO_ACTIVE_HIGH>;
> +               gpio-fan,speed-map = <0    0
> +                                                       4500 1>;
> +               #cooling-cells = <2>;
> +       };
> +
> +       thermal-zones {
> +               aqr_thermal: aqr-thermal {

This is weird, why are you adding only the thermal zone here, then
using the label to add the trips and cooling device
down in the DTS?

> +                       polling-delay-passive = <1000>;
> +                       polling-delay = <1000>;
> +                       thermal-sensors = <&aqr113c>;
> +               };
> +       };
>  };
>
>  &tlmm {
> @@ -291,6 +307,7 @@
>                 compatible = "ethernet-phy-ieee802.3-c45";
>                 reg = <8>;
>                 reset-gpios = <&tlmm 63 GPIO_ACTIVE_LOW>;
> +               #thermal-sensor-cells = <0>;
>         };
>  };
>
> @@ -443,3 +460,105 @@
>
>         qcom,ath11k-calibration-variant = "Zyxel-NBG7815";
>  };
> +
> +&cpu0_thermal {
> +       trips {
> +               cpu0_active: cpu0-active {
> +                       temperature = <70000>;
> +                       hysteresis = <5000>;
> +                       type = "active";
> +               };
> +       };
> +
> +       cooling-maps {
> +               map1 {
> +                       trip = <&cpu0_active>;
> +                       cooling-device = <&fan THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
> +               };
> +       };
> +};
> +
> +&cpu1_thermal {
> +       trips {
> +               cpu1_active: cpu1-active {
> +                       temperature = <70000>;
> +                       hysteresis = <5000>;
> +                       type = "active";
> +               };
> +       };
> +
> +       cooling-maps {
> +               map1 {
> +                       trip = <&cpu1_active>;
> +                       cooling-device = <&fan THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
> +               };
> +       };
> +};
> +
> +&cpu2_thermal {
> +       trips {
> +               cpu2_active: cpu2-active {
> +                       temperature = <70000>;
> +                       hysteresis = <5000>;
> +                       type = "active";
> +               };
> +       };
> +
> +       cooling-maps {
> +               map1 {
> +                       trip = <&cpu2_active>;
> +                       cooling-device = <&fan THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
> +               };
> +       };
> +};
> +
> +&cpu3_thermal {
> +       trips {
> +               cpu3_active: cpu3-active {
> +                       temperature = <70000>;
> +                       hysteresis = <5000>;
> +                       type = "active";
> +               };
> +       };
> +
> +       cooling-maps {
> +               map1 {
> +                       trip = <&cpu3_active>;
> +                       cooling-device = <&fan THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
> +               };
> +       };
> +};
> +
> +&cluster_thermal {
> +       trips {
> +               cluster_active: cluster-active {
> +                       temperature = <70000>;
> +                       hysteresis = <5000>;
> +                       type = "active";
> +               };
> +       };
> +
> +       cooling-maps {
> +               map1 {
> +                       trip = <&cluster_active>;
> +                       cooling-device = <&fan THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
> +               };
> +       };
> +};
> +
> +&aqr_thermal {

This ties into my question for the zone, why not just add it directly
in the node?
> +       trips {
> +               aqr_thermal_active: aqr-thermal-active {
> +                       temperature = <70000>;
> +                       hysteresis = <5000>;
> +                       type = "active";
> +               };
> +       };
> +
> +       cooling-maps {
> +               map1 {
> +                       trip = <&aqr_thermal_active>;
> +                       cooling-device = <&fan THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
> +               };
> +       };
> +};
> diff --git a/target/linux/ipq807x/image/generic.mk b/target/linux/ipq807x/image/generic.mk
> index 38770a5f24..bbdb8c5d8b 100644
> --- a/target/linux/ipq807x/image/generic.mk
> +++ b/target/linux/ipq807x/image/generic.mk
> @@ -141,6 +141,6 @@ define Device/zyxel_nbg7815
>         IMAGES += factory.bin sysupgrade.bin
>         IMAGE/factory.bin := append-rootfs | pad-rootfs | pad-to 64k
>         IMAGE/sysupgrade.bin/squashfs := append-rootfs | pad-to 64k | sysupgrade-tar rootfs=$$$$@ | append-metadata
> -       DEVICE_PACKAGES := ipq-wifi-zyxel_nbg7815 kmod-ath11k-pci e2fsprogs kmod-fs-ext4 losetup kmod-hwmon-tmp103
> +       DEVICE_PACKAGES := ipq-wifi-zyxel_nbg7815 kmod-ath11k-pci e2fsprogs kmod-fs-ext4 losetup kmod-hwmon-tmp103 kmod-hwmon-gpiofan kmod-phy-aquantia
>  endef

No need to add AQR kmod as it's included by default on the target.

Regards,
Robert
>  TARGET_DEVICES += zyxel_nbg7815
> --
> 2.39.2
>
>
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list