Tach-gpio is missing from pwm-fan device tree so we can't monitor fan RPM

The device tree for pwm-fan needs to have the tach-gpio attribute set or we can’t see the fan rpm (unless it’s hidden somewhere else). I think it needs to be TEGRA_GPIO(Q, 2).

hello gtj,

may I know which JetPack release you’re working with; are you able to check the RPM with system nodes.
for example,
/sys/bus/platform/devices/pwm-fan/cur_pwm

L4T 32.4.2
/sys/bus/platform/devices/pwm-fan/cur_pwm” shows the current PWM setting not the actual fan RPM.
/sys/bus/platform/devices/pwm-fan/rpm_measuredshould show the actual RPM but shows 0.
/sys/bus/platform/devices/pwm-fan/tach_enable” is also 0 and when I try to set it to 1,
I get a kernel error message “pwm_fan_driver pwm-fan: Can't find tach_gpio”.

Sure enough, when I look in the device tree (both live on the device and in the sources), there’s no tach_gpio attribute set.

hello gtj,

please have a try to include tach_gpio property in the t19x pwm-fan device tree,
for example,
$L4T_Sources/r32.4.2/Linux_for_Tegra/source/public/kernel_src/hardware/nvidia/platform/t19x/common/kernel-dts/t19x-common-platforms/tegra194-pwm-fan.dtsi

...
tach_gpio = <&tegra_main_gpio TEGRA_MAIN_GPIO(Q, 2) GPIO_ACTIVE_LOW>;

Actually, it has to go in the pwm_fan_shared_data (pfsd) tree, not pwm-fan itself. Here’s an overlay that works…

/dts-v1/;
/plugin/;
/ {
 overlay-name = "PWM Fan Tach GPIO";
 compatible = "nvidia,p3509-0000+p3668-0000", "nvidia,p3509-0000+p3668-0001", "nvidia,tegra194";
    fragment {
        target = < &pwm_fan_shared_data >;
        __overlay__ {
           tach_gpio = <&tegra_main_gpio ((16 * 8) + 2) 0>;
        };
    };
};

hello gtj,

since we have tachometer, we don’t use tach-gpio.
FYI, please read rpm from tachometer as below.
thanks

# First check which hwmon* is for tach
$ cat /sys/class/hwmon/hwmon*/name

# please use pwm_tach nodes to read rpm
$ cat /sys/class/hwmon/hwmon1/rpm
1 Like

That’s strange. I could have sworn I checked that and it was always 0. It looks correct now though.