diff options
author | Charles Keepax <ckeepax@opensource.wolfsonmicro.com> | 2013-02-20 12:28:40 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2013-03-03 22:01:00 -0500 |
commit | ee929a9780605f21ad67a1ccb626baa41e038c1a (patch) | |
tree | 7f46c9218a20210e1fa8988d723af3c5ba90c0b2 /sound/soc/codecs/arizona.c | |
parent | de1e6eedddeab2fa417c38c231d896198f903129 (diff) |
ASoC: arizona: Add support for directly setting the FLL REFCLK
This patch allows the REFCLK to be set directly allowing much greater
flexibility in how the FLLs are configured.
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/codecs/arizona.c')
-rw-r--r-- | sound/soc/codecs/arizona.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/sound/soc/codecs/arizona.c b/sound/soc/codecs/arizona.c index 149e44f42f84..2bebfae3485f 100644 --- a/sound/soc/codecs/arizona.c +++ b/sound/soc/codecs/arizona.c | |||
@@ -1139,6 +1139,45 @@ static void arizona_disable_fll(struct arizona_fll *fll) | |||
1139 | pm_runtime_put_autosuspend(arizona->dev); | 1139 | pm_runtime_put_autosuspend(arizona->dev); |
1140 | } | 1140 | } |
1141 | 1141 | ||
1142 | int arizona_set_fll_refclk(struct arizona_fll *fll, int source, | ||
1143 | unsigned int Fref, unsigned int Fout) | ||
1144 | { | ||
1145 | struct arizona_fll_cfg ref, sync; | ||
1146 | int ret; | ||
1147 | |||
1148 | if (source < 0) | ||
1149 | return -EINVAL; | ||
1150 | |||
1151 | if (fll->ref_src == source && fll->ref_freq == Fref && | ||
1152 | fll->fout == Fout) | ||
1153 | return 0; | ||
1154 | |||
1155 | if (Fout) { | ||
1156 | ret = arizona_calc_fll(fll, &ref, Fref, Fout); | ||
1157 | if (ret != 0) | ||
1158 | return ret; | ||
1159 | |||
1160 | if (fll->sync_src >= 0) { | ||
1161 | ret = arizona_calc_fll(fll, &sync, fll->sync_freq, Fout); | ||
1162 | if (ret != 0) | ||
1163 | return ret; | ||
1164 | } | ||
1165 | } | ||
1166 | |||
1167 | fll->ref_src = source; | ||
1168 | fll->ref_freq = Fref; | ||
1169 | fll->fout = Fout; | ||
1170 | |||
1171 | if (Fout) { | ||
1172 | arizona_enable_fll(fll, &ref, &sync); | ||
1173 | } else { | ||
1174 | arizona_disable_fll(fll); | ||
1175 | } | ||
1176 | |||
1177 | return 0; | ||
1178 | } | ||
1179 | EXPORT_SYMBOL_GPL(arizona_set_fll_refclk); | ||
1180 | |||
1142 | int arizona_set_fll(struct arizona_fll *fll, int source, | 1181 | int arizona_set_fll(struct arizona_fll *fll, int source, |
1143 | unsigned int Fref, unsigned int Fout) | 1182 | unsigned int Fref, unsigned int Fout) |
1144 | { | 1183 | { |