[alsa-devel] [PATCH v3 2/8] ASoC: topology: ABI - Add private data to PCM

mengdong.lin at linux.intel.com mengdong.lin at linux.intel.com
Thu Sep 29 08:09:02 CEST 2016


From: Mengdong Lin <mengdong.lin at linux.intel.com>

Add private data to PCM (Frontend DAI & DAI link) for future extension.
Revise offset update for PCM with private data.

Signed-off-by: Mengdong Lin <mengdong.lin at linux.intel.com>

diff --git a/include/uapi/sound/asoc.h b/include/uapi/sound/asoc.h
index a8d25be..309c9a7 100644
--- a/include/uapi/sound/asoc.h
+++ b/include/uapi/sound/asoc.h
@@ -446,6 +446,7 @@ struct snd_soc_tplg_pcm {
 	struct snd_soc_tplg_stream_caps caps[2]; /* playback and capture for DAI */
 	__le32 flag_mask;       /* bitmask of flags to configure */
 	__le32 flags;           /* SND_SOC_TPLG_LNK_FLGBIT_* flag value */
+	struct snd_soc_tplg_private priv;
 } __attribute__((packed));
 
 
diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c
index b6e7063..e76fb15 100644
--- a/sound/soc/soc-topology.c
+++ b/sound/soc/soc-topology.c
@@ -1708,19 +1708,18 @@ static int soc_tplg_pcm_elems_load(struct soc_tplg *tplg,
 	}
 
 	/* create the FE DAIs and DAI links */
-	pcm = (struct snd_soc_tplg_pcm *)tplg->pos;
 	for (i = 0; i < count; i++) {
+		pcm = (struct snd_soc_tplg_pcm *)tplg->pos;
 		if (pcm->size != sizeof(*pcm)) {
 			dev_err(tplg->dev, "ASoC: invalid pcm size\n");
 			return -EINVAL;
 		}
 
 		soc_tplg_pcm_create(tplg, pcm);
-		pcm++;
+		tplg->pos += (sizeof(*pcm) + pcm->priv.size);
 	}
 
 	dev_dbg(tplg->dev, "ASoC: adding %d PCM DAIs\n", count);
-	tplg->pos += sizeof(struct snd_soc_tplg_pcm) * count;
 
 	return 0;
 }
-- 
2.5.0



More information about the Alsa-devel mailing list