* [PATCH] arm64: dts: rockchip: pwm-fan overlay for NanoPC-T6 @ 2025-10-26 19:48 Hugh Cole-Baker 2025-10-27 9:14 ` Alexey Charkov 0 siblings, 1 reply; 9+ messages in thread From: Hugh Cole-Baker @ 2025-10-26 19:48 UTC (permalink / raw) To: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Heiko Stuebner Cc: Hugh Cole-Baker, devicetree, linux-arm-kernel, linux-rockchip, linux-kernel FriendlyELEC offers an optional heatsink and fan addon for the NanoPC-T6 and T6 LTS. Add an overlay which can be applied if the fan is fitted and configures the fan as an active cooling device for the SoC package. Signed-off-by: Hugh Cole-Baker <sigmaris@gmail.com> --- FriendlyELEC heatsink with fan addon: https://www.friendlyelec.com/index.php?route=product/product&product_id=305 Vendor DT with trip points and PWM duty cycle values: https://github.com/friendlyarm/kernel-rockchip/blob/4944602540b62f5aad139fe602a76cf7c3176128/arch/arm64/boot/dts/rockchip/rk3588-nanopi6-rev01.dts#L75-L90 arch/arm64/boot/dts/rockchip/Makefile | 9 +++ .../dts/rockchip/rk3588-nanopc-t6-fan.dtso | 78 +++++++++++++++++++ 2 files changed, 87 insertions(+) create mode 100644 arch/arm64/boot/dts/rockchip/rk3588-nanopc-t6-fan.dtso diff --git a/arch/arm64/boot/dts/rockchip/Makefile b/arch/arm64/boot/dts/rockchip/Makefile index 4cd8ef607f55c..7a67b68a6bb03 100644 --- a/arch/arm64/boot/dts/rockchip/Makefile +++ b/arch/arm64/boot/dts/rockchip/Makefile @@ -178,6 +178,7 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588-jaguar-ethernet-switch.dtbo dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588-jaguar-pre-ict-tester.dtbo dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588-mnt-reform2.dtb dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588-nanopc-t6.dtb +dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588-nanopc-t6-fan.dtbo dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588-nanopc-t6-lts.dtb dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588-ok3588-c.dtb dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588-orangepi-5-max.dtb @@ -271,6 +272,14 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588-jaguar-pre-ict-tester.dtb rk3588-jaguar-pre-ict-tester-dtbs := rk3588-jaguar.dtb \ rk3588-jaguar-pre-ict-tester.dtbo +dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588-nanopc-t6-with-fan.dtb +rk3588-nanopc-t6-with-fan-dtbs := rk3588-nanopc-t6.dtb \ + rk3588-nanopc-t6-fan.dtbo + +dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588-nanopc-t6-lts-with-fan.dtb +rk3588-nanopc-t6-lts-with-fan-dtbs := rk3588-nanopc-t6-lts.dtb \ + rk3588-nanopc-t6-fan.dtbo + dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3588-rock-5b-pcie-ep.dtb rk3588-rock-5b-pcie-ep-dtbs := rk3588-rock-5b.dtb \ rk3588-rock-5b-pcie-ep.dtbo diff --git a/arch/arm64/boot/dts/rockchip/rk3588-nanopc-t6-fan.dtso b/arch/arm64/boot/dts/rockchip/rk3588-nanopc-t6-fan.dtso new file mode 100644 index 0000000000000..08c4782fb4148 --- /dev/null +++ b/arch/arm64/boot/dts/rockchip/rk3588-nanopc-t6-fan.dtso @@ -0,0 +1,78 @@ +// SPDX-License-Identifier: (GPL-2.0+ OR MIT) +/dts-v1/; +/plugin/; + +#include <dt-bindings/thermal/thermal.h> + +&{/} { + fan: pwm-fan { + compatible = "pwm-fan"; + cooling-levels = <0 35 64 100 150 255>; + fan-supply = <&vcc5v0_sys>; + pwms = <&pwm1 0 50000 0>; + #cooling-cells = <2>; + }; +}; + +&package_thermal { + polling-delay = <1000>; + + trips { + package_fan0: package-fan0 { + temperature = <50000>; + hysteresis = <2000>; + type = "active"; + }; + + package_fan1: package-fan1 { + temperature = <55000>; + hysteresis = <2000>; + type = "active"; + }; + + package_fan2: package-fan2 { + temperature = <60000>; + hysteresis = <2000>; + type = "active"; + }; + + package_fan3: package-fan3 { + temperature = <65000>; + hysteresis = <2000>; + type = "active"; + }; + + package_fan4: package-fan4 { + temperature = <70000>; + hysteresis = <2000>; + type = "active"; + }; + }; + + cooling-maps { + map0 { + trip = <&package_fan0>; + cooling-device = <&fan THERMAL_NO_LIMIT 1>; + }; + + map1 { + trip = <&package_fan1>; + cooling-device = <&fan 2 3>; + }; + + map2 { + trip = <&package_fan2>; + cooling-device = <&fan 3 4>; + }; + + map3 { + trip = <&package_fan3>; + cooling-device = <&fan 4 5>; + }; + + map4 { + trip = <&package_fan4>; + cooling-device = <&fan 5 THERMAL_NO_LIMIT>; + }; + }; +}; -- 2.50.1 (Apple Git-155) ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH] arm64: dts: rockchip: pwm-fan overlay for NanoPC-T6 2025-10-26 19:48 [PATCH] arm64: dts: rockchip: pwm-fan overlay for NanoPC-T6 Hugh Cole-Baker @ 2025-10-27 9:14 ` Alexey Charkov 2025-10-27 19:08 ` Hugh Cole-Baker 0 siblings, 1 reply; 9+ messages in thread From: Alexey Charkov @ 2025-10-27 9:14 UTC (permalink / raw) To: Hugh Cole-Baker Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Heiko Stuebner, devicetree, linux-arm-kernel, linux-rockchip, linux-kernel Hi Hugh, On Mon, Oct 27, 2025 at 1:09 PM Hugh Cole-Baker <sigmaris@gmail.com> wrote: > > FriendlyELEC offers an optional heatsink and fan addon for the NanoPC-T6 > and T6 LTS. Add an overlay which can be applied if the fan is fitted and > configures the fan as an active cooling device for the SoC package. > > Signed-off-by: Hugh Cole-Baker <sigmaris@gmail.com> > --- > FriendlyELEC heatsink with fan addon: > https://www.friendlyelec.com/index.php?route=product/product&product_id=305 > Vendor DT with trip points and PWM duty cycle values: > https://github.com/friendlyarm/kernel-rockchip/blob/4944602540b62f5aad139fe602a76cf7c3176128/arch/arm64/boot/dts/rockchip/rk3588-nanopi6-rev01.dts#L75-L90 Is there any downside to enabling this unconditionally in the board .dts? Overlays require more user configuration, and not all bootloaders support them directly (e.g. systemd-boot users would struggle). Compiling with overlays enabled also makes .dtb's a lot larger due to added symbols information. Best regards, Alexey ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] arm64: dts: rockchip: pwm-fan overlay for NanoPC-T6 2025-10-27 9:14 ` Alexey Charkov @ 2025-10-27 19:08 ` Hugh Cole-Baker 2025-10-27 20:02 ` Dragan Simic 0 siblings, 1 reply; 9+ messages in thread From: Hugh Cole-Baker @ 2025-10-27 19:08 UTC (permalink / raw) To: Alexey Charkov Cc: Rob Herring, Krzysztof Kozlowski, Conor Dooley, Heiko Stuebner, devicetree, linux-arm-kernel, linux-rockchip, linux-kernel On 27/10/2025 09:14, Alexey Charkov wrote: > Hi Hugh, > > On Mon, Oct 27, 2025 at 1:09 PM Hugh Cole-Baker <sigmaris@gmail.com> wrote: >> >> FriendlyELEC offers an optional heatsink and fan addon for the NanoPC-T6 >> and T6 LTS. Add an overlay which can be applied if the fan is fitted and >> configures the fan as an active cooling device for the SoC package. >> >> Signed-off-by: Hugh Cole-Baker <sigmaris@gmail.com> >> --- >> FriendlyELEC heatsink with fan addon: >> https://www.friendlyelec.com/index.php?route=product/product&product_id=305 >> Vendor DT with trip points and PWM duty cycle values: >> https://github.com/friendlyarm/kernel-rockchip/blob/4944602540b62f5aad139fe602a76cf7c3176128/arch/arm64/boot/dts/rockchip/rk3588-nanopi6-rev01.dts#L75-L90 Hi Alexey, > Is there any downside to enabling this unconditionally in the board > .dts? Only that it goes against the principle that the DT should describe the hardware; the board .dts would describe a cooling device that doesn't actually exist on the base board. I guess then in theory, an OS might allow the SoC to reach undesirably high temperatures if it's relying on the nonexistent fan to cool it down. But I don't think this would be an issue on Linux, at least, in practice. > Overlays require more user configuration, and not all > bootloaders support them directly (e.g. systemd-boot users would > struggle). Compiling with overlays enabled also makes .dtb's a lot > larger due to added symbols information. Nowadays (on Debian at least) using overlays is pretty easy, I'm using the u-boot-menu package in Debian, I just copy the overlay(s) to /boot/dtbo/ and it detects them automatically and adds them to extlinux.conf for u-boot to apply. Couldn't systemd-boot users just use rk3588-nanopc-t6-(lts-)with-fan.dtb as their single DT to load, if it doesn't support applying overlays and they want to use the fan addon? FWIW, I haven't noticed any problems with having a larger .dtb (using mainline U-Boot to load it) and several other RK3588 boards are also compiled with symbols enabled already, and I haven't seen any issues reported with them. Best regards, Hugh ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] arm64: dts: rockchip: pwm-fan overlay for NanoPC-T6 2025-10-27 19:08 ` Hugh Cole-Baker @ 2025-10-27 20:02 ` Dragan Simic 2025-10-27 20:56 ` Alexey Charkov 0 siblings, 1 reply; 9+ messages in thread From: Dragan Simic @ 2025-10-27 20:02 UTC (permalink / raw) To: sigmaris Cc: alchark, conor+dt, devicetree, heiko, krzk+dt, linux-arm-kernel, linux-kernel, linux-rockchip, robh Hello Hugh and Alexey, On Mon, Oct 27, 2025 at 7:08 PM Hugh Cole-Baker <sigmaris@gmail.com> wrote: > On 27/10/2025 09:14, Alexey Charkov wrote: > >> Is there any downside to enabling this unconditionally in the board >> .dts? > > Only that it goes against the principle that the DT should describe the > hardware; the board .dts would describe a cooling device that doesn't > actually exist on the base board. Having a separate DT overlay is perfectly fine if we want to describe a board absolutely correctly: if the fan actually isn't present, the operating system shouldn't be made to think it is there, especially if there's no fan RPM feedback, which is the case on almost all Rockchip boards that support a fan. Preventing the kernel from managing a non-existent fan might even save some CPU cycles, ending up producing a bit less heat, which can only help in passively cooled setups. However, the practice so far has been to describe the fans in the main board dts files, if the board provides fan support, regardless of the fan being present in a particular board setup or not. > I guess then in theory, an OS might allow the SoC to reach undesirably high > temperatures if it's relying on the nonexistent fan to cool it down. But I > don't think this would be an issue on Linux, at least, in practice. We're safe, a thermal runaway isn't going to happen when the fan is defined in a board DT but actually isn't present. Thermal CPU and GPU throttling will prevent the overheating from happening. >> Overlays require more user configuration, and not all >> bootloaders support them directly (e.g. systemd-boot users would >> struggle). Compiling with overlays enabled also makes .dtb's a lot >> larger due to added symbols information. > > Nowadays (on Debian at least) using overlays is pretty easy, I'm using the > u-boot-menu package in Debian, I just copy the overlay(s) to /boot/dtbo/ and > it detects them automatically and adds them to extlinux.conf for u-boot to > apply. > > Couldn't systemd-boot users just use rk3588-nanopc-t6-(lts-)with-fan.dtb as > their single DT to load, if it doesn't support applying overlays and they > want to use the fan addon? Yes, that's an option. However, that in general doesn't resolve the issues arising from systemd-boot users wanting to apply more than a single DT overlay. > FWIW, I haven't noticed any problems with having a larger .dtb (using mainline > U-Boot to load it) and several other RK3588 boards are also compiled with > symbols enabled already, and I haven't seen any issues reported with them. After thinking a bit about it, I'd support the extraction of fan definitions into separate DT overlays. As I wrote above already, not managing the non-existent fan might actually help a bit with passively cooled board setups, which is a good enough reason for me to support separate DT overlays. If we end up agreeing to accept this DT overlay, I'll have some comments on the way cooling maps are defined. I think there's quite a bit of redundancy there. ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] arm64: dts: rockchip: pwm-fan overlay for NanoPC-T6 2025-10-27 20:02 ` Dragan Simic @ 2025-10-27 20:56 ` Alexey Charkov 2025-10-27 21:15 ` Dragan Simic 0 siblings, 1 reply; 9+ messages in thread From: Alexey Charkov @ 2025-10-27 20:56 UTC (permalink / raw) To: Dragan Simic Cc: sigmaris, conor+dt, devicetree, heiko, krzk+dt, linux-arm-kernel, linux-kernel, linux-rockchip, robh On Tue, Oct 28, 2025 at 12:02 AM Dragan Simic <dsimic@manjaro.org> wrote: > > Hello Hugh and Alexey, > > On Mon, Oct 27, 2025 at 7:08 PM Hugh Cole-Baker <sigmaris@gmail.com> wrote: > > On 27/10/2025 09:14, Alexey Charkov wrote: > > > >> Is there any downside to enabling this unconditionally in the board > >> .dts? > > > > Only that it goes against the principle that the DT should describe the > > hardware; the board .dts would describe a cooling device that doesn't > > actually exist on the base board. > > Having a separate DT overlay is perfectly fine if we want to > describe a board absolutely correctly: if the fan actually isn't > present, the operating system shouldn't be made to think it is > there, especially if there's no fan RPM feedback, which is the > case on almost all Rockchip boards that support a fan. > > Preventing the kernel from managing a non-existent fan might even > save some CPU cycles, ending up producing a bit less heat, which > can only help in passively cooled setups. Sounds like an overcomplication without real benefit. It's one thing with overlays for functionality that can be software-incompatible depending on whether an external attachment is connected or depending on the type of attachment connected. Here we are looking at a plain 2-pin fan which cannot be software incompatible to anything really (it's not like one could repurpose the fan connector for anything meaningful if a fan is not in use, and noone gets hurt if a PWM output is left running without load). The CPU cycles spent parsing a slightly larger DTB at boot are likely comparable to those spent activating a PWM output needlessly upon hitting the active cooling trip point, and both are negligible for any practical purpose. > However, the practice so far has been to describe the fans in the > main board dts files, if the board provides fan support, regardless > of the fan being present in a particular board setup or not. > > > I guess then in theory, an OS might allow the SoC to reach undesirably high > > temperatures if it's relying on the nonexistent fan to cool it down. But I > > don't think this would be an issue on Linux, at least, in practice. > > We're safe, a thermal runaway isn't going to happen when the fan is > defined in a board DT but actually isn't present. Thermal CPU and > GPU throttling will prevent the overheating from happening. > > >> Overlays require more user configuration, and not all > >> bootloaders support them directly (e.g. systemd-boot users would > >> struggle). Compiling with overlays enabled also makes .dtb's a lot > >> larger due to added symbols information. > > > > Nowadays (on Debian at least) using overlays is pretty easy, I'm using the > > u-boot-menu package in Debian, I just copy the overlay(s) to /boot/dtbo/ and > > it detects them automatically and adds them to extlinux.conf for u-boot to > > apply. > > > > Couldn't systemd-boot users just use rk3588-nanopc-t6-(lts-)with-fan.dtb as > > their single DT to load, if it doesn't support applying overlays and they > > want to use the fan addon? Sure, but it's a manual configuration step, where otherwise the kernel would just default to the correct dtb for the board that the firmware told it about. The fan is not discoverable, so the firmware won't ever offer the "-with-fan" variant, meaning users would need to supply it manually in every instance. > Yes, that's an option. However, that in general doesn't resolve > the issues arising from systemd-boot users wanting to apply more > than a single DT overlay. > > > FWIW, I haven't noticed any problems with having a larger .dtb (using mainline > > U-Boot to load it) and several other RK3588 boards are also compiled with > > symbols enabled already, and I haven't seen any issues reported with them. > > After thinking a bit about it, I'd support the extraction of fan > definitions into separate DT overlays. As I wrote above already, > not managing the non-existent fan might actually help a bit with > passively cooled board setups, which is a good enough reason for > me to support separate DT overlays. Practical benefits sound far fetched here, while forcing users to manually configure something that would have otherwise just worked. Let's see what Heiko thinks. > If we end up agreeing to accept this DT overlay, I'll have some > comments on the way cooling maps are defined. I think there's > quite a bit of redundancy there. Agree. Thermal governors can figure out the fan speed ramp-up without specifying each and every temperature threshold manually. Two trips seem to be enough for everyone (c) - as we've done e.g. on Rock 5B and others. Best regards, Alexey ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] arm64: dts: rockchip: pwm-fan overlay for NanoPC-T6 2025-10-27 20:56 ` Alexey Charkov @ 2025-10-27 21:15 ` Dragan Simic 2025-10-27 21:20 ` Diederik de Haas 2025-11-01 11:44 ` Heiko Stuebner 0 siblings, 2 replies; 9+ messages in thread From: Dragan Simic @ 2025-10-27 21:15 UTC (permalink / raw) To: Alexey Charkov Cc: sigmaris, conor+dt, devicetree, heiko, krzk+dt, linux-arm-kernel, linux-kernel, linux-rockchip, robh Hello Alexey, On Monday, October 27, 2025 21:56 CET, Alexey Charkov <alchark@gmail.com> wrote: > On Tue, Oct 28, 2025 at 12:02 AM Dragan Simic <dsimic@manjaro.org> wrote: > > On Mon, Oct 27, 2025 at 7:08 PM Hugh Cole-Baker <sigmaris@gmail.com> wrote: > > > On 27/10/2025 09:14, Alexey Charkov wrote: > > > > > >> Is there any downside to enabling this unconditionally in the board > > >> .dts? > > > > > > Only that it goes against the principle that the DT should describe the > > > hardware; the board .dts would describe a cooling device that doesn't > > > actually exist on the base board. > > > > Having a separate DT overlay is perfectly fine if we want to > > describe a board absolutely correctly: if the fan actually isn't > > present, the operating system shouldn't be made to think it is > > there, especially if there's no fan RPM feedback, which is the > > case on almost all Rockchip boards that support a fan. > > > > Preventing the kernel from managing a non-existent fan might even > > save some CPU cycles, ending up producing a bit less heat, which > > can only help in passively cooled setups. > > Sounds like an overcomplication without real benefit. It's one thing > with overlays for functionality that can be software-incompatible > depending on whether an external attachment is connected or depending > on the type of attachment connected. Here we are looking at a plain > 2-pin fan which cannot be software incompatible to anything really > (it's not like one could repurpose the fan connector for anything > meaningful if a fan is not in use, and noone gets hurt if a PWM output > is left running without load). > > The CPU cycles spent parsing a slightly larger DTB at boot are likely > comparable to those spent activating a PWM output needlessly upon > hitting the active cooling trip point, and both are negligible for any > practical purpose. Hmm, right, I forgot for a moment that the PWM output is generated by dedicated hardware, so not many CPU cycles would be wasted. BTW, with a fan PWM signal generated by a soft-GPIO output, much more CPU cycles would've been saved by omitting the fan definition if it isn't present, but that isn't the case here. > > However, the practice so far has been to describe the fans in the > > main board dts files, if the board provides fan support, regardless > > of the fan being present in a particular board setup or not. > > > > > I guess then in theory, an OS might allow the SoC to reach undesirably high > > > temperatures if it's relying on the nonexistent fan to cool it down. But I > > > don't think this would be an issue on Linux, at least, in practice. > > > > We're safe, a thermal runaway isn't going to happen when the fan is > > defined in a board DT but actually isn't present. Thermal CPU and > > GPU throttling will prevent the overheating from happening. > > > > >> Overlays require more user configuration, and not all > > >> bootloaders support them directly (e.g. systemd-boot users would > > >> struggle). Compiling with overlays enabled also makes .dtb's a lot > > >> larger due to added symbols information. > > > > > > Nowadays (on Debian at least) using overlays is pretty easy, I'm using the > > > u-boot-menu package in Debian, I just copy the overlay(s) to /boot/dtbo/ and > > > it detects them automatically and adds them to extlinux.conf for u-boot to > > > apply. > > > > > > Couldn't systemd-boot users just use rk3588-nanopc-t6-(lts-)with-fan.dtb as > > > their single DT to load, if it doesn't support applying overlays and they > > > want to use the fan addon? > > Sure, but it's a manual configuration step, where otherwise the kernel > would just default to the correct dtb for the board that the firmware > told it about. The fan is not discoverable, so the firmware won't ever > offer the "-with-fan" variant, meaning users would need to supply it > manually in every instance. FWIW, the most user-friendly SBC family in the world, Raspberry Pi, :) requires manual enabling of the fan on Raspberry Pi 4. I haven't researched what's the background for that, perhaps the need to keep the GPIO expansion header completely unoccupied by default, because the fan attaches to the GPIO header, instead of to some dedicated fan connector. > > Yes, that's an option. However, that in general doesn't resolve > > the issues arising from systemd-boot users wanting to apply more > > than a single DT overlay. > > > > > FWIW, I haven't noticed any problems with having a larger .dtb (using mainline > > > U-Boot to load it) and several other RK3588 boards are also compiled with > > > symbols enabled already, and I haven't seen any issues reported with them. > > > > After thinking a bit about it, I'd support the extraction of fan > > definitions into separate DT overlays. As I wrote above already, > > not managing the non-existent fan might actually help a bit with > > passively cooled board setups, which is a good enough reason for > > me to support separate DT overlays. > > Practical benefits sound far fetched here, while forcing users to > manually configure something that would have otherwise just worked. > Let's see what Heiko thinks. Yeah, I forgot for a moment that the PWM signal is generated by hardware, which means that the resulting overheads when no fan is present are rather small. > > If we end up agreeing to accept this DT overlay, I'll have some > > comments on the way cooling maps are defined. I think there's > > quite a bit of redundancy there. > > Agree. Thermal governors can figure out the fan speed ramp-up without > specifying each and every temperature threshold manually. Two trips > seem to be enough for everyone (c) - as we've done e.g. on Rock 5B and > others. Indeed, and if there are actually measurable/audible benefits from having those manually defined thresholds/maps, then we should start thinking about improving the already existing fan-driving logic instead. ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] arm64: dts: rockchip: pwm-fan overlay for NanoPC-T6 2025-10-27 21:15 ` Dragan Simic @ 2025-10-27 21:20 ` Diederik de Haas 2025-11-01 11:44 ` Heiko Stuebner 1 sibling, 0 replies; 9+ messages in thread From: Diederik de Haas @ 2025-10-27 21:20 UTC (permalink / raw) To: Dragan Simic, Alexey Charkov Cc: sigmaris, conor+dt, devicetree, heiko, krzk+dt, linux-arm-kernel, linux-kernel, linux-rockchip, robh On Mon Oct 27, 2025 at 10:15 PM CET, Dragan Simic wrote: > FWIW, the most user-friendly SBC family in the world, Raspberry > Pi, :) requires manual enabling of the fan on Raspberry Pi 4. > I haven't researched what's the background for that, perhaps the RPi's have been using DT overlays basically from their start (ie way before it became practically usable on the upstream kernel). ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] arm64: dts: rockchip: pwm-fan overlay for NanoPC-T6 2025-10-27 21:15 ` Dragan Simic 2025-10-27 21:20 ` Diederik de Haas @ 2025-11-01 11:44 ` Heiko Stuebner 2025-11-01 13:14 ` Hugh Cole-Baker 1 sibling, 1 reply; 9+ messages in thread From: Heiko Stuebner @ 2025-11-01 11:44 UTC (permalink / raw) To: Alexey Charkov, Dragan Simic Cc: sigmaris, conor+dt, devicetree, krzk+dt, linux-arm-kernel, linux-kernel, linux-rockchip, robh Am Montag, 27. Oktober 2025, 22:15:05 Mitteleuropäische Normalzeit schrieb Dragan Simic: > Hello Alexey, > > On Monday, October 27, 2025 21:56 CET, Alexey Charkov <alchark@gmail.com> wrote: > > On Tue, Oct 28, 2025 at 12:02 AM Dragan Simic <dsimic@manjaro.org> wrote: > > > On Mon, Oct 27, 2025 at 7:08 PM Hugh Cole-Baker <sigmaris@gmail.com> wrote: > > > > On 27/10/2025 09:14, Alexey Charkov wrote: > > > > > > > >> Is there any downside to enabling this unconditionally in the board > > > >> .dts? > > > > > > > > Only that it goes against the principle that the DT should describe the > > > > hardware; the board .dts would describe a cooling device that doesn't > > > > actually exist on the base board. > > > > > > Having a separate DT overlay is perfectly fine if we want to > > > describe a board absolutely correctly: if the fan actually isn't > > > present, the operating system shouldn't be made to think it is > > > there, especially if there's no fan RPM feedback, which is the > > > case on almost all Rockchip boards that support a fan. > > > > > > Preventing the kernel from managing a non-existent fan might even > > > save some CPU cycles, ending up producing a bit less heat, which > > > can only help in passively cooled setups. > > > > Sounds like an overcomplication without real benefit. It's one thing > > with overlays for functionality that can be software-incompatible > > depending on whether an external attachment is connected or depending > > on the type of attachment connected. Here we are looking at a plain > > 2-pin fan which cannot be software incompatible to anything really > > (it's not like one could repurpose the fan connector for anything > > meaningful if a fan is not in use, and noone gets hurt if a PWM output > > is left running without load). > > > > The CPU cycles spent parsing a slightly larger DTB at boot are likely > > comparable to those spent activating a PWM output needlessly upon > > hitting the active cooling trip point, and both are negligible for any > > practical purpose. > > Hmm, right, I forgot for a moment that the PWM output is generated > by dedicated hardware, so not many CPU cycles would be wasted. > > BTW, with a fan PWM signal generated by a soft-GPIO output, much > more CPU cycles would've been saved by omitting the fan definition > if it isn't present, but that isn't the case here. > > > > However, the practice so far has been to describe the fans in the > > > main board dts files, if the board provides fan support, regardless > > > of the fan being present in a particular board setup or not. > > > > > > > I guess then in theory, an OS might allow the SoC to reach undesirably high > > > > temperatures if it's relying on the nonexistent fan to cool it down. But I > > > > don't think this would be an issue on Linux, at least, in practice. > > > > > > We're safe, a thermal runaway isn't going to happen when the fan is > > > defined in a board DT but actually isn't present. Thermal CPU and > > > GPU throttling will prevent the overheating from happening. > > > > > > >> Overlays require more user configuration, and not all > > > >> bootloaders support them directly (e.g. systemd-boot users would > > > >> struggle). Compiling with overlays enabled also makes .dtb's a lot > > > >> larger due to added symbols information. > > > > > > > > Nowadays (on Debian at least) using overlays is pretty easy, I'm using the > > > > u-boot-menu package in Debian, I just copy the overlay(s) to /boot/dtbo/ and > > > > it detects them automatically and adds them to extlinux.conf for u-boot to > > > > apply. > > > > > > > > Couldn't systemd-boot users just use rk3588-nanopc-t6-(lts-)with-fan.dtb as > > > > their single DT to load, if it doesn't support applying overlays and they > > > > want to use the fan addon? > > > > Sure, but it's a manual configuration step, where otherwise the kernel > > would just default to the correct dtb for the board that the firmware > > told it about. The fan is not discoverable, so the firmware won't ever > > offer the "-with-fan" variant, meaning users would need to supply it > > manually in every instance. > > FWIW, the most user-friendly SBC family in the world, Raspberry > Pi, :) requires manual enabling of the fan on Raspberry Pi 4. > I haven't researched what's the background for that, perhaps the > need to keep the GPIO expansion header completely unoccupied by > default, because the fan attaches to the GPIO header, instead of > to some dedicated fan connector. > > > > Yes, that's an option. However, that in general doesn't resolve > > > the issues arising from systemd-boot users wanting to apply more > > > than a single DT overlay. > > > > > > > FWIW, I haven't noticed any problems with having a larger .dtb (using mainline > > > > U-Boot to load it) and several other RK3588 boards are also compiled with > > > > symbols enabled already, and I haven't seen any issues reported with them. > > > > > > After thinking a bit about it, I'd support the extraction of fan > > > definitions into separate DT overlays. As I wrote above already, > > > not managing the non-existent fan might actually help a bit with > > > passively cooled board setups, which is a good enough reason for > > > me to support separate DT overlays. > > > > Practical benefits sound far fetched here, while forcing users to > > manually configure something that would have otherwise just worked. > > Let's see what Heiko thinks. Personally, I'm more on the less complication side. I.e. if there is an actual fan-connector on the board we should describe it as such. Overlays I see for things where you attach hats to generic pin headers to create specific functionality on top of a generic interface. But if the board itself has an actual fan header, it should be described as such. Because that then _is_ the standard use of that. Heiko ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] arm64: dts: rockchip: pwm-fan overlay for NanoPC-T6 2025-11-01 11:44 ` Heiko Stuebner @ 2025-11-01 13:14 ` Hugh Cole-Baker 0 siblings, 0 replies; 9+ messages in thread From: Hugh Cole-Baker @ 2025-11-01 13:14 UTC (permalink / raw) To: Heiko Stuebner, Alexey Charkov, Dragan Simic Cc: conor+dt, devicetree, krzk+dt, linux-arm-kernel, linux-kernel, linux-rockchip, robh On 01/11/2025 11:44, Heiko Stuebner wrote: > Am Montag, 27. Oktober 2025, 22:15:05 Mitteleuropäische Normalzeit schrieb Dragan Simic: >> Hello Alexey, >> >> On Monday, October 27, 2025 21:56 CET, Alexey Charkov <alchark@gmail.com> wrote: >>> On Tue, Oct 28, 2025 at 12:02 AM Dragan Simic <dsimic@manjaro.org> wrote: >>>> On Mon, Oct 27, 2025 at 7:08 PM Hugh Cole-Baker <sigmaris@gmail.com> wrote: >>>>> On 27/10/2025 09:14, Alexey Charkov wrote: >>>>> >>>>>> Is there any downside to enabling this unconditionally in the board >>>>>> .dts? >>>>> >>>>> Only that it goes against the principle that the DT should describe the >>>>> hardware; the board .dts would describe a cooling device that doesn't >>>>> actually exist on the base board. >>>> >>>> Having a separate DT overlay is perfectly fine if we want to >>>> describe a board absolutely correctly: if the fan actually isn't >>>> present, the operating system shouldn't be made to think it is >>>> there, especially if there's no fan RPM feedback, which is the >>>> case on almost all Rockchip boards that support a fan. >>>> >>>> Preventing the kernel from managing a non-existent fan might even >>>> save some CPU cycles, ending up producing a bit less heat, which >>>> can only help in passively cooled setups. >>> >>> Sounds like an overcomplication without real benefit. It's one thing >>> with overlays for functionality that can be software-incompatible >>> depending on whether an external attachment is connected or depending >>> on the type of attachment connected. Here we are looking at a plain >>> 2-pin fan which cannot be software incompatible to anything really >>> (it's not like one could repurpose the fan connector for anything >>> meaningful if a fan is not in use, and noone gets hurt if a PWM output >>> is left running without load). >>> >>> The CPU cycles spent parsing a slightly larger DTB at boot are likely >>> comparable to those spent activating a PWM output needlessly upon >>> hitting the active cooling trip point, and both are negligible for any >>> practical purpose. >> >> Hmm, right, I forgot for a moment that the PWM output is generated >> by dedicated hardware, so not many CPU cycles would be wasted. >> >> BTW, with a fan PWM signal generated by a soft-GPIO output, much >> more CPU cycles would've been saved by omitting the fan definition >> if it isn't present, but that isn't the case here. >> >>>> However, the practice so far has been to describe the fans in the >>>> main board dts files, if the board provides fan support, regardless >>>> of the fan being present in a particular board setup or not. >>>> >>>>> I guess then in theory, an OS might allow the SoC to reach undesirably high >>>>> temperatures if it's relying on the nonexistent fan to cool it down. But I >>>>> don't think this would be an issue on Linux, at least, in practice. >>>> >>>> We're safe, a thermal runaway isn't going to happen when the fan is >>>> defined in a board DT but actually isn't present. Thermal CPU and >>>> GPU throttling will prevent the overheating from happening. >>>> >>>>>> Overlays require more user configuration, and not all >>>>>> bootloaders support them directly (e.g. systemd-boot users would >>>>>> struggle). Compiling with overlays enabled also makes .dtb's a lot >>>>>> larger due to added symbols information. >>>>> >>>>> Nowadays (on Debian at least) using overlays is pretty easy, I'm using the >>>>> u-boot-menu package in Debian, I just copy the overlay(s) to /boot/dtbo/ and >>>>> it detects them automatically and adds them to extlinux.conf for u-boot to >>>>> apply. >>>>> >>>>> Couldn't systemd-boot users just use rk3588-nanopc-t6-(lts-)with-fan.dtb as >>>>> their single DT to load, if it doesn't support applying overlays and they >>>>> want to use the fan addon? >>> >>> Sure, but it's a manual configuration step, where otherwise the kernel >>> would just default to the correct dtb for the board that the firmware >>> told it about. The fan is not discoverable, so the firmware won't ever >>> offer the "-with-fan" variant, meaning users would need to supply it >>> manually in every instance. >> >> FWIW, the most user-friendly SBC family in the world, Raspberry >> Pi, :) requires manual enabling of the fan on Raspberry Pi 4. >> I haven't researched what's the background for that, perhaps the >> need to keep the GPIO expansion header completely unoccupied by >> default, because the fan attaches to the GPIO header, instead of >> to some dedicated fan connector. >> >>>> Yes, that's an option. However, that in general doesn't resolve >>>> the issues arising from systemd-boot users wanting to apply more >>>> than a single DT overlay. >>>> >>>>> FWIW, I haven't noticed any problems with having a larger .dtb (using mainline >>>>> U-Boot to load it) and several other RK3588 boards are also compiled with >>>>> symbols enabled already, and I haven't seen any issues reported with them. >>>> >>>> After thinking a bit about it, I'd support the extraction of fan >>>> definitions into separate DT overlays. As I wrote above already, >>>> not managing the non-existent fan might actually help a bit with >>>> passively cooled board setups, which is a good enough reason for >>>> me to support separate DT overlays. >>> >>> Practical benefits sound far fetched here, while forcing users to >>> manually configure something that would have otherwise just worked. >>> Let's see what Heiko thinks. > > Personally, I'm more on the less complication side. > > I.e. if there is an actual fan-connector on the board we should describe > it as such. > > Overlays I see for things where you attach hats to generic pin headers > to create specific functionality on top of a generic interface. > > But if the board itself has an actual fan header, it should be described > as such. Because that then _is_ the standard use of that. The board does have a fan connector, just no fan by default. But anyway, since it sounds like the preferred approach I'll send a v2 which puts the fan into the base board .dts. Dragan, you mentioned there's no need for more than 2 trip points - if I remove the trip points between "SoC is warm, start fan at slow speed" and "SoC is v. hot, run fan at full speed" is the OS/kernel expected to interpolate between those 2 trip points (if you have a link to docs or code about this it'd be interesting, I couldn't find anything in the dt-bindings)? Best regards, Hugh ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2025-11-01 13:15 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2025-10-26 19:48 [PATCH] arm64: dts: rockchip: pwm-fan overlay for NanoPC-T6 Hugh Cole-Baker 2025-10-27 9:14 ` Alexey Charkov 2025-10-27 19:08 ` Hugh Cole-Baker 2025-10-27 20:02 ` Dragan Simic 2025-10-27 20:56 ` Alexey Charkov 2025-10-27 21:15 ` Dragan Simic 2025-10-27 21:20 ` Diederik de Haas 2025-11-01 11:44 ` Heiko Stuebner 2025-11-01 13:14 ` Hugh Cole-Baker
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).