Skip to content

Commit 24d3461

Browse files
sravnborgLee Jones
authored andcommitted
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>
1 parent 5a09765 commit 24d3461

1 file changed

Lines changed: 9 additions & 16 deletions

File tree

‎drivers/video/backlight/cr_bllcd.c‎

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -63,22 +63,15 @@ static int cr_backlight_set_intensity(struct backlight_device *bd)
6363
u32 addr = gpio_bar + CRVML_PANEL_PORT;
6464
u32 cur = inl(addr);
6565

66-
if (bd->props.power == FB_BLANK_UNBLANK)
67-
intensity = FB_BLANK_UNBLANK;
68-
if (bd->props.fb_blank == FB_BLANK_UNBLANK)
69-
intensity = FB_BLANK_UNBLANK;
70-
if (bd->props.power == FB_BLANK_POWERDOWN)
71-
intensity = FB_BLANK_POWERDOWN;
72-
if (bd->props.fb_blank == FB_BLANK_POWERDOWN)
73-
intensity = FB_BLANK_POWERDOWN;
74-
75-
if (intensity == FB_BLANK_UNBLANK) { /* FULL ON */
76-
cur &= ~CRVML_BACKLIGHT_OFF;
77-
outl(cur, addr);
78-
} else if (intensity == FB_BLANK_POWERDOWN) { /* OFF */
66+
if (backlight_get_brightness(bd) == 0) {
67+
/* OFF */
7968
cur |= CRVML_BACKLIGHT_OFF;
8069
outl(cur, addr);
81-
} /* anything else, don't bother */
70+
} else {
71+
/* FULL ON */
72+
cur &= ~CRVML_BACKLIGHT_OFF;
73+
outl(cur, addr);
74+
}
8275

8376
return 0;
8477
}
@@ -90,9 +83,9 @@ static int cr_backlight_get_intensity(struct backlight_device *bd)
9083
u8 intensity;
9184

9285
if (cur & CRVML_BACKLIGHT_OFF)
93-
intensity = FB_BLANK_POWERDOWN;
86+
intensity = 0;
9487
else
95-
intensity = FB_BLANK_UNBLANK;
88+
intensity = 1;
9689

9790
return intensity;
9891
}

0 commit comments

Comments
 (0)