diff options
author | Lars-Peter Clausen <lars@metafoo.de> | 2012-10-27 11:15:06 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2012-10-27 16:31:42 -0400 |
commit | a484a9a338b386e26d9dac14a76d59afa4e8bb3e (patch) | |
tree | 4087bf14b0ab087f3e96fb7816bdd3bf7c6ad1fd /sound/soc/codecs/jz4740.c | |
parent | 6f0c0580b70c89094b3422ba81118c7b959c7556 (diff) |
ASoC: jz4740-codec: Add dB information
Add dB TLV ranges for the various volume controls.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/codecs/jz4740.c')
-rw-r--r-- | sound/soc/codecs/jz4740.c | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/sound/soc/codecs/jz4740.c b/sound/soc/codecs/jz4740.c index 85d9cabe6d55..51b4f99bbd6a 100644 --- a/sound/soc/codecs/jz4740.c +++ b/sound/soc/codecs/jz4740.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <sound/pcm_params.h> | 24 | #include <sound/pcm_params.h> |
25 | #include <sound/initval.h> | 25 | #include <sound/initval.h> |
26 | #include <sound/soc.h> | 26 | #include <sound/soc.h> |
27 | #include <sound/tlv.h> | ||
27 | 28 | ||
28 | #define JZ4740_REG_CODEC_1 0x0 | 29 | #define JZ4740_REG_CODEC_1 0x0 |
29 | #define JZ4740_REG_CODEC_2 0x1 | 30 | #define JZ4740_REG_CODEC_2 0x1 |
@@ -95,15 +96,27 @@ static int jz4740_codec_write(struct snd_soc_codec *codec, unsigned int reg, | |||
95 | return 0; | 96 | return 0; |
96 | } | 97 | } |
97 | 98 | ||
99 | static const unsigned int jz4740_mic_tlv[] = { | ||
100 | TLV_DB_RANGE_HEAD(2), | ||
101 | 0, 2, TLV_DB_SCALE_ITEM(0, 600, 0), | ||
102 | 3, 3, TLV_DB_SCALE_ITEM(2000, 0, 0), | ||
103 | }; | ||
104 | |||
105 | static const DECLARE_TLV_DB_SCALE(jz4740_out_tlv, 0, 200, 0); | ||
106 | static const DECLARE_TLV_DB_SCALE(jz4740_in_tlv, -3450, 150, 0); | ||
107 | |||
98 | static const struct snd_kcontrol_new jz4740_codec_controls[] = { | 108 | static const struct snd_kcontrol_new jz4740_codec_controls[] = { |
99 | SOC_SINGLE("Master Playback Volume", JZ4740_REG_CODEC_2, | 109 | SOC_SINGLE_TLV("Master Playback Volume", JZ4740_REG_CODEC_2, |
100 | JZ4740_CODEC_2_HEADPHONE_VOLUME_OFFSET, 3, 0), | 110 | JZ4740_CODEC_2_HEADPHONE_VOLUME_OFFSET, 3, 0, |
101 | SOC_SINGLE("Master Capture Volume", JZ4740_REG_CODEC_2, | 111 | jz4740_out_tlv), |
102 | JZ4740_CODEC_2_INPUT_VOLUME_OFFSET, 31, 0), | 112 | SOC_SINGLE_TLV("Master Capture Volume", JZ4740_REG_CODEC_2, |
113 | JZ4740_CODEC_2_INPUT_VOLUME_OFFSET, 31, 0, | ||
114 | jz4740_in_tlv), | ||
103 | SOC_SINGLE("Master Playback Switch", JZ4740_REG_CODEC_1, | 115 | SOC_SINGLE("Master Playback Switch", JZ4740_REG_CODEC_1, |
104 | JZ4740_CODEC_1_HEADPHONE_DISABLE_OFFSET, 1, 1), | 116 | JZ4740_CODEC_1_HEADPHONE_DISABLE_OFFSET, 1, 1), |
105 | SOC_SINGLE("Mic Capture Volume", JZ4740_REG_CODEC_2, | 117 | SOC_SINGLE_TLV("Mic Capture Volume", JZ4740_REG_CODEC_2, |
106 | JZ4740_CODEC_2_MIC_BOOST_GAIN_OFFSET, 3, 0), | 118 | JZ4740_CODEC_2_MIC_BOOST_GAIN_OFFSET, 3, 0, |
119 | jz4740_mic_tlv), | ||
107 | }; | 120 | }; |
108 | 121 | ||
109 | static const struct snd_kcontrol_new jz4740_codec_output_controls[] = { | 122 | static const struct snd_kcontrol_new jz4740_codec_output_controls[] = { |