ASoC: tegra-alt: Prepare for removal of rt565x_manage_codec_sysclk

The function rt565x_manage_codec_sysclk() only exists in the downstream
kernel and is only currently used for the audio supermodule. It is not
necessary to port this function to the upstream kernel because we can
simply implement the same functionality within the machine driver by
calling the snd_soc_dai_set_pll() and snd_soc_dai_set_sysclk() APIs.
Therefore, update the Tegra machine to avoid using the function
rt565x_manage_codec_sysclk() so we can remove from downstream.

Bug 1665446

Change-Id: Id7e941368740f28cb74e6a04556e7b00abae119d
Signed-off-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2073779
Reviewed-by: Mohan Kumar D <mkumard@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Bibek Basu <bbasu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Jonathan Hunter
2019-03-14 16:33:16 +00:00
committed by Sameer Pujar
parent 1785c1bee4
commit cacbb942a8

View File

@@ -545,6 +545,8 @@ static int tegra_machine_dai_init(struct snd_soc_pcm_runtime *runtime,
rtd = snd_soc_get_pcm_runtime(card, "rt565x-codec-sysclk-bclk1"); rtd = snd_soc_get_pcm_runtime(card, "rt565x-codec-sysclk-bclk1");
if (rtd) { if (rtd) {
unsigned int bclk_rate;
dai_params = dai_params =
(struct snd_soc_pcm_stream *)rtd->dai_link->params; (struct snd_soc_pcm_stream *)rtd->dai_link->params;
@@ -552,8 +554,35 @@ static int tegra_machine_dai_init(struct snd_soc_pcm_runtime *runtime,
dai_params->formats = (machine->fmt_via_kcontrol == 2) ? dai_params->formats = (machine->fmt_via_kcontrol == 2) ?
(1ULL << SNDRV_PCM_FORMAT_S32_LE) : formats; (1ULL << SNDRV_PCM_FORMAT_S32_LE) : formats;
err = rt565x_manage_codec_sysclk(dai_params, rtd->codec_dai, switch (dai_params->formats) {
RT5659_PLL1_S_BCLK1); case SNDRV_PCM_FMTBIT_S8:
bclk_rate = clk_rate * channels * 8;
break;
case SNDRV_PCM_FMTBIT_S16_LE:
bclk_rate = clk_rate * channels * 16;
break;
case SNDRV_PCM_FMTBIT_S24_LE:
bclk_rate = clk_rate * channels * 24;
break;
case SNDRV_PCM_FMTBIT_S32_LE:
bclk_rate = clk_rate * channels * 32;
break;
default:
dev_err(card->dev, "invalid format %llu\n",
dai_params->formats);
return -EINVAL;
}
err = snd_soc_dai_set_pll(rtd->codec_dai, 0,
RT5659_PLL1_S_BCLK1,
bclk_rate, clk_rate * 256);
if (err < 0) {
dev_err(card->dev, "failed to set codec pll\n");
return err;
}
err = snd_soc_dai_set_sysclk(rtd->codec_dai, RT5659_SCLK_S_PLL1,
clk_rate * 256, SND_SOC_CLOCK_IN);
if (err < 0) { if (err < 0) {
dev_err(card->dev, "codec_dai clock not set\n"); dev_err(card->dev, "codec_dai clock not set\n");
return err; return err;