diff options
author | Andreas Mohr <andi@lisas.de> | 2006-05-17 05:03:16 -0400 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2006-06-22 15:33:39 -0400 |
commit | 13769e3f21d6e9c59999c9bf6908278b878d05c5 (patch) | |
tree | 255c4fb239afbd2f6d6f1d4ccb824c81e3d52f82 /sound/pci | |
parent | ca54bde3634360afecd0dada9c59399bbe88bd32 (diff) |
[ALSA] azt3328.c: add 3D sound mixer switch/rename controls
- add 3D sound pre-3D/post-3D switch, as seen in standard AC-97
- rename controls to shorter and more accurate strings
Signed-off-by: Andreas Mohr <andi@lisas.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci')
-rw-r--r-- | sound/pci/azt3328.c | 41 | ||||
-rw-r--r-- | sound/pci/azt3328.h | 16 |
2 files changed, 39 insertions, 18 deletions
diff --git a/sound/pci/azt3328.c b/sound/pci/azt3328.c index f197fbac10ab..c9af04ed200f 100644 --- a/sound/pci/azt3328.c +++ b/sound/pci/azt3328.c | |||
@@ -39,8 +39,15 @@ | |||
39 | * for compatibility reasons) has the following features: | 39 | * for compatibility reasons) has the following features: |
40 | * | 40 | * |
41 | * - builtin AC97 conformant codec (SNR over 80dB) | 41 | * - builtin AC97 conformant codec (SNR over 80dB) |
42 | * (really AC97 compliant?? I really doubt it when looking | 42 | * Note that "conformant" != "compliant"!! this chip's mixer register layout |
43 | * at the mixer register layout) | 43 | * *differs* from the standard AC97 layout: |
44 | * they chose to not implement the headphone register (which is not a | ||
45 | * problem since it's merely optional), yet when doing this, they committed | ||
46 | * the grave sin of letting other registers follow immediately instead of | ||
47 | * keeping a headphone dummy register, thereby shifting the mixer register | ||
48 | * addresses illegally. So far unfortunately it looks like the very flexible | ||
49 | * ALSA AC97 support is still not enough to easily compensate for such a | ||
50 | * grave layout violation despite all tweaks and quirks mechanisms it offers. | ||
44 | * - builtin genuine OPL3 | 51 | * - builtin genuine OPL3 |
45 | * - full duplex 16bit playback/record at independent sampling rate | 52 | * - full duplex 16bit playback/record at independent sampling rate |
46 | * - MPU401 (+ legacy address support) FIXME: how to enable legacy addr?? | 53 | * - MPU401 (+ legacy address support) FIXME: how to enable legacy addr?? |
@@ -96,6 +103,9 @@ | |||
96 | * The standard suspend/resume functionality could probably make use of | 103 | * The standard suspend/resume functionality could probably make use of |
97 | * some improvement, too... | 104 | * some improvement, too... |
98 | * - figure out what all unknown port bits are responsible for | 105 | * - figure out what all unknown port bits are responsible for |
106 | * - figure out some cleverly evil scheme to possibly make ALSA AC97 code | ||
107 | * fully accept our quite incompatible ""AC97"" mixer and thus save some | ||
108 | * code (but I'm not too optimistic that doing this is possible at all) | ||
99 | */ | 109 | */ |
100 | 110 | ||
101 | #include <sound/driver.h> | 111 | #include <sound/driver.h> |
@@ -526,15 +536,18 @@ snd_azf3328_info_mixer_enum(struct snd_kcontrol *kcontrol, | |||
526 | struct snd_ctl_elem_info *uinfo) | 536 | struct snd_ctl_elem_info *uinfo) |
527 | { | 537 | { |
528 | static const char * const texts1[] = { | 538 | static const char * const texts1[] = { |
529 | "ModemOut1", "ModemOut2" | 539 | "Mic1", "Mic2" |
530 | }; | 540 | }; |
531 | static const char * const texts2[] = { | 541 | static const char * const texts2[] = { |
532 | "MonoSelectSource1", "MonoSelectSource2" | 542 | "Mix", "Mic" |
533 | }; | 543 | }; |
534 | static const char * const texts3[] = { | 544 | static const char * const texts3[] = { |
535 | "Mic", "CD", "Video", "Aux", | 545 | "Mic", "CD", "Video", "Aux", |
536 | "Line", "Mix", "Mix Mono", "Phone" | 546 | "Line", "Mix", "Mix Mono", "Phone" |
537 | }; | 547 | }; |
548 | static const char * const texts4[] = { | ||
549 | "pre 3D", "post 3D" | ||
550 | }; | ||
538 | struct azf3328_mixer_reg reg; | 551 | struct azf3328_mixer_reg reg; |
539 | 552 | ||
540 | snd_azf3328_mixer_reg_decode(®, kcontrol->private_value); | 553 | snd_azf3328_mixer_reg_decode(®, kcontrol->private_value); |
@@ -545,10 +558,17 @@ snd_azf3328_info_mixer_enum(struct snd_kcontrol *kcontrol, | |||
545 | uinfo->value.enumerated.item = reg.enum_c - 1U; | 558 | uinfo->value.enumerated.item = reg.enum_c - 1U; |
546 | if (reg.reg == IDX_MIXER_ADVCTL2) | 559 | if (reg.reg == IDX_MIXER_ADVCTL2) |
547 | { | 560 | { |
548 | if (reg.lchan_shift == 8) /* modem out sel */ | 561 | switch(reg.lchan_shift) { |
562 | case 8: /* modem out sel */ | ||
549 | strcpy(uinfo->value.enumerated.name, texts1[uinfo->value.enumerated.item]); | 563 | strcpy(uinfo->value.enumerated.name, texts1[uinfo->value.enumerated.item]); |
550 | else /* mono sel source */ | 564 | break; |
565 | case 9: /* mono sel source */ | ||
551 | strcpy(uinfo->value.enumerated.name, texts2[uinfo->value.enumerated.item]); | 566 | strcpy(uinfo->value.enumerated.name, texts2[uinfo->value.enumerated.item]); |
567 | break; | ||
568 | case 15: /* PCM Out Path */ | ||
569 | strcpy(uinfo->value.enumerated.name, texts4[uinfo->value.enumerated.item]); | ||
570 | break; | ||
571 | } | ||
552 | } | 572 | } |
553 | else | 573 | else |
554 | strcpy(uinfo->value.enumerated.name, texts3[uinfo->value.enumerated.item] | 574 | strcpy(uinfo->value.enumerated.name, texts3[uinfo->value.enumerated.item] |
@@ -641,13 +661,14 @@ static const struct snd_kcontrol_new snd_azf3328_mixer_controls[] __devinitdata | |||
641 | AZF3328_MIXER_VOL_MONO("Modem Playback Volume", IDX_MIXER_MODEMOUT, 0x1f, 1), | 661 | AZF3328_MIXER_VOL_MONO("Modem Playback Volume", IDX_MIXER_MODEMOUT, 0x1f, 1), |
642 | AZF3328_MIXER_SWITCH("Modem Capture Switch", IDX_MIXER_MODEMIN, 15, 1), | 662 | AZF3328_MIXER_SWITCH("Modem Capture Switch", IDX_MIXER_MODEMIN, 15, 1), |
643 | AZF3328_MIXER_VOL_MONO("Modem Capture Volume", IDX_MIXER_MODEMIN, 0x1f, 1), | 663 | AZF3328_MIXER_VOL_MONO("Modem Capture Volume", IDX_MIXER_MODEMIN, 0x1f, 1), |
644 | AZF3328_MIXER_ENUM("Modem Out Select", IDX_MIXER_ADVCTL2, 2, 8), | 664 | AZF3328_MIXER_ENUM("Mic Select", IDX_MIXER_ADVCTL2, 2, 8), |
645 | AZF3328_MIXER_ENUM("Mono Select Source", IDX_MIXER_ADVCTL2, 2, 9), | 665 | AZF3328_MIXER_ENUM("Mono Output Select", IDX_MIXER_ADVCTL2, 2, 9), |
666 | AZF3328_MIXER_ENUM("PCM", IDX_MIXER_ADVCTL2, 2, 15), /* PCM Out Path, place in front since it controls *both* 3D and Bass/Treble! */ | ||
646 | AZF3328_MIXER_VOL_SPECIAL("Tone Control - Treble", IDX_MIXER_BASSTREBLE, 0x07, 1, 0), | 667 | AZF3328_MIXER_VOL_SPECIAL("Tone Control - Treble", IDX_MIXER_BASSTREBLE, 0x07, 1, 0), |
647 | AZF3328_MIXER_VOL_SPECIAL("Tone Control - Bass", IDX_MIXER_BASSTREBLE, 0x07, 9, 0), | 668 | AZF3328_MIXER_VOL_SPECIAL("Tone Control - Bass", IDX_MIXER_BASSTREBLE, 0x07, 9, 0), |
648 | AZF3328_MIXER_SWITCH("3D Control - Switch", IDX_MIXER_ADVCTL2, 13, 0), | 669 | AZF3328_MIXER_SWITCH("3D Control - Switch", IDX_MIXER_ADVCTL2, 13, 0), |
649 | AZF3328_MIXER_VOL_SPECIAL("3D Control - Wide", IDX_MIXER_ADVCTL1, 0x07, 1, 0), /* "3D Width" */ | 670 | AZF3328_MIXER_VOL_SPECIAL("3D Control - Width", IDX_MIXER_ADVCTL1, 0x07, 1, 0), /* "3D Width" */ |
650 | AZF3328_MIXER_VOL_SPECIAL("3D Control - Space", IDX_MIXER_ADVCTL1, 0x03, 8, 0), /* "Hifi 3D" */ | 671 | AZF3328_MIXER_VOL_SPECIAL("3D Control - Depth", IDX_MIXER_ADVCTL1, 0x03, 8, 0), /* "Hifi 3D" */ |
651 | #if MIXER_TESTING | 672 | #if MIXER_TESTING |
652 | AZF3328_MIXER_SWITCH("0", IDX_MIXER_ADVCTL2, 0, 0), | 673 | AZF3328_MIXER_SWITCH("0", IDX_MIXER_ADVCTL2, 0, 0), |
653 | AZF3328_MIXER_SWITCH("1", IDX_MIXER_ADVCTL2, 1, 0), | 674 | AZF3328_MIXER_SWITCH("1", IDX_MIXER_ADVCTL2, 1, 0), |
diff --git a/sound/pci/azt3328.h b/sound/pci/azt3328.h index 560a4653c0b2..b4f3e3cd006b 100644 --- a/sound/pci/azt3328.h +++ b/sound/pci/azt3328.h | |||
@@ -90,7 +90,7 @@ | |||
90 | #define IDX_IO_REC_DMA_CURROFS 0x34 /* PU:0x00000000 */ | 90 | #define IDX_IO_REC_DMA_CURROFS 0x34 /* PU:0x00000000 */ |
91 | #define IDX_IO_REC_SOUNDFORMAT 0x36 /* PU:0x0000 */ | 91 | #define IDX_IO_REC_SOUNDFORMAT 0x36 /* PU:0x0000 */ |
92 | 92 | ||
93 | /** hmm, what is this I/O area for? MPU401?? (after playback, recording, ???, timer) **/ | 93 | /** hmm, what is this I/O area for? MPU401?? or external DAC via I2S?? (after playback, recording, ???, timer) **/ |
94 | #define IDX_IO_SOMETHING_FLAGS 0x40 /* gets set to 0x34 just like port 0x0 and 0x20 on card init, PU:0x0000 */ | 94 | #define IDX_IO_SOMETHING_FLAGS 0x40 /* gets set to 0x34 just like port 0x0 and 0x20 on card init, PU:0x0000 */ |
95 | /* general */ | 95 | /* general */ |
96 | #define IDX_IO_42H 0x42 /* PU:0x0001 */ | 96 | #define IDX_IO_42H 0x42 /* PU:0x0001 */ |
@@ -170,14 +170,14 @@ | |||
170 | #define IDX_MIXER_ADVCTL1 0x1e | 170 | #define IDX_MIXER_ADVCTL1 0x1e |
171 | /* unlisted bits are unmodifiable */ | 171 | /* unlisted bits are unmodifiable */ |
172 | #define MIXER_ADVCTL1_3DWIDTH_MASK 0x000e | 172 | #define MIXER_ADVCTL1_3DWIDTH_MASK 0x000e |
173 | #define MIXER_ADVCTL1_HIFI3D_MASK 0x0300 | 173 | #define MIXER_ADVCTL1_HIFI3D_MASK 0x0300 /* yup, this is missing the high bit that official AC97 contains, plus it doesn't have linear bit value range behaviour but instead acts weirdly (possibly we're dealing with two *different* 3D settings here??) */ |
174 | #define IDX_MIXER_ADVCTL2 0x20 /* resembles AC97_GENERAL_PURPOSE reg! */ | 174 | #define IDX_MIXER_ADVCTL2 0x20 /* subset of AC97_GENERAL_PURPOSE reg! */ |
175 | /* unlisted bits are unmodifiable */ | 175 | /* unlisted bits are unmodifiable */ |
176 | #define MIXER_ADVCTL2_BIT7 0x0080 /* WaveOut 3D Bypass? mutes WaveOut at LineOut */ | 176 | #define MIXER_ADVCTL2_LPBK 0x0080 /* Loopback mode -- Win driver: "WaveOut3DBypass"? mutes WaveOut at LineOut */ |
177 | #define MIXER_ADVCTL2_BIT8 0x0100 /* is this Modem Out Select? */ | 177 | #define MIXER_ADVCTL2_MS 0x0100 /* Mic Select 0=Mic1, 1=Mic2 -- Win driver: "ModemOutSelect"?? */ |
178 | #define MIXER_ADVCTL2_BIT9 0x0200 /* Mono Select Source? */ | 178 | #define MIXER_ADVCTL2_MIX 0x0200 /* Mono output select 0=Mix, 1=Mic; Win driver: "MonoSelectSource"?? */ |
179 | #define MIXER_ADVCTL2_BIT13 0x2000 /* 3D enable? */ | 179 | #define MIXER_ADVCTL2_3D 0x2000 /* 3D Enhancement 1=on */ |
180 | #define MIXER_ADVCTL2_BIT15 0x8000 /* unknown */ | 180 | #define MIXER_ADVCTL2_POP 0x8000 /* Pcm Out Path, 0=pre 3D, 1=post 3D */ |
181 | 181 | ||
182 | #define IDX_MIXER_SOMETHING30H 0x30 /* used, but unknown??? */ | 182 | #define IDX_MIXER_SOMETHING30H 0x30 /* used, but unknown??? */ |
183 | 183 | ||