diff options
author | Clemens Ladisch <clemens@ladisch.de> | 2007-08-22 09:45:03 +0200 |
---|---|---|
committer | Jaroslav Kysela <perex@perex.cz> | 2007-10-16 15:59:22 +0200 |
commit | 45c41b4868c9dbec5d43a4023e77994afa94470f (patch) | |
tree | cdf019b41ae2462d5dc63dcf65d879890c9208b5 /sound/pci | |
parent | c2b1239a9f22f19c53543b460b24507d0e21ea0c (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>
Diffstat (limited to 'sound/pci')
-rw-r--r-- | sound/pci/Kconfig | 6 | ||||
-rw-r--r-- | sound/pci/cmipci.c | 22 |
2 files changed, 18 insertions, 10 deletions
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 will be called snd-ca0106. config SND_CMIPCI - tristate "C-Media 8738, 8338" + tristate "C-Media 8338, 8738, 8768, 8770" depends on SND select SND_OPL3_LIB select SND_MPU401_UART select SND_PCM help - If you want to use soundcards based on C-Media CMI8338 or CMI8738 - chips, say Y here and read + If you want to use soundcards based on C-Media CMI8338, CMI8738, + CMI8768 or CMI8770 chips, say Y here and read <file:Documentation/sound/alsa/CMIPCI.txt>. 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) if (!fm_port) goto disable_fm; - /* first try FM regs in PCI port range */ - iosynth = cm->iobase + CM_REG_FM_PCI; - err = snd_opl3_create(cm->card, iosynth, iosynth + 2, - OPL3_HW_OPL3, 1, &opl3); + if (cm->chip_version > 33) { + /* first try FM regs in PCI port range */ + iosynth = cm->iobase + CM_REG_FM_PCI; + err = snd_opl3_create(cm->card, iosynth, iosynth + 2, + OPL3_HW_OPL3, 1, &opl3); + } else { + err = -EIO; + } if (err < 0) { /* then try legacy ports */ 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 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) iomidi = cm->iobase + CM_REG_MPU_PCI; else { @@ -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) - return err; + if (cm->chip_version < 68) { + err = snd_cmipci_create_fm(cm, fm_port[dev]); + if (err < 0) + return err; + } /* reset mixer */ snd_cmipci_mixer_write(cm, 0, 0); |