aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/ca0106/ca0106_mixer.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/ca0106/ca0106_mixer.c')
-rw-r--r--sound/pci/ca0106/ca0106_mixer.c50
1 files changed, 28 insertions, 22 deletions
diff --git a/sound/pci/ca0106/ca0106_mixer.c b/sound/pci/ca0106/ca0106_mixer.c
index 9855f528ea78..b913a1fb8c21 100644
--- a/sound/pci/ca0106/ca0106_mixer.c
+++ b/sound/pci/ca0106/ca0106_mixer.c
@@ -74,8 +74,8 @@
74 74
75#include "ca0106.h" 75#include "ca0106.h"
76 76
77static DECLARE_TLV_DB_SCALE(snd_ca0106_db_scale1, -5175, 25, 1); 77static const DECLARE_TLV_DB_SCALE(snd_ca0106_db_scale1, -5175, 25, 1);
78static DECLARE_TLV_DB_SCALE(snd_ca0106_db_scale2, -10350, 50, 1); 78static const DECLARE_TLV_DB_SCALE(snd_ca0106_db_scale2, -10350, 50, 1);
79 79
80static int snd_ca0106_shared_spdif_info(struct snd_kcontrol *kcontrol, 80static int snd_ca0106_shared_spdif_info(struct snd_kcontrol *kcontrol,
81 struct snd_ctl_elem_info *uinfo) 81 struct snd_ctl_elem_info *uinfo)
@@ -482,19 +482,6 @@ static int snd_ca0106_i2c_volume_put(struct snd_kcontrol *kcontrol,
482 .private_value = ((chid) << 8) | (reg) \ 482 .private_value = ((chid) << 8) | (reg) \
483} 483}
484 484
485#define I2C_VOLUME(xname,chid) \
486{ \
487 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
488 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | \
489 SNDRV_CTL_ELEM_ACCESS_TLV_READ, \
490 .info = snd_ca0106_i2c_volume_info, \
491 .get = snd_ca0106_i2c_volume_get, \
492 .put = snd_ca0106_i2c_volume_put, \
493 .tlv = { .p = snd_ca0106_db_scale2 }, \
494 .private_value = chid \
495}
496
497
498static struct snd_kcontrol_new snd_ca0106_volume_ctls[] __devinitdata = { 485static struct snd_kcontrol_new snd_ca0106_volume_ctls[] __devinitdata = {
499 CA_VOLUME("Analog Front Playback Volume", 486 CA_VOLUME("Analog Front Playback Volume",
500 CONTROL_FRONT_CHANNEL, PLAYBACK_VOLUME2), 487 CONTROL_FRONT_CHANNEL, PLAYBACK_VOLUME2),
@@ -517,11 +504,6 @@ static struct snd_kcontrol_new snd_ca0106_volume_ctls[] __devinitdata = {
517 CA_VOLUME("CAPTURE feedback Playback Volume", 504 CA_VOLUME("CAPTURE feedback Playback Volume",
518 1, CAPTURE_CONTROL), 505 1, CAPTURE_CONTROL),
519 506
520 I2C_VOLUME("Phone Capture Volume", 0),
521 I2C_VOLUME("Mic Capture Volume", 1),
522 I2C_VOLUME("Line in Capture Volume", 2),
523 I2C_VOLUME("Aux Capture Volume", 3),
524
525 { 507 {
526 .access = SNDRV_CTL_ELEM_ACCESS_READ, 508 .access = SNDRV_CTL_ELEM_ACCESS_READ,
527 .iface = SNDRV_CTL_ELEM_IFACE_PCM, 509 .iface = SNDRV_CTL_ELEM_IFACE_PCM,
@@ -539,14 +521,14 @@ static struct snd_kcontrol_new snd_ca0106_volume_ctls[] __devinitdata = {
539 }, 521 },
540 { 522 {
541 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 523 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
542 .name = "Digital Capture Source", 524 .name = "Digital Source Capture Enum",
543 .info = snd_ca0106_capture_source_info, 525 .info = snd_ca0106_capture_source_info,
544 .get = snd_ca0106_capture_source_get, 526 .get = snd_ca0106_capture_source_get,
545 .put = snd_ca0106_capture_source_put 527 .put = snd_ca0106_capture_source_put
546 }, 528 },
547 { 529 {
548 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 530 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
549 .name = "Capture Source", 531 .name = "Analog Source Capture Enum",
550 .info = snd_ca0106_i2c_capture_source_info, 532 .info = snd_ca0106_i2c_capture_source_info,
551 .get = snd_ca0106_i2c_capture_source_get, 533 .get = snd_ca0106_i2c_capture_source_get,
552 .put = snd_ca0106_i2c_capture_source_put 534 .put = snd_ca0106_i2c_capture_source_put
@@ -561,6 +543,25 @@ static struct snd_kcontrol_new snd_ca0106_volume_ctls[] __devinitdata = {
561 }, 543 },
562}; 544};
563 545
546#define I2C_VOLUME(xname,chid) \
547{ \
548 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
549 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | \
550 SNDRV_CTL_ELEM_ACCESS_TLV_READ, \
551 .info = snd_ca0106_i2c_volume_info, \
552 .get = snd_ca0106_i2c_volume_get, \
553 .put = snd_ca0106_i2c_volume_put, \
554 .tlv = { .p = snd_ca0106_db_scale2 }, \
555 .private_value = chid \
556}
557
558static struct snd_kcontrol_new snd_ca0106_volume_i2c_adc_ctls[] __devinitdata = {
559 I2C_VOLUME("Phone Capture Volume", 0),
560 I2C_VOLUME("Mic Capture Volume", 1),
561 I2C_VOLUME("Line in Capture Volume", 2),
562 I2C_VOLUME("Aux Capture Volume", 3),
563};
564
564static int __devinit remove_ctl(struct snd_card *card, const char *name) 565static int __devinit remove_ctl(struct snd_card *card, const char *name)
565{ 566{
566 struct snd_ctl_elem_id id; 567 struct snd_ctl_elem_id id;
@@ -645,6 +646,11 @@ int __devinit snd_ca0106_mixer(struct snd_ca0106 *emu)
645 return err; 646 return err;
646 } 647 }
647 if (emu->details->i2c_adc == 1) { 648 if (emu->details->i2c_adc == 1) {
649 for (i = 0; i < ARRAY_SIZE(snd_ca0106_volume_i2c_adc_ctls); i++) {
650 err = snd_ctl_add(card, snd_ctl_new1(&snd_ca0106_volume_i2c_adc_ctls[i], emu));
651 if (err < 0)
652 return err;
653 }
648 if (emu->details->gpio_type == 1) 654 if (emu->details->gpio_type == 1)
649 err = snd_ctl_add(card, snd_ctl_new1(&snd_ca0106_capture_mic_line_in, emu)); 655 err = snd_ctl_add(card, snd_ctl_new1(&snd_ca0106_capture_mic_line_in, emu));
650 else /* gpio_type == 2 */ 656 else /* gpio_type == 2 */