* [PATCH] drm: bridge: dw_hdmi: fix connector access for scdc
@ 2023-06-01 12:31 Adrián Larumbe
2023-06-22 10:05 ` Neil Armstrong
2023-06-22 12:54 ` Neil Armstrong
0 siblings, 2 replies; 3+ messages in thread
From: Adrián Larumbe @ 2023-06-01 12:31 UTC (permalink / raw)
To: ville.syrjala, narmstrong, andrzej.hajda, rfoss
Cc: Adrián Larumbe, kernel, dri-devel
Commit 5d844091f237 ("drm/scdc-helper: Pimp SCDC debugs") changed the scdc
interface to pick up an i2c adapter from a connector instead. However, in
the case of dw-hdmi, the wrong connector was being used to pass i2c adapter
information, since dw-hdmi's embedded connector structure is only populated
when the bridge attachment callback explicitly asks for it.
drm-meson is handling connector creation, so this won't happen, leading to
a NULL pointer dereference.
Fix it by having scdc functions access dw-hdmi's current connector pointer
instead, which is assigned during the bridge enablement stage.
Signed-off-by: Adrián Larumbe <adrian.larumbe@collabora.com>
Fixes: 5d844091f237 ("drm/scdc-helper: Pimp SCDC debugs")
---
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
index 0accfb51509c..69c0e80b8525 100644
--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
@@ -1412,9 +1412,9 @@ void dw_hdmi_set_high_tmds_clock_ratio(struct dw_hdmi *hdmi,
/* Control for TMDS Bit Period/TMDS Clock-Period Ratio */
if (dw_hdmi_support_scdc(hdmi, display)) {
if (mtmdsclock > HDMI14_MAX_TMDSCLK)
- drm_scdc_set_high_tmds_clock_ratio(&hdmi->connector, 1);
+ drm_scdc_set_high_tmds_clock_ratio(hdmi->curr_conn, 1);
else
- drm_scdc_set_high_tmds_clock_ratio(&hdmi->connector, 0);
+ drm_scdc_set_high_tmds_clock_ratio(hdmi->curr_conn, 0);
}
}
EXPORT_SYMBOL_GPL(dw_hdmi_set_high_tmds_clock_ratio);
@@ -2102,7 +2102,7 @@ static void hdmi_av_composer(struct dw_hdmi *hdmi,
min_t(u8, bytes, SCDC_MIN_SOURCE_VERSION));
/* Enabled Scrambling in the Sink */
- drm_scdc_set_scrambling(&hdmi->connector, 1);
+ drm_scdc_set_scrambling(hdmi->curr_conn, 1);
/*
* To activate the scrambler feature, you must ensure
@@ -2118,7 +2118,7 @@ static void hdmi_av_composer(struct dw_hdmi *hdmi,
hdmi_writeb(hdmi, 0, HDMI_FC_SCRAMBLER_CTRL);
hdmi_writeb(hdmi, (u8)~HDMI_MC_SWRSTZ_TMDSSWRST_REQ,
HDMI_MC_SWRSTZ);
- drm_scdc_set_scrambling(&hdmi->connector, 0);
+ drm_scdc_set_scrambling(hdmi->curr_conn, 0);
}
}
@@ -3546,6 +3546,7 @@ struct dw_hdmi *dw_hdmi_probe(struct platform_device *pdev,
hdmi->bridge.ops = DRM_BRIDGE_OP_DETECT | DRM_BRIDGE_OP_EDID
| DRM_BRIDGE_OP_HPD;
hdmi->bridge.interlace_allowed = true;
+ hdmi->bridge.ddc = hdmi->ddc;
#ifdef CONFIG_OF
hdmi->bridge.of_node = pdev->dev.of_node;
#endif
--
2.40.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] drm: bridge: dw_hdmi: fix connector access for scdc
2023-06-01 12:31 [PATCH] drm: bridge: dw_hdmi: fix connector access for scdc Adrián Larumbe
@ 2023-06-22 10:05 ` Neil Armstrong
2023-06-22 12:54 ` Neil Armstrong
1 sibling, 0 replies; 3+ messages in thread
From: Neil Armstrong @ 2023-06-22 10:05 UTC (permalink / raw)
To: Adrián Larumbe, ville.syrjala, narmstrong, andrzej.hajda, rfoss
Cc: kernel, dri-devel
Hi !
On 01/06/2023 14:31, Adrián Larumbe wrote:
> Commit 5d844091f237 ("drm/scdc-helper: Pimp SCDC debugs") changed the scdc
> interface to pick up an i2c adapter from a connector instead. However, in
> the case of dw-hdmi, the wrong connector was being used to pass i2c adapter
> information, since dw-hdmi's embedded connector structure is only populated
> when the bridge attachment callback explicitly asks for it.
>
> drm-meson is handling connector creation, so this won't happen, leading to
> a NULL pointer dereference.
>
> Fix it by having scdc functions access dw-hdmi's current connector pointer
> instead, which is assigned during the bridge enablement stage.
>
> Signed-off-by: Adrián Larumbe <adrian.larumbe@collabora.com>
> Fixes: 5d844091f237 ("drm/scdc-helper: Pimp SCDC debugs")
Fixes should go first.
I missed again this change because you again used my old baylibre address,
but git-send-email should not use it anymore since a .mailmap entry exists
upstream since september 2022.
Anyway, please use get_maintainers on the current working tree or use b4 to
get the most recent maintainers, reviewers & list emails.
> ---
> drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
> index 0accfb51509c..69c0e80b8525 100644
> --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
> +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
> @@ -1412,9 +1412,9 @@ void dw_hdmi_set_high_tmds_clock_ratio(struct dw_hdmi *hdmi,
> /* Control for TMDS Bit Period/TMDS Clock-Period Ratio */
> if (dw_hdmi_support_scdc(hdmi, display)) {
> if (mtmdsclock > HDMI14_MAX_TMDSCLK)
> - drm_scdc_set_high_tmds_clock_ratio(&hdmi->connector, 1);
> + drm_scdc_set_high_tmds_clock_ratio(hdmi->curr_conn, 1);
> else
> - drm_scdc_set_high_tmds_clock_ratio(&hdmi->connector, 0);
> + drm_scdc_set_high_tmds_clock_ratio(hdmi->curr_conn, 0);
> }
> }
> EXPORT_SYMBOL_GPL(dw_hdmi_set_high_tmds_clock_ratio);
> @@ -2102,7 +2102,7 @@ static void hdmi_av_composer(struct dw_hdmi *hdmi,
> min_t(u8, bytes, SCDC_MIN_SOURCE_VERSION));
>
> /* Enabled Scrambling in the Sink */
> - drm_scdc_set_scrambling(&hdmi->connector, 1);
> + drm_scdc_set_scrambling(hdmi->curr_conn, 1);
>
> /*
> * To activate the scrambler feature, you must ensure
> @@ -2118,7 +2118,7 @@ static void hdmi_av_composer(struct dw_hdmi *hdmi,
> hdmi_writeb(hdmi, 0, HDMI_FC_SCRAMBLER_CTRL);
> hdmi_writeb(hdmi, (u8)~HDMI_MC_SWRSTZ_TMDSSWRST_REQ,
> HDMI_MC_SWRSTZ);
> - drm_scdc_set_scrambling(&hdmi->connector, 0);
> + drm_scdc_set_scrambling(hdmi->curr_conn, 0);
> }
> }
>
> @@ -3546,6 +3546,7 @@ struct dw_hdmi *dw_hdmi_probe(struct platform_device *pdev,
> hdmi->bridge.ops = DRM_BRIDGE_OP_DETECT | DRM_BRIDGE_OP_EDID
> | DRM_BRIDGE_OP_HPD;
> hdmi->bridge.interlace_allowed = true;
> + hdmi->bridge.ddc = hdmi->ddc;
I missed this one on my change...
> #ifdef CONFIG_OF
> hdmi->bridge.of_node = pdev->dev.of_node;
> #endif
I'll add:
Reported-by: Lukas F. Hartmann <lukas@mntre.com>
while applying and:
Acked-by: Neil Armstrong <neil.armstrong@linaro.org>
Thanks,
Neil
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] drm: bridge: dw_hdmi: fix connector access for scdc
2023-06-01 12:31 [PATCH] drm: bridge: dw_hdmi: fix connector access for scdc Adrián Larumbe
2023-06-22 10:05 ` Neil Armstrong
@ 2023-06-22 12:54 ` Neil Armstrong
1 sibling, 0 replies; 3+ messages in thread
From: Neil Armstrong @ 2023-06-22 12:54 UTC (permalink / raw)
To: ville.syrjala, andrzej.hajda, rfoss, Neil Armstrong, Adrián Larumbe
Cc: kernel, dri-devel
Hi,
On Thu, 01 Jun 2023 13:31:53 +0100, Adrián Larumbe wrote:
> Commit 5d844091f237 ("drm/scdc-helper: Pimp SCDC debugs") changed the scdc
> interface to pick up an i2c adapter from a connector instead. However, in
> the case of dw-hdmi, the wrong connector was being used to pass i2c adapter
> information, since dw-hdmi's embedded connector structure is only populated
> when the bridge attachment callback explicitly asks for it.
>
> drm-meson is handling connector creation, so this won't happen, leading to
> a NULL pointer dereference.
>
> [...]
Thanks, Applied to https://anongit.freedesktop.org/git/drm/drm-misc.git (drm-misc-fixes)
[1/1] drm: bridge: dw_hdmi: fix connector access for scdc
https://cgit.freedesktop.org/drm/drm-misc/commit/?id=98703e4e061fb8715c7613cd227e32cdfd136b23
--
Neil
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-06-22 12:54 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-01 12:31 [PATCH] drm: bridge: dw_hdmi: fix connector access for scdc Adrián Larumbe
2023-06-22 10:05 ` Neil Armstrong
2023-06-22 12:54 ` Neil Armstrong
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.