[PATCH 6/6] ASoC: amd: Added hw_params support for ALC1015
Kuninori Morimoto
kuninori.morimoto.gx at renesas.com
Tue Jul 28 01:40:43 CEST 2020
Hi Ravulapati
> +static int acp3x_1015_hw_params(struct snd_pcm_substream *substream,
> + struct snd_pcm_hw_params *params)
> +{
> + struct snd_soc_pcm_runtime *rtd = substream->private_data;
> + struct snd_soc_dai *codec_dai;
> + int srate, i, ret;
> +
> + ret = 0;
> + srate = params_rate(params);
> +
> + for (i = 0; i < rtd->num_codecs; i++) {
You can use for_each_rtd_codec_dais() here
> + if (strcmp(rtd->codec_dais[i]->name, "rt1015-aif"))
> + continue;
> + codec_dai = rtd->codec_dais[i];
> +
> + ret = snd_soc_dai_set_bclk_ratio(codec_dai, 64);
> + if (ret < 0) {
> + dev_err(codec_dai->dev,
> + "codec_dai bclk ratio not set\n");
> + return ret;
> + }
> + ret = snd_soc_dai_set_pll(codec_dai, 0, RT1015_PLL_S_BCLK,
> + 64 * srate, 256 * srate);
> + if (ret < 0) {
> + dev_err(codec_dai->dev, "codec_dai PLL not set\n");
> + return ret;
> + }
> + ret = snd_soc_dai_set_sysclk(codec_dai, RT1015_SCLK_S_PLL,
> + 256 * srate, SND_SOC_CLOCK_IN);
> + if (ret < 0) {
> + dev_err(codec_dai->dev,
> + "codec_dai sys clock not set\n");
> + return ret;
> + }
You don't need to use dev_err() for snd_soc_dai_xxx().
Current snd_soc_dai_xxx() will indicate error message in such case.
Thank you for your help !!
Best regards
---
Kuninori Morimoto
More information about the Alsa-devel
mailing list