[alsa-devel] [PATCH] ASoC: add ak4554 driver

Lars-Peter Clausen lars at metafoo.de
Mon Jul 1 17:32:29 CEST 2013


On 07/01/2013 08:43 AM, Kuninori Morimoto wrote:
> +
> +static int ak4554_dai_hw_params(struct snd_pcm_substream *substream,
> +				struct snd_pcm_hw_params *params,
> +				struct snd_soc_dai *dai)
> +{
> +	struct ak4554_priv *priv = dev_get_drvdata(dai->dev);
> +
> +	if ((priv->usrcnt > 0) &&
> +	    (priv->rate != params_rate(params))) {
> +		dev_err(dai->dev, "asymmetric rate\n");
> +		return -EIO;
> +	}
> +
> +	priv->usrcnt++;
> +	priv->rate = params_rate(params);

Set the symmetric_rates field of the dai driver to 1 to enforce symmetric
rates. No need to implement this by hand.

> +
> +	return 0;
> +}
> +
[...]
> +
> +struct snd_soc_dai_driver ak4554_dai[] = {
> +	{
> +		.name = "ak4554-hifi-playback",
> +		.playback = {
> +			.stream_name = "Playback",
> +			.channels_min = 2,
> +			.channels_max = 2,
> +			.rates = SNDRV_PCM_RATE_8000_48000,
> +			.formats = SNDRV_PCM_FMTBIT_S16_LE,
> +		},
> +		.ops = &ak4554_dai_ops,
> +	}, {
> +		.name = "ak4554-hifi-capture",
> +		.capture = {
> +			.stream_name = "Capture",
> +			.channels_min = 2,
> +			.channels_max = 2,
> +			.rates = SNDRV_PCM_RATE_8000_48000,
> +			.formats = SNDRV_PCM_FMTBIT_S16_LE,
> +		},
> +		.ops = &ak4554_dai_ops,
> +	}
> +};
> +EXPORT_SYMBOL_GPL(ak4554_dai);

I don't think this needs to be exported and the struct should be static

> +
> +static int ak4554_probe(struct snd_soc_codec *codec)
> +{
> +	dev_info(codec->dev, "probed\n");
> +	return 0;
> +}
> +
> +static int ak4554_remove(struct snd_soc_codec *codec)
> +{
> +	dev_info(codec->dev, "removed\n");
> +	return 0;
> +}

Remove the two functions above, there is not much point in printing these messages.


More information about the Alsa-devel mailing list