aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Fitzgerald <rf@opensource.wolfsonmicro.com>2015-11-03 09:24:12 -0500
committerMark Brown <broonie@kernel.org>2015-11-03 14:07:07 -0500
commit341604ad839d10314af51669fd454dc0aa2ef288 (patch)
treee790cf9364e314e6028ab92268085bac848df855
parent6ff33f3902c3b1c5d0db6b1e2c70b6d76fba357f (diff)
ASoC: arizona: fix range of OPCLK_REF
The code was able to generate illegal OPCLK_REF values because the reference frequency tables listed all values of SYSCLK instead of valid values for OPCLK_REF clock. The maximum OPCLK_REF clock is 49.152MHz or 45.1584MHz. Signed-off-by: Richard Fitzgerald <rf@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--sound/soc/codecs/arizona.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/sound/soc/codecs/arizona.c b/sound/soc/codecs/arizona.c
index 8a2221ab3d10..586789597ecd 100644
--- a/sound/soc/codecs/arizona.c
+++ b/sound/soc/codecs/arizona.c
@@ -979,24 +979,18 @@ void arizona_init_dvfs(struct arizona_priv *priv)
979} 979}
980EXPORT_SYMBOL_GPL(arizona_init_dvfs); 980EXPORT_SYMBOL_GPL(arizona_init_dvfs);
981 981
982static unsigned int arizona_sysclk_48k_rates[] = { 982static unsigned int arizona_opclk_ref_48k_rates[] = {
983 6144000, 983 6144000,
984 12288000, 984 12288000,
985 24576000, 985 24576000,
986 49152000, 986 49152000,
987 73728000,
988 98304000,
989 147456000,
990}; 987};
991 988
992static unsigned int arizona_sysclk_44k1_rates[] = { 989static unsigned int arizona_opclk_ref_44k1_rates[] = {
993 5644800, 990 5644800,
994 11289600, 991 11289600,
995 22579200, 992 22579200,
996 45158400, 993 45158400,
997 67737600,
998 90316800,
999 135475200,
1000}; 994};
1001 995
1002static int arizona_set_opclk(struct snd_soc_codec *codec, unsigned int clk, 996static int arizona_set_opclk(struct snd_soc_codec *codec, unsigned int clk,
@@ -1021,11 +1015,11 @@ static int arizona_set_opclk(struct snd_soc_codec *codec, unsigned int clk,
1021 } 1015 }
1022 1016
1023 if (refclk % 8000) 1017 if (refclk % 8000)
1024 rates = arizona_sysclk_44k1_rates; 1018 rates = arizona_opclk_ref_44k1_rates;
1025 else 1019 else
1026 rates = arizona_sysclk_48k_rates; 1020 rates = arizona_opclk_ref_48k_rates;
1027 1021
1028 for (ref = 0; ref < ARRAY_SIZE(arizona_sysclk_48k_rates) && 1022 for (ref = 0; ref < ARRAY_SIZE(arizona_opclk_ref_48k_rates) &&
1029 rates[ref] <= refclk; ref++) { 1023 rates[ref] <= refclk; ref++) {
1030 div = 1; 1024 div = 1;
1031 while (rates[ref] / div >= freq && div < 32) { 1025 while (rates[ref] / div >= freq && div < 32) {