How can I directly manipulate PWM4 on our carrier board? tx2-4GB

Hi:

tx2-4GB with our carrier board,
Linux tegra-ubuntu 4.9.140-tegra #1 SMP PREEMPT Mon Aug 12 21:29:52 PDT 2019 aarch64 aarch64 aarch64 GNU/Linux

How can i directly contrl pwm4.the FAN_PWM pin.
i have not the directory /sys/devices/pwm-fan/target_pwm.

HI:
How to let pwm4(FAN_PWM pin) genarate pwm waveforms with our carrier board.
I don’t have the directory /sys/devices/pwm-fan/target_pwm.

i read kernel-4.9/Documentation/pwm.txt ,and got the method.

hello 504566020,

for the more details of tegra-fan controls.
please also refer to similar discussion thread, Topic 1063982.
thanks

1)Export PWM0接口

cd /sys/class/pwm/pwmchip0/

echo 0 > export #表示PWM0下,index为0的PWM。

2)设置PWM0 周期和占空比,这里均为时间,单位为ns

分别设置周期为1s,占空比为50%

echo 1000000000 > pwm0/period

echo 500000000 > pwm0/duty_cycle

3)设置PWM0极性

echo normal > pwm0/polarity //正常

或者

echo inversed > pwm0/polarity //极性翻转

4)使能PWM0,

echo 1 > pwm0/enable