[alsa-devel] [PATCH 6/9] topology: ABI - Change stream formats to a bitwise flag

mengdong.lin at linux.intel.com mengdong.lin at linux.intel.com
Thu Nov 5 13:49:02 CET 2015


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

The toplogy user space tool will generate this bitwise flag by using
SNDRV_PCM_FORMAT_* exposed by asound.h, and the topology core will copy
this flag when generating DAI streams.

Signed-off-by: Mengdong Lin <mengdong.lin at linux.intel.com>
Acked-by: Liam Girdwood <liam.r.girdwood at linux.intel.com>

diff --git a/include/sound/asoc.h b/include/sound/asoc.h
index acff6ec..5f857cf 100644
--- a/include/sound/asoc.h
+++ b/include/sound/asoc.h
@@ -190,7 +190,7 @@ struct snd_soc_tplg_ctl_hdr {
 struct snd_soc_tplg_stream_caps {
 	__le32 size;		/* in bytes of this structure */
 	char name[SNDRV_CTL_ELEM_ID_NAME_MAXLEN];
-	__le64 formats[SND_SOC_TPLG_MAX_FORMATS];	/* supported formats SNDRV_PCM_FMTBIT_* */
+	__le64 formats;	/* supported formats SNDRV_PCM_FMTBIT_* */
 	__le32 rates;		/* supported rates SNDRV_PCM_RATE_* */
 	__le32 rate_min;	/* min rate */
 	__le32 rate_max;	/* max rate */
diff --git a/src/topology/pcm.c b/src/topology/pcm.c
index 8559376..ec26f9c 100644
--- a/src/topology/pcm.c
+++ b/src/topology/pcm.c
@@ -174,7 +174,7 @@ static int split_format(struct snd_soc_tplg_stream_caps *caps, char *str)
 			return -EINVAL;
 		}
 
-		caps->formats[i] = format;
+		caps->formats |= 1 << format;
 		s = strtok(NULL, ", ");
 		i++;
 	}
-- 
1.9.1



More information about the Alsa-devel mailing list