[alsa-devel] [PATCH] ASoC: Route Mic Bias in Visstrim_M10 board.

Lars-Peter Clausen lars at metafoo.de
Mon Jan 9 20:10:13 CET 2012


On 01/09/2012 12:01 PM, Javier Martin wrote:
> [...]
> diff --git a/sound/soc/imx/mx27vis-aic32x4.c b/sound/soc/imx/mx27vis-aic32x4.c
> index 054110b..7e55a99 100644
> --- a/sound/soc/imx/mx27vis-aic32x4.c
> +++ b/sound/soc/imx/mx27vis-aic32x4.c
> @@ -74,6 +74,43 @@ static struct snd_soc_ops mx27vis_aic32x4_snd_ops = {
[...]
> +static const struct snd_soc_dapm_route audio_map[] = {

I know this is can be found in may drivers as well, but aic32x4_dapm_routes
would be a much better name.

> +};
> +
> +static int mx27vis_aic32x4_dai_init(struct snd_soc_pcm_runtime *rtd)
> +{
> +	struct snd_soc_codec *codec = rtd->codec;
> +	struct snd_soc_dapm_context *dapm = &codec->dapm;
> +	int err = 0;
> +
> +	snd_soc_dapm_new_controls(dapm, aic32x4_dapm_widgets,
> +				  ARRAY_SIZE(aic32x4_dapm_widgets));
> +
> +	err = snd_soc_add_controls(codec, mx27vis_aic32x4_controls,
> +				   ARRAY_SIZE(mx27vis_aic32x4_controls));
> +	if (err < 0)
> +		return err;
> +
> +	snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
> +

Use the snd_soc_card's controls, dapm_widgets and dapm_routes fields to
register these instead of open coding it here.


More information about the Alsa-devel mailing list