OLED panel brightness support

Daniel Vetter daniel at ffwll.ch
Thu Jul 25 14:02:16 UTC 2019


On Thu, Jul 25, 2019 at 3:12 PM Sam Ravnborg <sam at ravnborg.org> wrote:
>
> Hi Daniel.
>
> >
> > > The next question is, how do we change the brightness level for OLED
> > > displays? Is changing gamma value a good way to do it?
> >
> > There's no overall amplifier knob to set general brightness on these?
>
> I just looked up two random OLED controllers.
> They have a "Contrast" - which is wired to set_gamma.
> See for example:
>
> fb_sh1106.c:
> /* Gamma is used to control Contrast */
> static int set_gamma(struct fbtft_par *par, u32 *curves)
> {
>         /* apply mask */
>         curves[0] &= 0xFF;
>
>         /* Set Contrast Control for BANK0 */
>         write_reg(par, 0x81, curves[0]);
>
>         return 0;
> }
>
>
> And fb_ssd1306.c:
> /* Gamma is used to control Contrast */
> static int set_gamma(struct fbtft_par *par, u32 *curves)
> {
>         /* apply mask */
>         curves[0] &= 0xFF;
>
>         /* Set Contrast Control for BANK0 */
>         write_reg(par, 0x81);
>         write_reg(par, curves[0]);
>
>         return 0;
> }
>
> I have a few ssd1306 panels in the mail, so when I get some spare time I
> will try to make a tiny DRM driver for them.
> But starting on the backlight stuff seems to a bit more complicated.
>
> Hmm... browsing backlight code I see that FB_EARLY_EVENT_BLANK and FB_R_EARLY_EVENT_BLANK
> are not used - time to delete some code...

5.3-rc1 has patches from me to fix that, it's gone already. These two
events are gone from the backlight code. They're still used by the lcd
driver stuff in backlight/lcd.c.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch


More information about the dri-devel mailing list