背光设计
24 Feb 2025
Read time: 1 minute(s)
Backlight 使用内核中 pwm-backlight 背光驱动,代码见 linux-5.10driversvideobacklightpwm_bl.c。
Panel 驱动可以通过 DTS 获取背光驱动的 device node,然后 backlight API 控制背光。
-
backlight_enable() 使能背光
-
backlight_update_status() 对背光状态进行更新
backlight { compatible = "pwm-backlight"; /* pwm node name; pwm device No.; period_ns; pwm_polarity */ pwms = <&pwm 0 1000000 PWM_POLARITY_INVERTED>; brightness-levels = <0 10 20 30 40 50 60 70 80 90 100>; default-brightness-level = <8>; status = "okay"; }; panel_rgb { compatible = "artinchip,aic-general-rgb-panel"; backlight = <&backlight>; }; // 为节省篇幅,已省略无关配置
应用程序对背光进行操作:
echo 2 > /sys/class/backlight/backlight/brightness