Skip to content

Commit aef10b1

Browse files
antheassuperm1
authored andcommitted
drm: panel-backlight-quirks: Add brightness mask quirk
Certain OLED devices malfunction on specific brightness levels. Specifically, when DP_SOURCE_BACKLIGHT_LEVEL is written to with the first byte being 0x00 and sometimes 0x01, the panel forcibly turns off until the device sleeps again. Below are some examples. This was found by iterating over brighness ranges while printing DP_SOURCE_BACKLIGHT_LEVEL. It was found that the screen would malfunction on specific values, and some of them were collected. Therefore, introduce a quirk where the minor byte of brightness is OR'd with 0x03 to avoid the range of invalid values. This quirk was tested by removing the workarounds and iterating from 0 to 50_000 value ranges with a cadence of 0.2s/it. The range of the panel is 1000...400_000, so the values were slightly interpolated during testing. The custom brightness curve added on 6.15 was disabled. 86016: 10101000000000000 86272: 10101000100000000 87808: 10101011100000000 251648: 111101011100000000 251649: 111101011100000001 86144: 10101000010000000 87809: 10101011100000001 251650: 111101011100000010 Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/3803 Tested-by: Philip Müller <philm@manjaro.org> Reviewed-by: Mario Limonciello <mario.limonciello@amd.com> Signed-off-by: Antheas Kapenekakis <lkml@antheas.dev> Link: https://lore.kernel.org/r/20250829145541.512671-5-lkml@antheas.dev Acked-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Mario Limonciello (AMD) <superm1@kernel.org>
1 parent f7033fa commit aef10b1

4 files changed

Lines changed: 49 additions & 0 deletions

File tree

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3662,6 +3662,9 @@ static void update_connector_ext_caps(struct amdgpu_dm_connector *aconnector)
36623662
if (panel_backlight_quirk->min_brightness)
36633663
caps->min_input_signal =
36643664
panel_backlight_quirk->min_brightness - 1;
3665+
if (panel_backlight_quirk->brightness_mask)
3666+
caps->brightness_mask =
3667+
panel_backlight_quirk->brightness_mask;
36653668
}
36663669
}
36673670

@@ -4862,6 +4865,10 @@ static void amdgpu_dm_backlight_set_level(struct amdgpu_display_manager *dm,
48624865
brightness = convert_brightness_from_user(caps, dm->brightness[bl_idx]);
48634866
link = (struct dc_link *)dm->backlight_link[bl_idx];
48644867

4868+
/* Apply brightness quirk */
4869+
if (caps->brightness_mask)
4870+
brightness |= caps->brightness_mask;
4871+
48654872
/* Change brightness based on AUX property */
48664873
mutex_lock(&dm->dc_lock);
48674874
if (dm->dc->caps.ips_support && dm->dc->ctx->dmub_srv->idle_allowed) {

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,11 @@ struct amdgpu_dm_backlight_caps {
200200
* @aux_support: Describes if the display supports AUX backlight.
201201
*/
202202
bool aux_support;
203+
/**
204+
* @brightness_mask: After deriving brightness, OR it with this mask.
205+
* Workaround for panels with issues with certain brightness values.
206+
*/
207+
u32 brightness_mask;
203208
/**
204209
* @ac_level: the default brightness if booted on AC
205210
*/

drivers/gpu/drm/drm_panel_backlight_quirks.c

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,42 @@ static const struct drm_get_panel_backlight_quirk drm_panel_min_backlight_quirks
4545
.ident.name = "NE135A1M-NY1",
4646
.quirk = { .min_brightness = 1, },
4747
},
48+
/* Have OLED Panels with brightness issue when last byte is 0/1 */
49+
{
50+
.dmi_match.field = DMI_SYS_VENDOR,
51+
.dmi_match.value = "AYANEO",
52+
.dmi_match_other.field = DMI_PRODUCT_NAME,
53+
.dmi_match_other.value = "AYANEO 3",
54+
.quirk = { .brightness_mask = 3, },
55+
},
56+
{
57+
.dmi_match.field = DMI_SYS_VENDOR,
58+
.dmi_match.value = "ZOTAC",
59+
.dmi_match_other.field = DMI_BOARD_NAME,
60+
.dmi_match_other.value = "G0A1W",
61+
.quirk = { .brightness_mask = 3, },
62+
},
63+
{
64+
.dmi_match.field = DMI_SYS_VENDOR,
65+
.dmi_match.value = "ZOTAC",
66+
.dmi_match_other.field = DMI_BOARD_NAME,
67+
.dmi_match_other.value = "G1A1W",
68+
.quirk = { .brightness_mask = 3, },
69+
},
70+
{
71+
.dmi_match.field = DMI_SYS_VENDOR,
72+
.dmi_match.value = "ONE-NETBOOK",
73+
.dmi_match_other.field = DMI_PRODUCT_NAME,
74+
.dmi_match_other.value = "ONEXPLAYER F1Pro",
75+
.quirk = { .brightness_mask = 3, },
76+
},
77+
{
78+
.dmi_match.field = DMI_SYS_VENDOR,
79+
.dmi_match.value = "ONE-NETBOOK",
80+
.dmi_match_other.field = DMI_PRODUCT_NAME,
81+
.dmi_match_other.value = "ONEXPLAYER F1 EVA-02",
82+
.quirk = { .brightness_mask = 3, },
83+
},
4884
};
4985

5086
static bool drm_panel_min_backlight_quirk_matches(

include/drm/drm_utils.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ int drm_get_panel_orientation_quirk(int width, int height);
1818

1919
struct drm_panel_backlight_quirk {
2020
u16 min_brightness;
21+
u32 brightness_mask;
2122
};
2223

2324
const struct drm_panel_backlight_quirk *

0 commit comments

Comments
 (0)