aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClemens Ladisch <clemens@ladisch.de>2007-08-22 03:45:03 -0400
committerJaroslav Kysela <perex@perex.cz>2007-10-16 09:59:22 -0400
commit45c41b4868c9dbec5d43a4023e77994afa94470f (patch)
treecdf019b41ae2462d5dc63dcf65d879890c9208b5
parentc2b1239a9f22f19c53543b460b24507d0e21ea0c (diff)
[ALSA] cmipci: fix handling of FM/MIDI port addresses
Make sure that the MPU-401 MIDI and OPL-3 FM devices are used only on those chips where they are supported, and that the correct port addresses are used. Signed-off-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Jaroslav Kysela <perex@suse.cz>
-rw-r--r--Documentation/sound/alsa/ALSA-Configuration.txt12
-rw-r--r--Documentation/sound/alsa/CMIPCI.txt10
-rw-r--r--sound/pci/Kconfig6
-rw-r--r--sound/pci/cmipci.c22
4 files changed, 32 insertions, 18 deletions
diff --git a/Documentation/sound/alsa/ALSA-Configuration.txt b/Documentation/sound/alsa/ALSA-Configuration.txt
index 3df33ea8bae6..85b40057716d 100644
--- a/Documentation/sound/alsa/ALSA-Configuration.txt
+++ b/Documentation/sound/alsa/ALSA-Configuration.txt
@@ -365,13 +365,15 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
365 Module snd-cmipci 365 Module snd-cmipci
366 ----------------- 366 -----------------
367 367
368 Module for C-Media CMI8338 and 8738 PCI sound cards. 368 Module for C-Media CMI8338/8738/8768/8770 PCI sound cards.
369 369
370 mpu_port - 0x300,0x310,0x320,0x330 = legacy port, 370 mpu_port - port address of MIDI interface:
371 1 = integrated PCI port, 371 0x300,0x310,0x320,0x330 = legacy port,
372 1 = integrated PCI port (8738 or later),
372 0 = disable (default) 373 0 = disable (default)
373 fm_port - 0x388 = legacy port, 374 fm_port - port address of OPL-3 FM synthesizer (8x38 only):
374 1 = integrated PCI port (default), 375 0x388 = legacy port,
376 1 = integrated PCI port (default on 8738),
375 0 = disable 377 0 = disable
376 soft_ac3 - Software-conversion of raw SPDIF packets (model 033 only) 378 soft_ac3 - Software-conversion of raw SPDIF packets (model 033 only)
377 (default = 1) 379 (default = 1)
diff --git a/Documentation/sound/alsa/CMIPCI.txt b/Documentation/sound/alsa/CMIPCI.txt
index 4b2b15387056..664be46566b8 100644
--- a/Documentation/sound/alsa/CMIPCI.txt
+++ b/Documentation/sound/alsa/CMIPCI.txt
@@ -1,5 +1,5 @@
1 Brief Notes on C-Media 8738/8338 Driver 1 Brief Notes on C-Media 8338/8738/8768/8770 Driver
2 ======================================= 2 =================================================
3 3
4 Takashi Iwai <tiwai@suse.de> 4 Takashi Iwai <tiwai@suse.de>
5 5
@@ -212,7 +212,9 @@ MIDI CONTROLLER
212The MPU401-UART interface is disabled as default. You need to set 212The MPU401-UART interface is disabled as default. You need to set
213module option "mpu_port" with a valid I/O port address to enable the 213module option "mpu_port" with a valid I/O port address to enable the
214MIDI support. The valid I/O ports are 0x300, 0x310, 0x320 and 0x330. 214MIDI support. The valid I/O ports are 0x300, 0x310, 0x320 and 0x330.
215Choose the value which doesn't conflict with other cards. 215Choose the value which doesn't conflict with other cards. With
216CMI8738 and newer chips, you can use "mpu_port=1" to use a PCI port
217address that does not conflict with any other card.
216 218
217There is _no_ hardware wavetable function on this chip (except for 219There is _no_ hardware wavetable function on this chip (except for
218OPL3 synth below). 220OPL3 synth below).
@@ -230,6 +232,8 @@ Set "fm_port" module option for more cards.
230The output quality of FM OPL/3 is, however, very weird. 232The output quality of FM OPL/3 is, however, very weird.
231I don't know why.. 233I don't know why..
232 234
235CMI8768 and newer chips do not have the FM synth.
236
233 237
234Joystick and Modem 238Joystick and Modem
235------------------ 239------------------
diff --git a/sound/pci/Kconfig b/sound/pci/Kconfig
index 9554140f0b04..5d0732c09f2e 100644
--- a/sound/pci/Kconfig
+++ b/sound/pci/Kconfig
@@ -170,14 +170,14 @@ config SND_CA0106
170 will be called snd-ca0106. 170 will be called snd-ca0106.
171 171
172config SND_CMIPCI 172config SND_CMIPCI
173 tristate "C-Media 8738, 8338" 173 tristate "C-Media 8338, 8738, 8768, 8770"
174 depends on SND 174 depends on SND
175 select SND_OPL3_LIB 175 select SND_OPL3_LIB
176 select SND_MPU401_UART 176 select SND_MPU401_UART
177 select SND_PCM 177 select SND_PCM
178 help 178 help
179 If you want to use soundcards based on C-Media CMI8338 or CMI8738 179 If you want to use soundcards based on C-Media CMI8338, CMI8738,
180 chips, say Y here and read 180 CMI8768 or CMI8770 chips, say Y here and read
181 <file:Documentation/sound/alsa/CMIPCI.txt>. 181 <file:Documentation/sound/alsa/CMIPCI.txt>.
182 182
183 To compile this driver as a module, choose M here: the module 183 To compile this driver as a module, choose M here: the module
diff --git a/sound/pci/cmipci.c b/sound/pci/cmipci.c
index c42c51647df7..9d394c7c221d 100644
--- a/sound/pci/cmipci.c
+++ b/sound/pci/cmipci.c
@@ -2774,10 +2774,14 @@ static int __devinit snd_cmipci_create_fm(struct cmipci *cm, long fm_port)
2774 if (!fm_port) 2774 if (!fm_port)
2775 goto disable_fm; 2775 goto disable_fm;
2776 2776
2777 /* first try FM regs in PCI port range */ 2777 if (cm->chip_version > 33) {
2778 iosynth = cm->iobase + CM_REG_FM_PCI; 2778 /* first try FM regs in PCI port range */
2779 err = snd_opl3_create(cm->card, iosynth, iosynth + 2, 2779 iosynth = cm->iobase + CM_REG_FM_PCI;
2780 OPL3_HW_OPL3, 1, &opl3); 2780 err = snd_opl3_create(cm->card, iosynth, iosynth + 2,
2781 OPL3_HW_OPL3, 1, &opl3);
2782 } else {
2783 err = -EIO;
2784 }
2781 if (err < 0) { 2785 if (err < 0) {
2782 /* then try legacy ports */ 2786 /* then try legacy ports */
2783 val = snd_cmipci_read(cm, CM_REG_LEGACY_CTRL) & ~CM_FMSEL_MASK; 2787 val = snd_cmipci_read(cm, CM_REG_LEGACY_CTRL) & ~CM_FMSEL_MASK;
@@ -2935,7 +2939,8 @@ static int __devinit snd_cmipci_create(struct snd_card *card, struct pci_dev *pc
2935 return err; 2939 return err;
2936 } 2940 }
2937 2941
2938 integrated_midi = snd_cmipci_read_b(cm, CM_REG_MPU_PCI) != 0xff; 2942 integrated_midi = cm->chip_version > 33 &&
2943 snd_cmipci_read_b(cm, CM_REG_MPU_PCI + 1) != 0xff;
2939 if (integrated_midi && mpu_port[dev] == 1) 2944 if (integrated_midi && mpu_port[dev] == 1)
2940 iomidi = cm->iobase + CM_REG_MPU_PCI; 2945 iomidi = cm->iobase + CM_REG_MPU_PCI;
2941 else { 2946 else {
@@ -2955,8 +2960,11 @@ static int __devinit snd_cmipci_create(struct snd_card *card, struct pci_dev *pc
2955 } 2960 }
2956 } 2961 }
2957 2962
2958 if ((err = snd_cmipci_create_fm(cm, fm_port[dev])) < 0) 2963 if (cm->chip_version < 68) {
2959 return err; 2964 err = snd_cmipci_create_fm(cm, fm_port[dev]);
2965 if (err < 0)
2966 return err;
2967 }
2960 2968
2961 /* reset mixer */ 2969 /* reset mixer */
2962 snd_cmipci_mixer_write(cm, 0, 0); 2970 snd_cmipci_mixer_write(cm, 0, 0);