diff options
author | Jarkko Nikula <jarkko.nikula@nokia.com> | 2009-02-09 07:27:07 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2009-02-09 13:27:59 -0500 |
commit | 7565fc38cc8c3a2742d63e957199d70a82d2faf1 (patch) | |
tree | 6f90c8d567356bfa480f876c1b09acb11dfaaae2 | |
parent | b93f74f604c53b546fced33d11aee722560de249 (diff) |
ASoC: TLV320AIC3X: Add TLV information for volume controls
TLV320AIC3X volume controls are logarithmic. Export their dB ranges.
Signed-off-by: Jarkko Nikula <jarkko.nikula@nokia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
-rw-r--r-- | sound/soc/codecs/tlv320aic3x.c | 114 |
1 files changed, 73 insertions, 41 deletions
diff --git a/sound/soc/codecs/tlv320aic3x.c b/sound/soc/codecs/tlv320aic3x.c index cdb6dec14e1c..d638e3f0728b 100644 --- a/sound/soc/codecs/tlv320aic3x.c +++ b/sound/soc/codecs/tlv320aic3x.c | |||
@@ -45,6 +45,7 @@ | |||
45 | #include <sound/soc.h> | 45 | #include <sound/soc.h> |
46 | #include <sound/soc-dapm.h> | 46 | #include <sound/soc-dapm.h> |
47 | #include <sound/initval.h> | 47 | #include <sound/initval.h> |
48 | #include <sound/tlv.h> | ||
48 | 49 | ||
49 | #include "tlv320aic3x.h" | 50 | #include "tlv320aic3x.h" |
50 | 51 | ||
@@ -250,56 +251,86 @@ static const struct soc_enum aic3x_enum[] = { | |||
250 | SOC_ENUM_DOUBLE(AIC3X_CODEC_DFILT_CTRL, 6, 4, 4, aic3x_adc_hpf), | 251 | SOC_ENUM_DOUBLE(AIC3X_CODEC_DFILT_CTRL, 6, 4, 4, aic3x_adc_hpf), |
251 | }; | 252 | }; |
252 | 253 | ||
254 | /* | ||
255 | * DAC digital volumes. From -63.5 to 0 dB in 0.5 dB steps | ||
256 | */ | ||
257 | static DECLARE_TLV_DB_SCALE(dac_tlv, -6350, 50, 0); | ||
258 | /* ADC PGA gain volumes. From 0 to 59.5 dB in 0.5 dB steps */ | ||
259 | static DECLARE_TLV_DB_SCALE(adc_tlv, 0, 50, 0); | ||
260 | /* | ||
261 | * Output stage volumes. From -78.3 to 0 dB. Muted below -78.3 dB. | ||
262 | * Step size is approximately 0.5 dB over most of the scale but increasing | ||
263 | * near the very low levels. | ||
264 | * Define dB scale so that it is mostly correct for range about -55 to 0 dB | ||
265 | * but having increasing dB difference below that (and where it doesn't count | ||
266 | * so much). This setting shows -50 dB (actual is -50.3 dB) for register | ||
267 | * value 100 and -58.5 dB (actual is -78.3 dB) for register value 117. | ||
268 | */ | ||
269 | static DECLARE_TLV_DB_SCALE(output_stage_tlv, -5900, 50, 1); | ||
270 | |||
253 | static const struct snd_kcontrol_new aic3x_snd_controls[] = { | 271 | static const struct snd_kcontrol_new aic3x_snd_controls[] = { |
254 | /* Output */ | 272 | /* Output */ |
255 | SOC_DOUBLE_R("PCM Playback Volume", LDAC_VOL, RDAC_VOL, 0, 0x7f, 1), | 273 | SOC_DOUBLE_R_TLV("PCM Playback Volume", |
274 | LDAC_VOL, RDAC_VOL, 0, 0x7f, 1, dac_tlv), | ||
256 | 275 | ||
257 | SOC_DOUBLE_R("Line DAC Playback Volume", DACL1_2_LLOPM_VOL, | 276 | SOC_DOUBLE_R_TLV("Line DAC Playback Volume", |
258 | DACR1_2_RLOPM_VOL, 0, 118, 1), | 277 | DACL1_2_LLOPM_VOL, DACR1_2_RLOPM_VOL, |
278 | 0, 118, 1, output_stage_tlv), | ||
259 | SOC_SINGLE("LineL Playback Switch", LLOPM_CTRL, 3, 0x01, 0), | 279 | SOC_SINGLE("LineL Playback Switch", LLOPM_CTRL, 3, 0x01, 0), |
260 | SOC_SINGLE("LineR Playback Switch", RLOPM_CTRL, 3, 0x01, 0), | 280 | SOC_SINGLE("LineR Playback Switch", RLOPM_CTRL, 3, 0x01, 0), |
261 | SOC_DOUBLE_R("LineL DAC Playback Volume", DACL1_2_LLOPM_VOL, | 281 | SOC_DOUBLE_R_TLV("LineL DAC Playback Volume", |
262 | DACR1_2_LLOPM_VOL, 0, 118, 1), | 282 | DACL1_2_LLOPM_VOL, DACR1_2_LLOPM_VOL, |
263 | SOC_SINGLE("LineL Left PGA Bypass Playback Volume", PGAL_2_LLOPM_VOL, | 283 | 0, 118, 1, output_stage_tlv), |
264 | 0, 118, 1), | 284 | SOC_SINGLE_TLV("LineL Left PGA Bypass Playback Volume", |
265 | SOC_SINGLE("LineR Right PGA Bypass Playback Volume", PGAR_2_RLOPM_VOL, | 285 | PGAL_2_LLOPM_VOL, 0, 118, 1, output_stage_tlv), |
266 | 0, 118, 1), | 286 | SOC_SINGLE_TLV("LineR Right PGA Bypass Playback Volume", |
267 | SOC_DOUBLE_R("LineL Line2 Bypass Playback Volume", LINE2L_2_LLOPM_VOL, | 287 | PGAR_2_RLOPM_VOL, 0, 118, 1, output_stage_tlv), |
268 | LINE2R_2_LLOPM_VOL, 0, 118, 1), | 288 | SOC_DOUBLE_R_TLV("LineL Line2 Bypass Playback Volume", |
269 | SOC_DOUBLE_R("LineR Line2 Bypass Playback Volume", LINE2L_2_RLOPM_VOL, | 289 | LINE2L_2_LLOPM_VOL, LINE2R_2_LLOPM_VOL, |
270 | LINE2R_2_RLOPM_VOL, 0, 118, 1), | 290 | 0, 118, 1, output_stage_tlv), |
271 | 291 | SOC_DOUBLE_R_TLV("LineR Line2 Bypass Playback Volume", | |
272 | SOC_DOUBLE_R("Mono DAC Playback Volume", DACL1_2_MONOLOPM_VOL, | 292 | LINE2L_2_RLOPM_VOL, LINE2R_2_RLOPM_VOL, |
273 | DACR1_2_MONOLOPM_VOL, 0, 118, 1), | 293 | 0, 118, 1, output_stage_tlv), |
294 | |||
295 | SOC_DOUBLE_R_TLV("Mono DAC Playback Volume", | ||
296 | DACL1_2_MONOLOPM_VOL, DACR1_2_MONOLOPM_VOL, | ||
297 | 0, 118, 1, output_stage_tlv), | ||
274 | SOC_SINGLE("Mono DAC Playback Switch", MONOLOPM_CTRL, 3, 0x01, 0), | 298 | SOC_SINGLE("Mono DAC Playback Switch", MONOLOPM_CTRL, 3, 0x01, 0), |
275 | SOC_DOUBLE_R("Mono PGA Bypass Playback Volume", PGAL_2_MONOLOPM_VOL, | 299 | SOC_DOUBLE_R_TLV("Mono PGA Bypass Playback Volume", |
276 | PGAR_2_MONOLOPM_VOL, 0, 118, 1), | 300 | PGAL_2_MONOLOPM_VOL, PGAR_2_MONOLOPM_VOL, |
277 | SOC_DOUBLE_R("Mono Line2 Bypass Playback Volume", LINE2L_2_MONOLOPM_VOL, | 301 | 0, 118, 1, output_stage_tlv), |
278 | LINE2R_2_MONOLOPM_VOL, 0, 118, 1), | 302 | SOC_DOUBLE_R_TLV("Mono Line2 Bypass Playback Volume", |
279 | 303 | LINE2L_2_MONOLOPM_VOL, LINE2R_2_MONOLOPM_VOL, | |
280 | SOC_DOUBLE_R("HP DAC Playback Volume", DACL1_2_HPLOUT_VOL, | 304 | 0, 118, 1, output_stage_tlv), |
281 | DACR1_2_HPROUT_VOL, 0, 118, 1), | 305 | |
306 | SOC_DOUBLE_R_TLV("HP DAC Playback Volume", | ||
307 | DACL1_2_HPLOUT_VOL, DACR1_2_HPROUT_VOL, | ||
308 | 0, 118, 1, output_stage_tlv), | ||
282 | SOC_DOUBLE_R("HP DAC Playback Switch", HPLOUT_CTRL, HPROUT_CTRL, 3, | 309 | SOC_DOUBLE_R("HP DAC Playback Switch", HPLOUT_CTRL, HPROUT_CTRL, 3, |
283 | 0x01, 0), | 310 | 0x01, 0), |
284 | SOC_DOUBLE_R("HP Right PGA Bypass Playback Volume", PGAR_2_HPLOUT_VOL, | 311 | SOC_DOUBLE_R_TLV("HP Right PGA Bypass Playback Volume", |
285 | PGAR_2_HPROUT_VOL, 0, 118, 1), | 312 | PGAR_2_HPLOUT_VOL, PGAR_2_HPROUT_VOL, |
286 | SOC_SINGLE("HPL PGA Bypass Playback Volume", PGAL_2_HPLOUT_VOL, | 313 | 0, 118, 1, output_stage_tlv), |
287 | 0, 118, 1), | 314 | SOC_SINGLE_TLV("HPL PGA Bypass Playback Volume", |
288 | SOC_SINGLE("HPR PGA Bypass Playback Volume", PGAL_2_HPROUT_VOL, | 315 | PGAL_2_HPLOUT_VOL, 0, 118, 1, output_stage_tlv), |
289 | 0, 118, 1), | 316 | SOC_SINGLE_TLV("HPR PGA Bypass Playback Volume", |
290 | SOC_DOUBLE_R("HP Line2 Bypass Playback Volume", LINE2L_2_HPLOUT_VOL, | 317 | PGAL_2_HPROUT_VOL, 0, 118, 1, output_stage_tlv), |
291 | LINE2R_2_HPROUT_VOL, 0, 118, 1), | 318 | SOC_DOUBLE_R_TLV("HP Line2 Bypass Playback Volume", |
292 | 319 | LINE2L_2_HPLOUT_VOL, LINE2R_2_HPROUT_VOL, | |
293 | SOC_DOUBLE_R("HPCOM DAC Playback Volume", DACL1_2_HPLCOM_VOL, | 320 | 0, 118, 1, output_stage_tlv), |
294 | DACR1_2_HPRCOM_VOL, 0, 118, 1), | 321 | |
322 | SOC_DOUBLE_R_TLV("HPCOM DAC Playback Volume", | ||
323 | DACL1_2_HPLCOM_VOL, DACR1_2_HPRCOM_VOL, | ||
324 | 0, 118, 1, output_stage_tlv), | ||
295 | SOC_DOUBLE_R("HPCOM DAC Playback Switch", HPLCOM_CTRL, HPRCOM_CTRL, 3, | 325 | SOC_DOUBLE_R("HPCOM DAC Playback Switch", HPLCOM_CTRL, HPRCOM_CTRL, 3, |
296 | 0x01, 0), | 326 | 0x01, 0), |
297 | SOC_SINGLE("HPLCOM PGA Bypass Playback Volume", PGAL_2_HPLCOM_VOL, | 327 | SOC_SINGLE_TLV("HPLCOM PGA Bypass Playback Volume", |
298 | 0, 118, 1), | 328 | PGAL_2_HPLCOM_VOL, 0, 118, 1, output_stage_tlv), |
299 | SOC_SINGLE("HPRCOM PGA Bypass Playback Volume", PGAL_2_HPRCOM_VOL, | 329 | SOC_SINGLE_TLV("HPRCOM PGA Bypass Playback Volume", |
300 | 0, 118, 1), | 330 | PGAL_2_HPRCOM_VOL, 0, 118, 1, output_stage_tlv), |
301 | SOC_DOUBLE_R("HPCOM Line2 Bypass Playback Volume", LINE2L_2_HPLCOM_VOL, | 331 | SOC_DOUBLE_R_TLV("HPCOM Line2 Bypass Playback Volume", |
302 | LINE2R_2_HPRCOM_VOL, 0, 118, 1), | 332 | LINE2L_2_HPLCOM_VOL, LINE2R_2_HPRCOM_VOL, |
333 | 0, 118, 1, output_stage_tlv), | ||
303 | 334 | ||
304 | /* | 335 | /* |
305 | * Note: enable Automatic input Gain Controller with care. It can | 336 | * Note: enable Automatic input Gain Controller with care. It can |
@@ -308,7 +339,8 @@ static const struct snd_kcontrol_new aic3x_snd_controls[] = { | |||
308 | SOC_DOUBLE_R("AGC Switch", LAGC_CTRL_A, RAGC_CTRL_A, 7, 0x01, 0), | 339 | SOC_DOUBLE_R("AGC Switch", LAGC_CTRL_A, RAGC_CTRL_A, 7, 0x01, 0), |
309 | 340 | ||
310 | /* Input */ | 341 | /* Input */ |
311 | SOC_DOUBLE_R("PGA Capture Volume", LADC_VOL, RADC_VOL, 0, 119, 0), | 342 | SOC_DOUBLE_R_TLV("PGA Capture Volume", LADC_VOL, RADC_VOL, |
343 | 0, 119, 0, adc_tlv), | ||
312 | SOC_DOUBLE_R("PGA Capture Switch", LADC_VOL, RADC_VOL, 7, 0x01, 1), | 344 | SOC_DOUBLE_R("PGA Capture Switch", LADC_VOL, RADC_VOL, 7, 0x01, 1), |
313 | 345 | ||
314 | SOC_ENUM("ADC HPF Cut-off", aic3x_enum[ADC_HPF_ENUM]), | 346 | SOC_ENUM("ADC HPF Cut-off", aic3x_enum[ADC_HPF_ENUM]), |