[PATCH v3 1/2] drm/vc4: hdmi: Call HDMI hotplug helper on disconnect

David Turner posted 2 patches 9 months, 1 week ago
There is a newer version of this series
[PATCH v3 1/2] drm/vc4: hdmi: Call HDMI hotplug helper on disconnect
Posted by David Turner 9 months, 1 week ago
From: Stefan Wahren <wahrenst@gmx.net>

drm_atomic_helper_connector_hdmi_hotplug() must be called
regardless of the connection status, otherwise the HDMI audio
disconnect event won't be notified.  Also update the comment on
drm_atomic_helper_connector_hdmi_hotplug() to explain that this is
necessary.

Fixes: 2ea9ec5d2c20 ("drm/vc4: hdmi: use drm_atomic_helper_connector_hdmi_hotplug()")
Suggested-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
Signed-off-by: David Turner <david.turner@raspberrypi.com>
---
 drivers/gpu/drm/display/drm_hdmi_state_helper.c | 3 ++-
 drivers/gpu/drm/vc4/vc4_hdmi.c                  | 4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/display/drm_hdmi_state_helper.c b/drivers/gpu/drm/display/drm_hdmi_state_helper.c
index c205f37da1e12b11c384670db83e43613e031340..d26d51902ba1a73175b23eec71562a30ceda1082 100644
--- a/drivers/gpu/drm/display/drm_hdmi_state_helper.c
+++ b/drivers/gpu/drm/display/drm_hdmi_state_helper.c
@@ -816,7 +816,8 @@ drm_atomic_helper_connector_hdmi_update(struct drm_connector *connector,
  * @status: Connection status
  *
  * This function should be called as a part of the .detect() / .detect_ctx()
- * callbacks, updating the HDMI-specific connector's data.
+ * callbacks, updating the HDMI-specific connector's data. It also needs to be
+ * called for disconnects to notify audio users of the unplug.
  */
 void drm_atomic_helper_connector_hdmi_hotplug(struct drm_connector *connector,
 					      enum drm_connector_status status)
diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c
index 37238a12baa58a06a5d6f40d1ab64abc7fac60d7..37a7d45695f236d3ab281d9a8676921fd434955c 100644
--- a/drivers/gpu/drm/vc4/vc4_hdmi.c
+++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
@@ -372,13 +372,13 @@ static void vc4_hdmi_handle_hotplug(struct vc4_hdmi *vc4_hdmi,
 	 * the lock for now.
 	 */
 
+	drm_atomic_helper_connector_hdmi_hotplug(connector, status);
+
 	if (status == connector_status_disconnected) {
 		cec_phys_addr_invalidate(vc4_hdmi->cec_adap);
 		return;
 	}
 
-	drm_atomic_helper_connector_hdmi_hotplug(connector, status);
-
 	cec_s_phys_addr(vc4_hdmi->cec_adap,
 			connector->display_info.source_physical_address, false);
 

-- 
2.34.1
Re: [PATCH v3 1/2] drm/vc4: hdmi: Call HDMI hotplug helper on disconnect
Posted by Maxime Ripard 9 months, 1 week ago
Hi,

On Wed, Mar 12, 2025 at 03:40:55PM +0000, David Turner wrote:
> From: Stefan Wahren <wahrenst@gmx.net>
> 
> drm_atomic_helper_connector_hdmi_hotplug() must be called
> regardless of the connection status, otherwise the HDMI audio
> disconnect event won't be notified.  Also update the comment on
> drm_atomic_helper_connector_hdmi_hotplug() to explain that this is
> necessary.
> 
> Fixes: 2ea9ec5d2c20 ("drm/vc4: hdmi: use drm_atomic_helper_connector_hdmi_hotplug()")
> Suggested-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
> Signed-off-by: David Turner <david.turner@raspberrypi.com>
> ---
>  drivers/gpu/drm/display/drm_hdmi_state_helper.c | 3 ++-
>  drivers/gpu/drm/vc4/vc4_hdmi.c                  | 4 ++--
>  2 files changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpu/drm/display/drm_hdmi_state_helper.c b/drivers/gpu/drm/display/drm_hdmi_state_helper.c
> index c205f37da1e12b11c384670db83e43613e031340..d26d51902ba1a73175b23eec71562a30ceda1082 100644
> --- a/drivers/gpu/drm/display/drm_hdmi_state_helper.c
> +++ b/drivers/gpu/drm/display/drm_hdmi_state_helper.c
> @@ -816,7 +816,8 @@ drm_atomic_helper_connector_hdmi_update(struct drm_connector *connector,
>   * @status: Connection status
>   *
>   * This function should be called as a part of the .detect() / .detect_ctx()
> - * callbacks, updating the HDMI-specific connector's data.
> + * callbacks, updating the HDMI-specific connector's data. It also needs to be
> + * called for disconnects to notify audio users of the unplug.

This part should be in a separate patch.

I also think that it's wrong, it's not just about audio. It just needs
to be called as part of detect no matter what the status is. Audio is
one thing that it will possibly handle depending on the driver, but
EDIDs, CEC, etc. might also be dealt with. So I don't think it's right
to focus on audio there.

>   */
>  void drm_atomic_helper_connector_hdmi_hotplug(struct drm_connector *connector,
>  					      enum drm_connector_status status)
> diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c
> index 37238a12baa58a06a5d6f40d1ab64abc7fac60d7..37a7d45695f236d3ab281d9a8676921fd434955c 100644
> --- a/drivers/gpu/drm/vc4/vc4_hdmi.c
> +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
> @@ -372,13 +372,13 @@ static void vc4_hdmi_handle_hotplug(struct vc4_hdmi *vc4_hdmi,
>  	 * the lock for now.
>  	 */
>  
> +	drm_atomic_helper_connector_hdmi_hotplug(connector, status);
> +
>  	if (status == connector_status_disconnected) {
>  		cec_phys_addr_invalidate(vc4_hdmi->cec_adap);
>  		return;
>  	}
>  
> -	drm_atomic_helper_connector_hdmi_hotplug(connector, status);
> -
>  	cec_s_phys_addr(vc4_hdmi->cec_adap,
>  			connector->display_info.source_physical_address, false);

For the vc4 part alone,
Reviewed-by: Maxime Ripard <mripard@kernel.org>

Maxime
Re: [PATCH v3 1/2] drm/vc4: hdmi: Call HDMI hotplug helper on disconnect
Posted by David Turner 9 months ago
Hi Maxime,

Thanks for the reviews.

On Fri, 14 Mar 2025 at 13:33, Maxime Ripard <mripard@kernel.org> wrote:
> I also think that it's wrong, it's not just about audio. It just needs
> to be called as part of detect no matter what the status is. Audio is
> one thing that it will possibly handle depending on the driver, but
> EDIDs, CEC, etc. might also be dealt with. So I don't think it's right
> to focus on audio there.

Does this wording sound ok?

 * This function should be called as a part of the .detect() / .detect_ctx()
 * callbacks for all status changes in order to update the HDMI-specific
 * connector's data.

Best regards,
David
Re: [PATCH v3 1/2] drm/vc4: hdmi: Call HDMI hotplug helper on disconnect
Posted by Maxime Ripard 9 months ago
On Mon, Mar 17, 2025 at 02:37:03PM +0000, David Turner wrote:
> Hi Maxime,
> 
> Thanks for the reviews.
> 
> On Fri, 14 Mar 2025 at 13:33, Maxime Ripard <mripard@kernel.org> wrote:
> > I also think that it's wrong, it's not just about audio. It just needs
> > to be called as part of detect no matter what the status is. Audio is
> > one thing that it will possibly handle depending on the driver, but
> > EDIDs, CEC, etc. might also be dealt with. So I don't think it's right
> > to focus on audio there.
> 
> Does this wording sound ok?
> 
>  * This function should be called as a part of the .detect() / .detect_ctx()
>  * callbacks for all status changes in order to update the HDMI-specific
>  * connector's data.

I'd drop everything after "in order to..." but yeah, it's much better, thanks!
Maxime