aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/arizona.c
diff options
context:
space:
mode:
authorCharles Keepax <ckeepax@opensource.wolfsonmicro.com>2014-06-06 09:14:05 -0400
committerMark Brown <broonie@linaro.org>2014-06-09 16:19:50 -0400
commitcc9e92431ee9c7fe974266e0e6533a1a68e45539 (patch)
tree531abd966bb661d7c097f8074ec9f469fe5ed3c9 /sound/soc/codecs/arizona.c
parented70f3a264e9f746eaf17c96ccc4c9b7eda742dc (diff)
ASoC: wm5102: Add controls to allow shaping of ultrasonic response
Add controls to allow custom shaping of the ultrasonic response. This custom shaping can be turned on/off at runtime, although, it should be noted that settings will not affect a currently open audio stream, they will be applied when the next audio stream is started. Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'sound/soc/codecs/arizona.c')
-rw-r--r--sound/soc/codecs/arizona.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/sound/soc/codecs/arizona.c b/sound/soc/codecs/arizona.c
index e77f61c387f7..41b56ee6ff51 100644
--- a/sound/soc/codecs/arizona.c
+++ b/sound/soc/codecs/arizona.c
@@ -1127,6 +1127,31 @@ static int arizona_startup(struct snd_pcm_substream *substream,
1127 constraint); 1127 constraint);
1128} 1128}
1129 1129
1130static void arizona_wm5102_set_dac_comp(struct snd_soc_codec *codec,
1131 unsigned int rate)
1132{
1133 struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec);
1134 struct arizona *arizona = priv->arizona;
1135 struct reg_default dac_comp[] = {
1136 { 0x80, 0x3 },
1137 { ARIZONA_DAC_COMP_1, 0 },
1138 { ARIZONA_DAC_COMP_2, 0 },
1139 { 0x80, 0x0 },
1140 };
1141
1142 mutex_lock(&codec->mutex);
1143
1144 dac_comp[1].def = arizona->dac_comp_coeff;
1145 if (rate >= 176400)
1146 dac_comp[2].def = arizona->dac_comp_enabled;
1147
1148 mutex_unlock(&codec->mutex);
1149
1150 regmap_multi_reg_write(arizona->regmap,
1151 dac_comp,
1152 ARRAY_SIZE(dac_comp));
1153}
1154
1130static int arizona_hw_params_rate(struct snd_pcm_substream *substream, 1155static int arizona_hw_params_rate(struct snd_pcm_substream *substream,
1131 struct snd_pcm_hw_params *params, 1156 struct snd_pcm_hw_params *params,
1132 struct snd_soc_dai *dai) 1157 struct snd_soc_dai *dai)
@@ -1153,6 +1178,15 @@ static int arizona_hw_params_rate(struct snd_pcm_substream *substream,
1153 1178
1154 switch (dai_priv->clk) { 1179 switch (dai_priv->clk) {
1155 case ARIZONA_CLK_SYSCLK: 1180 case ARIZONA_CLK_SYSCLK:
1181 switch (priv->arizona->type) {
1182 case WM5102:
1183 arizona_wm5102_set_dac_comp(codec,
1184 params_rate(params));
1185 break;
1186 default:
1187 break;
1188 }
1189
1156 snd_soc_update_bits(codec, ARIZONA_SAMPLE_RATE_1, 1190 snd_soc_update_bits(codec, ARIZONA_SAMPLE_RATE_1,
1157 ARIZONA_SAMPLE_RATE_1_MASK, sr_val); 1191 ARIZONA_SAMPLE_RATE_1_MASK, sr_val);
1158 if (base) 1192 if (base)