drm-panel: Don't make failures quite so fatal
Douglas Anderson
reviewercover drm-panel: Don't make failures quite so fatal
This patch series is born out of the observation that after several Chromebooks transitioned over to the generic "edp-panel" compatible string that we received a number of in-the-field reports of the primary graphics device for the Chromebook not coming up.
The current belief is that these Chromebooks are actually suffering from a true hardware failure and the panel is either fully disconnected or it has some type of intermittent connection. While we can't solve that problem, digging showed that we actually dealt with this situation better _before_ switching to the generic "edp-panel" compatible string.
Before switching to "edp-panel", devices using eDP would finish their probe and would actually not show any failure until you tried to turn the panel on. That was a _good_ thing. The component model used by many DRM devices means that if the panel doesn't finish probing that the rest of the DRM device doesn't probe. In turn, that means that any other display adapters (like ones that would allow hooking up an external display) don't probe. The end result was that a device with a broken panel that could have continued to be a useful computer by hooking up an external display became e-waste.
I won't say that this series is the most elegant/wonderful thing in the world. Ideally we could fail the probe of the panel and still use the external display. That's a pretty serious re-design, though. DRM devices work like they do with the component model because of some of their inherent complexities.
Douglas Anderson (3):
drm/panel-edp: Abstract out function to set conservative timings drm/panel-edp: If we fail to powerup/get EDID, use conservative
timings
drm-panel: If drm_panel_dp_aux_backlight() fails, don't fail panel
probe
drivers/gpu/drm/panel/panel-edp.c | 60 +++++++++++-------- .../gpu/drm/panel/panel-samsung-atna33xc20.c | 9 ++- 2 files changed, 41 insertions(+), 28 deletions(-)
Signature · 1 line
2.44.0.396.g6e790dbe36-goog
Douglas Anderson
reviewerPATCH 1/3 drm/panel-edp: Abstract out function to set conservative timings
If we're using the generic "edp-panel" compatible string and we fail to detect an eDP panel then we fall back to conservative timings for powering up and powering down the panel. Abstract out the function for setting these timings so it can be used in future patches.
No functional change expected--just code movement.
---
drivers/gpu/drm/panel/panel-edp.c | 40 +++++++++++++++---------------- 1 file changed, 20 insertions(+), 20 deletions(-)
drivers/gpu/drm/panel/panel-edp.c +20 -20
@@ -760,6 +760,25 @@ static void panel_edp_parse_panel_timing_node(struct device *dev,static const struct edp_panel_entry *find_edp_panel (u32 panel_id,const struct drm_edid *edid); +static void panel_edp_set_conservative_timings (struct panel_edp *panel,struct panel_desc *desc) +{ +/* +* It's highly likely that the panel will work if we use very +* conservative timings, so let's do that. +* +* Nearly all panels have a "unprepare" delay of 500 ms though +* there are a few with 1000. Let's stick 2000 in just to be +* super conservative. +* +* An "enable" delay of 80 ms seems the most common, but we'll +* throw in 200 ms to be safe. +*/ + desc->delay.unprepare =2000 ; + desc->delay.enable =200 ; + + panel->detected_panel =ERR_PTR (-EINVAL ); +} +static int generic_edp_panel_probe (struct device *dev,struct panel_edp *panel) {struct panel_desc *desc;
@@ -816,26 +835,7 @@ static int generic_edp_panel_probe(struct device *dev, struct panel_edp *panel)dev_warn (dev,"Unknown panel %s %#06x, using conservative timings\n" , vend, product_id); - -/* -* It's highly likely that the panel will work if we use very -* conservative timings, so let's do that. We already know that -* the HPD-related delays must have worked since we got this -* far, so we really just need the "unprepare" / "enable" -* delays. We don't need "prepare_to_enable" since that -* overlaps the "enable" delay anyway. -* -* Nearly all panels have a "unprepare" delay of 500 ms though -* there are a few with 1000. Let's stick 2000 in just to be -* super conservative. -* -* An "enable" delay of 80 ms seems the most common, but we'll -* throw in 200 ms to be safe. -*/ - desc->delay.unprepare =2000 ; - desc->delay.enable =200 ; - - panel->detected_panel =ERR_PTR (-EINVAL ); +panel_edp_set_conservative_timings (panel, desc); }else {dev_info (dev,"Detected %s %s (%#06x)\n" , vend, panel->detected_panel->ident.name, product_id);
Signature · 1 line
2.44.0.396.g6e790dbe36-goog
Re: [PATCH 1/3] drm/panel-edp: Abstract out function to set conservative timings
Quoted 9 lines · Douglas Anderson
If we're using the generic "edp-panel" compatible string and we fail to detect an eDP panel then we fall back to conservative timings for powering up and powering down the panel. Abstract out the function for setting these timings so it can be used in future patches.
No functional change expected--just code movement.
Signed-off-by Douglas Anderson <[email protected]>
Quoted 66 lines
---
drivers/gpu/drm/panel/panel-edp.c | 40 +++++++++++++++---------------- 1 file changed, 20 insertions(+), 20 deletions(-)drivers/gpu/drm/panel/panel-edp.c +20
-21@@ -760,6 +760,25 @@ static void panel_edp_parse_panel_timing_node(struct device *dev,static const struct edp_panel_entry *find_edp_panel (u32 panel_id,const struct drm_edid *edid); +static void panel_edp_set_conservative_timings (struct panel_edp *panel,struct panel_desc *desc) +{ +/* +* It's highly likely that the panel will work if we use very +* conservative timings, so let's do that. +* +* Nearly all panels have a "unprepare" delay of 500 ms though +* there are a few with 1000. Let's stick 2000 in just to be +* super conservative. +* +* An "enable" delay of 80 ms seems the most common, but we'll +* throw in 200 ms to be safe. +*/ + desc->delay.unprepare =2000 ; + desc->delay.enable =200 ; + + panel->detected_panel =ERR_PTR (-EINVAL ); +} +static int generic_edp_panel_probe (struct device *dev,struct panel_edp *panel) {struct panel_desc *desc;@@ -816,26 +835,7 @@ static int generic_edp_panel_probe(struct device *dev, struct panel_edp *panel)dev_warn (dev,"Unknown panel %s %#06x, using conservative timings\n" , vend, product_id); - -/* -* It's highly likely that the panel will work if we use very -* conservative timings, so let's do that. We already know that -* the HPD-related delays must have worked since we got this -* far, so we really just need the "unprepare" / "enable" -* delays. We don't need "prepare_to_enable" since that -* overlaps the "enable" delay anyway. -* -* Nearly all panels have a "unprepare" delay of 500 ms though -* there are a few with 1000. Let's stick 2000 in just to be -* super conservative. -* -* An "enable" delay of 80 ms seems the most common, but we'll -* throw in 200 ms to be safe. -*/ - desc->delay.unprepare =2000 ; - desc->delay.enable =200 ; - - panel->detected_panel =ERR_PTR (-EINVAL ); +panel_edp_set_conservative_timings (panel, desc); }else {dev_info (dev,"Detected %s %s (%#06x)\n" , vend, panel->detected_panel->ident.name, product_id); --2.44.0.396.g6e790dbe36-goog
Re: [PATCH 1/3] drm/panel-edp: Abstract out function to set conservative timings
Hi,
Quoted 8 lines · Hsin-Yi Wang
Quoted 6 lines · Douglas Anderson
If we're using the generic "edp-panel" compatible string and we fail to detect an eDP panel then we fall back to conservative timings for powering up and powering down the panel. Abstract out the function for setting these timings so it can be used in future patches.
Quoted 5 lines
Quoted 3 lines
No functional change expected--just code movement.
Signed-off-by Douglas Anderson <[email protected]>Reviewed-by Hsin-Yi Wang <[email protected]>
Pushed to drm-misc-next:
2cbee8ae55f5 drm/panel-edp: Abstract out function to set conservative timings
Douglas Anderson
reviewerPATCH 2/3 drm/panel-edp: If we fail to powerup/get EDID, use conservative timings
In reply to Douglas AndersonIf at boot we fail to power up the eDP panel (most often happens if the eDP panel never asserts HPD to us) or if we are unable to read the EDID at bootup to figure out the panel's ID then let's use the conservative eDP panel powerup/powerdown timings but _not_ fail the probe.
It might seem strange to _not_ fail the probe in this case since we were unable to powerup the panel and confirm it's there. However, there is a reason to do this. Specifically, if we fail to probe the panel then it really throws the whole display pipeline for loop. Most DRM subsystems are written so that they wait until all components (including the panel) have probed before they set everything up. When the panel doesn't come up then this never happens. As a side effect of not setting everything up then other display adapters don't get initialized. As a practical example, I can see that if I open up a sc7180-trogdor based Chromebook that's using the generic "edp-panel" and unplug the eDP panel that it causes the _external_ DP monitor not to function. This is obviously bad because it means that a device with a dead eDP panel becomes e-waste when it could instead still be given useful life with an external display.
NOTES:
- When we fail to probe like this, boot is a bit slow because we try several times to power the panel up. This doesn't feel horrible because it'll eventually work and the retries are known to help bring some panels up.
- In the case where we hit the condition of failing to power up, the display will likely _never_ have a chance to work again until reboot. Once the panel-edp pm_runtime resume function fails it doesn't ever seem to retry. This is probably for the best given that we don't have any real timing/modes. eDP isn't expected to be "hotplugged" so this makes some sense.
- It turns out that this makes panel-edp behave more similarly for users of the generic "edp-panel" compatible string and the old fixed panel compatible string. With the old fixed panel compatible string we don't talk to the panel during probe so we'd actually behave much the same way that we'll now behave for the generic "edp-panel".
---
drivers/gpu/drm/panel/panel-edp.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/gpu/drm/panel/panel-edp.c +7 -5
@@ -808,7 +808,10 @@ static int generic_edp_panel_probe(struct device *dev, struct panel_edp *panel)/* Power the panel on so we can read the EDID */ ret =pm_runtime_get_sync (dev);if (ret <0 ) { -dev_err (dev,"Couldn't power on panel to read EDID: %d\n" , ret); +dev_err (dev, +"Couldn't power on panel to ID it; using conservative timings: %d\n" , + ret); +panel_edp_set_conservative_timings (panel, desc); goto exit; }
@@ -816,8 +819,8 @@ static int generic_edp_panel_probe(struct device *dev, struct panel_edp *panel)if (base_block) { panel_id =drm_edid_get_panel_id (base_block); }else { -dev_err (dev,"Couldn't identify panel via EDID\n" ); - ret = -EIO ; +dev_err (dev,"Couldn't read EDID for ID; using conservative timings\n" ); +panel_edp_set_conservative_timings (panel, desc); goto exit; }drm_edid_decode_panel_id (panel_id, vend, &product_id);
@@ -844,12 +847,11 @@ static int generic_edp_panel_probe(struct device *dev, struct panel_edp *panel) desc->delay = *panel->detected_panel->delay; } - ret =0 ; exit:pm_runtime_mark_last_busy (dev);pm_runtime_put_autosuspend (dev); -return ret; +return 0 ; } static int panel_edp_probe(struct device *dev, const struct panel_desc *desc,
Signature · 1 line
2.44.0.396.g6e790dbe36-goog
Re: [PATCH 2/3] drm/panel-edp: If we fail to powerup/get EDID, use conservative timings
Quoted 39 lines · Douglas Anderson
If at boot we fail to power up the eDP panel (most often happens if the eDP panel never asserts HPD to us) or if we are unable to read the EDID at bootup to figure out the panel's ID then let's use the conservative eDP panel powerup/powerdown timings but _not_ fail the probe.
It might seem strange to _not_ fail the probe in this case since we were unable to powerup the panel and confirm it's there. However, there is a reason to do this. Specifically, if we fail to probe the panel then it really throws the whole display pipeline for loop. Most DRM subsystems are written so that they wait until all components (including the panel) have probed before they set everything up. When the panel doesn't come up then this never happens. As a side effect of not setting everything up then other display adapters don't get initialized. As a practical example, I can see that if I open up a sc7180-trogdor based Chromebook that's using the generic "edp-panel" and unplug the eDP panel that it causes the _external_ DP monitor not to function. This is obviously bad because it means that a device with a dead eDP panel becomes e-waste when it could instead still be given useful life with an external display.
NOTES:
- When we fail to probe like this, boot is a bit slow because we try several times to power the panel up. This doesn't feel horrible because it'll eventually work and the retries are known to help bring some panels up.
- In the case where we hit the condition of failing to power up, the display will likely _never_ have a chance to work again until reboot. Once the panel-edppm_runtimeresume function fails it doesn't ever seem to retry. This is probably for the best given that we don't have any real timing/modes. eDP isn't expected to be "hotplugged" so this makes some sense.
- It turns out that this makes panel-edp behave more similarly for users of the generic "edp-panel" compatible string and the old fixed panel compatible string. With the old fixed panel compatible string we don't talk to the panel during probe so we'd actually behave much the same way that we'll now behave for the generic "edp-panel".
Quoted 1 line
Signed-off-by Douglas Anderson <[email protected]>
Quoted 49 lines
---
drivers/gpu/drm/panel/panel-edp.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)drivers/gpu/drm/panel/panel-edp.c +7
-6@@ -808,7 +808,10 @@ static int generic_edp_panel_probe(struct device *dev, struct panel_edp *panel)/* Power the panel on so we can read the EDID */ ret =pm_runtime_get_sync (dev);if (ret <0 ) { -dev_err (dev,"Couldn't power on panel to read EDID: %d\n" , ret); +dev_err (dev, +"Couldn't power on panel to ID it; using conservative timings: %d\n" , + ret); +panel_edp_set_conservative_timings (panel, desc); goto exit; }@@ -816,8 +819,8 @@ static int generic_edp_panel_probe(struct device *dev, struct panel_edp *panel)if (base_block) { panel_id =drm_edid_get_panel_id (base_block); }else { -dev_err (dev,"Couldn't identify panel via EDID\n" ); - ret = -EIO ; +dev_err (dev,"Couldn't read EDID for ID; using conservative timings\n" ); +panel_edp_set_conservative_timings (panel, desc); goto exit; }drm_edid_decode_panel_id (panel_id, vend, &product_id);@@ -844,12 +847,11 @@ static int generic_edp_panel_probe(struct device *dev, struct panel_edp *panel) desc->delay = *panel->detected_panel->delay; } - ret =0 ; exit:pm_runtime_mark_last_busy (dev);pm_runtime_put_autosuspend (dev); -return ret; +return 0 ; } static int panel_edp_probe(struct device *dev, const struct panel_desc *desc, --2.44.0.396.g6e790dbe36-goog
Re: [PATCH 2/3] drm/panel-edp: If we fail to powerup/get EDID, use conservative timings
Hi,
Quoted 41 lines · Hsin-Yi Wang
Quoted 39 lines · Douglas Anderson
If at boot we fail to power up the eDP panel (most often happens if the eDP panel never asserts HPD to us) or if we are unable to read the EDID at bootup to figure out the panel's ID then let's use the conservative eDP panel powerup/powerdown timings but _not_ fail the probe.
It might seem strange to _not_ fail the probe in this case since we were unable to powerup the panel and confirm it's there. However, there is a reason to do this. Specifically, if we fail to probe the panel then it really throws the whole display pipeline for loop. Most DRM subsystems are written so that they wait until all components (including the panel) have probed before they set everything up. When the panel doesn't come up then this never happens. As a side effect of not setting everything up then other display adapters don't get initialized. As a practical example, I can see that if I open up a sc7180-trogdor based Chromebook that's using the generic "edp-panel" and unplug the eDP panel that it causes the _external_ DP monitor not to function. This is obviously bad because it means that a device with a dead eDP panel becomes e-waste when it could instead still be given useful life with an external display.
NOTES:
- When we fail to probe like this, boot is a bit slow because we try several times to power the panel up. This doesn't feel horrible because it'll eventually work and the retries are known to help bring some panels up.
- In the case where we hit the condition of failing to power up, the display will likely _never_ have a chance to work again until reboot. Once the panel-edppm_runtimeresume function fails it doesn't ever seem to retry. This is probably for the best given that we don't have any real timing/modes. eDP isn't expected to be "hotplugged" so this makes some sense.
- It turns out that this makes panel-edp behave more similarly for users of the generic "edp-panel" compatible string and the old fixed panel compatible string. With the old fixed panel compatible string we don't talk to the panel during probe so we'd actually behave much the same way that we'll now behave for the generic "edp-panel".
Quoted 3 lines
Quoted 1 line
Signed-off-by Douglas Anderson <[email protected]>Reviewed-by Hsin-Yi Wang <[email protected]>
Pushed to drm-misc-next:
ce0ff22388ab drm/panel-edp: If we fail to powerup/get EDID, use conservative timings
Douglas Anderson
reviewerPATCH 3/3 drm-panel: If drm_panel_dp_aux_backlight() fails, don't fail panel probe
In reply to Douglas AndersonIf we're using the AUX channel for eDP backlight and it fails to probe for some reason, let's _not_ fail the panel probe.
At least one case where we could fail to init the backlight is because of a dead or physically missing panel. As talked about in detail in the earlier patch in this series, ("drm/panel-edp: If we fail to powerup/get EDID, use conservative timings"), this can cause the entire system's display pipeline to fail to come up and that's non-ideal.
If we fail to init the backlight for some transitory reason, we should dig in and see if there's a way to fix this (perhaps retries?). Even in that case, though, having a panel whose backlight is stuck at 100% (the default, at least in the panel Samsung ATNA33XC20 I tested) is better than having no panel at all.
---
If needed, I could split this into two patches: one for each of the two panels that use drm_panel_dp_aux_backlight(). Since they both go through drm-misc, though, it doesn't feel worth it.
drivers/gpu/drm/panel/panel-edp.c | 8 +++++++- drivers/gpu/drm/panel/panel-samsung-atna33xc20.c | 9 +++++++-- 2 files changed, 14 insertions(+), 3 deletions(-)
drivers/gpu/drm/panel/panel-edp.c +7 -1
@@ -944,8 +944,14 @@ static int panel_edp_probe(struct device *dev, const struct panel_desc *desc, err =drm_panel_dp_aux_backlight (&panel->base, panel->aux);pm_runtime_mark_last_busy (dev);pm_runtime_put_autosuspend (dev); + +/* +* Warn if we get an error, but don't consider it fatal. Having +* a panel where we can't control the backlight is better than +* no panel. +*/ if (err) - goto err_finished_pm_runtime; +dev_warn (dev,"failed to register dp aux backlight: %d\n" , err); }drm_panel_add (&panel->base);
drivers/gpu/drm/panel/panel-samsung-atna33xc20.c +7 -2
@@ -328,9 +328,14 @@ static int atana33xc20_probe(struct dp_aux_ep_device *aux_ep) ret =drm_panel_dp_aux_backlight (&panel->base, aux_ep->aux);pm_runtime_mark_last_busy (dev);pm_runtime_put_autosuspend (dev); + +/* +* Warn if we get an error, but don't consider it fatal. Having +* a panel where we can't control the backlight is better than +* no panel. +*/ if (ret) -return dev_err_probe (dev, ret, -"failed to register dp aux backlight\n" ); +dev_warn (dev,"failed to register dp aux backlight: %d\n" , ret);drm_panel_add (&panel->base);
Signature · 1 line
2.44.0.396.g6e790dbe36-goog
Re: [PATCH 3/3] drm-panel: If drm_panel_dp_aux_backlight() fails, don't fail panel probe
Quoted 11 lines · Douglas Anderson
If we're using the AUX channel for eDP backlight and it fails to probe for some reason, let's _not_ fail the panel probe.
At least one case where we could fail to init the backlight is because of a dead or physically missing panel. As talked about in detail in the earlier patch in this series, ("drm/panel-edp: If we fail to powerup/get EDID, use conservative timings"), this can cause the entire system's display pipeline to fail to come up and that's non-ideal.
Quoted 7 lines
If we fail to init the backlight for some transitory reason, we should dig in and see if there's a way to fix this (perhaps retries?). Even in that case, though, having a panel whose backlight is stuck at 100% (the default, at least in the panel Samsung ATNA33XC20 I tested) is better than having no panel at all.
Signed-off-by Douglas Anderson <[email protected]>
Quoted 53 lines
---
If needed, I could split this into two patches: one for each of the two panels that usedrm_panel_dp_aux_backlight(). Since they both go through drm-misc, though, it doesn't feel worth it.drivers/gpu/drm/panel/panel-edp.c | 8 +++++++- drivers/gpu/drm/panel/panel-samsung-atna33xc20.c | 9 +++++++-- 2 files changed, 14 insertions(+), 3 deletions(-)drivers/gpu/drm/panel/panel-edp.c +7
-1@@ -944,8 +944,14 @@ static int panel_edp_probe(struct device *dev, const struct panel_desc *desc, err =drm_panel_dp_aux_backlight (&panel->base, panel->aux);pm_runtime_mark_last_busy (dev);pm_runtime_put_autosuspend (dev); + +/* +* Warn if we get an error, but don't consider it fatal. Having +* a panel where we can't control the backlight is better than +* no panel. +*/ if (err) - goto err_finished_pm_runtime; +dev_warn (dev,"failed to register dp aux backlight: %d\n" , err); }drm_panel_add (&panel->base);drivers/gpu/drm/panel/panel-samsung-atna33xc20.c +7
-3@@ -328,9 +328,14 @@ static int atana33xc20_probe(struct dp_aux_ep_device *aux_ep) ret =drm_panel_dp_aux_backlight (&panel->base, aux_ep->aux);pm_runtime_mark_last_busy (dev);pm_runtime_put_autosuspend (dev); + +/* +* Warn if we get an error, but don't consider it fatal. Having +* a panel where we can't control the backlight is better than +* no panel. +*/ if (ret) -return dev_err_probe (dev, ret, -"failed to register dp aux backlight\n" ); +dev_warn (dev,"failed to register dp aux backlight: %d\n" , ret);drm_panel_add (&panel->base); --2.44.0.396.g6e790dbe36-goog
Re: [PATCH 3/3] drm-panel: If drm_panel_dp_aux_backlight() fails, don't fail panel probe
Hi,
Quoted 19 lines · Hsin-Yi Wang
Quoted 17 lines · Douglas Anderson
If we're using the AUX channel for eDP backlight and it fails to probe for some reason, let's _not_ fail the panel probe.
At least one case where we could fail to init the backlight is because of a dead or physically missing panel. As talked about in detail in the earlier patch in this series, ("drm/panel-edp: If we fail to powerup/get EDID, use conservative timings"), this can cause the entire system's display pipeline to fail to come up and that's non-ideal.
If we fail to init the backlight for some transitory reason, we should dig in and see if there's a way to fix this (perhaps retries?). Even in that case, though, having a panel whose backlight is stuck at 100% (the default, at least in the panel Samsung ATNA33XC20 I tested) is better than having no panel at all.
Quoted 3 lines
Quoted 1 line
Signed-off-by Douglas Anderson <[email protected]>Reviewed-by Hsin-Yi Wang <[email protected]>
Pushed to drm-misc-next:
b48ccb18e642 drm-panel: If drm_panel_dp_aux_backlight() fails, don't fail panel probe