Changing Jetson Xavier default fan PWM line

Hello,
We are trying to utilize a second pwm fan for the nx xavier.
Applying below change to the dts:
pwm_fan_shared_data2: pfsd2 {
num_resources = <1>;
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 = <8>;
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_main_gpio TEGRA194_MAIN_GPIO(R, 0) GPIO_ACTIVE_LOW>;
};

pwm-fan2 {
	compatible = "pwm-fan";
	status = "okay";
	#pwm-cells = <1>;
	pwms = <&tegra_pwm8 0 45534>;
	shared_data = <&pwm_fan_shared_data2>;
	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>;
		};
	};
};

We do see pwm-fan2 device.
Reading cur_pwm shows a valid duty cycle value.
However, checking the pin13 in the 40 pin connector, nothing happens.
Even setting the target pwm to 255, gpio line is still 0.

dmesg logs gives this:

[ 5.068889] FAN:PWM gpio is: 424
[ 5.072243] pwm_fan_driver pwm-fan2: FAN:PWM gpio is: 424
[ 5.111712] FAN:gpio request success.
[ 5.118508] pwm_fan_driver pwm-fan2: FAN:PWM id is: 8

Any thoughts of what we are doing wrong?

hello tirank,

you would like to control it via GPIO07 / GPIO3_PR.00, right?
according to Jetson Xavier NX Pinmux Table, this pin is by default configure as GPIO pin, you may have customization to modify customer usage as PWM,
please also refer to developer guide, Pinmux Changes for reference,
thanks

Hi Jerry,
Thanks for the inputs.
I understand the translation and was able to calculate the actual pin number(427 in my case).
But how do I free this from being used as regular gpio?
I mean, in the above pfsd2 I provide the gpio number via the macro (&tegra_main_gpio TEGRA194_MAIN_GPIO(R, 0) GPIO_ACTIVE_LOW), which will translate into 427.
WHat else do I need to do to make this GPIO free to be used as PWM?

Thanks

I think I understand now…
I need to generate the dtsi files from the excel after selecting the pwm8 instead of gpio and recompile.

Thanks

hello tirank,

yes, that’s default pin configuration loaded by device tree.

What do I do with the resulting .cfg file?

Should it be provided as a patch file to the kernel?

move this topic to Xavier NX,

hello tirank,

please check developer guide, Pinmux Changes for reference.
you must customize the spreadsheet for the configuration of your board, and convert the .dtsi file generated by excel spreadsheets into a .cfg file.
please perform a flash process, you should flash the whole image to update the board configuration.
thanks