All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
To: alsa-devel@alsa-project.org
Cc: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>,
	Kai Vehmanen <kai.vehmanen@linux.intel.com>,
	tiwai@suse.de,
	Ranjani Sridharan <ranjani.sridharan@linux.intel.com>,
	Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>,
	broonie@kernel.org, Bard Liao <yung-chuan.liao@linux.intel.com>
Subject: [PATCH 06/13] ASoC: intel: sof_sdw: init all aggregated codecs
Date: Thu,  9 Apr 2020 13:58:20 -0500	[thread overview]
Message-ID: <20200409185827.16255-7-pierre-louis.bossart@linux.intel.com> (raw)
In-Reply-To: <20200409185827.16255-1-pierre-louis.bossart@linux.intel.com>

From: Bard Liao <yung-chuan.liao@linux.intel.com>

Init codecs which belong to the same group id on all links.

Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 sound/soc/intel/boards/sof_sdw.c | 41 ++++++++++++++++++++------------
 1 file changed, 26 insertions(+), 15 deletions(-)

diff --git a/sound/soc/intel/boards/sof_sdw.c b/sound/soc/intel/boards/sof_sdw.c
index a64dc563b47e..6a1b51c0546b 100644
--- a/sound/soc/intel/boards/sof_sdw.c
+++ b/sound/soc/intel/boards/sof_sdw.c
@@ -411,25 +411,36 @@ static int create_codec_dai_name(struct device *dev,
 
 static int set_codec_init_func(const struct snd_soc_acpi_link_adr *link,
 			       struct snd_soc_dai_link *dai_links,
-			       bool playback)
+			       bool playback, int group_id)
 {
 	int i;
 
-	for (i = 0; i < link->num_adr; i++) {
-		unsigned int part_id;
-		int codec_index;
-
-		part_id = SDW_PART_ID(link->adr_d[i].adr);
-		codec_index = find_codec_info_part(part_id);
+	do {
+		/*
+		 * Initialize the codec. If codec is part of an aggregated
+		 * group (group_id>0), initialize all codecs belonging to
+		 * same group.
+		 */
+		for (i = 0; i < link->num_adr; i++) {
+			unsigned int part_id;
+			int codec_index;
 
-		if (codec_index < 0)
-			return codec_index;
+			part_id = SDW_PART_ID(link->adr_d[i].adr);
+			codec_index = find_codec_info_part(part_id);
 
-		if (codec_info_list[codec_index].init)
-			codec_info_list[codec_index].init(link, dai_links,
-						 &codec_info_list[codec_index],
-						 playback);
-	}
+			if (codec_index < 0)
+				return codec_index;
+			/* The group_id is > 0 iff the codec is aggregated */
+			if (link->adr_d[i].endpoints->group_id != group_id)
+				continue;
+			if (codec_info_list[codec_index].init)
+				codec_info_list[codec_index].init(link,
+						dai_links,
+						&codec_info_list[codec_index],
+						playback);
+		}
+		link++;
+	} while (link->mask && group_id);
 
 	return 0;
 }
@@ -623,7 +634,7 @@ static int create_sdw_dailink(struct device *dev, int *be_index,
 			      NULL, &sdw_ops);
 
 		ret = set_codec_init_func(link, dai_links + (*be_index)++,
-					  playback);
+					  playback, group_id);
 		if (ret < 0) {
 			dev_err(dev, "failed to init codec %d", codec_index);
 			return ret;
-- 
2.20.1


  parent reply	other threads:[~2020-04-09 19:03 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-09 18:58 [PATCH 00/13] ASoC: Intel: machine drivers update for 5.8 Pierre-Louis Bossart
2020-04-09 18:58 ` [PATCH 01/13] ASoC: Intel: sof_da7219_max98373: Add BE dailink for dmic16k Pierre-Louis Bossart
2020-04-14 14:48   ` Applied "ASoC: Intel: sof_da7219_max98373: Add BE dailink for dmic16k" to the asoc tree Mark Brown
2020-04-09 18:58 ` [PATCH 02/13] ASoC: intel/skl/hda - set autosuspend timeout for hda codecs Pierre-Louis Bossart
2020-04-14 14:48   ` Applied "ASoC: intel/skl/hda - set autosuspend timeout for hda codecs" to the asoc tree Mark Brown
2020-04-09 18:58 ` [PATCH 03/13] ALSA: hda: Add ElkhartLake HDMI codec vid Pierre-Louis Bossart
2020-04-11 10:29   ` Takashi Iwai
2020-04-14 16:09     ` Kai Vehmanen
2020-04-14 16:32       ` Takashi Iwai
2020-04-14 16:36       ` Pierre-Louis Bossart
2020-04-14 14:48   ` Applied "ALSA: hda: Add ElkhartLake HDMI codec vid" to the asoc tree Mark Brown
2020-04-09 18:58 ` [PATCH 04/13] ASoC: SOF: Intel: add PCI ID for ElkhartLake Pierre-Louis Bossart
2020-04-14 14:48   ` Applied "ASoC: SOF: Intel: add PCI ID for ElkhartLake" to the asoc tree Mark Brown
2020-04-09 18:58 ` [PATCH 05/13] ASoC: Intel: boards: support Elkhart Lake with rt5660 Pierre-Louis Bossart
2020-04-14 14:48   ` Applied "ASoC: Intel: boards: support Elkhart Lake with rt5660" to the asoc tree Mark Brown
2020-04-09 18:58 ` Pierre-Louis Bossart [this message]
2020-04-14 14:47   ` Applied "ASoC: intel: sof_sdw: init all aggregated codecs" " Mark Brown
2020-04-09 18:58 ` [PATCH 07/13] ASoC: Intel: sof-da7219-max98373: add DMIC widget and route Pierre-Louis Bossart
2020-04-14 14:47   ` Applied "ASoC: Intel: sof-da7219-max98373: add DMIC widget and route" to the asoc tree Mark Brown
2020-04-09 18:58 ` [PATCH 08/13] ASoC: Intel: sof_sdw_hdmi: fix compilation issue in fallback mode Pierre-Louis Bossart
2020-04-14 14:47   ` Applied "ASoC: Intel: sof_sdw_hdmi: fix compilation issue in fallback mode" to the asoc tree Mark Brown
2020-04-09 18:58 ` [PATCH 09/13] ASoC: Intel: sof_sdw_hdmi: remove codec_dai use Pierre-Louis Bossart
2020-04-14 14:47   ` Applied "ASoC: Intel: sof_sdw_hdmi: remove codec_dai use" to the asoc tree Mark Brown
2020-04-09 18:58 ` [PATCH 10/13] ASoC: Intel: sof_sdw_rt1308: remove codec dai use Pierre-Louis Bossart
2020-04-14 14:47   ` Applied "ASoC: Intel: sof_sdw_rt1308: remove codec dai use" to the asoc tree Mark Brown
2020-04-09 18:58 ` [PATCH 11/13] ASoC: Intel: sof_sdw_rt5682: remove codec_dai use Pierre-Louis Bossart
2020-04-14 14:47   ` Applied "ASoC: Intel: sof_sdw_rt5682: remove codec_dai use" to the asoc tree Mark Brown
2020-04-09 18:58 ` [PATCH 12/13] ASoC: Intel: sof_sdw_rt700: remove codec_dai use Pierre-Louis Bossart
2020-04-14 14:47   ` Applied "ASoC: Intel: sof_sdw_rt700: remove codec_dai use" to the asoc tree Mark Brown
2020-04-09 18:58 ` [PATCH 13/13] ASoC: Intel: sof_sdw_rt711: remove codec_dai use Pierre-Louis Bossart
2020-04-14 14:47   ` Applied "ASoC: Intel: sof_sdw_rt711: remove codec_dai use" to the asoc tree Mark Brown

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=20200409185827.16255-7-pierre-louis.bossart@linux.intel.com \
    --to=pierre-louis.bossart@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=guennadi.liakhovetski@linux.intel.com \
    --cc=kai.vehmanen@linux.intel.com \
    --cc=ranjani.sridharan@linux.intel.com \
    --cc=tiwai@suse.de \
    --cc=yung-chuan.liao@linux.intel.com \
    /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.