diff options
author | Axel Lin <axel.lin@ingics.com> | 2014-06-09 20:57:36 -0400 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2014-06-16 10:58:06 -0400 |
commit | 30f14b439f0cc0c7776722c0b1c2836769fe0ce7 (patch) | |
tree | 2c8899c05d7b5866d423a0283dbbc9043a0fa427 /sound/soc/codecs/rt5677.c | |
parent | c8cfbec882b408cd933d24882302cacd39985e18 (diff) |
ASoC: rt5677: Convert to use rl6231_get_clk_info
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Tested-by: Oder Chiou <oder_chiou@realtek.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'sound/soc/codecs/rt5677.c')
-rw-r--r-- | sound/soc/codecs/rt5677.c | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/sound/soc/codecs/rt5677.c b/sound/soc/codecs/rt5677.c index 60fff7fdb85e..1ffc6891fcbc 100644 --- a/sound/soc/codecs/rt5677.c +++ b/sound/soc/codecs/rt5677.c | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <sound/initval.h> | 27 | #include <sound/initval.h> |
28 | #include <sound/tlv.h> | 28 | #include <sound/tlv.h> |
29 | 29 | ||
30 | #include "rl6231.h" | ||
30 | #include "rt5677.h" | 31 | #include "rt5677.h" |
31 | 32 | ||
32 | #define RT5677_DEVICE_ID 0x6327 | 33 | #define RT5677_DEVICE_ID 0x6327 |
@@ -2798,21 +2799,6 @@ static const struct snd_soc_dapm_route rt5677_dapm_routes[] = { | |||
2798 | { "PDM2R", NULL, "PDM2 R Mux" }, | 2799 | { "PDM2R", NULL, "PDM2 R Mux" }, |
2799 | }; | 2800 | }; |
2800 | 2801 | ||
2801 | static int get_clk_info(int sclk, int rate) | ||
2802 | { | ||
2803 | int i, pd[] = {1, 2, 3, 4, 6, 8, 12, 16}; | ||
2804 | |||
2805 | if (sclk <= 0 || rate <= 0) | ||
2806 | return -EINVAL; | ||
2807 | |||
2808 | rate = rate << 8; | ||
2809 | for (i = 0; i < ARRAY_SIZE(pd); i++) | ||
2810 | if (sclk == rate * pd[i]) | ||
2811 | return i; | ||
2812 | |||
2813 | return -EINVAL; | ||
2814 | } | ||
2815 | |||
2816 | static int rt5677_hw_params(struct snd_pcm_substream *substream, | 2802 | static int rt5677_hw_params(struct snd_pcm_substream *substream, |
2817 | struct snd_pcm_hw_params *params, struct snd_soc_dai *dai) | 2803 | struct snd_pcm_hw_params *params, struct snd_soc_dai *dai) |
2818 | { | 2804 | { |
@@ -2822,7 +2808,7 @@ static int rt5677_hw_params(struct snd_pcm_substream *substream, | |||
2822 | int pre_div, bclk_ms, frame_size; | 2808 | int pre_div, bclk_ms, frame_size; |
2823 | 2809 | ||
2824 | rt5677->lrck[dai->id] = params_rate(params); | 2810 | rt5677->lrck[dai->id] = params_rate(params); |
2825 | pre_div = get_clk_info(rt5677->sysclk, rt5677->lrck[dai->id]); | 2811 | pre_div = rl6231_get_clk_info(rt5677->sysclk, rt5677->lrck[dai->id]); |
2826 | if (pre_div < 0) { | 2812 | if (pre_div < 0) { |
2827 | dev_err(codec->dev, "Unsupported clock setting\n"); | 2813 | dev_err(codec->dev, "Unsupported clock setting\n"); |
2828 | return -EINVAL; | 2814 | return -EINVAL; |