aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/rt5645.c
diff options
context:
space:
mode:
authorOder Chiou <oder_chiou@realtek.com>2014-05-20 03:01:55 -0400
committerMark Brown <broonie@linaro.org>2014-06-01 15:04:30 -0400
commitd92950e755328a0293af66e18096e0cae29996f1 (patch)
treef4f5a06ad7856bb3d34cb80663c2f3183a87359e /sound/soc/codecs/rt5645.c
parent71c7a2d675c8fe9b6ab284dcf586f30a7109c96c (diff)
ASoC: rt5640: Add the function "get_clk_info" to RL6231 shared support
The patch adds the function "get_clk_info" to RL6231 shared support. Signed-off-by: Oder Chiou <oder_chiou@realtek.com> Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'sound/soc/codecs/rt5645.c')
-rw-r--r--sound/soc/codecs/rt5645.c17
1 files changed, 1 insertions, 16 deletions
diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c
index ee6db7c7c5e8..02147be2b302 100644
--- a/sound/soc/codecs/rt5645.c
+++ b/sound/soc/codecs/rt5645.c
@@ -1786,21 +1786,6 @@ static const struct snd_soc_dapm_route rt5645_dapm_routes[] = {
1786 { "SPOR", NULL, "SPK amp" }, 1786 { "SPOR", NULL, "SPK amp" },
1787}; 1787};
1788 1788
1789static int get_clk_info(int sclk, int rate)
1790{
1791 int i, pd[] = {1, 2, 3, 4, 6, 8, 12, 16};
1792
1793 if (sclk <= 0 || rate <= 0)
1794 return -EINVAL;
1795
1796 rate = rate << 8;
1797 for (i = 0; i < ARRAY_SIZE(pd); i++)
1798 if (sclk == rate * pd[i])
1799 return i;
1800
1801 return -EINVAL;
1802}
1803
1804static int rt5645_hw_params(struct snd_pcm_substream *substream, 1789static int rt5645_hw_params(struct snd_pcm_substream *substream,
1805 struct snd_pcm_hw_params *params, struct snd_soc_dai *dai) 1790 struct snd_pcm_hw_params *params, struct snd_soc_dai *dai)
1806{ 1791{
@@ -1810,7 +1795,7 @@ static int rt5645_hw_params(struct snd_pcm_substream *substream,
1810 int pre_div, bclk_ms, frame_size; 1795 int pre_div, bclk_ms, frame_size;
1811 1796
1812 rt5645->lrck[dai->id] = params_rate(params); 1797 rt5645->lrck[dai->id] = params_rate(params);
1813 pre_div = get_clk_info(rt5645->sysclk, rt5645->lrck[dai->id]); 1798 pre_div = rl6231_get_clk_info(rt5645->sysclk, rt5645->lrck[dai->id]);
1814 if (pre_div < 0) { 1799 if (pre_div < 0) {
1815 dev_err(codec->dev, "Unsupported clock setting\n"); 1800 dev_err(codec->dev, "Unsupported clock setting\n");
1816 return -EINVAL; 1801 return -EINVAL;