1、light系统框架
2、驱动相关的文件
1)Hal
/vendor/mediatek/proprietary/hardware/liblights/lights.c
2)Kernel
/kernel-3.18/drivers/leds/led-class.c
/kernel-3.18/drivers/leds/led-core.c
/kernel-3.18/drivers/leds/led-triggers.c
/kernel-3.18/drivers/leds/led-trigger/ledtring-timer.c
3)Driver
Kernel
/kernel-3.18/drivers/misc/mediatek/leds/$(platform)/leds.c
/kernel-3.18/drivers/misc/mediatek/leds/leds_drv.c
lk
/vendor/mediatek/proprietary/bootable/bootloader/lk/platform/$(platform)/mt_leds.c
4)客制化
--- Kernel(DTS):
/kernel-3.18/arch/arm64/boot/dts/$(project).dts
---LK
/vendor/mediatek/proprietary/bootable/bootloader/lk/target/$(project)/cust_leds.c
3、背光灯模式
1)PWM 控制背光
2)PMIC 控制背光
4、背光灯客制化
1)lk 部分客制化
2)Kernel 部分客制化
修改设备树参数: led_mode 和data [参数的具体定义参考上图]
/kernel-3.18/arch/arm64/boot/dts/$(project).dts
led0:led@0 {
compatible = "mediatek,red";
led_mode &#61; <0>;
data &#61; <1>;
pwm_config &#61; <0 0 0 0 0>;
};
led1:led&#64;1 {
compatible &#61; "mediatek,green";
led_mode &#61; <0>; ---------------------LED 模式需要设置对
data &#61; <1>;
pwm_config &#61; <0 0 0 0 0>;
};
led2:led&#64;2 {
compatible &#61; "mediatek,blue";
led_mode &#61; <0>;
data &#61; <1>;
pwm_config &#61; <0 0 0 0 0>;
};
led3:led&#64;3 {
compatible &#61; "mediatek,jogball-backlight";
led_mode &#61; <0>;
data &#61; <1>;
pwm_config &#61; <0 0 0 0 0>;
};
led4:led&#64;4 {
compatible &#61; "mediatek,keyboard-backlight";
led_mode &#61; <0>;
data &#61; <1>;
pwm_config &#61; <0 0 0 0 0>;
};
led5:led&#64;5 {
compatible &#61; "mediatek,button-backlight";
led_mode &#61; <0>;
data &#61; <1>;
pwm_config &#61; <0 0 0 0 0>;
};
led6:led&#64;6 {
compatible &#61; "mediatek,lcd-backlight";
led_mode &#61; <5>;
data &#61; <1>;
pwm_config &#61; <0 0 0 0 0>;
};
3&#xff09;BB_PWM的波形周期和波形持续时间决定背光灯的亮度。
需要配置的参数在PWM_config定义&#xff0c;如果参数为0&#xff0c;就是使用系统定义的默认的参数&#xff0c;参数的具体定义参考硬件手册。
5 、调试方法
看背光灯的亮度和是否亮
---/sys/class/leds/xxx/brightness xxx---green,blue,red light的名字
---如果背光灯工作不正常&#xff0c;可以检查驱动。
echo brightness_level>brightness 检查设置的背光值是否正确
---背光灯的blank
echo timer>trigger
echo on_timer>delay_on
echo off_timer>delay_off