aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavel Hofman <dustin@seznam.cz>2007-05-19 11:21:04 -0400
committerJaroslav Kysela <perex@suse.cz>2007-07-20 05:11:18 -0400
commitea7cfcdfe6439cd98816da9d339a6bc9032d2084 (patch)
tree0192cef9e2210f8aaae739c3471c174a8899f8cc
parent959047431a9e65f6ae25705e77a8e460a1aa04c0 (diff)
[ALSA] ice1724 - Add PCM Playback Switch to Revo 7.1
This patch adds the support of mute for front channels of M-Audio Revolution 7.1 (the DAC AK4381 features a mute bit). Signed-off-by: Pavel Hofman <dustin@seznam.cz> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@suse.cz>
-rw-r--r--include/sound/ak4xxx-adda.h1
-rw-r--r--sound/i2c/other/ak4xxx-adda.c24
-rw-r--r--sound/pci/ice1712/revo.c7
3 files changed, 29 insertions, 3 deletions
diff --git a/include/sound/ak4xxx-adda.h b/include/sound/ak4xxx-adda.h
index aa49dda4f410..fd0a6c46f497 100644
--- a/include/sound/ak4xxx-adda.h
+++ b/include/sound/ak4xxx-adda.h
@@ -43,6 +43,7 @@ struct snd_ak4xxx_ops {
43struct snd_akm4xxx_dac_channel { 43struct snd_akm4xxx_dac_channel {
44 char *name; /* mixer volume name */ 44 char *name; /* mixer volume name */
45 unsigned int num_channels; 45 unsigned int num_channels;
46 char *switch_name; /* mixer switch*/
46}; 47};
47 48
48/* ADC labels and channels */ 49/* ADC labels and channels */
diff --git a/sound/i2c/other/ak4xxx-adda.c b/sound/i2c/other/ak4xxx-adda.c
index 8805110017a7..fd335159f849 100644
--- a/sound/i2c/other/ak4xxx-adda.c
+++ b/sound/i2c/other/ak4xxx-adda.c
@@ -481,8 +481,8 @@ static int ak4xxx_switch_get(struct snd_kcontrol *kcontrol,
481 int addr = AK_GET_ADDR(kcontrol->private_value); 481 int addr = AK_GET_ADDR(kcontrol->private_value);
482 int shift = AK_GET_SHIFT(kcontrol->private_value); 482 int shift = AK_GET_SHIFT(kcontrol->private_value);
483 int invert = AK_GET_INVERT(kcontrol->private_value); 483 int invert = AK_GET_INVERT(kcontrol->private_value);
484 unsigned char val = snd_akm4xxx_get(ak, chip, addr); 484 /* we observe the (1<<shift) bit only */
485 485 unsigned char val = snd_akm4xxx_get(ak, chip, addr) & (1<<shift);
486 if (invert) 486 if (invert)
487 val = ! val; 487 val = ! val;
488 ucontrol->value.integer.value[0] = (val & (1<<shift)) != 0; 488 ucontrol->value.integer.value[0] = (val & (1<<shift)) != 0;
@@ -585,6 +585,26 @@ static int build_dac_controls(struct snd_akm4xxx *ak)
585 585
586 mixer_ch = 0; 586 mixer_ch = 0;
587 for (idx = 0; idx < ak->num_dacs; ) { 587 for (idx = 0; idx < ak->num_dacs; ) {
588 /* mute control for Revolution 7.1 - AK4381 */
589 if (ak->type == SND_AK4381
590 && ak->dac_info[mixer_ch].switch_name) {
591 memset(&knew, 0, sizeof(knew));
592 knew.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
593 knew.count = 1;
594 knew.access = SNDRV_CTL_ELEM_ACCESS_READWRITE;
595 knew.name = ak->dac_info[mixer_ch].switch_name;
596 knew.info = ak4xxx_switch_info;
597 knew.get = ak4xxx_switch_get;
598 knew.put = ak4xxx_switch_put;
599 knew.access = 0;
600 /* register 1, bit 0 (SMUTE): 0 = normal operation,
601 1 = mute */
602 knew.private_value =
603 AK_COMPOSE(idx/2, 1, 0, 0) | AK_INVERT;
604 err = snd_ctl_add(ak->card, snd_ctl_new1(&knew, ak));
605 if (err < 0)
606 return err;
607 }
588 memset(&knew, 0, sizeof(knew)); 608 memset(&knew, 0, sizeof(knew));
589 if (! ak->dac_info || ! ak->dac_info[mixer_ch].name) { 609 if (! ak->dac_info || ! ak->dac_info[mixer_ch].name) {
590 knew.name = "DAC Volume"; 610 knew.name = "DAC Volume";
diff --git a/sound/pci/ice1712/revo.c b/sound/pci/ice1712/revo.c
index 690ceb340644..d18a31e188a9 100644
--- a/sound/pci/ice1712/revo.c
+++ b/sound/pci/ice1712/revo.c
@@ -186,7 +186,12 @@ static int revo51_i2c_init(struct snd_ice1712 *ice,
186#define AK_DAC(xname,xch) { .name = xname, .num_channels = xch } 186#define AK_DAC(xname,xch) { .name = xname, .num_channels = xch }
187 187
188static const struct snd_akm4xxx_dac_channel revo71_front[] = { 188static const struct snd_akm4xxx_dac_channel revo71_front[] = {
189 AK_DAC("PCM Playback Volume", 2) 189 {
190 .name = "PCM Playback Volume",
191 .num_channels = 2,
192 /* front channels DAC supports muting */
193 .switch_name = "PCM Playback Switch",
194 },
190}; 195};
191 196
192static const struct snd_akm4xxx_dac_channel revo71_surround[] = { 197static const struct snd_akm4xxx_dac_channel revo71_surround[] = {