aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/wm8350.c
diff options
context:
space:
mode:
authorPeter Ujfalusi <peter.ujfalusi@ti.com>2011-10-05 03:29:19 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2011-10-05 12:10:08 -0400
commit0f9887d11e7c59ebae5e464f30a6dde788ed9011 (patch)
treea207635ae6f45a576f1ace0489b2c69043baa5ea /sound/soc/codecs/wm8350.c
parent7508b12a8eb713436feb65893ae7ada57bf165ce (diff)
ASoC: Consolidate use of controls with custom get/put function
Use the macros for controls require custom get/put function. This is to make sure that the soc_mixer_control is used consistently among the drivers. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Cc: Arun KS <arunks@mistralsolutions.com> Cc: Misael Lopez Cruz <misael.lopez@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/codecs/wm8350.c')
-rw-r--r--sound/soc/codecs/wm8350.c39
1 files changed, 15 insertions, 24 deletions
diff --git a/sound/soc/codecs/wm8350.c b/sound/soc/codecs/wm8350.c
index 6d6dc9efe914..50ea9d7d12d0 100644
--- a/sound/soc/codecs/wm8350.c
+++ b/sound/soc/codecs/wm8350.c
@@ -395,20 +395,6 @@ static int wm8350_get_volsw_2r(struct snd_kcontrol *kcontrol,
395 return snd_soc_get_volsw_2r(kcontrol, ucontrol); 395 return snd_soc_get_volsw_2r(kcontrol, ucontrol);
396} 396}
397 397
398/* double control with volume update */
399#define SOC_WM8350_DOUBLE_R_TLV(xname, reg_left, reg_right, xshift, xmax, \
400 xinvert, tlv_array) \
401{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = (xname), \
402 .access = SNDRV_CTL_ELEM_ACCESS_TLV_READ | \
403 SNDRV_CTL_ELEM_ACCESS_READWRITE | \
404 SNDRV_CTL_ELEM_ACCESS_VOLATILE, \
405 .tlv.p = (tlv_array), \
406 .info = snd_soc_info_volsw_2r, \
407 .get = wm8350_get_volsw_2r, .put = wm8350_put_volsw_2r_vu, \
408 .private_value = (unsigned long)&(struct soc_mixer_control) \
409 {.reg = reg_left, .rreg = reg_right, .shift = xshift, \
410 .rshift = xshift, .max = xmax, .invert = xinvert}, }
411
412static const char *wm8350_deemp[] = { "None", "32kHz", "44.1kHz", "48kHz" }; 398static const char *wm8350_deemp[] = { "None", "32kHz", "44.1kHz", "48kHz" };
413static const char *wm8350_pol[] = { "Normal", "Inv R", "Inv L", "Inv L & R" }; 399static const char *wm8350_pol[] = { "Normal", "Inv R", "Inv L", "Inv L & R" };
414static const char *wm8350_dacmutem[] = { "Normal", "Soft" }; 400static const char *wm8350_dacmutem[] = { "Normal", "Soft" };
@@ -443,26 +429,29 @@ static const unsigned int capture_sd_tlv[] = {
443static const struct snd_kcontrol_new wm8350_snd_controls[] = { 429static const struct snd_kcontrol_new wm8350_snd_controls[] = {
444 SOC_ENUM("Playback Deemphasis", wm8350_enum[0]), 430 SOC_ENUM("Playback Deemphasis", wm8350_enum[0]),
445 SOC_ENUM("Playback DAC Inversion", wm8350_enum[1]), 431 SOC_ENUM("Playback DAC Inversion", wm8350_enum[1]),
446 SOC_WM8350_DOUBLE_R_TLV("Playback PCM Volume", 432 SOC_DOUBLE_R_EXT_TLV("Playback PCM Volume",
447 WM8350_DAC_DIGITAL_VOLUME_L, 433 WM8350_DAC_DIGITAL_VOLUME_L,
448 WM8350_DAC_DIGITAL_VOLUME_R, 434 WM8350_DAC_DIGITAL_VOLUME_R,
449 0, 255, 0, dac_pcm_tlv), 435 0, 255, 0, wm8350_get_volsw_2r,
436 wm8350_put_volsw_2r_vu, dac_pcm_tlv),
450 SOC_ENUM("Playback PCM Mute Function", wm8350_enum[2]), 437 SOC_ENUM("Playback PCM Mute Function", wm8350_enum[2]),
451 SOC_ENUM("Playback PCM Mute Speed", wm8350_enum[3]), 438 SOC_ENUM("Playback PCM Mute Speed", wm8350_enum[3]),
452 SOC_ENUM("Capture PCM Filter", wm8350_enum[4]), 439 SOC_ENUM("Capture PCM Filter", wm8350_enum[4]),
453 SOC_ENUM("Capture PCM HP Filter", wm8350_enum[5]), 440 SOC_ENUM("Capture PCM HP Filter", wm8350_enum[5]),
454 SOC_ENUM("Capture ADC Inversion", wm8350_enum[6]), 441 SOC_ENUM("Capture ADC Inversion", wm8350_enum[6]),
455 SOC_WM8350_DOUBLE_R_TLV("Capture PCM Volume", 442 SOC_DOUBLE_R_EXT_TLV("Capture PCM Volume",
456 WM8350_ADC_DIGITAL_VOLUME_L, 443 WM8350_ADC_DIGITAL_VOLUME_L,
457 WM8350_ADC_DIGITAL_VOLUME_R, 444 WM8350_ADC_DIGITAL_VOLUME_R,
458 0, 255, 0, adc_pcm_tlv), 445 0, 255, 0, wm8350_get_volsw_2r,
446 wm8350_put_volsw_2r_vu, adc_pcm_tlv),
459 SOC_DOUBLE_TLV("Capture Sidetone Volume", 447 SOC_DOUBLE_TLV("Capture Sidetone Volume",
460 WM8350_ADC_DIVIDER, 448 WM8350_ADC_DIVIDER,
461 8, 4, 15, 1, capture_sd_tlv), 449 8, 4, 15, 1, capture_sd_tlv),
462 SOC_WM8350_DOUBLE_R_TLV("Capture Volume", 450 SOC_DOUBLE_R_EXT_TLV("Capture Volume",
463 WM8350_LEFT_INPUT_VOLUME, 451 WM8350_LEFT_INPUT_VOLUME,
464 WM8350_RIGHT_INPUT_VOLUME, 452 WM8350_RIGHT_INPUT_VOLUME,
465 2, 63, 0, pre_amp_tlv), 453 2, 63, 0, wm8350_get_volsw_2r,
454 wm8350_put_volsw_2r_vu, pre_amp_tlv),
466 SOC_DOUBLE_R("Capture ZC Switch", 455 SOC_DOUBLE_R("Capture ZC Switch",
467 WM8350_LEFT_INPUT_VOLUME, 456 WM8350_LEFT_INPUT_VOLUME,
468 WM8350_RIGHT_INPUT_VOLUME, 13, 1, 0), 457 WM8350_RIGHT_INPUT_VOLUME, 13, 1, 0),
@@ -490,17 +479,19 @@ static const struct snd_kcontrol_new wm8350_snd_controls[] = {
490 SOC_SINGLE_TLV("Out4 Capture Volume", 479 SOC_SINGLE_TLV("Out4 Capture Volume",
491 WM8350_INPUT_MIXER_VOLUME, 480 WM8350_INPUT_MIXER_VOLUME,
492 1, 7, 0, out_mix_tlv), 481 1, 7, 0, out_mix_tlv),
493 SOC_WM8350_DOUBLE_R_TLV("Out1 Playback Volume", 482 SOC_DOUBLE_R_EXT_TLV("Out1 Playback Volume",
494 WM8350_LOUT1_VOLUME, 483 WM8350_LOUT1_VOLUME,
495 WM8350_ROUT1_VOLUME, 484 WM8350_ROUT1_VOLUME,
496 2, 63, 0, out_pga_tlv), 485 2, 63, 0, wm8350_get_volsw_2r,
486 wm8350_put_volsw_2r_vu, out_pga_tlv),
497 SOC_DOUBLE_R("Out1 Playback ZC Switch", 487 SOC_DOUBLE_R("Out1 Playback ZC Switch",
498 WM8350_LOUT1_VOLUME, 488 WM8350_LOUT1_VOLUME,
499 WM8350_ROUT1_VOLUME, 13, 1, 0), 489 WM8350_ROUT1_VOLUME, 13, 1, 0),
500 SOC_WM8350_DOUBLE_R_TLV("Out2 Playback Volume", 490 SOC_DOUBLE_R_EXT_TLV("Out2 Playback Volume",
501 WM8350_LOUT2_VOLUME, 491 WM8350_LOUT2_VOLUME,
502 WM8350_ROUT2_VOLUME, 492 WM8350_ROUT2_VOLUME,
503 2, 63, 0, out_pga_tlv), 493 2, 63, 0, wm8350_get_volsw_2r,
494 wm8350_put_volsw_2r_vu, out_pga_tlv),
504 SOC_DOUBLE_R("Out2 Playback ZC Switch", WM8350_LOUT2_VOLUME, 495 SOC_DOUBLE_R("Out2 Playback ZC Switch", WM8350_LOUT2_VOLUME,
505 WM8350_ROUT2_VOLUME, 13, 1, 0), 496 WM8350_ROUT2_VOLUME, 13, 1, 0),
506 SOC_SINGLE("Out2 Right Invert Switch", WM8350_ROUT2_VOLUME, 10, 1, 0), 497 SOC_SINGLE("Out2 Right Invert Switch", WM8350_ROUT2_VOLUME, 10, 1, 0),