backlight: cr_bllcd: Introduce gpio-backlight semantics
cr_bllcd can turn backlight ON or OFF. Fix semantitics so they equals what we know from gpio-backlight. brightness == 0 => backlight off brightness == 1 => backlight on Use the backlight_get_brightness() helper to simplify the code. Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Lee Jones <lee.jones@linaro.org>
This commit is contained in:
parent
5a09765dde
commit
24d34617c2
|
@ -63,22 +63,15 @@ static int cr_backlight_set_intensity(struct backlight_device *bd)
|
||||||
u32 addr = gpio_bar + CRVML_PANEL_PORT;
|
u32 addr = gpio_bar + CRVML_PANEL_PORT;
|
||||||
u32 cur = inl(addr);
|
u32 cur = inl(addr);
|
||||||
|
|
||||||
if (bd->props.power == FB_BLANK_UNBLANK)
|
if (backlight_get_brightness(bd) == 0) {
|
||||||
intensity = FB_BLANK_UNBLANK;
|
/* OFF */
|
||||||
if (bd->props.fb_blank == FB_BLANK_UNBLANK)
|
|
||||||
intensity = FB_BLANK_UNBLANK;
|
|
||||||
if (bd->props.power == FB_BLANK_POWERDOWN)
|
|
||||||
intensity = FB_BLANK_POWERDOWN;
|
|
||||||
if (bd->props.fb_blank == FB_BLANK_POWERDOWN)
|
|
||||||
intensity = FB_BLANK_POWERDOWN;
|
|
||||||
|
|
||||||
if (intensity == FB_BLANK_UNBLANK) { /* FULL ON */
|
|
||||||
cur &= ~CRVML_BACKLIGHT_OFF;
|
|
||||||
outl(cur, addr);
|
|
||||||
} else if (intensity == FB_BLANK_POWERDOWN) { /* OFF */
|
|
||||||
cur |= CRVML_BACKLIGHT_OFF;
|
cur |= CRVML_BACKLIGHT_OFF;
|
||||||
outl(cur, addr);
|
outl(cur, addr);
|
||||||
} /* anything else, don't bother */
|
} else {
|
||||||
|
/* FULL ON */
|
||||||
|
cur &= ~CRVML_BACKLIGHT_OFF;
|
||||||
|
outl(cur, addr);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -90,9 +83,9 @@ static int cr_backlight_get_intensity(struct backlight_device *bd)
|
||||||
u8 intensity;
|
u8 intensity;
|
||||||
|
|
||||||
if (cur & CRVML_BACKLIGHT_OFF)
|
if (cur & CRVML_BACKLIGHT_OFF)
|
||||||
intensity = FB_BLANK_POWERDOWN;
|
intensity = 0;
|
||||||
else
|
else
|
||||||
intensity = FB_BLANK_UNBLANK;
|
intensity = 1;
|
||||||
|
|
||||||
return intensity;
|
return intensity;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue