bdk: di: adjust OLED panel brightness curve

The Samsung AMOLED panel least legible backlight is at a high duty (45 / 255).
Change the linear curve to a more appropriate one.
This commit is contained in:
CTCaer 2021-10-15 16:16:24 +03:00
parent 6992ece762
commit 808da1bce0
2 changed files with 7 additions and 0 deletions

View file

@ -557,6 +557,10 @@ void display_backlight(bool enable)
void display_dsi_backlight_brightness(u32 brightness)
{
// Normalize brightness value by 82% and a base of 45 duty.
if (brightness)
brightness = (brightness * PANEL_OLED_BL_COEFF / 100) + PANEL_OLED_BL_OFFSET;
u16 bl_ctrl = byte_swap_16((u16)(brightness * 8));
display_dsi_vblank_write(MIPI_DCS_SET_BRIGHTNESS, 2, &bl_ctrl);
}

View file

@ -652,6 +652,9 @@
#define DCS_CONTROL_DISPLAY_DIMMING_CTRL BIT(3)
#define DCS_CONTROL_DISPLAY_BRIGHTNESS_CTRL BIT(5)
#define PANEL_OLED_BL_COEFF 82 // 82%.
#define PANEL_OLED_BL_OFFSET 45 // Least legible backlight duty.
/* Switch Panels:
*
* 6.2" panels for Icosa and Iowa skus: