Commit 45c41b48 authored by Clemens Ladisch's avatar Clemens Ladisch Committed by Jaroslav Kysela

[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: default avatarClemens Ladisch <clemens@ladisch.de>
Signed-off-by: default avatarJaroslav Kysela <perex@suse.cz>
parent c2b1239a
...@@ -365,13 +365,15 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed. ...@@ -365,13 +365,15 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
Module snd-cmipci Module snd-cmipci
----------------- -----------------
Module for C-Media CMI8338 and 8738 PCI sound cards. Module for C-Media CMI8338/8738/8768/8770 PCI sound cards.
mpu_port - 0x300,0x310,0x320,0x330 = legacy port, mpu_port - port address of MIDI interface:
1 = integrated PCI port, 0x300,0x310,0x320,0x330 = legacy port,
1 = integrated PCI port (8738 or later),
0 = disable (default) 0 = disable (default)
fm_port - 0x388 = legacy port, fm_port - port address of OPL-3 FM synthesizer (8x38 only):
1 = integrated PCI port (default), 0x388 = legacy port,
1 = integrated PCI port (default on 8738),
0 = disable 0 = disable
soft_ac3 - Software-conversion of raw SPDIF packets (model 033 only) soft_ac3 - Software-conversion of raw SPDIF packets (model 033 only)
(default = 1) (default = 1)
......
Brief Notes on C-Media 8738/8338 Driver Brief Notes on C-Media 8338/8738/8768/8770 Driver
======================================= =================================================
Takashi Iwai <tiwai@suse.de> Takashi Iwai <tiwai@suse.de>
...@@ -212,7 +212,9 @@ MIDI CONTROLLER ...@@ -212,7 +212,9 @@ MIDI CONTROLLER
The MPU401-UART interface is disabled as default. You need to set The MPU401-UART interface is disabled as default. You need to set
module option "mpu_port" with a valid I/O port address to enable the module option "mpu_port" with a valid I/O port address to enable the
MIDI support. The valid I/O ports are 0x300, 0x310, 0x320 and 0x330. MIDI support. The valid I/O ports are 0x300, 0x310, 0x320 and 0x330.
Choose the value which doesn't conflict with other cards. Choose the value which doesn't conflict with other cards. With
CMI8738 and newer chips, you can use "mpu_port=1" to use a PCI port
address that does not conflict with any other card.
There is _no_ hardware wavetable function on this chip (except for There is _no_ hardware wavetable function on this chip (except for
OPL3 synth below). OPL3 synth below).
...@@ -230,6 +232,8 @@ Set "fm_port" module option for more cards. ...@@ -230,6 +232,8 @@ Set "fm_port" module option for more cards.
The output quality of FM OPL/3 is, however, very weird. The output quality of FM OPL/3 is, however, very weird.
I don't know why.. I don't know why..
CMI8768 and newer chips do not have the FM synth.
Joystick and Modem Joystick and Modem
------------------ ------------------
......
...@@ -170,14 +170,14 @@ config SND_CA0106 ...@@ -170,14 +170,14 @@ config SND_CA0106
will be called snd-ca0106. will be called snd-ca0106.
config SND_CMIPCI config SND_CMIPCI
tristate "C-Media 8738, 8338" tristate "C-Media 8338, 8738, 8768, 8770"
depends on SND depends on SND
select SND_OPL3_LIB select SND_OPL3_LIB
select SND_MPU401_UART select SND_MPU401_UART
select SND_PCM select SND_PCM
help help
If you want to use soundcards based on C-Media CMI8338 or CMI8738 If you want to use soundcards based on C-Media CMI8338, CMI8738,
chips, say Y here and read CMI8768 or CMI8770 chips, say Y here and read
<file:Documentation/sound/alsa/CMIPCI.txt>. <file:Documentation/sound/alsa/CMIPCI.txt>.
To compile this driver as a module, choose M here: the module To compile this driver as a module, choose M here: the module
......
...@@ -2774,10 +2774,14 @@ static int __devinit snd_cmipci_create_fm(struct cmipci *cm, long fm_port) ...@@ -2774,10 +2774,14 @@ static int __devinit snd_cmipci_create_fm(struct cmipci *cm, long fm_port)
if (!fm_port) if (!fm_port)
goto disable_fm; goto disable_fm;
if (cm->chip_version > 33) {
/* first try FM regs in PCI port range */ /* first try FM regs in PCI port range */
iosynth = cm->iobase + CM_REG_FM_PCI; iosynth = cm->iobase + CM_REG_FM_PCI;
err = snd_opl3_create(cm->card, iosynth, iosynth + 2, err = snd_opl3_create(cm->card, iosynth, iosynth + 2,
OPL3_HW_OPL3, 1, &opl3); OPL3_HW_OPL3, 1, &opl3);
} else {
err = -EIO;
}
if (err < 0) { if (err < 0) {
/* then try legacy ports */ /* then try legacy ports */
val = snd_cmipci_read(cm, CM_REG_LEGACY_CTRL) & ~CM_FMSEL_MASK; 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,7 +2939,8 @@ static int __devinit snd_cmipci_create(struct snd_card *card, struct pci_dev *pc
return err; return err;
} }
integrated_midi = snd_cmipci_read_b(cm, CM_REG_MPU_PCI) != 0xff; integrated_midi = cm->chip_version > 33 &&
snd_cmipci_read_b(cm, CM_REG_MPU_PCI + 1) != 0xff;
if (integrated_midi && mpu_port[dev] == 1) if (integrated_midi && mpu_port[dev] == 1)
iomidi = cm->iobase + CM_REG_MPU_PCI; iomidi = cm->iobase + CM_REG_MPU_PCI;
else { else {
...@@ -2955,8 +2960,11 @@ static int __devinit snd_cmipci_create(struct snd_card *card, struct pci_dev *pc ...@@ -2955,8 +2960,11 @@ static int __devinit snd_cmipci_create(struct snd_card *card, struct pci_dev *pc
} }
} }
if ((err = snd_cmipci_create_fm(cm, fm_port[dev])) < 0) if (cm->chip_version < 68) {
err = snd_cmipci_create_fm(cm, fm_port[dev]);
if (err < 0)
return err; return err;
}
/* reset mixer */ /* reset mixer */
snd_cmipci_mixer_write(cm, 0, 0); snd_cmipci_mixer_write(cm, 0, 0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment