Acqua PWM Udev Driver

Kernerl menu:

make ARCH=arm menuconfig

Device driver  —>    [*] Pulse-Width Modulation (PWM) Support  —>

<*> Atmel PWM support
<*> Atmel TC Block PWM support

 

# Udev PWM path

echo 0 > /sys/class/pwm/pwmchip0/export

/sys/class/pwm/pwmchip0/pwmX/
      |-- duty_cycle (r/w) duty cycle (in nanoseconds)
      |-- enable     (r/w) enable/disable PWM
      |-- period     (r/w) period (in nanoseconds)
      |-- polarity   (r/w) polarity of PWM
      |-- power
      `-- uevent

~# echo 1000000 > /sys/class/pwm/pwmchip0/pwm0/period
~# echo 500000 > /sys/class/pwm/pwmchip0/pwm0/duty_cycle
~# echo 1 > /sys/class/pwm/pwmchip0/pwm0/enable

 

 

Acqua A5  – DTS

 pwm0: pwm@f002c000 {
        pinctrl-names = "default";
        pinctrl-0 = <   
                        &pinctrl_pwm0_pwmh0
                        &pinctrl_pwm0_pwml0
                        &pinctrl_pwm0_pwmh1 
                        &pinctrl_pwm0_pwml1
                        &pinctrl_pwm0_pwmh2 
                        &pinctrl_pwm0_pwml2
                        &pinctrl_pwm0_pwmh3 
                        &pinctrl_pwm0_pwml3
                        >;
        status = "okay";
    };

    pinctrl@fffff200 {
        board {
            pinctrl_pwm0_pwmh0: pwm0_pwmh0 {
                atmel,pins =
                    < AT91_PIOB 0 AT91_PERIPH_B AT91_PINCTRL_NONE >;
            };
            pinctrl_pwm0_pwml0: pwm0_pwml0 {
                atmel,pins =
                    < AT91_PIOB 1 AT91_PERIPH_B AT91_PINCTRL_NONE >;
            };
            pinctrl_pwm0_pwmh1: pwm0_pwmh1 {
                atmel,pins =
                    < AT91_PIOB 4 AT91_PERIPH_B AT91_PINCTRL_NONE >;
            };
            pinctrl_pwm0_pwml1: pwm0_pwml1 {
                atmel,pins =
                    < AT91_PIOB 5 AT91_PERIPH_B AT91_PINCTRL_NONE >;
            };
            pinctrl_pwm0_pwmh2: pwm0_pwmh2 {
                atmel,pins =
                    < AT91_PIOB 8 AT91_PERIPH_B AT91_PINCTRL_NONE >;
            };
            pinctrl_pwm0_pwml2: pwm0_pwml2 {
                atmel,pins =
                    < AT91_PIOB 9 AT91_PERIPH_B AT91_PINCTRL_NONE >;
            };
            pinctrl_pwm0_pwmh3: pwm0_pwmh3 {
                atmel,pins =
                    < AT91_PIOB 12 AT91_PERIPH_B AT91_PINCTRL_NONE >;
            };
            pinctrl_pwm0_pwml3: pwm0_pwml3 {
                atmel,pins =
                    < AT91_PIOB 13 AT91_PERIPH_B AT91_PINCTRL_NONE >;
            };
        };
    };
Annunci