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 | |
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')
-rw-r--r-- | sound/soc/codecs/Kconfig | 2 | ||||
-rw-r--r-- | sound/soc/codecs/rt5677.c | 18 |
2 files changed, 4 insertions, 16 deletions
diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig index cbfa1e18f651..9d88845dc7c4 100644 --- a/sound/soc/codecs/Kconfig +++ b/sound/soc/codecs/Kconfig | |||
@@ -445,9 +445,11 @@ config SND_SOC_RL6231 | |||
445 | default y if SND_SOC_RT5640=y | 445 | default y if SND_SOC_RT5640=y |
446 | default y if SND_SOC_RT5645=y | 446 | default y if SND_SOC_RT5645=y |
447 | default y if SND_SOC_RT5651=y | 447 | default y if SND_SOC_RT5651=y |
448 | default y if SND_SOC_RT5677=y | ||
448 | default m if SND_SOC_RT5640=m | 449 | default m if SND_SOC_RT5640=m |
449 | default m if SND_SOC_RT5645=m | 450 | default m if SND_SOC_RT5645=m |
450 | default m if SND_SOC_RT5651=m | 451 | default m if SND_SOC_RT5651=m |
452 | default m if SND_SOC_RT5677=m | ||
451 | 453 | ||
452 | config SND_SOC_RT5631 | 454 | config SND_SOC_RT5631 |
453 | tristate | 455 | tristate |
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; |