alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCH RFC 0/3] Pass pipe to LPE audio
@ 2017-01-27 10:36 Takashi Iwai
  2017-01-27 10:36 ` [PATCH RFC 1/3] drm/i915: Avoid MST pipe handling for " Takashi Iwai
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Takashi Iwai @ 2017-01-27 10:36 UTC (permalink / raw)
  To: Pierre-Louis Bossart; +Cc: alsa-devel, intel-gfx

Hi,

this is a patch series to pass the pipe over LPE audio notification,
based on Pierre's latest patchset ("[RFC PATCH 0/5] DisplayPort Audio
on Cherrytrail").


Takashi

===

Takashi Iwai (3):
  drm/i915: Avoid MST pipe handling for LPE audio
  drm/i915: Pass pipe to LPE audio notification
  ALSA: x86: Use config base depending on the pipe

 drivers/gpu/drm/i915/i915_drv.h        |  2 +-
 drivers/gpu/drm/i915/intel_audio.c     | 27 ++++++++++++++-------------
 drivers/gpu/drm/i915/intel_lpe_audio.c |  3 ++-
 include/drm/intel_lpe_audio.h          |  1 +
 sound/x86/intel_hdmi_lpe_audio.c       | 32 +++++++++++++++++++++-----------
 5 files changed, 39 insertions(+), 26 deletions(-)

-- 
2.11.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* [PATCH RFC 1/3] drm/i915: Avoid MST pipe handling for LPE audio
  2017-01-27 10:36 [PATCH RFC 0/3] Pass pipe to LPE audio Takashi Iwai
@ 2017-01-27 10:36 ` Takashi Iwai
  2017-01-27 14:15   ` [alsa-devel] " Pierre-Louis Bossart
  2017-01-27 10:36 ` [PATCH RFC 2/3] drm/i915: Pass pipe to LPE audio notification Takashi Iwai
  2017-01-27 10:36 ` [PATCH RFC 3/3] ALSA: x86: Use config base depending on the pipe Takashi Iwai
  2 siblings, 1 reply; 6+ messages in thread
From: Takashi Iwai @ 2017-01-27 10:36 UTC (permalink / raw)
  To: Pierre-Louis Bossart; +Cc: alsa-devel, intel-gfx

The pipe gets cleared to -1 for non-MST before the ELD audio
notification due to the MST audio support.  This makes sense for
HD-audio that received the MST handling, but it's useless for LPE
audio.  Handle the MST pipe hack conditionally only for HD-audio.

Reported-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 drivers/gpu/drm/i915/intel_audio.c | 21 +++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_audio.c b/drivers/gpu/drm/i915/intel_audio.c
index 1645ce42b898..d4e6d1136cfe 100644
--- a/drivers/gpu/drm/i915/intel_audio.c
+++ b/drivers/gpu/drm/i915/intel_audio.c
@@ -624,13 +624,14 @@ void intel_audio_codec_enable(struct intel_encoder *intel_encoder,
 	dev_priv->av_enc_map[pipe] = intel_encoder;
 	mutex_unlock(&dev_priv->av_mutex);
 
-	/* audio drivers expect pipe = -1 to indicate Non-MST cases */
-	if (intel_encoder->type != INTEL_OUTPUT_DP_MST)
-		pipe = -1;
-
-	if (acomp && acomp->audio_ops && acomp->audio_ops->pin_eld_notify)
+	if (acomp && acomp->audio_ops && acomp->audio_ops->pin_eld_notify) {
+		/* audio drivers expect pipe = -1 to indicate Non-MST cases */
+		if (intel_encoder->type != INTEL_OUTPUT_DP_MST)
+			pipe = -1;
 		acomp->audio_ops->pin_eld_notify(acomp->audio_ops->audio_ptr,
 						 (int) port, (int) pipe);
+	}
+
 	switch (intel_encoder->type) {
 	case INTEL_OUTPUT_HDMI:
 		intel_lpe_audio_notify(dev_priv, connector->eld, port,
@@ -671,13 +672,13 @@ void intel_audio_codec_disable(struct intel_encoder *intel_encoder)
 	dev_priv->av_enc_map[pipe] = NULL;
 	mutex_unlock(&dev_priv->av_mutex);
 
-	/* audio drivers expect pipe = -1 to indicate Non-MST cases */
-	if (intel_encoder->type != INTEL_OUTPUT_DP_MST)
-		pipe = -1;
-
-	if (acomp && acomp->audio_ops && acomp->audio_ops->pin_eld_notify)
+	if (acomp && acomp->audio_ops && acomp->audio_ops->pin_eld_notify) {
+		/* audio drivers expect pipe = -1 to indicate Non-MST cases */
+		if (intel_encoder->type != INTEL_OUTPUT_DP_MST)
+			pipe = -1;
 		acomp->audio_ops->pin_eld_notify(acomp->audio_ops->audio_ptr,
 						 (int) port, (int) pipe);
+	}
 
 	intel_lpe_audio_notify(dev_priv, NULL, port, 0, false, 0);
 }
-- 
2.11.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* [PATCH RFC 2/3] drm/i915: Pass pipe to LPE audio notification
  2017-01-27 10:36 [PATCH RFC 0/3] Pass pipe to LPE audio Takashi Iwai
  2017-01-27 10:36 ` [PATCH RFC 1/3] drm/i915: Avoid MST pipe handling for " Takashi Iwai
@ 2017-01-27 10:36 ` Takashi Iwai
  2017-01-27 10:36 ` [PATCH RFC 3/3] ALSA: x86: Use config base depending on the pipe Takashi Iwai
  2 siblings, 0 replies; 6+ messages in thread
From: Takashi Iwai @ 2017-01-27 10:36 UTC (permalink / raw)
  To: Pierre-Louis Bossart; +Cc: alsa-devel, intel-gfx

The LPE audio configuration depends on the pipe, thus we need to pass
the currently used pipe.  It's now embedded in struct
intel_hdmi_lpe_audio_eld as well as port id.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 drivers/gpu/drm/i915/i915_drv.h        | 2 +-
 drivers/gpu/drm/i915/intel_audio.c     | 6 +++---
 drivers/gpu/drm/i915/intel_lpe_audio.c | 3 ++-
 include/drm/intel_lpe_audio.h          | 1 +
 4 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 1c7aa8fcd0fa..1c56c5832735 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -3400,7 +3400,7 @@ int  intel_lpe_audio_init(struct drm_i915_private *dev_priv);
 void intel_lpe_audio_teardown(struct drm_i915_private *dev_priv);
 void intel_lpe_audio_irq_handler(struct drm_i915_private *dev_priv);
 void intel_lpe_audio_notify(struct drm_i915_private *dev_priv,
-			    void *eld, int port, int tmds_clk_speed,
+			    void *eld, int port, int pipe, int tmds_clk_speed,
 			    bool dp_output, int link_rate);
 
 /* intel_i2c.c */
diff --git a/drivers/gpu/drm/i915/intel_audio.c b/drivers/gpu/drm/i915/intel_audio.c
index d4e6d1136cfe..892169b7952b 100644
--- a/drivers/gpu/drm/i915/intel_audio.c
+++ b/drivers/gpu/drm/i915/intel_audio.c
@@ -634,12 +634,12 @@ void intel_audio_codec_enable(struct intel_encoder *intel_encoder,
 
 	switch (intel_encoder->type) {
 	case INTEL_OUTPUT_HDMI:
-		intel_lpe_audio_notify(dev_priv, connector->eld, port,
+		intel_lpe_audio_notify(dev_priv, connector->eld, port, pipe,
 				       crtc_state->port_clock,
 				       false, 0);
 		break;
 	case INTEL_OUTPUT_DP:
-		intel_lpe_audio_notify(dev_priv, connector->eld, port,
+		intel_lpe_audio_notify(dev_priv, connector->eld, port, pipe,
 				       adjusted_mode->crtc_clock,
 				       true, crtc_state->port_clock);
 		break;
@@ -680,7 +680,7 @@ void intel_audio_codec_disable(struct intel_encoder *intel_encoder)
 						 (int) port, (int) pipe);
 	}
 
-	intel_lpe_audio_notify(dev_priv, NULL, port, 0, false, 0);
+	intel_lpe_audio_notify(dev_priv, NULL, port, pipe, 0, false, 0);
 }
 
 /**
diff --git a/drivers/gpu/drm/i915/intel_lpe_audio.c b/drivers/gpu/drm/i915/intel_lpe_audio.c
index b3134efdcf82..62bc3c6456e4 100644
--- a/drivers/gpu/drm/i915/intel_lpe_audio.c
+++ b/drivers/gpu/drm/i915/intel_lpe_audio.c
@@ -341,7 +341,7 @@ void intel_lpe_audio_teardown(struct drm_i915_private *dev_priv)
  * Notify lpe audio driver of eld change.
  */
 void intel_lpe_audio_notify(struct drm_i915_private *dev_priv,
-			    void *eld, int port, int tmds_clk_speed,
+			    void *eld, int port, int pipe, int tmds_clk_speed,
 			    bool dp_output, int link_rate)
 {
 	unsigned long irq_flags;
@@ -359,6 +359,7 @@ void intel_lpe_audio_notify(struct drm_i915_private *dev_priv,
 		memcpy(pdata->eld.eld_data, eld,
 			HDMI_MAX_ELD_BYTES);
 		pdata->eld.port_id = port;
+		pdata->eld.pipe_id = pipe;
 		pdata->hdmi_connected = true;
 
 		pdata->dp_output = dp_output;
diff --git a/include/drm/intel_lpe_audio.h b/include/drm/intel_lpe_audio.h
index 857e0eafed79..410128e4cd70 100644
--- a/include/drm/intel_lpe_audio.h
+++ b/include/drm/intel_lpe_audio.h
@@ -31,6 +31,7 @@
 
 struct intel_hdmi_lpe_audio_eld {
 	int port_id;
+	int pipe_id;
 	unsigned char eld_data[HDMI_MAX_ELD_BYTES];
 };
 
-- 
2.11.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* [PATCH RFC 3/3] ALSA: x86: Use config base depending on the pipe
  2017-01-27 10:36 [PATCH RFC 0/3] Pass pipe to LPE audio Takashi Iwai
  2017-01-27 10:36 ` [PATCH RFC 1/3] drm/i915: Avoid MST pipe handling for " Takashi Iwai
  2017-01-27 10:36 ` [PATCH RFC 2/3] drm/i915: Pass pipe to LPE audio notification Takashi Iwai
@ 2017-01-27 10:36 ` Takashi Iwai
  2 siblings, 0 replies; 6+ messages in thread
From: Takashi Iwai @ 2017-01-27 10:36 UTC (permalink / raw)
  To: Pierre-Louis Bossart; +Cc: alsa-devel, intel-gfx

Now the pipe that is being used is passed over i915 notification, we
can re-setup the had_config_offset depending on it at the hotplug.
This allows, at least, the stream transfer on the second DP working on
Dell Wyse 3040 box here (although it's still not audible by other
reasons).

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/x86/intel_hdmi_lpe_audio.c | 32 +++++++++++++++++++++-----------
 1 file changed, 21 insertions(+), 11 deletions(-)

diff --git a/sound/x86/intel_hdmi_lpe_audio.c b/sound/x86/intel_hdmi_lpe_audio.c
index 23e5b34dcf41..55bc2cfd21c4 100644
--- a/sound/x86/intel_hdmi_lpe_audio.c
+++ b/sound/x86/intel_hdmi_lpe_audio.c
@@ -463,6 +463,22 @@ static void notify_audio_lpe(void *audio_ptr)
 
 	} else if (eld != NULL) {
 
+		switch (eld->pipe_id) {
+		case 0:
+			ctx->had_config_offset = AUDIO_HDMI_CONFIG_A;
+			break;
+		case 1:
+			ctx->had_config_offset = AUDIO_HDMI_CONFIG_B;
+			break;
+		case 2:
+			ctx->had_config_offset = AUDIO_HDMI_CONFIG_C;
+			break;
+		default:
+			dev_dbg(&hlpe_pdev->dev, "Invalid pipe %d\n",
+				eld->pipe_id);
+			break;
+		}
+
 		hdmi_set_eld(eld->eld_data);
 
 		mid_hdmi_audio_signal_event(HAD_EVENT_HOT_PLUG);
@@ -560,21 +576,15 @@ static int hdmi_lpe_audio_probe(struct platform_device *pdev)
 	ctx->mmio_start = mmio_start;
 	ctx->tmds_clock_speed = DIS_SAMPLE_RATE_148_5;
 
-	if (pci_dev_present(cherryview_ids)) {
+	if (pci_dev_present(cherryview_ids))
 		dev_dbg(&hlpe_pdev->dev, "%s: Cherrytrail LPE - Detected\n",
 				__func__);
-		//ctx->had_config_offset = AUDIO_HDMI_CONFIG_C;
-		/* FIXME: hard-coding to CONFIG_A enables DP audio on CHT,
-		 *  how do I find out which config to use ?
-		 * the pipe is -1 (invalid) when the notify function is called,
-		 * so not sure how to go about this
-		 */
-		ctx->had_config_offset = AUDIO_HDMI_CONFIG_A;
-	} else {
+	else
 		dev_dbg(&hlpe_pdev->dev, "%s: Baytrail LPE - Assume\n",
 				__func__);
-		ctx->had_config_offset = AUDIO_HDMI_CONFIG_A;
-	}
+
+	/* assume pipe A as default */
+	ctx->had_config_offset = AUDIO_HDMI_CONFIG_A;
 
 	pdata = pdev->dev.platform_data;
 
-- 
2.11.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [alsa-devel] [PATCH RFC 1/3] drm/i915: Avoid MST pipe handling for LPE audio
  2017-01-27 10:36 ` [PATCH RFC 1/3] drm/i915: Avoid MST pipe handling for " Takashi Iwai
@ 2017-01-27 14:15   ` Pierre-Louis Bossart
  2017-01-27 14:17     ` Takashi Iwai
  0 siblings, 1 reply; 6+ messages in thread
From: Pierre-Louis Bossart @ 2017-01-27 14:15 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: alsa-devel, intel-gfx



On 01/27/2017 04:36 AM, Takashi Iwai wrote:
> The pipe gets cleared to -1 for non-MST before the ELD audio
> notification due to the MST audio support.  This makes sense for
> HD-audio that received the MST handling, but it's useless for LPE
> audio.  Handle the MST pipe hack conditionally only for HD-audio.
>
> Reported-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
> Signed-off-by: Takashi Iwai <tiwai@suse.de>
> ---
>   drivers/gpu/drm/i915/intel_audio.c | 21 +++++++++++----------
>   1 file changed, 11 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_audio.c b/drivers/gpu/drm/i915/intel_audio.c
> index 1645ce42b898..d4e6d1136cfe 100644
> --- a/drivers/gpu/drm/i915/intel_audio.c
> +++ b/drivers/gpu/drm/i915/intel_audio.c
> @@ -624,13 +624,14 @@ void intel_audio_codec_enable(struct intel_encoder *intel_encoder,
>   	dev_priv->av_enc_map[pipe] = intel_encoder;
>   	mutex_unlock(&dev_priv->av_mutex);
>   
> -	/* audio drivers expect pipe = -1 to indicate Non-MST cases */
> -	if (intel_encoder->type != INTEL_OUTPUT_DP_MST)
> -		pipe = -1;
> -
> -	if (acomp && acomp->audio_ops && acomp->audio_ops->pin_eld_notify)
> +	if (acomp && acomp->audio_ops && acomp->audio_ops->pin_eld_notify) {
> +		/* audio drivers expect pipe = -1 to indicate Non-MST cases */
> +		if (intel_encoder->type != INTEL_OUTPUT_DP_MST)
> +			pipe = -1;
>   		acomp->audio_ops->pin_eld_notify(acomp->audio_ops->audio_ptr,
>   						 (int) port, (int) pipe);
> +	}
> +
Cool. I missed this part, couldn't figure out where the -1 was coming from.
So do you get audio working on both of the DP ports now?
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

* Re: [alsa-devel] [PATCH RFC 1/3] drm/i915: Avoid MST pipe handling for LPE audio
  2017-01-27 14:15   ` [alsa-devel] " Pierre-Louis Bossart
@ 2017-01-27 14:17     ` Takashi Iwai
  0 siblings, 0 replies; 6+ messages in thread
From: Takashi Iwai @ 2017-01-27 14:17 UTC (permalink / raw)
  To: Pierre-Louis Bossart; +Cc: alsa-devel, intel-gfx

On Fri, 27 Jan 2017 15:15:14 +0100,
Pierre-Louis Bossart wrote:
> 
> 
> 
> On 01/27/2017 04:36 AM, Takashi Iwai wrote:
> > The pipe gets cleared to -1 for non-MST before the ELD audio
> > notification due to the MST audio support.  This makes sense for
> > HD-audio that received the MST handling, but it's useless for LPE
> > audio.  Handle the MST pipe hack conditionally only for HD-audio.
> >
> > Reported-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
> > Signed-off-by: Takashi Iwai <tiwai@suse.de>
> > ---
> >   drivers/gpu/drm/i915/intel_audio.c | 21 +++++++++++----------
> >   1 file changed, 11 insertions(+), 10 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/intel_audio.c b/drivers/gpu/drm/i915/intel_audio.c
> > index 1645ce42b898..d4e6d1136cfe 100644
> > --- a/drivers/gpu/drm/i915/intel_audio.c
> > +++ b/drivers/gpu/drm/i915/intel_audio.c
> > @@ -624,13 +624,14 @@ void intel_audio_codec_enable(struct intel_encoder *intel_encoder,
> >   	dev_priv->av_enc_map[pipe] = intel_encoder;
> >   	mutex_unlock(&dev_priv->av_mutex);
> >   -	/* audio drivers expect pipe = -1 to indicate Non-MST cases */
> > -	if (intel_encoder->type != INTEL_OUTPUT_DP_MST)
> > -		pipe = -1;
> > -
> > -	if (acomp && acomp->audio_ops && acomp->audio_ops->pin_eld_notify)
> > +	if (acomp && acomp->audio_ops && acomp->audio_ops->pin_eld_notify) {
> > +		/* audio drivers expect pipe = -1 to indicate Non-MST cases */
> > +		if (intel_encoder->type != INTEL_OUTPUT_DP_MST)
> > +			pipe = -1;
> >   		acomp->audio_ops->pin_eld_notify(acomp->audio_ops->audio_ptr,
> >   						 (int) port, (int) pipe);
> > +	}
> > +
> Cool. I missed this part, couldn't figure out where the -1 was coming from.
> So do you get audio working on both of the DP ports now?

DP1 is working now.
DP3 starts streaming, but no audio came out yet :-<


Takashi
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

end of thread, other threads:[~2017-01-27 14:17 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-27 10:36 [PATCH RFC 0/3] Pass pipe to LPE audio Takashi Iwai
2017-01-27 10:36 ` [PATCH RFC 1/3] drm/i915: Avoid MST pipe handling for " Takashi Iwai
2017-01-27 14:15   ` [alsa-devel] " Pierre-Louis Bossart
2017-01-27 14:17     ` Takashi Iwai
2017-01-27 10:36 ` [PATCH RFC 2/3] drm/i915: Pass pipe to LPE audio notification Takashi Iwai
2017-01-27 10:36 ` [PATCH RFC 3/3] ALSA: x86: Use config base depending on the pipe Takashi Iwai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).