主板上使用GPIO1_PD6作为LCD背光亮度调节引脚。
查看文件中pwm9相关的信息,得知GPIO1_PD6为pwm9m1_pins;
pwm9 {
/omit-if-no-ref/
pwm9m0_pins: pwm9m0-pins {
rockchip,pins =
/* pwm9_m0 */
<3 RK_PB2 5 &pcfg_pull_none>;
};
/omit-if-no-ref/
pwm9m1_pins: pwm9m1-pins {
rockchip,pins =
/* pwm9_m1 */
<1 RK_PD6 4 &pcfg_pull_none>;
};
};
文件中,pwm9默认使用的是pwm9m0_pins管脚;
pwm9: pwm@fe6f0010 {
compatible = "rockchip,rk3568-pwm", "rockchip,rk3328-pwm";
reg = <0x0 0xfe6f0010 0x0 0x10>;
#pwm-cells = <3>;
pinctrl-names = "active";
pinctrl-0 = <&pwm9m0_pins>;
clocks = <&cru CLK_PWM2>, <&cru PCLK_PWM2>;
clock-names = "pwm", "pclk";
status = "disabled";
};
改为:
pwm9: pwm@fe6f0010 {
compatible = "rockchip,rk3568-pwm", "rockchip,rk3328-pwm";
reg = <0x0 0xfe6f0010 0x0 0x10>;
#pwm-cells = <3>;
pinctrl-names = "active";
pinctrl-0 = <&pwm9m1_pins>;
clocks = <&cru CLK_PWM2>, <&cru PCLK_PWM2>;
clock-names = "pwm", "pclk";
status = "disabled";
};
backlight节点改为:
backlight: backlight {
compatible = "pwm-backlight";
pwms = <&pwm9 0 25000 1>;
......
};
重新编译内核生成,然后烧写到主板中。
亮度调节:
cd到/sys/devices/platform/backlight/backlight/backlight目录下,设置brightness的值即可调节亮度,0为亮度最低,255为亮度最高;
[root@RK356X:/sys/devices/platform/backlight/backlight/backlight]# ls
actual_brightness brightness max_brightness subsystem uevent
bl_power device power type
[root@RK356X:/sys/devices/platform/backlight/backlight/backlight]# echo 200 > br
ightness
[root@RK356X:/sys/devices/platform/backlight/backlight/backlight]# echo 0 > brig
htness
[root@RK356X:/sys/devices/platform/backlight/backlight/backlight]# echo 150 > br
ightness
可以看到屏幕的亮度会有变化。