Commit c3936ba9e0e4f472221320c33e20be3a8b795616

Authored by Ravulapati Vishnu vardhan rao
Committed by Mark Brown
1 parent f7b2651b96

ASoC: amd: Added hw_params support for ALC1015

Adding rt1015 hw_params which set Bit-clock ratio,
PLL and appropriate sys clk specific with RTK1015.

Signed-off-by: Ravulapati Vishnu vardhan rao <Vishnuvardhanrao.Ravulapati@amd.com>
Link: https://lore.kernel.org/r/20200728160255.31020-6-Vishnuvardhanrao.Ravulapati@amd.com
Signed-off-by: Mark Brown <broonie@kernel.org>

Showing 1 changed file with 29 additions and 0 deletions Side-by-side Diff

sound/soc/amd/acp3x-rt5682-max9836.c
... ... @@ -127,6 +127,34 @@
127 127 return ret;
128 128 }
129 129  
  130 +static int acp3x_1015_hw_params(struct snd_pcm_substream *substream,
  131 + struct snd_pcm_hw_params *params)
  132 +{
  133 + struct snd_soc_pcm_runtime *rtd = substream->private_data;
  134 + struct snd_soc_dai *codec_dai;
  135 + int srate, i, ret;
  136 +
  137 + ret = 0;
  138 + srate = params_rate(params);
  139 +
  140 + for_each_rtd_codec_dais(rtd, i, codec_dai) {
  141 + if (strcmp(codec_dai->component->name, "rt1015-aif"))
  142 + continue;
  143 + ret = snd_soc_dai_set_bclk_ratio(codec_dai, 64);
  144 + if (ret < 0)
  145 + return ret;
  146 + ret = snd_soc_dai_set_pll(codec_dai, 0, RT1015_PLL_S_BCLK,
  147 + 64 * srate, 256 * srate);
  148 + if (ret < 0)
  149 + return ret;
  150 + ret = snd_soc_dai_set_sysclk(codec_dai, RT1015_SCLK_S_PLL,
  151 + 256 * srate, SND_SOC_CLOCK_IN);
  152 + if (ret < 0)
  153 + return ret;
  154 + }
  155 + return ret;
  156 +}
  157 +
130 158 static void rt5682_clk_disable(void)
131 159 {
132 160 clk_disable_unprepare(rt5682_dai_wclk);
... ... @@ -232,6 +260,7 @@
232 260 static const struct snd_soc_ops acp3x_max_play_ops = {
233 261 .startup = acp3x_max_startup,
234 262 .shutdown = rt5682_shutdown,
  263 + .hw_params = acp3x_1015_hw_params,
235 264 };
236 265  
237 266 static const struct snd_soc_ops acp3x_ec_cap0_ops = {