ASoC: pcm512x: Implement analogue volume control
authorMark Brown <broonie@linaro.org>
Fri, 7 Feb 2014 19:16:56 +0000 (19:16 +0000)
committerMark Brown <broonie@linaro.org>
Fri, 7 Feb 2014 19:53:53 +0000 (19:53 +0000)
There are some analogue volume controls in page 1 of the register map so
implement support for them now that we can access the registers.

Signed-off-by: Mark Brown <broonie@linaro.org>
sound/soc/codecs/pcm512x.c
sound/soc/codecs/pcm512x.h

index cdcb51e4c86f135afbc0b1aa8fb087a5060c5b81..3a0bbb6ab242ff4c1cd325948f06f6788d0a2a59 100644 (file)
@@ -184,6 +184,8 @@ static bool pcm512x_volatile(struct device *dev, unsigned int reg)
 }
 
 static const DECLARE_TLV_DB_SCALE(digital_tlv, -10350, 50, 1);
+static const DECLARE_TLV_DB_SCALE(analog_tlv, -600, 600, 0);
+static const DECLARE_TLV_DB_SCALE(boost_tlv, 0, 80, 0);
 
 static const char * const pcm512x_dsp_program_texts[] = {
        "FIR interpolation with de-emphasis",
@@ -261,6 +263,10 @@ static const struct soc_enum pcm512x_veds =
 static const struct snd_kcontrol_new pcm512x_controls[] = {
 SOC_DOUBLE_R_TLV("Playback Digital Volume", PCM512x_DIGITAL_VOLUME_2,
                 PCM512x_DIGITAL_VOLUME_3, 0, 255, 1, digital_tlv),
+SOC_DOUBLE_TLV("Playback Volume", PCM512x_ANALOG_GAIN_CTRL,
+              PCM512x_LAGN_SHIFT, PCM512x_RAGN_SHIFT, 1, 1, analog_tlv),
+SOC_DOUBLE_TLV("Playback Boost Volume", PCM512x_ANALOG_GAIN_BOOST,
+              PCM512x_AGBL_SHIFT, PCM512x_AGBR_SHIFT, 1, 0, boost_tlv),
 SOC_DOUBLE("Playback Digital Switch", PCM512x_MUTE, PCM512x_RQML_SHIFT,
           PCM512x_RQMR_SHIFT, 1, 1),
 
index e58743c965d6a6d64d168a514220d67450500513..ac4a52c9ccf4fcc6b2f9791d1f127bd42c289f54 100644 (file)
 #define PCM512x_AMLE_SHIFT 1
 #define PCM512x_AMLR_SHIFT 0
 
+/* Page 1, Register 2 - analog volume control */
+#define PCM512x_RAGN_SHIFT 0
+#define PCM512x_LAGN_SHIFT 4
+
+/* Page 1, Register 7 - analog boost control */
+#define PCM512x_AGBR_SHIFT 0
+#define PCM512x_AGBL_SHIFT 4
+
 #endif
This page took 0.0256 seconds and 5 git commands to generate.