aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCharles Keepax <ckeepax@opensource.wolfsonmicro.com>2013-02-20 12:28:39 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2013-03-03 22:01:00 -0500
commitde1e6eedddeab2fa417c38c231d896198f903129 (patch)
tree59933f1f239b0a90c55f5ded309b8449470db622
parent357228153b4a158bdeb05f1c46ee13ef60a675a6 (diff)
ASoC: arizona: Improve suppression of noop FLL updates
Previously updates that only changes FLL source would be missed, this patch corrects this. We also ensures that both REFCLK and SYNCCLK frequency changes are considered, in preparation for future updates. Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
-rw-r--r--sound/soc/codecs/arizona.c16
-rw-r--r--sound/soc/codecs/arizona.h3
2 files changed, 11 insertions, 8 deletions
diff --git a/sound/soc/codecs/arizona.c b/sound/soc/codecs/arizona.c
index e770945fa019..149e44f42f84 100644
--- a/sound/soc/codecs/arizona.c
+++ b/sound/soc/codecs/arizona.c
@@ -1145,10 +1145,12 @@ int arizona_set_fll(struct arizona_fll *fll, int source,
1145 struct arizona_fll_cfg ref, sync; 1145 struct arizona_fll_cfg ref, sync;
1146 int ret; 1146 int ret;
1147 1147
1148 if (fll->fref == Fref && fll->fout == Fout)
1149 return 0;
1150
1151 if (fll->ref_src < 0 || fll->ref_src == source) { 1148 if (fll->ref_src < 0 || fll->ref_src == source) {
1149 if (fll->sync_src == -1 &&
1150 fll->ref_src == source && fll->ref_freq == Fref &&
1151 fll->fout == Fout)
1152 return 0;
1153
1152 if (Fout) { 1154 if (Fout) {
1153 ret = arizona_calc_fll(fll, &ref, Fref, Fout); 1155 ret = arizona_calc_fll(fll, &ref, Fref, Fout);
1154 if (ret != 0) 1156 if (ret != 0)
@@ -1159,6 +1161,10 @@ int arizona_set_fll(struct arizona_fll *fll, int source,
1159 fll->ref_src = source; 1161 fll->ref_src = source;
1160 fll->ref_freq = Fref; 1162 fll->ref_freq = Fref;
1161 } else { 1163 } else {
1164 if (fll->sync_src == source &&
1165 fll->sync_freq == Fref && fll->fout == Fout)
1166 return 0;
1167
1162 if (Fout) { 1168 if (Fout) {
1163 ret = arizona_calc_fll(fll, &ref, fll->ref_freq, Fout); 1169 ret = arizona_calc_fll(fll, &ref, fll->ref_freq, Fout);
1164 if (ret != 0) 1170 if (ret != 0)
@@ -1172,6 +1178,7 @@ int arizona_set_fll(struct arizona_fll *fll, int source,
1172 fll->sync_src = source; 1178 fll->sync_src = source;
1173 fll->sync_freq = Fref; 1179 fll->sync_freq = Fref;
1174 } 1180 }
1181 fll->fout = Fout;
1175 1182
1176 if (Fout) { 1183 if (Fout) {
1177 arizona_enable_fll(fll, &ref, &sync); 1184 arizona_enable_fll(fll, &ref, &sync);
@@ -1179,9 +1186,6 @@ int arizona_set_fll(struct arizona_fll *fll, int source,
1179 arizona_disable_fll(fll); 1186 arizona_disable_fll(fll);
1180 } 1187 }
1181 1188
1182 fll->fref = Fref;
1183 fll->fout = Fout;
1184
1185 return 0; 1189 return 0;
1186} 1190}
1187EXPORT_SYMBOL_GPL(arizona_set_fll); 1191EXPORT_SYMBOL_GPL(arizona_set_fll);
diff --git a/sound/soc/codecs/arizona.h b/sound/soc/codecs/arizona.h
index 37766b547b9d..bedf12a527e5 100644
--- a/sound/soc/codecs/arizona.h
+++ b/sound/soc/codecs/arizona.h
@@ -198,9 +198,8 @@ struct arizona_fll {
198 unsigned int base; 198 unsigned int base;
199 unsigned int vco_mult; 199 unsigned int vco_mult;
200 struct completion ok; 200 struct completion ok;
201 unsigned int fref;
202 unsigned int fout;
203 201
202 unsigned int fout;
204 int sync_src; 203 int sync_src;
205 unsigned int sync_freq; 204 unsigned int sync_freq;
206 int ref_src; 205 int ref_src;