[alsa-devel] [topic/asoc][RFC 0/1] ASoC: OMAP: Add support for mono link configuration to McBSP DAI

Jarkko Nikula jarkko.nikula at nokia.com
Mon Nov 24 14:09:23 CET 2008


Hi

I'm trying to cover also pure mono codecs like bluetooth audio with McBSP DAI
driver. Protocol part is trivial like patch here but interfacing with machine
driver is somewhat question mark.

With this patch, machine driver needs to "hack" with cpu_dai in its init
function:

	cpu_dai->playback.channels_min = 1;
	cpu_dai->playback.channels_max = 1;
	cpu_dai->capture.channels_min = 1;
	cpu_dai->capture.channels_max = 1;

Another idea is to introduce new omap_mcbsp_dai_mono[] array in omap-mcbsp.c
and initialize those with modified builder macro, e.g:

-#define OMAP_MCBSP_DAI_BUILDER(link_id)				\
+#define OMAP_MCBSP_DAI_BUILDER(link_id, min_ch, max_ch)		\
 {								\
 	.name = "omap-mcbsp-dai-"#link_id,			\
 	.id = (link_id),					\
 	.type = SND_SOC_DAI_I2S,				\
 	.playback = {						\
-		.channels_min = 2,				\
-		.channels_max = 2,				\
+		.channels_min = (min_ch),			\
+		.channels_max = (max_ch),			\
...

 struct snd_soc_dai omap_mcbsp_dai[] = {
-	OMAP_MCBSP_DAI_BUILDER(0),
-	OMAP_MCBSP_DAI_BUILDER(1),
+	OMAP_MCBSP_DAI_BUILDER(0, 2, 2),
+	OMAP_MCBSP_DAI_BUILDER(1, 2, 2),
 #if NUM_LINKS >= 3
...

and

+struct snd_soc_dai omap_mcbsp_dai_mono[] = {
+	OMAP_MCBSP_DAI_BUILDER(0, 1, 1),
+	OMAP_MCBSP_DAI_BUILDER(1, 1, 1),
+#if NUM_LINKS >= 3
...

but this looks a bit overkill if typical configuration has only one such a
mono link and might confuse if a machine driver still needs to reference those
arrays using sequential array index like:

	.cpu_dai = &omap_mcbsp_dai[0],
and
	.cpu_dai = &omap_mcbsp_dai_mono[1],

sequential since if I like that cpu_dai->id is also sequential for links.

Opinnions or better ideas :-)


-- 
Jarkko


More information about the Alsa-devel mailing list