Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Sam Ravnborg and committed by
Lee Jones
24d34617 5a09765d

+9 -16
+9 -16
drivers/video/backlight/cr_bllcd.c
··· 63 63 u32 addr = gpio_bar + CRVML_PANEL_PORT; 64 64 u32 cur = inl(addr); 65 65 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 */ 79 68 cur |= CRVML_BACKLIGHT_OFF; 80 69 outl(cur, addr); 81 - } /* anything else, don't bother */ 70 + } else { 71 + /* FULL ON */ 72 + cur &= ~CRVML_BACKLIGHT_OFF; 73 + outl(cur, addr); 74 + } 82 75 83 76 return 0; 84 77 } ··· 83 90 u8 intensity; 84 91 85 92 if (cur & CRVML_BACKLIGHT_OFF) 86 - intensity = FB_BLANK_POWERDOWN; 93 + intensity = 0; 87 94 else 88 - intensity = FB_BLANK_UNBLANK; 95 + intensity = 1; 89 96 90 97 return intensity; 91 98 }