[alsa-devel] [PATCH 3/4 v6] ASoC: fsi: enable .of_xlate_dai_name on struct snd_soc_dai_driver

Stephen Warren swarren at wwwdotorg.org
Tue Feb 19 22:00:19 CET 2013


On 02/14/2013 02:22 AM, Kuninori Morimoto wrote:
> fsi driver can be used from simple-card driver
> which requires .of_xlate_dai_name.
> 
> This patch supports .of_xlate_dai_name.

> diff --git a/Documentation/devicetree/bindings/sound/renesas,fsi.txt b/Documentation/devicetree/bindings/sound/renesas,fsi.txt

The change to this file looks sane.

> diff --git a/sound/soc/sh/fsi.c b/sound/soc/sh/fsi.c

> @@ -1861,6 +1861,7 @@ static struct snd_soc_dai_driver fsi_soc_dai[] = {
>  			.channels_max	= 2,
>  		},
>  		.ops = &fsi_dai_ops,
> +		.of_xlate_dai_name = snd_soc_common_of_xlate_dai_name,
>  	},

Hmm. I think that the .of_xlate_dai_name should be something related to
the object (e.g. CODEC) that contains the DAIs, rather than the DAIs
themselves. The intent is to ask some object (e.g. CODEC) which of its
DAIs is represented by the DT DAI specifier, not to ask each DAI whether
it is represented by that particular DT DAI specifier.

Aside from that, I'd expect the patch above to be something more like:

const char *fsi_xlate_dai_name(struct snd_soc_dai *dai,
				const struct of_phandle_args *args)
{
	switch (args[0]) {
	case 0:
		return fsi_soc_dai[0].name;
	case 1:
		return fsi_soc_dai[1].name;
	default:
		return NULL;
	}
}

@@ -1861,6 +1861,7 @@ static struct snd_soc_dai_driver fsi_soc_dai[] = {
 			.channels_max	= 2,
 		},
 		.ops = &fsi_dai_ops,
+		.of_xlate_dai_name = fsi_xlate_dai_name,
 	},

(although further modified according to my error handling comments before).


More information about the Alsa-devel mailing list