Skip to contentSkip to conversation

drm/msm/dp: do not notify audio subsystem if sink doesn't support audio

PATCH Superseded Abhinav Kumar 2 participants 5 messages Oct 29, 2020 – Nov 2, 2020

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/msm/dp: do not notify audio subsystem if sink doesn't support audio

For sinks that do not support audio, there is no need to notify audio subsystem of the connection event.

This will make sure that audio routes only to the primary display when connected to such sinks.

---
 drivers/gpu/drm/msm/dp/dp_display.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/gpu/drm/msm/dp/dp_display.c +10 -2
index 4a5735564be2..d970980b0ca5 100644
@@ -555,8 +555,16 @@ static int dp_connect_pending_timeout(struct dp_display_private *dp, u32 data)
 static void dp_display_handle_plugged_change(struct msm_dp *dp_display,
 		bool plugged)
 {
-	if (dp_display->plugged_cb && dp_display->codec_dev)
-		dp_display->plugged_cb(dp_display->codec_dev, plugged);
+	struct dp_display_private *dp;
+
+	dp = container_of(g_dp_display,
+			struct dp_display_private, dp_display);
+
+	if (dp_display->plugged_cb && dp_display->codec_dev) {
+		/* notify audio subsystem only if sink supports audio */
+		if (dp->audio_supported)
+			dp_display->plugged_cb(dp_display->codec_dev, plugged);
+	}
 }
 
 static int dp_hpd_unplug_handle(struct dp_display_private *dp, u32 data)
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
#1 lore raw

Quoting Abhinav Kumar (2020-10-29 13:55:09)

Quoted 6 lines

For sinks that do not support audio, there is no need to notify audio subsystem of the connection event.

This will make sure that audio routes only to the primary display when connected to such sinks.

Does this need a Fixes tag? Or it's just an optimization patch?

Quoted 10 lines
---
 drivers/gpu/drm/msm/dp/dp_display.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/gpu/drm/msm/dp/dp_display.c +0 -0
index 4a5735564be2..d970980b0ca5 100644

drivers/gpu/drm/msm/dp/dp_display.c static int dp_connect_pending_timeout(struct dp_display_private *dp, u32 data) · line 560

Quoted 8 lines
drivers/gpu/drm/msm/dp/dp_display.c +3 -2
@@ -555,8 +555,16 @@ static int dp_connect_pending_timeout(struct dp_display_private *dp, u32 data)
 static void dp_display_handle_plugged_change(struct msm_dp *dp_display,
                bool plugged)
 {
-       if (dp_display->plugged_cb && dp_display->codec_dev)
-               dp_display->plugged_cb(dp_display->codec_dev, plugged);
+       struct dp_display_private *dp;
+
+       dp = container_of(g_dp_display,

What is g_dp_display? I guess this doesn't compile?

drivers/gpu/drm/msm/dp/dp_display.c static int dp_connect_pending_timeout(struct dp_display_private *dp, u32 data) · line 565

Quoted 5 lines
drivers/gpu/drm/msm/dp/dp_display.c +5 -0
+                       struct dp_display_private, dp_display);
+
+       if (dp_display->plugged_cb && dp_display->codec_dev) {
+               /* notify audio subsystem only if sink supports audio */
+               if (dp->audio_supported)

Can we combine this into the above if statement?

drivers/gpu/drm/msm/dp/dp_display.c static int dp_connect_pending_timeout(struct dp_display_private *dp, u32 data) · line 566

Quoted 1 line
drivers/gpu/drm/msm/dp/dp_display.c +1 -0
+                       dp_display->plugged_cb(dp_display->codec_dev, plugged);

Then this isn't as nested.

Quoted 4 lines
drivers/gpu/drm/msm/dp/dp_display.c +1 -0
+       }
 }
 
 static int dp_hpd_unplug_handle(struct dp_display_private *dp, u32 data)
#2 lore raw

Hi Stephen

Thanks for the review.

Quoted 9 lines · Stephen Boyd

Quoting Abhinav Kumar (2020-10-29 13:55:09)

Quoted 6 lines

For sinks that do not support audio, there is no need to notify audio subsystem of the connection event.

This will make sure that audio routes only to the primary display when connected to such sinks.

Does this need a Fixes tag? Or it's just an optimization patch?

This is an unhandled corner case ( VGA dongle ) for DP audio and will make sure we do not switch audio output from primary to external when connected to a sink which does not support audio.
I thought of adding a fixes tag pointing to https://patchwork.freedesktop.org/patch/390236/.
But at the same time, thought this can go in as a standlone patch as well.
If you think its required, I will add the fixes tag pointing to the base audio patch.

Quoted 16 lines
Quoted 16 lines
---
 drivers/gpu/drm/msm/dp/dp_display.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/gpu/drm/msm/dp/dp_display.c +0 -0
index 4a5735564be2..d970980b0ca5 100644
@@ -555,8 +555,16 @@ static int dp_connect_pending_timeout(struct 
 dp_display_private *dp, u32 data)
 static void dp_display_handle_plugged_change(struct msm_dp 
 *dp_display,
                bool plugged)
 {
Quoted 8 lines

drivers/gpu/drm/msm/dp/dp_display.c static int dp_connect_pending_timeout(struct dp_display_private *dp, u32 data) · line 560

Quoted 6 lines
drivers/gpu/drm/msm/dp/dp_display.c +3 -2
-       if (dp_display->plugged_cb && dp_display->codec_dev)
-               dp_display->plugged_cb(dp_display->codec_dev, 
 plugged);
+       struct dp_display_private *dp;
+
+       dp = container_of(g_dp_display,

What is g_dp_display? I guess this doesn't compile?

g_dp_display is the global dp_display pointer in the dp_display.c file. It does compile.

Quoted 8 lines
Quoted 7 lines
drivers/gpu/drm/msm/dp/dp_display.c +4 -0
+                       struct dp_display_private, dp_display);
+
+       if (dp_display->plugged_cb && dp_display->codec_dev) {
+               /* notify audio subsystem only if sink supports audio 

*/
+ if (dp->audio_supported)

Quoted 6 lines

Can we combine this into the above if statement?

Quoted 2 lines

+ dp_display->plugged_cb(dp_display->codec_dev,
plugged);

Then this isn't as nested.

Ok, will do ...

Quoted 10 lines
Quoted 6 lines

+ }
}

static int dp_hpd_unplug_handle(struct dp_display_private *dp, u32
data)

_______________________________________________
Freedreno mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/freedreno

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#3 lore raw

Quoting [email protected] (2020-11-02 14:43:33)

Quoted 14 lines

Hi Stephen

Thanks for the review.

Quoted 9 lines · Stephen Boyd

Quoting Abhinav Kumar (2020-10-29 13:55:09)

Quoted 6 lines

For sinks that do not support audio, there is no need to notify audio subsystem of the connection event.

This will make sure that audio routes only to the primary display when connected to such sinks.

Does this need a Fixes tag? Or it's just an optimization patch?

Quoted 11 lines

This is an unhandled corner case ( VGA dongle ) for DP audio and will make
sure we do not switch audio output from primary to external when connected to
a sink which does not support audio.
I thought of adding a fixes tag pointing to
https://patchwork.freedesktop.org/patch/390236/.
But at the same time, thought this can go in as a standlone patch as well.
If you think its required, I will add the fixes tag pointing to the base audio patch.

Yeah Fixes is nice so we know what is fixed.

Quoted 25 lines
Quoted 17 lines
Quoted 17 lines
---
 drivers/gpu/drm/msm/dp/dp_display.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/gpu/drm/msm/dp/dp_display.c +0 -0
index 4a5735564be2..d970980b0ca5 100644
@@ -555,8 +555,16 @@ static int dp_connect_pending_timeout(struct 
 dp_display_private *dp, u32 data)
 static void dp_display_handle_plugged_change(struct msm_dp 
 *dp_display,
                bool plugged)
 {
Quoted 8 lines

drivers/gpu/drm/msm/dp/dp_display.c static int dp_connect_pending_timeout(struct dp_display_private *dp, u32 data) · line 560

Quoted 6 lines
drivers/gpu/drm/msm/dp/dp_display.c +3 -2
-       if (dp_display->plugged_cb && dp_display->codec_dev)
-               dp_display->plugged_cb(dp_display->codec_dev, 
 plugged);
+       struct dp_display_private *dp;
+
+       dp = container_of(g_dp_display,

What is g_dp_display? I guess this doesn't compile?

Quoted 2 lines

g_dp_display is the global dp_display pointer in the dp_display.c file. It does compile.

Oh gross. Can we not use it if dp_display points to it?

#4 lore raw

Hi Stephen

Quoted 27 lines · Stephen Boyd

Quoting [email protected] (2020-11-02 14:43:33)

Quoted 14 lines

Hi Stephen

Thanks for the review.

Quoted 9 lines · Stephen Boyd

Quoting Abhinav Kumar (2020-10-29 13:55:09)

Quoted 6 lines

For sinks that do not support audio, there is no need to notify audio subsystem of the connection event.

This will make sure that audio routes only to the primary display when connected to such sinks.

Does this need a Fixes tag? Or it's just an optimization patch?

Quoted 11 lines

This is an unhandled corner case ( VGA dongle ) for DP audio and will make
sure we do not switch audio output from primary to external when connected to
a sink which does not support audio.
I thought of adding a fixes tag pointing to
https://patchwork.freedesktop.org/patch/390236/.
But at the same time, thought this can go in as a standlone patch as well.
If you think its required, I will add the fixes tag pointing to the base audio patch.

Quoted 1 line

Yeah Fixes is nice so we know what is fixed.

Ok sure, will include it.

Quoted 26 lines
Quoted 26 lines
Quoted 26 lines
Quoted 14 lines
---
 drivers/gpu/drm/msm/dp/dp_display.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/gpu/drm/msm/dp/dp_display.c +0 -0
index 4a5735564be2..d970980b0ca5 100644
@@ -555,8 +555,16 @@ static int dp_connect_pending_timeout(struct
 dp_display_private *dp, u32 data)

drivers/gpu/drm/msm/dp/dp_display.c static int dp_connect_pending_timeout(struct · line 563

Quoted 10 lines
drivers/gpu/drm/msm/dp/dp_display.c +3 -2
 static void dp_display_handle_plugged_change(struct msm_dp
 *dp_display,
                bool plugged)
 {
-       if (dp_display->plugged_cb && dp_display->codec_dev)
-               dp_display->plugged_cb(dp_display->codec_dev,
 plugged);
+       struct dp_display_private *dp;
+
+       dp = container_of(g_dp_display,

What is g_dp_display? I guess this doesn't compile?

Quoted 4 lines
Quoted 2 lines

g_dp_display is the global dp_display pointer in the dp_display.c file. It does compile.

Oh gross. Can we not use it if dp_display points to it?

Ok sure, will get it from dp_display
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel