OLED panel brightness support

Sam Ravnborg sam at ravnborg.org
Thu Jul 25 13:12:39 UTC 2019


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...

	Sam


More information about the dri-devel mailing list