Skip to contentSkip to conversation

drm/amd/display: Restore guard against default backlight value < 1 nit

PATCH In review Mario Limonciello 3 participants 3 messages Dec 6, 2023 – Dec 7, 2023

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amd/display: Restore guard against default backlight value < 1 nit

Mark reports that brightness is not restored after Xorg dpms screen blank.

This behavior was introduced by commit d9e865826c20 ("drm/amd/display:
Simplify brightness initialization") which dropped the cached backlight value in display code, but also removed code for when the default value read back was less than 1 nit.

Restore this code so that the backlight brightness is restored to the correct default value in this circumstance.

Cc Camille Cho <[email protected]>
Cc Krunoslav Kovac <[email protected]>
Cc Hamza Mahfooz <[email protected]>
Fixes d9e865826c20 ("drm/amd/display: Simplify brightness initialization")
---
 .../amd/display/dc/link/protocols/link_edp_panel_control.c    | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/link/protocols/link_edp_panel_control.c +2 -2
index ac0fa88b52a0..bf53a86ea817 100644
@@ -287,8 +287,8 @@ bool set_default_brightness_aux(struct dc_link *link)
 	if (link && link->dpcd_sink_ext_caps.bits.oled == 1) {
 		if (!read_default_bl_aux(link, &default_backlight))
 			default_backlight = 150000;
-		// if > 5000, it might be wrong readback
-		if (default_backlight > 5000000)
+		// if < 1 nits or > 5000, it might be wrong readback
+		if (default_backlight < 1000 || default_backlight > 5000000)
 			default_backlight = 150000;
 
 		return edp_set_backlight_level_nits(link, true,
Signature · 1 line
2.34.1
Acked-by on v1 1/1
#1 lore raw
Quoted 11 lines · Mario Limonciello

Mark reports that brightness is not restored after Xorg dpms screen blank.

This behavior was introduced by commit d9e865826c20 ("drm/amd/display:
Simplify brightness initialization") which dropped the cached backlight value in display code, but also removed code for when the default value read back was less than 1 nit.

Restore this code so that the backlight brightness is restored to the correct default value in this circumstance.

Quoted 8 lines
Cc Camille Cho <[email protected]>
Cc Krunoslav Kovac <[email protected]>
Cc Hamza Mahfooz <[email protected]>
Fixes d9e865826c20 ("drm/amd/display: Simplify brightness initialization")
Quoted 22 lines
---
 .../amd/display/dc/link/protocols/link_edp_panel_control.c    | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/link/protocols/link_edp_panel_control.c +2 -3
index ac0fa88b52a0..bf53a86ea817 100644
@@ -287,8 +287,8 @@ bool set_default_brightness_aux(struct dc_link *link)
        if (link && link->dpcd_sink_ext_caps.bits.oled == 1) {
                if (!read_default_bl_aux(link, &default_backlight))
                        default_backlight = 150000;
-               // if > 5000, it might be wrong readback
-               if (default_backlight > 5000000)
+               // if < 1 nits or > 5000, it might be wrong readback
+               if (default_backlight < 1000 || default_backlight > 5000000)
                        default_backlight = 150000;
 
                return edp_set_backlight_level_nits(link, true,
--

2.34.1

maintainer Reviewed-by
#2 lore raw
Quoted 22 lines · Alex Deucher
Quoted 11 lines · Mario Limonciello

Mark reports that brightness is not restored after Xorg dpms screen blank.

This behavior was introduced by commit d9e865826c20 ("drm/amd/display:
Simplify brightness initialization") which dropped the cached backlight value in display code, but also removed code for when the default value read back was less than 1 nit.

Restore this code so that the backlight brightness is restored to the correct default value in this circumstance.

Quoted 8 lines
Cc Camille Cho <[email protected]>
Cc Krunoslav Kovac <[email protected]>
Cc Hamza Mahfooz <[email protected]>
Fixes d9e865826c20 ("drm/amd/display: Simplify brightness initialization")
Quoted 1 line

Harry

Quoted 23 lines
Quoted 23 lines
---
 .../amd/display/dc/link/protocols/link_edp_panel_control.c    | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/display/dc/link/protocols/link_edp_panel_control.c +2 -3
index ac0fa88b52a0..bf53a86ea817 100644
@@ -287,8 +287,8 @@ bool set_default_brightness_aux(struct dc_link *link)
        if (link && link->dpcd_sink_ext_caps.bits.oled == 1) {
                if (!read_default_bl_aux(link, &default_backlight))
                        default_backlight = 150000;
-               // if > 5000, it might be wrong readback
-               if (default_backlight > 5000000)
+               // if < 1 nits or > 5000, it might be wrong readback
+               if (default_backlight < 1000 || default_backlight > 5000000)
                        default_backlight = 150000;
 
                return edp_set_backlight_level_nits(link, true,
--

2.34.1