Android的背光值是[0~255],有时候会发现在Android的系统设置中把背光设置到最左边时屏幕会全黑,但Android系统本身是做了处理防止全黑,在调到最左边时,背光值是30,也就是背光为30时系统就黑了,所以应该是底层的问题,我们在drivers\video\backlight\pwm_bl.c中可以看到以下代码,按代码中的修改即可:
static int pwm_backlight_update_status(struct backlight_device *bl)
{
struct pwm_bl_data *pb = dev_get_drvdata(&bl->dev);
int brightness = bl->props.brightness;
int max = bl->props.max_brightness;
if (bl->props.power != FB_BLANK_UNBLANK)
brightness = 0;
if (pb->notify)
brightness = pb->notify(pb->dev, brightness);
if (brightness == 0) {
pwm_config(pb->pwm, 0, pb->period);
pwm_disable(pb->pwm);
} else {
if(brightness<50) brightness = 50;//如果亮度值太小,可能使屏太黑,可以把亮度值调到你认为的可以接受的最小值.
pwm_config(pb->pwm, brightness * pb->period / max, pb->period);
pwm_enable(pb->pwm);
}
return 0;
}