diff options
author | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 2010-07-01 01:23:45 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2010-07-01 12:08:47 -0400 |
commit | a300de3cfffb9ce7d3e87c8c4f24d22f0a081402 (patch) | |
tree | 966933a64feadc3ccc2047f4435342f68fa85ead /sound/soc/codecs | |
parent | 338de9d9dac038a76fd6577cf30aa3ada07ae756 (diff) |
ASoC: ak4642: Add Digital Playback Volume control
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/codecs')
-rw-r--r-- | sound/soc/codecs/ak4642.c | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/sound/soc/codecs/ak4642.c b/sound/soc/codecs/ak4642.c index 8d56811c7306..60b83b482467 100644 --- a/sound/soc/codecs/ak4642.c +++ b/sound/soc/codecs/ak4642.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/slab.h> | 28 | #include <linux/slab.h> |
29 | #include <sound/soc-dapm.h> | 29 | #include <sound/soc-dapm.h> |
30 | #include <sound/initval.h> | 30 | #include <sound/initval.h> |
31 | #include <sound/tlv.h> | ||
31 | 32 | ||
32 | #include "ak4642.h" | 33 | #include "ak4642.h" |
33 | 34 | ||
@@ -103,6 +104,23 @@ | |||
103 | 104 | ||
104 | struct snd_soc_codec_device soc_codec_dev_ak4642; | 105 | struct snd_soc_codec_device soc_codec_dev_ak4642; |
105 | 106 | ||
107 | /* | ||
108 | * Playback Volume (table 39) | ||
109 | * | ||
110 | * max : 0x00 : +12.0 dB | ||
111 | * ( 0.5 dB step ) | ||
112 | * min : 0xFE : -115.0 dB | ||
113 | * mute: 0xFF | ||
114 | */ | ||
115 | static const DECLARE_TLV_DB_SCALE(out_tlv, -11500, 50, 1); | ||
116 | |||
117 | static const struct snd_kcontrol_new ak4642_snd_controls[] = { | ||
118 | |||
119 | SOC_DOUBLE_R_TLV("Digital Playback Volume", L_DVC, R_DVC, | ||
120 | 0, 0xFF, 1, out_tlv), | ||
121 | }; | ||
122 | |||
123 | |||
106 | /* codec private data */ | 124 | /* codec private data */ |
107 | struct ak4642_priv { | 125 | struct ak4642_priv { |
108 | struct snd_soc_codec codec; | 126 | struct snd_soc_codec codec; |
@@ -196,7 +214,6 @@ static int ak4642_dai_startup(struct snd_pcm_substream *substream, | |||
196 | * | 214 | * |
197 | * PLL, Master Mode | 215 | * PLL, Master Mode |
198 | * Audio I/F Format :MSB justified (ADC & DAC) | 216 | * Audio I/F Format :MSB justified (ADC & DAC) |
199 | * Digital Volume: -8dB | ||
200 | * Bass Boost Level : Middle | 217 | * Bass Boost Level : Middle |
201 | * | 218 | * |
202 | * This operation came from example code of | 219 | * This operation came from example code of |
@@ -206,8 +223,6 @@ static int ak4642_dai_startup(struct snd_pcm_substream *substream, | |||
206 | ak4642_write(codec, 0x0e, 0x19); | 223 | ak4642_write(codec, 0x0e, 0x19); |
207 | ak4642_write(codec, 0x09, 0x91); | 224 | ak4642_write(codec, 0x09, 0x91); |
208 | ak4642_write(codec, 0x0c, 0x91); | 225 | ak4642_write(codec, 0x0c, 0x91); |
209 | ak4642_write(codec, 0x0a, 0x28); | ||
210 | ak4642_write(codec, 0x0d, 0x28); | ||
211 | ak4642_write(codec, 0x00, 0x64); | 226 | ak4642_write(codec, 0x00, 0x64); |
212 | snd_soc_update_bits(codec, PW_MGMT2, PMHP_MASK, PMHP); | 227 | snd_soc_update_bits(codec, PW_MGMT2, PMHP_MASK, PMHP); |
213 | snd_soc_update_bits(codec, PW_MGMT2, HPMTN, HPMTN); | 228 | snd_soc_update_bits(codec, PW_MGMT2, HPMTN, HPMTN); |
@@ -540,6 +555,9 @@ static int ak4642_probe(struct platform_device *pdev) | |||
540 | goto pcm_err; | 555 | goto pcm_err; |
541 | } | 556 | } |
542 | 557 | ||
558 | snd_soc_add_controls(ak4642_codec, ak4642_snd_controls, | ||
559 | ARRAY_SIZE(ak4642_snd_controls)); | ||
560 | |||
543 | dev_info(&pdev->dev, "AK4642 Audio Codec %s", AK4642_VERSION); | 561 | dev_info(&pdev->dev, "AK4642 Audio Codec %s", AK4642_VERSION); |
544 | return ret; | 562 | return ret; |
545 | 563 | ||