summaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/wm5102.c
diff options
context:
space:
mode:
authorCharles Keepax <ckeepax@opensource.wolfsonmicro.com>2014-06-06 14:14:05 +0100
committerMark Brown <broonie@linaro.org>2014-06-09 21:19:50 +0100
commitcc9e92431ee9c7fe974266e0e6533a1a68e45539 (patch)
tree531abd966bb661d7c097f8074ec9f469fe5ed3c9 /sound/soc/codecs/wm5102.c
parented70f3a264e9f746eaf17c96ccc4c9b7eda742dc (diff)
downloadlinux-cc9e92431ee9c7fe974266e0e6533a1a68e45539.tar.bz2
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/wm5102.c')
-rw-r--r--sound/soc/codecs/wm5102.c62
1 files changed, 62 insertions, 0 deletions
diff --git a/sound/soc/codecs/wm5102.c b/sound/soc/codecs/wm5102.c
index dcf1d12cfef8..7bf2397fc25a 100644
--- a/sound/soc/codecs/wm5102.c
+++ b/sound/soc/codecs/wm5102.c
@@ -612,6 +612,62 @@ static int wm5102_sysclk_ev(struct snd_soc_dapm_widget *w,
return 0;
}
+static int wm5102_out_comp_coeff_get(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
+ struct arizona *arizona = dev_get_drvdata(codec->dev->parent);
+ uint16_t data;
+
+ mutex_lock(&codec->mutex);
+ data = cpu_to_be16(arizona->dac_comp_coeff);
+ memcpy(ucontrol->value.bytes.data, &data, sizeof(data));
+ mutex_unlock(&codec->mutex);
+
+ return 0;
+}
+
+static int wm5102_out_comp_coeff_put(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
+ struct arizona *arizona = dev_get_drvdata(codec->dev->parent);
+
+ mutex_lock(&codec->mutex);
+ memcpy(&arizona->dac_comp_coeff, ucontrol->value.bytes.data,
+ sizeof(arizona->dac_comp_coeff));
+ arizona->dac_comp_coeff = be16_to_cpu(arizona->dac_comp_coeff);
+ mutex_unlock(&codec->mutex);
+
+ return 0;
+}
+
+static int wm5102_out_comp_switch_get(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
+ struct arizona *arizona = dev_get_drvdata(codec->dev->parent);
+
+ mutex_lock(&codec->mutex);
+ ucontrol->value.integer.value[0] = arizona->dac_comp_enabled;
+ mutex_unlock(&codec->mutex);
+
+ return 0;
+}
+
+static int wm5102_out_comp_switch_put(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_value *ucontrol)
+{
+ struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
+ struct arizona *arizona = dev_get_drvdata(codec->dev->parent);
+
+ mutex_lock(&codec->mutex);
+ arizona->dac_comp_enabled = ucontrol->value.integer.value[0];
+ mutex_unlock(&codec->mutex);
+
+ return 0;
+}
+
static const char *wm5102_osr_text[] = {
"Low power", "Normal", "High performance",
};
@@ -843,6 +899,12 @@ SOC_SINGLE_TLV("Noise Gate Threshold Volume", ARIZONA_NOISE_GATE_CONTROL,
ARIZONA_NGATE_THR_SHIFT, 7, 1, ng_tlv),
SOC_ENUM("Noise Gate Hold", arizona_ng_hold),
+SND_SOC_BYTES_EXT("Output Compensation Coefficient", 2,
+ wm5102_out_comp_coeff_get, wm5102_out_comp_coeff_put),
+
+SOC_SINGLE_EXT("Output Compensation Switch", 0, 0, 1, 0,
+ wm5102_out_comp_switch_get, wm5102_out_comp_switch_put),
+
WM5102_NG_SRC("HPOUT1L", ARIZONA_NOISE_GATE_SELECT_1L),
WM5102_NG_SRC("HPOUT1R", ARIZONA_NOISE_GATE_SELECT_1R),
WM5102_NG_SRC("HPOUT2L", ARIZONA_NOISE_GATE_SELECT_2L),