Xavier NX PWM-FAN

Hi Sir,

L4T 32.6.1
Our custom carrier board(MP stage)

We want to control the PWM-FAN.
Ex: sudo echo 224 > /sys/devices/pwm-fan/target_pwm

[The current status]
nvidia@nvidia-desktop:/sys/devices/pwm-fan$ ls -la
total 0
drwxr-xr-x 3 root root 0 八 29 11:46 .
drwxr-xr-x 122 root root 0 八 29 11:46 …
-rw-r–r-- 1 root root 4096 八 29 11:46 driver_override
-r–r–r-- 1 root root 4096 八 29 11:46 modalias
lrwxrwxrwx 1 root root 0 八 29 11:46 of_node → …/…/firmware/devicetree/base/pwm-fan
drwxr-xr-x 2 root root 0 八 29 11:46 power
lrwxrwxrwx 1 root root 0 八 29 11:46 subsystem → …/…/bus/platform
-rw-r–r-- 1 root root 4096 八 29 11:46 uevent
nvidia@nvidia-desktop:/sys/devices/pwm-fan$

[dmesg]
[ 2.071948] FAN dev name: pwm-fan
[ 2.071979] FAN:gpio request failed
[ 2.072091] pwm_fan_driver: probe of pwm-fan failed with error -22
I trace the driver source code and can not find out any key word.

[Device tree]
pwm-fan {
pwms = <&tegra_pwm6 0 45334>;
vdd-fan-supply = <&p3509_vdd_fan>;
profiles {
default = “quiet”;
quiet {
state_cap = <4>;
active_pwm = <0 130 160 200 255 255 255 255 255 255>;
};
cool {
state_cap = <4>;
active_pwm = <0 140 170 200 255 255 255 255 255 255>;
};
};
};
thermal-fan-est {
profiles {
default = “quiet”;
quiet {
active_trip_temps = <0 46000 60000 68000 76000
140000 150000 160000 170000 180000>;
active_hysteresis = <0 8000 8000 7000 7000
0 0 0 0 0>;
};
cool {
active_trip_temps = <0 35000 45000 53000 61000
140000 150000 160000 170000 180000>;
active_hysteresis = <0 8000 8000 7000 7000
0 0 0 0 0>;
};
};
};
We use the original source code and don’t change anything for FAN.

Can you teach us how to enable it?
(Our Nvidia Nano platform is OK.)

Thank you.
S.K.

Hi sk1977.huang,

It seems failed in the following snippet.

 	err = gpio_request(pwm_fan_gpio, "pwm-fan");
  	if (err < 0) {
  		pr_err("FAN:gpio request failed\n");
  		err = -EINVAL;
  		goto gpio_request_fail;
  	} else {
  		pr_info("FAN:gpio request success.\n");
  	}

Do you have the exact same fan design as the devkit?

Could you reproduce the same issue on the devkit or the issue is specific to your custom carrier board?

Hi Kevin,

I can get the snippet at the path ./kernenl_src/kernel/nvidia/drivers/thermal/pwm_fan.c.
It uses the gpio_request function.

From the topic:

/kernel_src/hardware/nvidia/platform/t19x/common/kernel-dts/t19x-common-platforms/tegra194-pwm-fan.dtsi:
/ {
	pwm_fan_shared_data: pfsd {
		num_resources = <0>;
		secret = <47>;
		active_steps = <10>;
		active_rpm = <0 1000 2000 3000 4000 5000 6000 7000 10000 11000>;
		rpm_diff_tolerance = <2>;
		active_rru = <40 2 1 1 1 1 1 1 1 1>;
		active_rrd = <40 2 1 1 1 1 1 1 1 1>;
		state_cap_lookup = <2 2 2 2 3 3 3 4 4 4>;
		pwm_period = <45334>;
		pwm_id = <4>;
		pwm_polarity = <PWM_POLARITY_INVERTED>;
		suspend_state = <1>;
		step_time = <100>; /* mesecs */
		state_cap = <7>;
		active_pwm_max = <256>;
		tach_period = <1000>;
		pwm_gpio = <&tegra_aon_gpio TEGRA194_AON_GPIO(CC, 4) GPIO_ACTIVE_LOW>;
	};

	pwm-fan {
		compatible = "pwm-fan";
		status = "okay";
		#pwm-cells = <1>;
		pwms = <&tegra_pwm4 0 45334>;
		shared_data = <&pwm_fan_shared_data>;
		profiles {
			default = "quiet";
			quiet {
				state_cap = <4>;
				active_pwm = <0 77 120 160 255 255 255 255 255 255>;
			};
			cool {
				state_cap = <4>;
				active_pwm = <0 77 120 160 255 255 255 255 255 255>;
			};
		};
	};
};
/kernel_src/hardware/nvidia/platform/t19x/jakku/kernel-dts/common/tegra194-p3509-0000-a00.dtsi:

	pwm-fan {
		pwms = <&tegra_pwm6 0 45334>;
		vdd-fan-supply = <&p3509_vdd_fan>;
		profiles {
			default = "quiet";
			quiet {
				state_cap = <4>;
				active_pwm = <0 130 160 200 255 255 255 255 255 255>;
			};
			cool {
				state_cap = <4>;
				active_pwm = <0 140 170 200 255 255 255 255 255 255>;
			};
		};
	};
	thermal-fan-est {
		profiles {
			default = "quiet";
			quiet {
				active_trip_temps = <0 46000 60000 68000 76000
						140000 150000 160000 170000 180000>;
				active_hysteresis = <0 8000 8000 7000 7000
						0 0 0 0 0>;
			};
			cool {
				active_trip_temps = <0 35000 45000 53000 61000
						140000 150000 160000 170000 180000>;
				active_hysteresis = <0 8000 8000 7000 7000
						0 0 0 0 0>;
			};
		};
	};

Do I change tegra194-pwm-fan.dtsi ?
pwm_gpio = <&tegra_aon_gpio TEGRA194_AON_GPIO(CC, 4) GPIO_ACTIVE_LOW>;

GPIO14 → (H,1)


Do you have the exact same fan design as the devkit?
[sk] Yes
Could you reproduce the same issue on the devkit or the issue is specific to your custom carrier board?
[sk] The Image files cannot be shared between SOM and devkit.
I check the Nvidia Nano with our custom carrier board and Nano image.
I can see the control interface /sys/devices/pwm-fan/target_pwm.

Thanks
S.K.

1 Like

Hi Kevin,

We can use the control interface now.

Thank you so much!

S.K.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.