* [PATCH] drm/msm/dp: write the Qualcomm source OUI before eDP link bring-up
@ 2026-12-05 9:55 ` Jens Glathe
0 siblings, 0 replies; 3+ messages in thread
From: Jens Glathe via B4 Relay @ 2026-12-05 9:55 UTC (permalink / raw)
To: Rob Clark, Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang,
Sean Paul, Marijn Suijten, David Airlie, Simona Vetter
Cc: linux-arm-msm, dri-devel, freedreno, linux-kernel, Jens Glathe
From: Jens Glathe <jens.glathe@oldschoolsolutions.biz>
Some eDP panels, e.g. the Samsung ATNA40CT01 OLED on the Lenovo IdeaPad
Slim 5x, only accept DPCD backlight writes once the source has identified
itself through DP_SOURCE_OUI. The UEFI GOP writes the Qualcomm OUI
(8c:fd:f0) on a cold boot, but the panel forgets it when its supply rail
is switched off, e.g. across s2idle. The panel then ignores the backlight
brightness writes and stays stuck at maximum brightness after resume.
Write the OUI for eDP sinks from msm_dp_display_prepare_link(), right
after the PHY is up and AUX is usable and before link training, which is
also where the panel has already been prepared by the panel bridge's
pre_enable and the backlight is not enabled yet. Like i915 does for the
Intel OUI, read DP_SOURCE_OUI first and only write it if the read failed
or the value differs, to avoid clearing any sink state by accident.
Use drm_dp_dpcd_write_data() to check the transfer size as well as the
return code.
Root cause found by Stewings, who diffed the panel's DPCD between a cold
boot and a resume from s2idle [1].
[1]: https://github.com/jglathe/linux_ms_dev_kit/issues/102
Assisted-by: Grok Bot
Signed-off-by: Jens Glathe <jens.glathe@oldschoolsolutions.biz>
---
drivers/gpu/drm/msm/dp/dp_display.c | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c
index 29032fb61443e..d4bf60e7cec2e 100644
--- a/drivers/gpu/drm/msm/dp/dp_display.c
+++ b/drivers/gpu/drm/msm/dp/dp_display.c
@@ -628,6 +628,32 @@ static int msm_dp_display_set_mode(struct msm_dp *msm_dp_display,
return 0;
}
+/**
+ * msm_dp_display_write_source_oui() - tell an eDP sink who the source is
+ * @dp: main display data structure
+ *
+ * Some eDP panels only honour their vendor specific DPCD backlight controls
+ * once the source has identified itself via DP_SOURCE_OUI, and forget the OUI
+ * whenever the panel is power cycled. Write it before the link is brought up,
+ * like i915 does, but leave it alone if the sink already has the value we
+ * want, so that no sink state is cleared by accident.
+ */
+static void msm_dp_display_write_source_oui(struct msm_dp_display_private *dp)
+{
+ /* Not const: drm_dp_dpcd_write_data() takes a non-const buffer */
+ u8 qcom_oui[] = { 0x8c, 0xfd, 0xf0 };
+ u8 buf[sizeof(qcom_oui)] = {};
+
+ if (drm_dp_dpcd_read_data(dp->aux, DP_SOURCE_OUI, buf, sizeof(buf)) < 0)
+ drm_dbg_dp(dp->drm_dev, "failed to read the source OUI\n");
+
+ if (!memcmp(buf, qcom_oui, sizeof(qcom_oui)))
+ return;
+
+ if (drm_dp_dpcd_write_data(dp->aux, DP_SOURCE_OUI, qcom_oui, sizeof(qcom_oui)) < 0)
+ drm_dbg_dp(dp->drm_dev, "failed to write the source OUI\n");
+}
+
static int msm_dp_display_prepare_link(struct msm_dp_display_private *dp)
{
struct msm_dp *msm_dp_display = &dp->msm_dp_display;
@@ -653,6 +679,9 @@ static int msm_dp_display_prepare_link(struct msm_dp_display_private *dp)
force_link_train = true;
}
+ if (msm_dp_display->is_edp)
+ msm_dp_display_write_source_oui(dp);
+
rc = msm_dp_ctrl_on_link(dp->ctrl, dp->panel);
if (rc) {
DRM_ERROR("Failed link training (rc=%d)\n", rc);
---
base-commit: dca2f1b25860f8caa0406f858e76a3a21671a012
change-id: 20261205-dp_send_qcom_oui-9196943eafa3
Best regards,
--
Jens Glathe <jens.glathe@oldschoolsolutions.biz>
^ permalink raw reply related [flat|nested] 3+ messages in thread* [PATCH] drm/msm/dp: write the Qualcomm source OUI before eDP link bring-up
@ 2026-12-05 9:55 ` Jens Glathe
0 siblings, 0 replies; 3+ messages in thread
From: Jens Glathe @ 2026-12-05 9:55 UTC (permalink / raw)
To: Rob Clark, Dmitry Baryshkov, Abhinav Kumar, Jessica Zhang,
Sean Paul, Marijn Suijten, David Airlie, Simona Vetter
Cc: linux-arm-msm, dri-devel, freedreno, linux-kernel, Jens Glathe
Some eDP panels, e.g. the Samsung ATNA40CT01 OLED on the Lenovo IdeaPad
Slim 5x, only accept DPCD backlight writes once the source has identified
itself through DP_SOURCE_OUI. The UEFI GOP writes the Qualcomm OUI
(8c:fd:f0) on a cold boot, but the panel forgets it when its supply rail
is switched off, e.g. across s2idle. The panel then ignores the backlight
brightness writes and stays stuck at maximum brightness after resume.
Write the OUI for eDP sinks from msm_dp_display_prepare_link(), right
after the PHY is up and AUX is usable and before link training, which is
also where the panel has already been prepared by the panel bridge's
pre_enable and the backlight is not enabled yet. Like i915 does for the
Intel OUI, read DP_SOURCE_OUI first and only write it if the read failed
or the value differs, to avoid clearing any sink state by accident.
Use drm_dp_dpcd_write_data() to check the transfer size as well as the
return code.
Root cause found by Stewings, who diffed the panel's DPCD between a cold
boot and a resume from s2idle [1].
[1]: https://github.com/jglathe/linux_ms_dev_kit/issues/102
Assisted-by: Grok Bot
Signed-off-by: Jens Glathe <jens.glathe@oldschoolsolutions.biz>
---
drivers/gpu/drm/msm/dp/dp_display.c | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c
index 29032fb61443e..d4bf60e7cec2e 100644
--- a/drivers/gpu/drm/msm/dp/dp_display.c
+++ b/drivers/gpu/drm/msm/dp/dp_display.c
@@ -628,6 +628,32 @@ static int msm_dp_display_set_mode(struct msm_dp *msm_dp_display,
return 0;
}
+/**
+ * msm_dp_display_write_source_oui() - tell an eDP sink who the source is
+ * @dp: main display data structure
+ *
+ * Some eDP panels only honour their vendor specific DPCD backlight controls
+ * once the source has identified itself via DP_SOURCE_OUI, and forget the OUI
+ * whenever the panel is power cycled. Write it before the link is brought up,
+ * like i915 does, but leave it alone if the sink already has the value we
+ * want, so that no sink state is cleared by accident.
+ */
+static void msm_dp_display_write_source_oui(struct msm_dp_display_private *dp)
+{
+ /* Not const: drm_dp_dpcd_write_data() takes a non-const buffer */
+ u8 qcom_oui[] = { 0x8c, 0xfd, 0xf0 };
+ u8 buf[sizeof(qcom_oui)] = {};
+
+ if (drm_dp_dpcd_read_data(dp->aux, DP_SOURCE_OUI, buf, sizeof(buf)) < 0)
+ drm_dbg_dp(dp->drm_dev, "failed to read the source OUI\n");
+
+ if (!memcmp(buf, qcom_oui, sizeof(qcom_oui)))
+ return;
+
+ if (drm_dp_dpcd_write_data(dp->aux, DP_SOURCE_OUI, qcom_oui, sizeof(qcom_oui)) < 0)
+ drm_dbg_dp(dp->drm_dev, "failed to write the source OUI\n");
+}
+
static int msm_dp_display_prepare_link(struct msm_dp_display_private *dp)
{
struct msm_dp *msm_dp_display = &dp->msm_dp_display;
@@ -653,6 +679,9 @@ static int msm_dp_display_prepare_link(struct msm_dp_display_private *dp)
force_link_train = true;
}
+ if (msm_dp_display->is_edp)
+ msm_dp_display_write_source_oui(dp);
+
rc = msm_dp_ctrl_on_link(dp->ctrl, dp->panel);
if (rc) {
DRM_ERROR("Failed link training (rc=%d)\n", rc);
---
base-commit: dca2f1b25860f8caa0406f858e76a3a21671a012
change-id: 20261205-dp_send_qcom_oui-9196943eafa3
Best regards,
--
Jens Glathe <jens.glathe@oldschoolsolutions.biz>
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] drm/msm/dp: write the Qualcomm source OUI before eDP link bring-up
2026-12-05 9:55 ` Jens Glathe
(?)
@ 2026-12-05 10:10 ` sashiko-bot
-1 siblings, 0 replies; 3+ messages in thread
From: sashiko-bot @ 2026-12-05 10:10 UTC (permalink / raw)
To: Jens Glathe; +Cc: dri-devel
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] drm/msm/dp: msm_dp_display_write_source_oui() checks buf after
failed read
--
commit c144d1e3106d36ea14e6fc6fcc64c82cc7aaf9c0
Author: Jens Glathe <jens.glathe@oldschoolsolutions.biz>
drm/msm/dp: write the Qualcomm source OUI before eDP link bring-up
This commit writes the Qualcomm source OUI to DP_SOURCE_OUI for eDP
sinks in msm_dp_display_prepare_link() before link training, reading the
register first to skip the write if it already matches.
> diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c
> index 29032fb61443e..d4bf60e7cec2e 100644
> --- a/drivers/gpu/drm/msm/dp/dp_display.c
> +++ b/drivers/gpu/drm/msm/dp/dp_display.c
> @@ -628,6 +628,32 @@ static int msm_dp_display_set_mode(struct msm_dp *msm_dp_display,
[ ... ]
> +static void msm_dp_display_write_source_oui(struct msm_dp_display_private *dp)
> +{
> + /* Not const: drm_dp_dpcd_write_data() takes a non-const buffer */
> + u8 qcom_oui[] = { 0x8c, 0xfd, 0xf0 };
> + u8 buf[sizeof(qcom_oui)] = {};
> +
> + if (drm_dp_dpcd_read_data(dp->aux, DP_SOURCE_OUI, buf, sizeof(buf)) < 0)
> + drm_dbg_dp(dp->drm_dev, "failed to read the source OUI\n");
> +
> + if (!memcmp(buf, qcom_oui, sizeof(qcom_oui)))
> + return;
[Severity: Low]
Should this memcmp() be in an else if branch so it does not inspect buf
when drm_dp_dpcd_read_data() fails?
On a short AUX read, msm_dp_aux_cmd_fifo_rx() stores each byte from
REG_DP_AUX_DATA before breaking on i != actual_i. Neither
drm_dp_dpcd_access() nor the fallback in drm_dp_dpcd_read_data() clears
the buffer on error, so a failed read can leave buf matching qcom_oui.
If that happens, msm_dp_display_write_source_oui() returns early and
skips writing DP_SOURCE_OUI, leaving the panel's DPCD backlight controls
unresponsive until the next link bring-up.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261205-dp_send_qcom_oui-v1-1-b0b2332dd226@oldschoolsolutions.biz?part=1
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-12-05 10:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-05 9:55 [PATCH] drm/msm/dp: write the Qualcomm source OUI before eDP link bring-up Jens Glathe via B4 Relay
2026-12-05 9:55 ` Jens Glathe
2026-12-05 10:10 ` sashiko-bot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.