drm/dp: don't mark the AUX backlight enabled when enabling failed
Subsystems (2)
PATCH 1/1 drm/dp: don't mark the AUX backlight enabled when enabling failed
If drm_edp_backlight_enable() fails, dp_aux_backlight_update_status() still marks the backlight as enabled. From then on every brightness change only updates the level and the enable is never retried, so the panel stays dark until something blanks and unblanks the backlight.
I hit this after resume on a Samsung ATNA OLED panel, where the first AUX write can fail while the panel is still waking up.
Return the error instead, so the next update tries to enable again.
--- drivers/gpu/drm/display/drm_dp_helper.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/display/drm_dp_helper.c +3 -1
@@ -4634,7 +4634,9 @@ static int dp_aux_backlight_update_status(struct backlight_device *bd)if (!backlight_is_blank (bd)) {if (!bl->enabled) { -drm_edp_backlight_enable (bl->aux, &bl->info, brightness); + ret =drm_edp_backlight_enable (bl->aux, &bl->info, brightness); +if (ret) +return ret; bl->enabled = true;return 0 ; }
base-commit: 4c253ac4b29b8c6cc6fdef8f92d4facde62e63b9
Signature · 1 line
2.55.0
Hi,
Quoted 21 lines · Oleg Keri
If
drm_edp_backlight_enable()fails,dp_aux_backlight_update_status()still marks the backlight as enabled. From then on every brightness change only updates the level and the enable is never retried, so the panel stays dark until something blanks and unblanks the backlight.I hit this after resume on a Samsung ATNA OLED panel, where the first AUX write can fail while the panel is still waking up.
Return the error instead, so the next update tries to enable again.
Fixes 10f7b40e4f30 ("drm/panel: add basic DP AUX backlight support")Signed-off-by Oleg Keri <[email protected]>--- drivers/gpu/drm/display/drm_dp_helper.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/display/drm_dp_helper.c static int dp_aux_backlight_update_status(struct backlight_device *bd) · line 4641
Quoted 9 lines
drivers/gpu/drm/display/drm_dp_helper.c +3
-1@@ -4634,7 +4634,9 @@ static int dp_aux_backlight_update_status(struct backlight_device *bd)if (!backlight_is_blank (bd)) {if (!bl->enabled) { -drm_edp_backlight_enable (bl->aux, &bl->info, brightness); + ret =drm_edp_backlight_enable (bl->aux, &bl->info, brightness); +if (ret) +return ret; bl->enabled = true;return 0 ;
The above looks like a good fix. Thanks for catching and sending a patch.
Unless there is a reason not to, I'll try to apply this to drm-misc-fixes next week.
That being said, why exactly is the first AUX command failing? That seems fishy and warrants separate investigation. The panel should be fully powered up and communicating by the time we get here and I believe there are already retries in place for the AUX commands.
I'll also note that I considered whether we should also error-check the drm_edp_backlight_disable(). I think the answer there is "no". In general errors in "disable" and "free" are hard to handle sensibly, and hopefully the panel will be powered off shortly after the backlight goes off anyway.
-Doug
Hi Doug,
Sorry for the muddy commit message. Unfortunately i cannot reproduce the enable fail. I found the unchecked return while debugging eDP issues on glymur. Please drop the second paragraph when applying, or drop the patch if a code-inspection fix without a reproducer isn't worth taking.
Oleg
Hi,
Quoted 7 lines · Oleg Keri
Hi Doug,
Sorry for the muddy commit message. Unfortunately i cannot reproduce the enable fail. I found the unchecked return while debugging eDP issues on glymur. Please drop the second paragraph when applying, or drop the patch if a code-inspection fix without a reproducer isn't worth taking.
OK, I pushed it to drm-misc-fixes while dropping the second paragraph:
[1/1] drm/dp: don't mark the AUX backlight enabled when enabling failed
commit: 707ce102521496c67860d81221b20c56d8255f2f