[alsa-devel] [PATCH 4/5 v7][RFC] ASoC: ak4642: add .of_xlate_dai_name support
swarren at wwwdotorg.org
Thu Feb 28 00:27:25 CET 2013
On 02/25/2013 01:57 AM, Kuninori Morimoto wrote:
> ak4642 driver can be used from simple-card driver
> which requires .of_xlate_dai_name.
> This patch supports it.
> diff --git a/sound/soc/codecs/ak4642.c b/sound/soc/codecs/ak4642.c
> +static int ak4642_of_xlate_dai_name(struct snd_soc_codec *codec,
> + struct of_phandle_args *spec,
> + const char **dai_name)
> + *dai_name = ak4642_dai.name;
> + return 0;
This seems fine, but I would be tempted to make that a common function;
with body something like:
if codec->num_dai == 1:
loop over all codec->dais
if args->args == dai->of_id:
(similar to how drivers/gpio/gpiolib-of.c:of_gpio_simple_xlate() works).
That would allow the same function to be used by most CODECs/CPUs.
More information about the Alsa-devel