Commit c8a04b5d authored by Bard Liao's avatar Bard Liao Committed by Mark Brown

ASoC: rt5659: move set_pll to codec level

Move set_pll function to codec level and people can use it at both
codec and dai level.
Signed-off-by: default avatarBard Liao <bardliao@realtek.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent fe01e5e8
...@@ -3419,15 +3419,15 @@ static int rt5659_set_codec_sysclk(struct snd_soc_codec *codec, int clk_id, ...@@ -3419,15 +3419,15 @@ static int rt5659_set_codec_sysclk(struct snd_soc_codec *codec, int clk_id,
return 0; return 0;
} }
static int rt5659_set_dai_pll(struct snd_soc_dai *dai, int pll_id, int Source, static int rt5659_set_codec_pll(struct snd_soc_codec *codec, int pll_id,
unsigned int freq_in, unsigned int freq_out) int source, unsigned int freq_in,
unsigned int freq_out)
{ {
struct snd_soc_codec *codec = dai->codec;
struct rt5659_priv *rt5659 = snd_soc_codec_get_drvdata(codec); struct rt5659_priv *rt5659 = snd_soc_codec_get_drvdata(codec);
struct rl6231_pll_code pll_code; struct rl6231_pll_code pll_code;
int ret; int ret;
if (Source == rt5659->pll_src && freq_in == rt5659->pll_in && if (source == rt5659->pll_src && freq_in == rt5659->pll_in &&
freq_out == rt5659->pll_out) freq_out == rt5659->pll_out)
return 0; return 0;
...@@ -3441,7 +3441,7 @@ static int rt5659_set_dai_pll(struct snd_soc_dai *dai, int pll_id, int Source, ...@@ -3441,7 +3441,7 @@ static int rt5659_set_dai_pll(struct snd_soc_dai *dai, int pll_id, int Source,
return 0; return 0;
} }
switch (Source) { switch (source) {
case RT5659_PLL1_S_MCLK: case RT5659_PLL1_S_MCLK:
snd_soc_update_bits(codec, RT5659_GLB_CLK, snd_soc_update_bits(codec, RT5659_GLB_CLK,
RT5659_PLL1_SRC_MASK, RT5659_PLL1_SRC_MCLK); RT5659_PLL1_SRC_MASK, RT5659_PLL1_SRC_MCLK);
...@@ -3459,7 +3459,7 @@ static int rt5659_set_dai_pll(struct snd_soc_dai *dai, int pll_id, int Source, ...@@ -3459,7 +3459,7 @@ static int rt5659_set_dai_pll(struct snd_soc_dai *dai, int pll_id, int Source,
RT5659_PLL1_SRC_MASK, RT5659_PLL1_SRC_BCLK3); RT5659_PLL1_SRC_MASK, RT5659_PLL1_SRC_BCLK3);
break; break;
default: default:
dev_err(codec->dev, "Unknown PLL Source %d\n", Source); dev_err(codec->dev, "Unknown PLL source %d\n", source);
return -EINVAL; return -EINVAL;
} }
...@@ -3481,7 +3481,7 @@ static int rt5659_set_dai_pll(struct snd_soc_dai *dai, int pll_id, int Source, ...@@ -3481,7 +3481,7 @@ static int rt5659_set_dai_pll(struct snd_soc_dai *dai, int pll_id, int Source,
rt5659->pll_in = freq_in; rt5659->pll_in = freq_in;
rt5659->pll_out = freq_out; rt5659->pll_out = freq_out;
rt5659->pll_src = Source; rt5659->pll_src = source;
return 0; return 0;
} }
...@@ -3667,7 +3667,6 @@ static const struct snd_soc_dai_ops rt5659_aif_dai_ops = { ...@@ -3667,7 +3667,6 @@ static const struct snd_soc_dai_ops rt5659_aif_dai_ops = {
.hw_params = rt5659_hw_params, .hw_params = rt5659_hw_params,
.set_fmt = rt5659_set_dai_fmt, .set_fmt = rt5659_set_dai_fmt,
.set_tdm_slot = rt5659_set_tdm_slot, .set_tdm_slot = rt5659_set_tdm_slot,
.set_pll = rt5659_set_dai_pll,
.set_bclk_ratio = rt5659_set_bclk_ratio, .set_bclk_ratio = rt5659_set_bclk_ratio,
}; };
...@@ -3747,6 +3746,7 @@ static const struct snd_soc_codec_driver soc_codec_dev_rt5659 = { ...@@ -3747,6 +3746,7 @@ static const struct snd_soc_codec_driver soc_codec_dev_rt5659 = {
.num_dapm_routes = ARRAY_SIZE(rt5659_dapm_routes), .num_dapm_routes = ARRAY_SIZE(rt5659_dapm_routes),
}, },
.set_sysclk = rt5659_set_codec_sysclk, .set_sysclk = rt5659_set_codec_sysclk,
.set_pll = rt5659_set_codec_pll,
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment