[alsa-devel] [PATCH] ASoC: tegra: TrimSlice machine support

Mark Brown broonie at opensource.wolfsonmicro.com
Mon Apr 18 16:44:27 CEST 2011


On Sun, Apr 17, 2011 at 03:39:48PM +0300, Mike Rapoport wrote:

> +	if (mclk_change) {
> +		err = snd_soc_dai_set_sysclk(codec_dai, 0, mclk,
> +					     SND_SOC_CLOCK_IN);
> +		if (err < 0) {
> +			dev_err(card->dev, "codec_dai clock not set\n");
> +			return err;
> +		}
> +	}

Fix the CODEC driver to cope gracefully with noop changes if this is a
problem, no sense in all callers replicating this code.

> +static int trimslice_asoc_init(struct snd_soc_pcm_runtime *rtd)
> +{
> +	struct snd_soc_codec *codec = rtd->codec;
> +	struct snd_soc_dapm_context *dapm = &codec->dapm;
> +
> +	snd_soc_dapm_new_controls(dapm, trimslice_dapm_widgets,
> +					ARRAY_SIZE(trimslice_dapm_widgets));
> +
> +	snd_soc_dapm_add_routes(dapm, trimslice_audio_map,
> +				ARRAY_SIZE(trimslice_audio_map));
> +
> +	snd_soc_dapm_sync(dapm);

Please switch to using the data based specification of widgets and
routes in -next.  This should completely remove the need for this code.

> +static __devinit int tegra_snd_trimslice_probe(struct platform_device *pdev)
> +{
> +	struct snd_soc_card *card = &snd_soc_trimslice;
> +	struct tegra_trimslice *trimslice;
> +	int ret;
> +
> +	if (!machine_is_trimslice()) {
> +		dev_err(&pdev->dev, "Not running on Trimslice!\n");
> +		return -ENODEV;
> +	}

This isn't needed since you're registering based on a platform device -
whatever registers the platform device should check this.

> +err_clear_drvdata:
> +	snd_soc_card_set_drvdata(card, NULL);
> +	platform_set_drvdata(pdev, NULL);
> +	card->dev = NULL;

No need for any of these, anything relying on them outside of the device
being registered is buggy anyway.

> +	snd_soc_card_set_drvdata(card, NULL);
> +	platform_set_drvdata(pdev, NULL);
> +	card->dev = NULL;

Similarly here.


More information about the Alsa-devel mailing list