Message ID | 20200703184546.144664-15-sam@ravnborg.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | backlight: backlight updates | expand |
On Fri, Jul 03, 2020 at 08:45:40PM +0200, Sam Ravnborg wrote: > The cr_bllcd uses the FB_BLANK states as brightness. > This results in brightness value equals 0 that turn on > the display and 4 that turn off the display. max_brightness is 0 which makes it impossible to set the brightness to 4. > Simplify the logic but keep current behaviour > as userspace may expect brightness set to 0 to turn on the display. I don't deny the possibility but we'd be talking about a userspace custom enough to explicitly configure the module loader (otherwise the module wouldn't load and the backlight would be inherited from the BIOS) and that also contains an explicit write to the brightness property that sets it to what is already the default (and only possible) value. In other words I'm very sceptical such a userspace exists and would be happy to see this driver modified to use the new helpers and behave like gpio-backlight (which can be regarded as our reference 1-bit backlight driver). Daniel. > > Signed-off-by: Sam Ravnborg <sam@ravnborg.org> > Cc: Lee Jones <lee.jones@linaro.org> > Cc: Daniel Thompson <daniel.thompson@linaro.org> > Cc: Jingoo Han <jingoohan1@gmail.com> > --- > drivers/video/backlight/cr_bllcd.c | 14 ++++---------- > 1 file changed, 4 insertions(+), 10 deletions(-) > > diff --git a/drivers/video/backlight/cr_bllcd.c b/drivers/video/backlight/cr_bllcd.c > index 4624b7b7c6a6..edca5fee9689 100644 > --- a/drivers/video/backlight/cr_bllcd.c > +++ b/drivers/video/backlight/cr_bllcd.c > @@ -63,22 +63,16 @@ static int cr_backlight_set_intensity(struct backlight_device *bd) > u32 addr = gpio_bar + CRVML_PANEL_PORT; > u32 cur = inl(addr); > > - if (bd->props.power == FB_BLANK_UNBLANK) > - intensity = FB_BLANK_UNBLANK; > - 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) > + if (backlight_is_blank(bd)) > intensity = FB_BLANK_POWERDOWN; > > - if (intensity == FB_BLANK_UNBLANK) { /* FULL ON */ > + if (intensity != FB_BLANK_POWERDOWN) { /* FULL ON */ > cur &= ~CRVML_BACKLIGHT_OFF; > outl(cur, addr); > - } else if (intensity == FB_BLANK_POWERDOWN) { /* OFF */ > + } else { /* OFF */ > cur |= CRVML_BACKLIGHT_OFF; > outl(cur, addr); > - } /* anything else, don't bother */ > + } > > return 0; > } > -- > 2.25.1 >
diff --git a/drivers/video/backlight/cr_bllcd.c b/drivers/video/backlight/cr_bllcd.c index 4624b7b7c6a6..edca5fee9689 100644 --- a/drivers/video/backlight/cr_bllcd.c +++ b/drivers/video/backlight/cr_bllcd.c @@ -63,22 +63,16 @@ static int cr_backlight_set_intensity(struct backlight_device *bd) u32 addr = gpio_bar + CRVML_PANEL_PORT; u32 cur = inl(addr); - if (bd->props.power == FB_BLANK_UNBLANK) - intensity = FB_BLANK_UNBLANK; - 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) + if (backlight_is_blank(bd)) intensity = FB_BLANK_POWERDOWN; - if (intensity == FB_BLANK_UNBLANK) { /* FULL ON */ + if (intensity != FB_BLANK_POWERDOWN) { /* FULL ON */ cur &= ~CRVML_BACKLIGHT_OFF; outl(cur, addr); - } else if (intensity == FB_BLANK_POWERDOWN) { /* OFF */ + } else { /* OFF */ cur |= CRVML_BACKLIGHT_OFF; outl(cur, addr); - } /* anything else, don't bother */ + } return 0; }
The cr_bllcd uses the FB_BLANK states as brightness. This results in brightness value equals 0 that turn on the display and 4 that turn off the display. Simplify the logic but keep current behaviour as userspace may expect brightness set to 0 to turn on the display. Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Cc: Lee Jones <lee.jones@linaro.org> Cc: Daniel Thompson <daniel.thompson@linaro.org> Cc: Jingoo Han <jingoohan1@gmail.com> --- drivers/video/backlight/cr_bllcd.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-)