[RFC,3/3] ALSA: x86: Use config base depending on the pipe

Submitted by Takashi Iwai on Jan. 27, 2017, 10:36 a.m.

Details

Message ID 20170127103631.25302-4-tiwai@suse.de
State New
Headers show
Series "Pass pipe to LPE audio" ( rev: 1 ) in Intel GFX

Not browsing as part of any series.

Commit Message

Takashi Iwai Jan. 27, 2017, 10:36 a.m.
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(-)

Patch hide | download patch | download mbox

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;