All of lore.kernel.org
 help / color / mirror / Atom feed
From: jeeja.kp@intel.com
To: alsa-devel@alsa-project.org
Cc: tiwai@suse.de, patches.audio@intel.com, broonie@kernel.org,
	liam.r.girdwood@intel.com, Jeeja KP <jeeja.kp@intel.com>
Subject: [PATCH v3 05/12] ASoC: Intel: bxt: add channel map support in bxt_da7219_max98357a machine
Date: Tue, 24 Jan 2017 21:49:07 +0530	[thread overview]
Message-ID: <1485274754-5723-6-git-send-email-jeeja.kp@intel.com> (raw)
In-Reply-To: <1485274754-5723-1-git-send-email-jeeja.kp@intel.com>

From: Jeeja KP <jeeja.kp@intel.com>

HDMI registers channel map controls per PCM. As PCMs are not
registered during dai_link init callback, store the pcm ids and
codec DAIs during this init callback.

Register for late probe and call the jack_init API which also
registers channel map in the late probe callback handler.

Signed-off-by: Jeeja KP <jeeja.kp@intel.com>
---
 sound/soc/intel/boards/bxt_da7219_max98357a.c | 49 ++++++++++++++++++++++++++-
 1 file changed, 48 insertions(+), 1 deletion(-)

diff --git a/sound/soc/intel/boards/bxt_da7219_max98357a.c b/sound/soc/intel/boards/bxt_da7219_max98357a.c
index 02439ac..1592170 100644
--- a/sound/soc/intel/boards/bxt_da7219_max98357a.c
+++ b/sound/soc/intel/boards/bxt_da7219_max98357a.c
@@ -34,6 +34,16 @@
 
 static struct snd_soc_jack broxton_headset;
 
+struct bxt_hdmi_pcm {
+	struct list_head head;
+	struct snd_soc_dai *codec_dai;
+	int device;
+};
+
+struct bxt_card_private {
+	struct list_head hdmi_pcm_list;
+};
+
 enum {
 	BXT_DPCM_AUDIO_PB = 0,
 	BXT_DPCM_AUDIO_CP,
@@ -147,9 +157,20 @@ static int broxton_da7219_codec_init(struct snd_soc_pcm_runtime *rtd)
 
 static int broxton_hdmi_init(struct snd_soc_pcm_runtime *rtd)
 {
+	struct bxt_card_private *ctx = snd_soc_card_get_drvdata(rtd->card);
 	struct snd_soc_dai *dai = rtd->codec_dai;
+	struct bxt_hdmi_pcm *pcm;
+
+	pcm = devm_kzalloc(rtd->card->dev, sizeof(*pcm), GFP_KERNEL);
+	if (!pcm)
+		return -ENOMEM;
 
-	return hdac_hdmi_jack_init(dai, BXT_DPCM_AUDIO_HDMI1_PB + dai->id);
+	pcm->device = BXT_DPCM_AUDIO_HDMI1_PB + dai->id;
+	pcm->codec_dai = dai;
+
+	list_add_tail(&pcm->head, &ctx->hdmi_pcm_list);
+
+	return 0;
 }
 
 static int broxton_da7219_fe_init(struct snd_soc_pcm_runtime *rtd)
@@ -496,6 +517,21 @@ static struct snd_soc_dai_link broxton_dais[] = {
 	},
 };
 
+static int bxt_card_late_probe(struct snd_soc_card *card)
+{
+	struct bxt_card_private *ctx = snd_soc_card_get_drvdata(card);
+	struct bxt_hdmi_pcm *pcm;
+	int err;
+
+	list_for_each_entry(pcm, &ctx->hdmi_pcm_list, head) {
+		err = hdac_hdmi_jack_init(pcm->codec_dai, pcm->device);
+		if (err < 0)
+			return err;
+	}
+
+	return 0;
+}
+
 /* broxton audio machine driver for SPT + da7219 */
 static struct snd_soc_card broxton_audio_card = {
 	.name = "bxtda7219max",
@@ -509,11 +545,22 @@ static struct snd_soc_card broxton_audio_card = {
 	.dapm_routes = broxton_map,
 	.num_dapm_routes = ARRAY_SIZE(broxton_map),
 	.fully_routed = true,
+	.late_probe = bxt_card_late_probe,
 };
 
 static int broxton_audio_probe(struct platform_device *pdev)
 {
+	struct bxt_card_private *ctx;
+
+	ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_ATOMIC);
+	if (!ctx)
+		return -ENOMEM;
+
+	INIT_LIST_HEAD(&ctx->hdmi_pcm_list);
+
 	broxton_audio_card.dev = &pdev->dev;
+	snd_soc_card_set_drvdata(&broxton_audio_card, ctx);
+
 	return devm_snd_soc_register_card(&pdev->dev, &broxton_audio_card);
 }
 
-- 
2.5.0

  parent reply	other threads:[~2017-01-24 16:08 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-24 16:19 [PATCH v3 00/12] ASoC: hdmi: Preparatory work to support MST audio jeeja.kp
2017-01-24 16:19 ` [PATCH v3 01/12] ASoC: hdac_hdmi: Register widget event handlers jeeja.kp
2017-01-24 16:19 ` [PATCH v3 02/12] ASoC: Intel: Skylake: Use set_tdm_slot to set the dma channel jeeja.kp
2017-01-24 16:19 ` [PATCH v3 03/12] ASoC: hdac_hdmi: Move channel info from pin to PCM structure jeeja.kp
2017-01-24 16:19 ` [PATCH v3 04/12] ASoC: Intel: bxt: add channel map support in rt298 machine jeeja.kp
2017-01-24 16:19 ` jeeja.kp [this message]
2017-01-24 16:19 ` [PATCH v3 06/12] ASoC: hdac_hdmi: Begin to add support for DP Multi-stream audio jeeja.kp
2017-02-04 12:09   ` Mark Brown
2017-02-06  6:49     ` Jeeja KP
2017-01-24 16:19 ` [PATCH v3 07/12] ASoC: Intel: Skylake: Add route change to rt286 machine jeeja.kp
2017-01-24 16:19 ` [PATCH v3 08/12] ASoC: Intel: Skylake: Add route change to nau88l25_max98357a machine jeeja.kp
2017-01-24 16:19 ` [PATCH v3 09/12] ASoC: Intel: Skylake: Add route change to nau88l25_ssm4567 machine jeeja.kp
2017-01-24 16:19 ` [PATCH v3 10/12] ASoC: Intel: bxt: Add route change to rt298 machine jeeja.kp
2017-01-24 16:19 ` [PATCH v3 11/12] ASoC: Intel: bxt: Add route change to da7219_max98357a machine jeeja.kp
2017-01-24 16:19 ` [PATCH v3 12/12] ASoC: hdac_hdmi: Add support to handle MST capable pin jeeja.kp
2017-02-08 18:34   ` Applied "ASoC: hdac_hdmi: Add support to handle MST capable pin" to the asoc tree Mark Brown
2017-01-31 19:45 ` [PATCH v3 00/12] ASoC: hdmi: Preparatory work to support MST audio Mark Brown
2017-02-01 10:00   ` Jeeja KP

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1485274754-5723-6-git-send-email-jeeja.kp@intel.com \
    --to=jeeja.kp@intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=liam.r.girdwood@intel.com \
    --cc=patches.audio@intel.com \
    --cc=tiwai@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.