aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorKrzysztof Helt <krzysztof.h1@wp.pl>2009-01-21 02:18:16 -0500
committerTakashi Iwai <tiwai@suse.de>2009-01-21 02:36:39 -0500
commit48972cc5101dee24243c1b53d409cc27880e7a29 (patch)
tree87f27c072339f213654245e70a66a093f4010d97 /sound
parent1de9e8e70f5acc441550ca75433563d91b269bbe (diff)
ALSA: cmi8330: add OPL3 support
Add OPL3 handling to the driver and volume control for FM synthesis. Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r--sound/isa/Kconfig1
-rw-r--r--sound/isa/cmi8330.c30
2 files changed, 29 insertions, 2 deletions
diff --git a/sound/isa/Kconfig b/sound/isa/Kconfig
index ce0aa044e274..be2d377ff90a 100644
--- a/sound/isa/Kconfig
+++ b/sound/isa/Kconfig
@@ -94,6 +94,7 @@ config SND_CMI8330
94 tristate "C-Media CMI8330" 94 tristate "C-Media CMI8330"
95 select SND_WSS_LIB 95 select SND_WSS_LIB
96 select SND_SB16_DSP 96 select SND_SB16_DSP
97 select SND_OPL3_LIB
97 help 98 help
98 Say Y here to include support for soundcards based on the 99 Say Y here to include support for soundcards based on the
99 C-Media CMI8330 chip. 100 C-Media CMI8330 chip.
diff --git a/sound/isa/cmi8330.c b/sound/isa/cmi8330.c
index e49aec700a55..dec6ea52cc4f 100644
--- a/sound/isa/cmi8330.c
+++ b/sound/isa/cmi8330.c
@@ -51,6 +51,7 @@
51#include <linux/moduleparam.h> 51#include <linux/moduleparam.h>
52#include <sound/core.h> 52#include <sound/core.h>
53#include <sound/wss.h> 53#include <sound/wss.h>
54#include <sound/opl3.h>
54#include <sound/sb.h> 55#include <sound/sb.h>
55#include <sound/initval.h> 56#include <sound/initval.h>
56 57
@@ -79,6 +80,7 @@ static int sbdma16[SNDRV_CARDS] = SNDRV_DEFAULT_DMA;
79static long wssport[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; 80static long wssport[SNDRV_CARDS] = SNDRV_DEFAULT_PORT;
80static int wssirq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; 81static int wssirq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ;
81static int wssdma[SNDRV_CARDS] = SNDRV_DEFAULT_DMA; 82static int wssdma[SNDRV_CARDS] = SNDRV_DEFAULT_DMA;
83static long fmport[SNDRV_CARDS] = SNDRV_DEFAULT_PORT;
82 84
83module_param_array(index, int, NULL, 0444); 85module_param_array(index, int, NULL, 0444);
84MODULE_PARM_DESC(index, "Index value for CMI8330 soundcard."); 86MODULE_PARM_DESC(index, "Index value for CMI8330 soundcard.");
@@ -107,6 +109,8 @@ MODULE_PARM_DESC(wssirq, "IRQ # for CMI8330 WSS driver.");
107module_param_array(wssdma, int, NULL, 0444); 109module_param_array(wssdma, int, NULL, 0444);
108MODULE_PARM_DESC(wssdma, "DMA for CMI8330 WSS driver."); 110MODULE_PARM_DESC(wssdma, "DMA for CMI8330 WSS driver.");
109 111
112module_param_array(fmport, long, NULL, 0444);
113MODULE_PARM_DESC(fmport, "FM port # for CMI8330 driver.");
110#ifdef CONFIG_PNP 114#ifdef CONFIG_PNP
111static int isa_registered; 115static int isa_registered;
112static int pnp_registered; 116static int pnp_registered;
@@ -219,8 +223,10 @@ WSS_SINGLE("3D Control - Switch", 0,
219 CMI8330_RMUX3D, 5, 1, 1), 223 CMI8330_RMUX3D, 5, 1, 1),
220WSS_SINGLE("PC Speaker Playback Volume", 0, 224WSS_SINGLE("PC Speaker Playback Volume", 0,
221 CMI8330_OUTPUTVOL, 3, 3, 0), 225 CMI8330_OUTPUTVOL, 3, 3, 0),
222WSS_SINGLE("FM Playback Switch", 0, 226WSS_DOUBLE("FM Playback Switch", 0,
223 CMI8330_RECMUX, 3, 1, 1), 227 CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 7, 7, 1, 1),
228WSS_DOUBLE("FM Playback Volume", 0,
229 CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 0, 0, 31, 1),
224WSS_SINGLE(SNDRV_CTL_NAME_IEC958("Input ", CAPTURE, SWITCH), 0, 230WSS_SINGLE(SNDRV_CTL_NAME_IEC958("Input ", CAPTURE, SWITCH), 0,
225 CMI8330_RMUX3D, 7, 1, 1), 231 CMI8330_RMUX3D, 7, 1, 1),
226WSS_SINGLE(SNDRV_CTL_NAME_IEC958("Input ", PLAYBACK, SWITCH), 0, 232WSS_SINGLE(SNDRV_CTL_NAME_IEC958("Input ", PLAYBACK, SWITCH), 0,
@@ -333,6 +339,7 @@ static int __devinit snd_cmi8330_pnp(int dev, struct snd_cmi8330 *acard,
333 wssport[dev] = pnp_port_start(pdev, 0); 339 wssport[dev] = pnp_port_start(pdev, 0);
334 wssdma[dev] = pnp_dma(pdev, 0); 340 wssdma[dev] = pnp_dma(pdev, 0);
335 wssirq[dev] = pnp_irq(pdev, 0); 341 wssirq[dev] = pnp_irq(pdev, 0);
342 fmport[dev] = pnp_port_start(pdev, 1);
336 343
337 /* allocate SB16 resources */ 344 /* allocate SB16 resources */
338 pdev = acard->play; 345 pdev = acard->play;
@@ -487,6 +494,7 @@ static int __devinit snd_cmi8330_probe(struct snd_card *card, int dev)
487{ 494{
488 struct snd_cmi8330 *acard; 495 struct snd_cmi8330 *acard;
489 int i, err; 496 int i, err;
497 struct snd_opl3 *opl3;
490 498
491 acard = card->private_data; 499 acard = card->private_data;
492 err = snd_wss_create(card, wssport[dev] + 4, -1, 500 err = snd_wss_create(card, wssport[dev] + 4, -1,
@@ -530,6 +538,24 @@ static int __devinit snd_cmi8330_probe(struct snd_card *card, int dev)
530 snd_printk(KERN_ERR PFX "failed to create pcms\n"); 538 snd_printk(KERN_ERR PFX "failed to create pcms\n");
531 return err; 539 return err;
532 } 540 }
541 if (fmport[dev] != SNDRV_AUTO_PORT) {
542 if (snd_opl3_create(card,
543 fmport[dev], fmport[dev] + 2,
544 OPL3_HW_AUTO, 0, &opl3) < 0) {
545 snd_printk(KERN_ERR PFX
546 "no OPL device at 0x%lx-0x%lx ?\n",
547 fmport[dev], fmport[dev] + 2);
548 } else {
549 err = snd_opl3_timer_new(opl3, 0, 1);
550 if (err < 0)
551 return err;
552
553 err = snd_opl3_hwdep_new(opl3, 0, 1, NULL);
554 if (err < 0)
555 return err;
556 }
557 }
558
533 559
534 strcpy(card->driver, "CMI8330/C3D"); 560 strcpy(card->driver, "CMI8330/C3D");
535 strcpy(card->shortname, "C-Media CMI8330/C3D"); 561 strcpy(card->shortname, "C-Media CMI8330/C3D");