2023-08-04 07:11:42

by Sandor Yu

[permalink] [raw]
Subject: [PATCH v2] drm: bridge: dw_hdmi: Fix ELD is not updated issue

The ELD (EDID-Like Data) is not updated when the HDMI cable
is plugged into different HDMI monitors.
This is because the EDID is not updated in the HDMI HPD function.
As a result, the ELD data remains unchanged and may not reflect
the capabilities of the newly connected HDMI sink device.

To address this issue, the handle_plugged_change function should move to
the bridge_atomic_enable and bridge_atomic_disable functions.
Make sure the EDID is properly updated before updating ELD.

Signed-off-by: Sandor Yu <[email protected]>

---
v2:
- Add the variable of last_connector_result back to driver.
It will only be used to initialize audio codec jack status when audio codec driver probe.

---
drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
index aa51c61a78c7..963050de42c3 100644
--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
@@ -2463,15 +2463,7 @@ static enum drm_connector_status dw_hdmi_detect(struct dw_hdmi *hdmi)
enum drm_connector_status result;

result = hdmi->phy.ops->read_hpd(hdmi, hdmi->phy.data);
-
- mutex_lock(&hdmi->mutex);
- if (result != hdmi->last_connector_result) {
- dev_dbg(hdmi->dev, "read_hpd result: %d", result);
- handle_plugged_change(hdmi,
- result == connector_status_connected);
- hdmi->last_connector_result = result;
- }
- mutex_unlock(&hdmi->mutex);
+ hdmi->last_connector_result = result;

return result;
}
@@ -2971,6 +2963,7 @@ static void dw_hdmi_bridge_atomic_disable(struct drm_bridge *bridge,
hdmi->curr_conn = NULL;
dw_hdmi_update_power(hdmi);
dw_hdmi_update_phy_mask(hdmi);
+ handle_plugged_change(hdmi, false);
mutex_unlock(&hdmi->mutex);
}

@@ -2989,6 +2982,7 @@ static void dw_hdmi_bridge_atomic_enable(struct drm_bridge *bridge,
hdmi->curr_conn = connector;
dw_hdmi_update_power(hdmi);
dw_hdmi_update_phy_mask(hdmi);
+ handle_plugged_change(hdmi, true);
mutex_unlock(&hdmi->mutex);
}

--
2.34.1



2023-08-04 08:47:47

by Neil Armstrong

[permalink] [raw]
Subject: Re: [PATCH v2] drm: bridge: dw_hdmi: Fix ELD is not updated issue

On 04/08/2023 08:11, Sandor Yu wrote:
> The ELD (EDID-Like Data) is not updated when the HDMI cable
> is plugged into different HDMI monitors.
> This is because the EDID is not updated in the HDMI HPD function.
> As a result, the ELD data remains unchanged and may not reflect
> the capabilities of the newly connected HDMI sink device.
>
> To address this issue, the handle_plugged_change function should move to
> the bridge_atomic_enable and bridge_atomic_disable functions.
> Make sure the EDID is properly updated before updating ELD.
>
> Signed-off-by: Sandor Yu <[email protected]>
>
> ---
> v2:
> - Add the variable of last_connector_result back to driver.
> It will only be used to initialize audio codec jack status when audio codec driver probe.
>
> ---
> drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 12 +++---------
> 1 file changed, 3 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
> index aa51c61a78c7..963050de42c3 100644
> --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
> +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
> @@ -2463,15 +2463,7 @@ static enum drm_connector_status dw_hdmi_detect(struct dw_hdmi *hdmi)
> enum drm_connector_status result;
>
> result = hdmi->phy.ops->read_hpd(hdmi, hdmi->phy.data);
> -
> - mutex_lock(&hdmi->mutex);
> - if (result != hdmi->last_connector_result) {
> - dev_dbg(hdmi->dev, "read_hpd result: %d", result);
> - handle_plugged_change(hdmi,
> - result == connector_status_connected);
> - hdmi->last_connector_result = result;
> - }
> - mutex_unlock(&hdmi->mutex);
> + hdmi->last_connector_result = result;
>
> return result;
> }
> @@ -2971,6 +2963,7 @@ static void dw_hdmi_bridge_atomic_disable(struct drm_bridge *bridge,
> hdmi->curr_conn = NULL;
> dw_hdmi_update_power(hdmi);
> dw_hdmi_update_phy_mask(hdmi);
> + handle_plugged_change(hdmi, false);
> mutex_unlock(&hdmi->mutex);
> }
>
> @@ -2989,6 +2982,7 @@ static void dw_hdmi_bridge_atomic_enable(struct drm_bridge *bridge,
> hdmi->curr_conn = connector;
> dw_hdmi_update_power(hdmi);
> dw_hdmi_update_phy_mask(hdmi);
> + handle_plugged_change(hdmi, true);
> mutex_unlock(&hdmi->mutex);
> }
>

Reviewed-by: Neil Armstrong <[email protected]>

2023-08-04 09:28:12

by Neil Armstrong

[permalink] [raw]
Subject: Re: [PATCH v2] drm: bridge: dw_hdmi: Fix ELD is not updated issue

Hi,

On Fri, 04 Aug 2023 14:11:45 +0800, Sandor Yu wrote:
> The ELD (EDID-Like Data) is not updated when the HDMI cable
> is plugged into different HDMI monitors.
> This is because the EDID is not updated in the HDMI HPD function.
> As a result, the ELD data remains unchanged and may not reflect
> the capabilities of the newly connected HDMI sink device.
>
> To address this issue, the handle_plugged_change function should move to
> the bridge_atomic_enable and bridge_atomic_disable functions.
> Make sure the EDID is properly updated before updating ELD.
>
> [...]

Thanks, Applied to https://anongit.freedesktop.org/git/drm/drm-misc.git (drm-misc-next)

[1/1] drm: bridge: dw_hdmi: Fix ELD is not updated issue
https://cgit.freedesktop.org/drm/drm-misc/commit/?id=6db96c7703edd6e37da8ca571dfe5e1ecb6010c1

--
Neil