1
votes

We are using beaglebone black based custom board, We are porting linux 3.12 for our board, We have three leds which are to be controlled using pwm. those LEDS are connected to following balls,

1. E18 --> Pinmux mode 0 --> eCAP0_in_PWM0_out
2. B19 --> Pinmux mode 3 --> eCAP1_in_PWM1_out
3. C18 --> Pinmux mode 3 --> eCAP2_in_PWM2_out

We modified device-tree as follows to enable the leds-pwm support,

 am33xx_pinmux: pinmux@44e10800 {
            pinctrl-names = "default";
            backlight_pin_0: pinmux_backlight_pin_0 {
                    pinctrl-single,pins = <
                            0x164 0x00  /* ecap0_in_pwm0_out.gpio0_7, OUTPUT | MODE0 */
                    >;
            };
            backlight_pin_1: pinmux_backlight_pin_1 {
                    pinctrl-single,pins = <
                            0x18C 0x03  /* ecap0_in_pwm0_out.gpio0_7, OUTPUT | MODE0 */
                    >;
            };
            backlight_pin_2: pinmux_backlight_pin_2 {
                    pinctrl-single,pins = <
                            0x188 0x03  /* ecap0_in_pwm0_out.gpio0_7, OUTPUT | MODE0 */
                    >;
            };
};


ocp {

                    epwmss0: epwmss@48300000 {
                    status = "okay";
                    /*ecap0: ecap@48300100 {*/
                    ehrpwm0: ehrpwm@48300200 {
                            status = "okay";
                            pinctrl-names = "default";
                            pinctrl-0 = <&backlight_pin_0>;
                    };
            };
            epwmss1: epwmss@48302000 {
                    status = "okay";
                    /*ecap0: ecap@48300100 {*/
                    ehrpwm1: ehrpwm@48302200 {
                            status = "okay";
                            pinctrl-names = "default";
                            pinctrl-0 = <&backlight_pin_1>;
                    };
            };

};


        pwm_led {
            compatible = "pwm-leds";
            led0 {
                    pwms = <&ehrpwm0 0 50 1>;
                    max-brightness = <255>;
                    linux,default-trigger = "default-on";
                    brightness = <127>;
                    status = "okay";
            };
            led1 {
                    pwms = <&ehrpwm1 1 50 1>;
                    max-brightness = <255>;
                    linux,default-trigger = "default-on";
                    brightness = <127>;
            };

    };

With above changes we are seeing entries in "/sys/class/pwm/" and in "/sys/class/leds/". But the problem is we are not able to control the leds, leds are not switching on,

# ls /sys/class/leds/
led0  led1
# ls /sys/class/leds/led0/
brightness      max_brightness  subsystem       uevent
device          power           trigger
# cat /sys/class/leds/led0/trigger
none nand-disk timer oneshot heartbeat backlight gpio cpu0 [default-on]
# cat /sys/class/leds/led0/brightness
255
# cat /sys/class/leds/led0/max_brightness
255
# ls /sys/class/pwm/
pwmchip0  pwmchip2
# ls /sys/class/pwm/pwmchip0
device     export     npwm       power      subsystem  uevent     unexport
# cat /sys/class/pwm/pwmchip0/device/modalias
platform:48300200.ehrpwm

we tried changing brightness and triggers under the leds but it didnt help, Any suggestions? do you see something missing ?

Thank you,

Regards, Ankur

1

1 Answers

0
votes

Finally we found out that we should be using ecap instead of ehrpwm to make pwm work.
for detailed answer refer below link
http://e2e.ti.com/support/embedded/linux/f/354/t/366635.aspx