All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/nouveau: Fix regression by audio component transition
@ 2020-04-16  7:54 ` Takashi Iwai
  0 siblings, 0 replies; 5+ messages in thread
From: Takashi Iwai @ 2020-04-16  7:54 UTC (permalink / raw)
  To: Ben Skeggs; +Cc: dri-devel, nouveau, linux-kernel

Since the commit 742db30c4ee6 ("drm/nouveau: Add HD-audio component
notifier support"), the nouveau driver notifies and pokes the HD-audio
HPD and ELD via audio component, but this seems broken.  The culprit
is the naive assumption that crtc->index corresponds to the HDA pin.
Actually this rather corresponds to the MST dev_id (alias "pipe" in
the audio component framework) while the actual port number is given
from the output ior id number.

This patch corrects the assignment of port and dev_id arguments in the
audio component ops to recover from the HDMI/DP audio regression.

Fixes: 742db30c4ee6 ("drm/nouveau: Add HD-audio component notifier support")
BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=207223
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 drivers/gpu/drm/nouveau/dispnv50/disp.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/dispnv50/disp.c b/drivers/gpu/drm/nouveau/dispnv50/disp.c
index a3dc2ba19fb2..3a9fd565079d 100644
--- a/drivers/gpu/drm/nouveau/dispnv50/disp.c
+++ b/drivers/gpu/drm/nouveau/dispnv50/disp.c
@@ -481,15 +481,16 @@ nv50_dac_create(struct drm_connector *connector, struct dcb_output *dcbe)
  * audio component binding for ELD notification
  */
 static void
-nv50_audio_component_eld_notify(struct drm_audio_component *acomp, int port)
+nv50_audio_component_eld_notify(struct drm_audio_component *acomp, int port,
+				int dev_id)
 {
 	if (acomp && acomp->audio_ops && acomp->audio_ops->pin_eld_notify)
 		acomp->audio_ops->pin_eld_notify(acomp->audio_ops->audio_ptr,
-						 port, -1);
+						 port, dev_id);
 }
 
 static int
-nv50_audio_component_get_eld(struct device *kdev, int port, int pipe,
+nv50_audio_component_get_eld(struct device *kdev, int port, int dev_id,
 			     bool *enabled, unsigned char *buf, int max_bytes)
 {
 	struct drm_device *drm_dev = dev_get_drvdata(kdev);
@@ -505,7 +506,8 @@ nv50_audio_component_get_eld(struct device *kdev, int port, int pipe,
 		nv_encoder = nouveau_encoder(encoder);
 		nv_connector = nouveau_encoder_connector_get(nv_encoder);
 		nv_crtc = nouveau_crtc(encoder->crtc);
-		if (!nv_connector || !nv_crtc || nv_crtc->index != port)
+		if (!nv_connector || !nv_crtc || nv_encoder->or != port ||
+		    nv_crtc->index != dev_id)
 			continue;
 		*enabled = drm_detect_monitor_audio(nv_connector->edid);
 		if (*enabled) {
@@ -599,7 +601,8 @@ nv50_audio_disable(struct drm_encoder *encoder, struct nouveau_crtc *nv_crtc)
 
 	nvif_mthd(&disp->disp->object, 0, &args, sizeof(args));
 
-	nv50_audio_component_eld_notify(drm->audio.component, nv_crtc->index);
+	nv50_audio_component_eld_notify(drm->audio.component, nv_encoder->or,
+					nv_crtc->index);
 }
 
 static void
@@ -633,7 +636,8 @@ nv50_audio_enable(struct drm_encoder *encoder, struct drm_display_mode *mode)
 	nvif_mthd(&disp->disp->object, 0, &args,
 		  sizeof(args.base) + drm_eld_size(args.data));
 
-	nv50_audio_component_eld_notify(drm->audio.component, nv_crtc->index);
+	nv50_audio_component_eld_notify(drm->audio.component, nv_encoder->or,
+					nv_crtc->index);
 }
 
 /******************************************************************************
-- 
2.16.4


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH] drm/nouveau: Fix regression by audio component transition
@ 2020-04-16  7:54 ` Takashi Iwai
  0 siblings, 0 replies; 5+ messages in thread
From: Takashi Iwai @ 2020-04-16  7:54 UTC (permalink / raw)
  To: Ben Skeggs
  Cc: nouveau-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW

Since the commit 742db30c4ee6 ("drm/nouveau: Add HD-audio component
notifier support"), the nouveau driver notifies and pokes the HD-audio
HPD and ELD via audio component, but this seems broken.  The culprit
is the naive assumption that crtc->index corresponds to the HDA pin.
Actually this rather corresponds to the MST dev_id (alias "pipe" in
the audio component framework) while the actual port number is given
from the output ior id number.

This patch corrects the assignment of port and dev_id arguments in the
audio component ops to recover from the HDMI/DP audio regression.

Fixes: 742db30c4ee6 ("drm/nouveau: Add HD-audio component notifier support")
BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=207223
Cc: <stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Signed-off-by: Takashi Iwai <tiwai-l3A5Bk7waGM@public.gmane.org>
---
 drivers/gpu/drm/nouveau/dispnv50/disp.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/dispnv50/disp.c b/drivers/gpu/drm/nouveau/dispnv50/disp.c
index a3dc2ba19fb2..3a9fd565079d 100644
--- a/drivers/gpu/drm/nouveau/dispnv50/disp.c
+++ b/drivers/gpu/drm/nouveau/dispnv50/disp.c
@@ -481,15 +481,16 @@ nv50_dac_create(struct drm_connector *connector, struct dcb_output *dcbe)
  * audio component binding for ELD notification
  */
 static void
-nv50_audio_component_eld_notify(struct drm_audio_component *acomp, int port)
+nv50_audio_component_eld_notify(struct drm_audio_component *acomp, int port,
+				int dev_id)
 {
 	if (acomp && acomp->audio_ops && acomp->audio_ops->pin_eld_notify)
 		acomp->audio_ops->pin_eld_notify(acomp->audio_ops->audio_ptr,
-						 port, -1);
+						 port, dev_id);
 }
 
 static int
-nv50_audio_component_get_eld(struct device *kdev, int port, int pipe,
+nv50_audio_component_get_eld(struct device *kdev, int port, int dev_id,
 			     bool *enabled, unsigned char *buf, int max_bytes)
 {
 	struct drm_device *drm_dev = dev_get_drvdata(kdev);
@@ -505,7 +506,8 @@ nv50_audio_component_get_eld(struct device *kdev, int port, int pipe,
 		nv_encoder = nouveau_encoder(encoder);
 		nv_connector = nouveau_encoder_connector_get(nv_encoder);
 		nv_crtc = nouveau_crtc(encoder->crtc);
-		if (!nv_connector || !nv_crtc || nv_crtc->index != port)
+		if (!nv_connector || !nv_crtc || nv_encoder->or != port ||
+		    nv_crtc->index != dev_id)
 			continue;
 		*enabled = drm_detect_monitor_audio(nv_connector->edid);
 		if (*enabled) {
@@ -599,7 +601,8 @@ nv50_audio_disable(struct drm_encoder *encoder, struct nouveau_crtc *nv_crtc)
 
 	nvif_mthd(&disp->disp->object, 0, &args, sizeof(args));
 
-	nv50_audio_component_eld_notify(drm->audio.component, nv_crtc->index);
+	nv50_audio_component_eld_notify(drm->audio.component, nv_encoder->or,
+					nv_crtc->index);
 }
 
 static void
@@ -633,7 +636,8 @@ nv50_audio_enable(struct drm_encoder *encoder, struct drm_display_mode *mode)
 	nvif_mthd(&disp->disp->object, 0, &args,
 		  sizeof(args.base) + drm_eld_size(args.data));
 
-	nv50_audio_component_eld_notify(drm->audio.component, nv_crtc->index);
+	nv50_audio_component_eld_notify(drm->audio.component, nv_encoder->or,
+					nv_crtc->index);
 }
 
 /******************************************************************************
-- 
2.16.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH] drm/nouveau: Fix regression by audio component transition
@ 2020-04-16  7:54 ` Takashi Iwai
  0 siblings, 0 replies; 5+ messages in thread
From: Takashi Iwai @ 2020-04-16  7:54 UTC (permalink / raw)
  To: Ben Skeggs; +Cc: nouveau, linux-kernel, dri-devel

Since the commit 742db30c4ee6 ("drm/nouveau: Add HD-audio component
notifier support"), the nouveau driver notifies and pokes the HD-audio
HPD and ELD via audio component, but this seems broken.  The culprit
is the naive assumption that crtc->index corresponds to the HDA pin.
Actually this rather corresponds to the MST dev_id (alias "pipe" in
the audio component framework) while the actual port number is given
from the output ior id number.

This patch corrects the assignment of port and dev_id arguments in the
audio component ops to recover from the HDMI/DP audio regression.

Fixes: 742db30c4ee6 ("drm/nouveau: Add HD-audio component notifier support")
BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=207223
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 drivers/gpu/drm/nouveau/dispnv50/disp.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/nouveau/dispnv50/disp.c b/drivers/gpu/drm/nouveau/dispnv50/disp.c
index a3dc2ba19fb2..3a9fd565079d 100644
--- a/drivers/gpu/drm/nouveau/dispnv50/disp.c
+++ b/drivers/gpu/drm/nouveau/dispnv50/disp.c
@@ -481,15 +481,16 @@ nv50_dac_create(struct drm_connector *connector, struct dcb_output *dcbe)
  * audio component binding for ELD notification
  */
 static void
-nv50_audio_component_eld_notify(struct drm_audio_component *acomp, int port)
+nv50_audio_component_eld_notify(struct drm_audio_component *acomp, int port,
+				int dev_id)
 {
 	if (acomp && acomp->audio_ops && acomp->audio_ops->pin_eld_notify)
 		acomp->audio_ops->pin_eld_notify(acomp->audio_ops->audio_ptr,
-						 port, -1);
+						 port, dev_id);
 }
 
 static int
-nv50_audio_component_get_eld(struct device *kdev, int port, int pipe,
+nv50_audio_component_get_eld(struct device *kdev, int port, int dev_id,
 			     bool *enabled, unsigned char *buf, int max_bytes)
 {
 	struct drm_device *drm_dev = dev_get_drvdata(kdev);
@@ -505,7 +506,8 @@ nv50_audio_component_get_eld(struct device *kdev, int port, int pipe,
 		nv_encoder = nouveau_encoder(encoder);
 		nv_connector = nouveau_encoder_connector_get(nv_encoder);
 		nv_crtc = nouveau_crtc(encoder->crtc);
-		if (!nv_connector || !nv_crtc || nv_crtc->index != port)
+		if (!nv_connector || !nv_crtc || nv_encoder->or != port ||
+		    nv_crtc->index != dev_id)
 			continue;
 		*enabled = drm_detect_monitor_audio(nv_connector->edid);
 		if (*enabled) {
@@ -599,7 +601,8 @@ nv50_audio_disable(struct drm_encoder *encoder, struct nouveau_crtc *nv_crtc)
 
 	nvif_mthd(&disp->disp->object, 0, &args, sizeof(args));
 
-	nv50_audio_component_eld_notify(drm->audio.component, nv_crtc->index);
+	nv50_audio_component_eld_notify(drm->audio.component, nv_encoder->or,
+					nv_crtc->index);
 }
 
 static void
@@ -633,7 +636,8 @@ nv50_audio_enable(struct drm_encoder *encoder, struct drm_display_mode *mode)
 	nvif_mthd(&disp->disp->object, 0, &args,
 		  sizeof(args.base) + drm_eld_size(args.data));
 
-	nv50_audio_component_eld_notify(drm->audio.component, nv_crtc->index);
+	nv50_audio_component_eld_notify(drm->audio.component, nv_encoder->or,
+					nv_crtc->index);
 }
 
 /******************************************************************************
-- 
2.16.4

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [Nouveau] [PATCH] drm/nouveau: Fix regression by audio component transition
  2020-04-16  7:54 ` Takashi Iwai
@ 2020-04-30  4:13   ` Ben Skeggs
  -1 siblings, 0 replies; 5+ messages in thread
From: Ben Skeggs @ 2020-04-30  4:13 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: Ben Skeggs, ML nouveau, LKML, ML dri-devel

Good catch!  The OR is definitely a far better choice than the head
here, as it's what we use to select the GPU-side HDA registers too.

Merged.

On Thu, 16 Apr 2020 at 17:54, Takashi Iwai <tiwai@suse.de> wrote:
>
> Since the commit 742db30c4ee6 ("drm/nouveau: Add HD-audio component
> notifier support"), the nouveau driver notifies and pokes the HD-audio
> HPD and ELD via audio component, but this seems broken.  The culprit
> is the naive assumption that crtc->index corresponds to the HDA pin.
> Actually this rather corresponds to the MST dev_id (alias "pipe" in
> the audio component framework) while the actual port number is given
> from the output ior id number.
>
> This patch corrects the assignment of port and dev_id arguments in the
> audio component ops to recover from the HDMI/DP audio regression.
>
> Fixes: 742db30c4ee6 ("drm/nouveau: Add HD-audio component notifier support")
> BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=207223
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Takashi Iwai <tiwai@suse.de>
> ---
>  drivers/gpu/drm/nouveau/dispnv50/disp.c | 16 ++++++++++------
>  1 file changed, 10 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/nouveau/dispnv50/disp.c b/drivers/gpu/drm/nouveau/dispnv50/disp.c
> index a3dc2ba19fb2..3a9fd565079d 100644
> --- a/drivers/gpu/drm/nouveau/dispnv50/disp.c
> +++ b/drivers/gpu/drm/nouveau/dispnv50/disp.c
> @@ -481,15 +481,16 @@ nv50_dac_create(struct drm_connector *connector, struct dcb_output *dcbe)
>   * audio component binding for ELD notification
>   */
>  static void
> -nv50_audio_component_eld_notify(struct drm_audio_component *acomp, int port)
> +nv50_audio_component_eld_notify(struct drm_audio_component *acomp, int port,
> +                               int dev_id)
>  {
>         if (acomp && acomp->audio_ops && acomp->audio_ops->pin_eld_notify)
>                 acomp->audio_ops->pin_eld_notify(acomp->audio_ops->audio_ptr,
> -                                                port, -1);
> +                                                port, dev_id);
>  }
>
>  static int
> -nv50_audio_component_get_eld(struct device *kdev, int port, int pipe,
> +nv50_audio_component_get_eld(struct device *kdev, int port, int dev_id,
>                              bool *enabled, unsigned char *buf, int max_bytes)
>  {
>         struct drm_device *drm_dev = dev_get_drvdata(kdev);
> @@ -505,7 +506,8 @@ nv50_audio_component_get_eld(struct device *kdev, int port, int pipe,
>                 nv_encoder = nouveau_encoder(encoder);
>                 nv_connector = nouveau_encoder_connector_get(nv_encoder);
>                 nv_crtc = nouveau_crtc(encoder->crtc);
> -               if (!nv_connector || !nv_crtc || nv_crtc->index != port)
> +               if (!nv_connector || !nv_crtc || nv_encoder->or != port ||
> +                   nv_crtc->index != dev_id)
>                         continue;
>                 *enabled = drm_detect_monitor_audio(nv_connector->edid);
>                 if (*enabled) {
> @@ -599,7 +601,8 @@ nv50_audio_disable(struct drm_encoder *encoder, struct nouveau_crtc *nv_crtc)
>
>         nvif_mthd(&disp->disp->object, 0, &args, sizeof(args));
>
> -       nv50_audio_component_eld_notify(drm->audio.component, nv_crtc->index);
> +       nv50_audio_component_eld_notify(drm->audio.component, nv_encoder->or,
> +                                       nv_crtc->index);
>  }
>
>  static void
> @@ -633,7 +636,8 @@ nv50_audio_enable(struct drm_encoder *encoder, struct drm_display_mode *mode)
>         nvif_mthd(&disp->disp->object, 0, &args,
>                   sizeof(args.base) + drm_eld_size(args.data));
>
> -       nv50_audio_component_eld_notify(drm->audio.component, nv_crtc->index);
> +       nv50_audio_component_eld_notify(drm->audio.component, nv_encoder->or,
> +                                       nv_crtc->index);
>  }
>
>  /******************************************************************************
> --
> 2.16.4
>
> _______________________________________________
> Nouveau mailing list
> Nouveau@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/nouveau

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Nouveau] [PATCH] drm/nouveau: Fix regression by audio component transition
@ 2020-04-30  4:13   ` Ben Skeggs
  0 siblings, 0 replies; 5+ messages in thread
From: Ben Skeggs @ 2020-04-30  4:13 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: ML nouveau, Ben Skeggs, ML dri-devel, LKML

Good catch!  The OR is definitely a far better choice than the head
here, as it's what we use to select the GPU-side HDA registers too.

Merged.

On Thu, 16 Apr 2020 at 17:54, Takashi Iwai <tiwai@suse.de> wrote:
>
> Since the commit 742db30c4ee6 ("drm/nouveau: Add HD-audio component
> notifier support"), the nouveau driver notifies and pokes the HD-audio
> HPD and ELD via audio component, but this seems broken.  The culprit
> is the naive assumption that crtc->index corresponds to the HDA pin.
> Actually this rather corresponds to the MST dev_id (alias "pipe" in
> the audio component framework) while the actual port number is given
> from the output ior id number.
>
> This patch corrects the assignment of port and dev_id arguments in the
> audio component ops to recover from the HDMI/DP audio regression.
>
> Fixes: 742db30c4ee6 ("drm/nouveau: Add HD-audio component notifier support")
> BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=207223
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Takashi Iwai <tiwai@suse.de>
> ---
>  drivers/gpu/drm/nouveau/dispnv50/disp.c | 16 ++++++++++------
>  1 file changed, 10 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/nouveau/dispnv50/disp.c b/drivers/gpu/drm/nouveau/dispnv50/disp.c
> index a3dc2ba19fb2..3a9fd565079d 100644
> --- a/drivers/gpu/drm/nouveau/dispnv50/disp.c
> +++ b/drivers/gpu/drm/nouveau/dispnv50/disp.c
> @@ -481,15 +481,16 @@ nv50_dac_create(struct drm_connector *connector, struct dcb_output *dcbe)
>   * audio component binding for ELD notification
>   */
>  static void
> -nv50_audio_component_eld_notify(struct drm_audio_component *acomp, int port)
> +nv50_audio_component_eld_notify(struct drm_audio_component *acomp, int port,
> +                               int dev_id)
>  {
>         if (acomp && acomp->audio_ops && acomp->audio_ops->pin_eld_notify)
>                 acomp->audio_ops->pin_eld_notify(acomp->audio_ops->audio_ptr,
> -                                                port, -1);
> +                                                port, dev_id);
>  }
>
>  static int
> -nv50_audio_component_get_eld(struct device *kdev, int port, int pipe,
> +nv50_audio_component_get_eld(struct device *kdev, int port, int dev_id,
>                              bool *enabled, unsigned char *buf, int max_bytes)
>  {
>         struct drm_device *drm_dev = dev_get_drvdata(kdev);
> @@ -505,7 +506,8 @@ nv50_audio_component_get_eld(struct device *kdev, int port, int pipe,
>                 nv_encoder = nouveau_encoder(encoder);
>                 nv_connector = nouveau_encoder_connector_get(nv_encoder);
>                 nv_crtc = nouveau_crtc(encoder->crtc);
> -               if (!nv_connector || !nv_crtc || nv_crtc->index != port)
> +               if (!nv_connector || !nv_crtc || nv_encoder->or != port ||
> +                   nv_crtc->index != dev_id)
>                         continue;
>                 *enabled = drm_detect_monitor_audio(nv_connector->edid);
>                 if (*enabled) {
> @@ -599,7 +601,8 @@ nv50_audio_disable(struct drm_encoder *encoder, struct nouveau_crtc *nv_crtc)
>
>         nvif_mthd(&disp->disp->object, 0, &args, sizeof(args));
>
> -       nv50_audio_component_eld_notify(drm->audio.component, nv_crtc->index);
> +       nv50_audio_component_eld_notify(drm->audio.component, nv_encoder->or,
> +                                       nv_crtc->index);
>  }
>
>  static void
> @@ -633,7 +636,8 @@ nv50_audio_enable(struct drm_encoder *encoder, struct drm_display_mode *mode)
>         nvif_mthd(&disp->disp->object, 0, &args,
>                   sizeof(args.base) + drm_eld_size(args.data));
>
> -       nv50_audio_component_eld_notify(drm->audio.component, nv_crtc->index);
> +       nv50_audio_component_eld_notify(drm->audio.component, nv_encoder->or,
> +                                       nv_crtc->index);
>  }
>
>  /******************************************************************************
> --
> 2.16.4
>
> _______________________________________________
> Nouveau mailing list
> Nouveau@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/nouveau
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-04-30  4:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-16  7:54 [PATCH] drm/nouveau: Fix regression by audio component transition Takashi Iwai
2020-04-16  7:54 ` Takashi Iwai
2020-04-16  7:54 ` Takashi Iwai
2020-04-30  4:13 ` [Nouveau] " Ben Skeggs
2020-04-30  4:13   ` Ben Skeggs

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.