aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2007-02-15 12:56:43 -0500
committerJaroslav Kysela <perex@suse.cz>2007-03-06 05:03:53 -0500
commit2f24d159d5ac418c946e0d38ada46345753688b1 (patch)
treee09fa3562a56314802451153072367796a1ae411 /sound
parentdd87da1c5d3fd1d973d52e468f76fcc72ad69bd5 (diff)
[ALSA] cmipci - Allow to disable integrated FM port
The driver didn't allow to disable the integrated FM port (if available), and this annoyed people who don't want FM port. Now fm_port=0 disables the FM port unconditionally. fm_port=1 is used for enabling the integrated FM port (as default). Also fixed the documentation about this option. Fix ALSA bug#2491. Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@suse.cz>
Diffstat (limited to 'sound')
-rw-r--r--sound/pci/cmipci.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/sound/pci/cmipci.c b/sound/pci/cmipci.c
index 70face7e1048..7d3c5ee0005c 100644
--- a/sound/pci/cmipci.c
+++ b/sound/pci/cmipci.c
@@ -57,7 +57,7 @@ static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
57static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 57static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
58static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable switches */ 58static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable switches */
59static long mpu_port[SNDRV_CARDS]; 59static long mpu_port[SNDRV_CARDS];
60static long fm_port[SNDRV_CARDS]; 60static long fm_port[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)]=1};
61static int soft_ac3[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)]=1}; 61static int soft_ac3[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)]=1};
62#ifdef SUPPORT_JOYSTICK 62#ifdef SUPPORT_JOYSTICK
63static int joystick_port[SNDRV_CARDS]; 63static int joystick_port[SNDRV_CARDS];
@@ -2779,6 +2779,9 @@ static int __devinit snd_cmipci_create_fm(struct cmipci *cm, long fm_port)
2779 struct snd_opl3 *opl3; 2779 struct snd_opl3 *opl3;
2780 int err; 2780 int err;
2781 2781
2782 if (!fm_port)
2783 goto disable_fm;
2784
2782 /* first try FM regs in PCI port range */ 2785 /* first try FM regs in PCI port range */
2783 iosynth = cm->iobase + CM_REG_FM_PCI; 2786 iosynth = cm->iobase + CM_REG_FM_PCI;
2784 err = snd_opl3_create(cm->card, iosynth, iosynth + 2, 2787 err = snd_opl3_create(cm->card, iosynth, iosynth + 2,
@@ -2793,7 +2796,7 @@ static int __devinit snd_cmipci_create_fm(struct cmipci *cm, long fm_port)
2793 case 0x3C8: val |= CM_FMSEL_3C8; break; 2796 case 0x3C8: val |= CM_FMSEL_3C8; break;
2794 case 0x388: val |= CM_FMSEL_388; break; 2797 case 0x388: val |= CM_FMSEL_388; break;
2795 default: 2798 default:
2796 return 0; 2799 goto disable_fm;
2797 } 2800 }
2798 snd_cmipci_write(cm, CM_REG_LEGACY_CTRL, val); 2801 snd_cmipci_write(cm, CM_REG_LEGACY_CTRL, val);
2799 /* enable FM */ 2802 /* enable FM */
@@ -2803,11 +2806,7 @@ static int __devinit snd_cmipci_create_fm(struct cmipci *cm, long fm_port)
2803 OPL3_HW_OPL3, 0, &opl3) < 0) { 2806 OPL3_HW_OPL3, 0, &opl3) < 0) {
2804 printk(KERN_ERR "cmipci: no OPL device at %#lx, " 2807 printk(KERN_ERR "cmipci: no OPL device at %#lx, "
2805 "skipping...\n", iosynth); 2808 "skipping...\n", iosynth);
2806 /* disable FM */ 2809 goto disable_fm;
2807 snd_cmipci_write(cm, CM_REG_LEGACY_CTRL,
2808 val & ~CM_FMSEL_MASK);
2809 snd_cmipci_clear_bit(cm, CM_REG_MISC_CTRL, CM_FM_EN);
2810 return 0;
2811 } 2810 }
2812 } 2811 }
2813 if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) { 2812 if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) {
@@ -2815,6 +2814,11 @@ static int __devinit snd_cmipci_create_fm(struct cmipci *cm, long fm_port)
2815 return err; 2814 return err;
2816 } 2815 }
2817 return 0; 2816 return 0;
2817
2818 disable_fm:
2819 snd_cmipci_clear_bit(cm, CM_REG_LEGACY_CTRL, CM_FMSEL_MASK);
2820 snd_cmipci_clear_bit(cm, CM_REG_MISC_CTRL, CM_FM_EN);
2821 return 0;
2818} 2822}
2819 2823
2820static int __devinit snd_cmipci_create(struct snd_card *card, struct pci_dev *pci, 2824static int __devinit snd_cmipci_create(struct snd_card *card, struct pci_dev *pci,