Skip to content

Commit a44f42b

Browse files
Lyuderodrigovivi
authored andcommitted
drm/i915/dp: Perform 30ms delay after source OUI write
While working on supporting the Intel HDR backlight interface, I noticed that there's a couple of laptops that will very rarely manage to boot up without detecting Intel HDR backlight support - even though it's supported on the system. One example of such a laptop is the Lenovo P17 1st generation. Following some investigation Ville Syrjälä did through the docs they have available to them, they discovered that there's actually supposed to be a 30ms wait after writing the source OUI before we begin setting up the rest of the backlight interface. This seems to be correct, as adding this 30ms delay seems to have completely fixed the probing issues I was previously seeing. So - let's start performing a 30ms wait after writing the OUI, which we do in a manner similar to how we keep track of PPS delays (e.g. record the timestamp of the OUI write, and then wait for however many ms are left since that timestamp right before we interact with the backlight) in order to avoid waiting any longer then we need to. As well, this also avoids us performing this delay on systems where we don't end up using the HDR backlight interface. V3: * Move last_oui_write into intel_dp V2: * Move panel delays into intel_pps Signed-off-by: Lyude Paul <[email protected]> Reviewed-by: Jani Nikula <[email protected]> Fixes: 4a8d799 ("drm/i915/dp: Enable Intel's HDR backlight interface (only SDR for now)") Cc: Ville Syrjälä <[email protected]> Cc: <[email protected]> # v5.12+ Signed-off-by: Jani Nikula <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] (cherry picked from commit c7c90b0) Signed-off-by: Rodrigo Vivi <[email protected]>
1 parent 61e29a0 commit a44f42b

File tree

4 files changed

+21
-0
lines changed

4 files changed

+21
-0
lines changed

drivers/gpu/drm/i915/display/intel_display_types.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1640,6 +1640,9 @@ struct intel_dp {
16401640
struct intel_dp_pcon_frl frl;
16411641

16421642
struct intel_psr psr;
1643+
1644+
/* When we last wrote the OUI for eDP */
1645+
unsigned long last_oui_write;
16431646
};
16441647

16451648
enum lspcon_vendor {

drivers/gpu/drm/i915/display/intel_dp.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include <linux/i2c.h>
3030
#include <linux/notifier.h>
3131
#include <linux/slab.h>
32+
#include <linux/timekeeping.h>
3233
#include <linux/types.h>
3334

3435
#include <asm/byteorder.h>
@@ -1955,6 +1956,16 @@ intel_edp_init_source_oui(struct intel_dp *intel_dp, bool careful)
19551956

19561957
if (drm_dp_dpcd_write(&intel_dp->aux, DP_SOURCE_OUI, oui, sizeof(oui)) < 0)
19571958
drm_err(&i915->drm, "Failed to write source OUI\n");
1959+
1960+
intel_dp->last_oui_write = jiffies;
1961+
}
1962+
1963+
void intel_dp_wait_source_oui(struct intel_dp *intel_dp)
1964+
{
1965+
struct drm_i915_private *i915 = dp_to_i915(intel_dp);
1966+
1967+
drm_dbg_kms(&i915->drm, "Performing OUI wait\n");
1968+
wait_remaining_ms_from_jiffies(intel_dp->last_oui_write, 30);
19581969
}
19591970

19601971
/* If the device supports it, try to set the power state appropriately */

drivers/gpu/drm/i915/display/intel_dp.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,4 +119,6 @@ void intel_dp_pcon_dsc_configure(struct intel_dp *intel_dp,
119119
const struct intel_crtc_state *crtc_state);
120120
void intel_dp_phy_test(struct intel_encoder *encoder);
121121

122+
void intel_dp_wait_source_oui(struct intel_dp *intel_dp);
123+
122124
#endif /* __INTEL_DP_H__ */

drivers/gpu/drm/i915/display/intel_dp_aux_backlight.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636

3737
#include "intel_backlight.h"
3838
#include "intel_display_types.h"
39+
#include "intel_dp.h"
3940
#include "intel_dp_aux_backlight.h"
4041

4142
/* TODO:
@@ -106,6 +107,8 @@ intel_dp_aux_supports_hdr_backlight(struct intel_connector *connector)
106107
int ret;
107108
u8 tcon_cap[4];
108109

110+
intel_dp_wait_source_oui(intel_dp);
111+
109112
ret = drm_dp_dpcd_read(aux, INTEL_EDP_HDR_TCON_CAP0, tcon_cap, sizeof(tcon_cap));
110113
if (ret != sizeof(tcon_cap))
111114
return false;
@@ -204,6 +207,8 @@ intel_dp_aux_hdr_enable_backlight(const struct intel_crtc_state *crtc_state,
204207
int ret;
205208
u8 old_ctrl, ctrl;
206209

210+
intel_dp_wait_source_oui(intel_dp);
211+
207212
ret = drm_dp_dpcd_readb(&intel_dp->aux, INTEL_EDP_HDR_GETSET_CTRL_PARAMS, &old_ctrl);
208213
if (ret != 1) {
209214
drm_err(&i915->drm, "Failed to read current backlight control mode: %d\n", ret);

0 commit comments

Comments
 (0)