设备树配置如下:
backlight: backlight {
status = "okay";
compatible = "pwm-backlight";
pwms = <&ehrpwm1 0 500000 0>;
brightness-levels = <0 51 53 56 62 75 101 152 255>;
default-brightness-level = <8>;
};
ehrpwm1_pins: pinmux-ehrpwm1-pins {
pinctrl-single,pins = <
AM33XX_IOPAD(0x848, PIN_OUTPUT_PULLDOWN | MUX_MODE6) /* gpmc_a2.ehrpwm1a */
AM33XX_IOPAD(0x84c, PIN_OUTPUT_PULLDOWN | MUX_MODE6) /* gpmc_a2.ehrpwm1b */
>;
};
&epwmss1 {
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&ehrpwm1_pins>;
ecap@48302100 {
status = "disable";
};
pwm@48302200 {
status = "okay"; /* ehrpwm1 */
};
};
把EHRPWM1A用作了背光,那如何控制EHRPWM1B的输出
Shine:
EHRPWM1A对应pwm0, EHRPWM1B对应pwm1,可以通过下面的命令使能EHRPWM1B。
echo 1 > /sys/class/pwm/pwmchip1/pwm1/enable
user6394011:
ehrpwm1a可以配置为背光,为什么ehrpwm1b不行呢,配置为ehrpwm1b就没有输出
user6394011:
回复 Shine:
但是我显示的是pwmchip0,且下面并没有pwm1,EHRPWM1A被配置为背光了,但是EHRPWM1B配置背光就没有输出
user6394011:
回复 Shine:
root@am335x-evm:/sys/class/pwm/pwmchip0# lsdeviceexportnpwmpowersubsystemueventunexport
这是pwmchip0下的所有文件
Shine:
回复 user6394011:
请参考下面帖子的设备树配置。
e2e.ti.com/…/661736
user6394011:
回复 Shine:
通过 echo 1 > export命令pwmchip0下显示出pwm1.
但是使用echo 1 > /sys/class/pwm/pwmchip0/pwm1/enable命令报错
-sh: echo: write error: Invalid argument
Shine:
回复 user6394011:
设备树改成下面的试试
&epwmss1 {status = "okay";
ehrpwm1: pwm@48302200 {status = "okay";pinctrl-names = "default";pinctrl-0 = <&ehrpwm1_pins>;};
};
Shine:
回复 user6394011:
感谢分享,很详细!