mirror of https://lore.kernel.org/linux-amlogic/
 help / color / mirror / Atom feed
* [PATCH] arm64: dts: amlogic: meson-sm1-odroid-hc4: add the fan tachometer
@ 2026-10-06  4:07 Igor Velkov via B4 Relay
  2026-10-06  4:17 ` sashiko-bot
  0 siblings, 1 reply; 4+ messages in thread
From: Igor Velkov via B4 Relay @ 2026-10-06  4:07 UTC (permalink / raw)
  To: Neil Armstrong, Kevin Hilman, Jerome Brunet, Martin Blumenstingl
  Cc: Rob Herring, Conor Dooley, devicetree, linux-kernel, Igor Velkov,
	linux-amlogic, Krzysztof Kozlowski, linux-arm-kernel

From: Igor Velkov <iav@iav.lv>

The fan connector routes the fan's tachometer output to GPIOX_7, but
the fan node does not describe it. pwm-fan therefore registers no
fan1_input, and the fan speed cannot be read.

Describe the line as the fan's interrupt.

Tested on ODROID-HC4: fan1_input reads 0 with the fan stopped and
rises with the duty cycle, to about 4400 rpm at full speed.

Assisted-by: LLM
Signed-off-by: Igor Velkov <iav@iav.lv>
---
 arch/arm64/boot/dts/amlogic/meson-sm1-odroid-hc4.dts | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-hc4.dts b/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-hc4.dts
index 5f15c2299509..261a42560a5e 100644
--- a/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-hc4.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-hc4.dts
@@ -21,6 +21,8 @@ fan0: pwm-fan {
 		#cooling-cells = <2>;
 		cooling-levels = <0 120 170 220>;
 		pwms = <&pwm_cd 1 40000 0>;
+		interrupt-parent = <&gpio_intc>;
+		interrupts = <IRQID_GPIOX_7 IRQ_TYPE_EDGE_FALLING>;
 	};
 
 	leds {

---
base-commit: b44e2be772f866985cafdf90355285069ea68495
change-id: 20261006-hc4-fan-tach-440c1b874a04

Best regards,
-- 
Igor Velkov <iav@iav.lv>



_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* Re: [PATCH] arm64: dts: amlogic: meson-sm1-odroid-hc4: add the fan tachometer
  2026-10-06  4:07 [PATCH] arm64: dts: amlogic: meson-sm1-odroid-hc4: add the fan tachometer Igor Velkov via B4 Relay
@ 2026-10-06  4:17 ` sashiko-bot
  2026-10-06  4:29   ` Igor Velkov
  0 siblings, 1 reply; 4+ messages in thread
From: sashiko-bot @ 2026-10-06  4:17 UTC (permalink / raw)
  To: Igor Velkov; +Cc: linux-amlogic, robh, conor+dt, devicetree, neil.armstrong

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] arm64: dts: amlogic: missing pinctrl for fan tachometer interrupt
--

commit a6a97db21df93ac09c2154310040802278dbb495
Author: Igor Velkov <iav@iav.lv>

arm64: dts: amlogic: meson-sm1-odroid-hc4: add the fan tachometer

This commit adds the interrupt configuration for the fan tachometer to the
pwm-fan node on the ODROID-HC4, mapping it to GPIOX_7.

> diff --git a/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-hc4.dts b/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-hc4.dts
> index 5f15c2299509b..261a42560a5e9 100644
> --- a/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-hc4.dts
> +++ b/arch/arm64/boot/dts/amlogic/meson-sm1-odroid-hc4.dts
> @@ -21,6 +21,8 @@ fan0: pwm-fan {
>  		#cooling-cells = <2>;
>  		cooling-levels = <0 120 170 220>;
>  		pwms = <&pwm_cd 1 40000 0>;
> +		interrupt-parent = <&gpio_intc>;
> +		interrupts = <IRQID_GPIOX_7 IRQ_TYPE_EDGE_FALLING>;

[Severity: Medium]
Does this configuration leave the hardware pin direction entirely dependent on
the pre-kernel bootloader state?

The pwm-fan driver requests the IRQ via devm_request_irq(), and the
meson-gpio-intc interrupt controller does not implement .irq_request_resources
to automatically mux the pin to GPIO mode.

Without an explicit pinctrl-0 property in the fan0 node, will the fan
tachometer silently fail to read the fan speed (always reporting 0) on systems
where the bootloader leaves GPIOX_7 configured as an alternate function (such
as uart_b_rx or pwm_f_x) instead of a GPIO input?

>  	};
>  
>  	leds {

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261006-hc4-fan-tach-v1-1-4e7cecf0b45b@iav.lv?part=1

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* Re: [PATCH] arm64: dts: amlogic: meson-sm1-odroid-hc4: add the fan tachometer
  2026-10-06  4:17 ` sashiko-bot
@ 2026-10-06  4:29   ` Igor Velkov
  2026-10-06 13:03     ` Neil Armstrong
  0 siblings, 1 reply; 4+ messages in thread
From: Igor Velkov @ 2026-10-06  4:29 UTC (permalink / raw)
  To: Neil Armstrong
  Cc: Rob Herring, Conor Dooley, devicetree, Martin Blumenstingl,
	Kevin Hilman, linux-kernel, Igor Velkov, linux-amlogic,
	Krzysztof Kozlowski, linux-arm-kernel, Jerome Brunet

On Tue, 06 Oct 2026 04:17:33 +0000, sashiko-bot@kernel.org wrote:
> Without an explicit pinctrl-0 property in the fan0 node, will the fan
> tachometer silently fail to read the fan speed (always reporting 0) on systems
> where the bootloader leaves GPIOX_7 configured as an alternate function (such
> as uart_b_rx or pwm_f_x) instead of a GPIO input?

Checked on the board: with GPIOX_7 muxed to uart_b_rx, the interrupt
counts edges as it does with the pin as GPIO (452 vs 445 in 5 s).
U-Boot leaves the pin as GPIO. The PHY interrupt on this board is
described the same way, without pinctrl.

Igor

_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

* Re: [PATCH] arm64: dts: amlogic: meson-sm1-odroid-hc4: add the fan tachometer
  2026-10-06  4:29   ` Igor Velkov
@ 2026-10-06 13:03     ` Neil Armstrong
  0 siblings, 0 replies; 4+ messages in thread
From: Neil Armstrong @ 2026-10-06 13:03 UTC (permalink / raw)
  To: Igor Velkov
  Cc: Neil Armstrong, Conor Dooley, Rob Herring, Martin Blumenstingl,
	Kevin Hilman, linux-kernel, devicetree, linux-amlogic,
	Krzysztof Kozlowski, linux-arm-kernel, Jerome Brunet

On 2026-10-06 07:29:02+03:00, Igor Velkov wrote:
> On Tue, 06 Oct 2026 04:17:33 +0000, sashiko-bot@kernel.org wrote:
> 
> > Without an explicit pinctrl-0 property in the fan0 node, will the fan
> > tachometer silently fail to read the fan speed (always reporting 0) on systems
> > where the bootloader leaves GPIOX_7 configured as an alternate function (such
> > as uart_b_rx or pwm_f_x) instead of a GPIO input?
> 
> Checked on the board: with GPIOX_7 muxed to uart_b_rx, the interrupt
> counts edges as it does with the pin as GPIO (452 vs 445 in 5 s).
> U-Boot leaves the pin as GPIO. The PHY interrupt on this board is
> described the same way, without pinctrl.

Actually on Amlogic platforms the GPIO Interrup HW block
directly gets the pin input directly from the pin, so
the pin doesn't need to be set as input.

Nevertheless, so be sure there's no remaining pull-up
or pull-down remaining on the pin, it's safer to add
a pinctrl mux node for the pin.

Thamks,
Neil

> 
> Igor



_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

end of thread, other threads:[~2026-10-06 13:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-06  4:07 [PATCH] arm64: dts: amlogic: meson-sm1-odroid-hc4: add the fan tachometer Igor Velkov via B4 Relay
2026-10-06  4:17 ` sashiko-bot
2026-10-06  4:29   ` Igor Velkov
2026-10-06 13:03     ` Neil Armstrong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®