diff options
Diffstat (limited to 'sound/soc/codecs/arizona.c')
-rw-r--r-- | sound/soc/codecs/arizona.c | 53 |
1 files changed, 52 insertions, 1 deletions
diff --git a/sound/soc/codecs/arizona.c b/sound/soc/codecs/arizona.c index 054967d8bac2..adf397b9d0e6 100644 --- a/sound/soc/codecs/arizona.c +++ b/sound/soc/codecs/arizona.c | |||
@@ -226,6 +226,31 @@ EXPORT_SYMBOL_GPL(arizona_mixer_values); | |||
226 | const DECLARE_TLV_DB_SCALE(arizona_mixer_tlv, -3200, 100, 0); | 226 | const DECLARE_TLV_DB_SCALE(arizona_mixer_tlv, -3200, 100, 0); |
227 | EXPORT_SYMBOL_GPL(arizona_mixer_tlv); | 227 | EXPORT_SYMBOL_GPL(arizona_mixer_tlv); |
228 | 228 | ||
229 | static const char *arizona_vol_ramp_text[] = { | ||
230 | "0ms/6dB", "0.5ms/6dB", "1ms/6dB", "2ms/6dB", "4ms/6dB", "8ms/6dB", | ||
231 | "15ms/6dB", "30ms/6dB", | ||
232 | }; | ||
233 | |||
234 | const struct soc_enum arizona_in_vd_ramp = | ||
235 | SOC_ENUM_SINGLE(ARIZONA_INPUT_VOLUME_RAMP, | ||
236 | ARIZONA_IN_VD_RAMP_SHIFT, 7, arizona_vol_ramp_text); | ||
237 | EXPORT_SYMBOL_GPL(arizona_in_vd_ramp); | ||
238 | |||
239 | const struct soc_enum arizona_in_vi_ramp = | ||
240 | SOC_ENUM_SINGLE(ARIZONA_INPUT_VOLUME_RAMP, | ||
241 | ARIZONA_IN_VI_RAMP_SHIFT, 7, arizona_vol_ramp_text); | ||
242 | EXPORT_SYMBOL_GPL(arizona_in_vi_ramp); | ||
243 | |||
244 | const struct soc_enum arizona_out_vd_ramp = | ||
245 | SOC_ENUM_SINGLE(ARIZONA_OUTPUT_VOLUME_RAMP, | ||
246 | ARIZONA_OUT_VD_RAMP_SHIFT, 7, arizona_vol_ramp_text); | ||
247 | EXPORT_SYMBOL_GPL(arizona_out_vd_ramp); | ||
248 | |||
249 | const struct soc_enum arizona_out_vi_ramp = | ||
250 | SOC_ENUM_SINGLE(ARIZONA_OUTPUT_VOLUME_RAMP, | ||
251 | ARIZONA_OUT_VI_RAMP_SHIFT, 7, arizona_vol_ramp_text); | ||
252 | EXPORT_SYMBOL_GPL(arizona_out_vi_ramp); | ||
253 | |||
229 | static const char *arizona_lhpf_mode_text[] = { | 254 | static const char *arizona_lhpf_mode_text[] = { |
230 | "Low-pass", "High-pass" | 255 | "Low-pass", "High-pass" |
231 | }; | 256 | }; |
@@ -380,6 +405,18 @@ int arizona_set_sysclk(struct snd_soc_codec *codec, int clk_id, | |||
380 | case 49152000: | 405 | case 49152000: |
381 | val |= 3 << ARIZONA_SYSCLK_FREQ_SHIFT; | 406 | val |= 3 << ARIZONA_SYSCLK_FREQ_SHIFT; |
382 | break; | 407 | break; |
408 | case 67737600: | ||
409 | case 73728000: | ||
410 | val |= 4 << ARIZONA_SYSCLK_FREQ_SHIFT; | ||
411 | break; | ||
412 | case 90316800: | ||
413 | case 98304000: | ||
414 | val |= 5 << ARIZONA_SYSCLK_FREQ_SHIFT; | ||
415 | break; | ||
416 | case 135475200: | ||
417 | case 147456000: | ||
418 | val |= 6 << ARIZONA_SYSCLK_FREQ_SHIFT; | ||
419 | break; | ||
383 | default: | 420 | default: |
384 | return -EINVAL; | 421 | return -EINVAL; |
385 | } | 422 | } |
@@ -737,6 +774,9 @@ static int arizona_dai_set_sysclk(struct snd_soc_dai *dai, | |||
737 | return -EBUSY; | 774 | return -EBUSY; |
738 | } | 775 | } |
739 | 776 | ||
777 | dev_dbg(codec->dev, "Setting AIF%d to %s\n", dai->id + 1, | ||
778 | arizona_dai_clk_str(clk_id)); | ||
779 | |||
740 | memset(&routes, 0, sizeof(routes)); | 780 | memset(&routes, 0, sizeof(routes)); |
741 | routes[0].sink = dai->driver->capture.stream_name; | 781 | routes[0].sink = dai->driver->capture.stream_name; |
742 | routes[1].sink = dai->driver->playback.stream_name; | 782 | routes[1].sink = dai->driver->playback.stream_name; |
@@ -749,6 +789,8 @@ static int arizona_dai_set_sysclk(struct snd_soc_dai *dai, | |||
749 | routes[1].source = arizona_dai_clk_str(clk_id); | 789 | routes[1].source = arizona_dai_clk_str(clk_id); |
750 | snd_soc_dapm_add_routes(&codec->dapm, routes, ARRAY_SIZE(routes)); | 790 | snd_soc_dapm_add_routes(&codec->dapm, routes, ARRAY_SIZE(routes)); |
751 | 791 | ||
792 | dai_priv->clk = clk_id; | ||
793 | |||
752 | return snd_soc_dapm_sync(&codec->dapm); | 794 | return snd_soc_dapm_sync(&codec->dapm); |
753 | } | 795 | } |
754 | 796 | ||
@@ -925,6 +967,9 @@ int arizona_set_fll(struct arizona_fll *fll, int source, | |||
925 | bool ena; | 967 | bool ena; |
926 | int ret; | 968 | int ret; |
927 | 969 | ||
970 | if (fll->fref == Fref && fll->fout == Fout) | ||
971 | return 0; | ||
972 | |||
928 | ret = regmap_read(arizona->regmap, fll->base + 1, ®); | 973 | ret = regmap_read(arizona->regmap, fll->base + 1, ®); |
929 | if (ret != 0) { | 974 | if (ret != 0) { |
930 | arizona_fll_err(fll, "Failed to read current state: %d\n", | 975 | arizona_fll_err(fll, "Failed to read current state: %d\n", |
@@ -970,6 +1015,9 @@ int arizona_set_fll(struct arizona_fll *fll, int source, | |||
970 | if (ena) | 1015 | if (ena) |
971 | pm_runtime_put_autosuspend(arizona->dev); | 1016 | pm_runtime_put_autosuspend(arizona->dev); |
972 | 1017 | ||
1018 | fll->fref = Fref; | ||
1019 | fll->fout = Fout; | ||
1020 | |||
973 | return 0; | 1021 | return 0; |
974 | } | 1022 | } |
975 | 1023 | ||
@@ -998,10 +1046,13 @@ int arizona_set_fll(struct arizona_fll *fll, int source, | |||
998 | ARIZONA_FLL1_SYNC_ENA); | 1046 | ARIZONA_FLL1_SYNC_ENA); |
999 | 1047 | ||
1000 | ret = wait_for_completion_timeout(&fll->ok, | 1048 | ret = wait_for_completion_timeout(&fll->ok, |
1001 | msecs_to_jiffies(25)); | 1049 | msecs_to_jiffies(250)); |
1002 | if (ret == 0) | 1050 | if (ret == 0) |
1003 | arizona_fll_warn(fll, "Timed out waiting for lock\n"); | 1051 | arizona_fll_warn(fll, "Timed out waiting for lock\n"); |
1004 | 1052 | ||
1053 | fll->fref = Fref; | ||
1054 | fll->fout = Fout; | ||
1055 | |||
1005 | return 0; | 1056 | return 0; |
1006 | } | 1057 | } |
1007 | EXPORT_SYMBOL_GPL(arizona_set_fll); | 1058 | EXPORT_SYMBOL_GPL(arizona_set_fll); |