All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cmi8330: add OPL3 support
@ 2009-01-21  7:18 Krzysztof Helt
  2009-01-21  7:49 ` Clemens Ladisch
  0 siblings, 1 reply; 6+ messages in thread
From: Krzysztof Helt @ 2009-01-21  7:18 UTC (permalink / raw)
  To: Alsa-devel; +Cc: Takashi Iwai, Rene Herman

From: Krzysztof Helt <krzysztof.h1@wp.pl>

Add OPL3 handling to the driver
and volume control for FM synthesis.

Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl>
---
 sound/isa/Kconfig   |    1 +
 sound/isa/cmi8330.c |   30 ++++++++++++++++++++++++++++--
 2 files changed, 29 insertions(+), 2 deletions(-)

diff --git a/sound/isa/Kconfig b/sound/isa/Kconfig
index 2d6ce32..ae917e1 100644
--- a/sound/isa/Kconfig
+++ b/sound/isa/Kconfig
@@ -94,6 +94,7 @@ config SND_CMI8330
 	tristate "C-Media CMI8330"
 	select SND_WSS_LIB
 	select SND_SB16_DSP
+	select SND_OPL3_LIB
 	help
 	  Say Y here to include support for soundcards based on the
 	  C-Media CMI8330 chip.
diff --git a/sound/isa/cmi8330.c b/sound/isa/cmi8330.c
index e49aec7..dec6ea5 100644
--- a/sound/isa/cmi8330.c
+++ b/sound/isa/cmi8330.c
@@ -51,6 +51,7 @@
 #include <linux/moduleparam.h>
 #include <sound/core.h>
 #include <sound/wss.h>
+#include <sound/opl3.h>
 #include <sound/sb.h>
 #include <sound/initval.h>
 
@@ -79,6 +80,7 @@ static int sbdma16[SNDRV_CARDS] = SNDRV_DEFAULT_DMA;
 static long wssport[SNDRV_CARDS] = SNDRV_DEFAULT_PORT;
 static int wssirq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ;
 static int wssdma[SNDRV_CARDS] = SNDRV_DEFAULT_DMA;
+static long fmport[SNDRV_CARDS] = SNDRV_DEFAULT_PORT;
 
 module_param_array(index, int, NULL, 0444);
 MODULE_PARM_DESC(index, "Index value for CMI8330 soundcard.");
@@ -107,6 +109,8 @@ MODULE_PARM_DESC(wssirq, "IRQ # for CMI8330 WSS driver.");
 module_param_array(wssdma, int, NULL, 0444);
 MODULE_PARM_DESC(wssdma, "DMA for CMI8330 WSS driver.");
 
+module_param_array(fmport, long, NULL, 0444);
+MODULE_PARM_DESC(fmport, "FM port # for CMI8330 driver.");
 #ifdef CONFIG_PNP
 static int isa_registered;
 static int pnp_registered;
@@ -219,8 +223,10 @@ WSS_SINGLE("3D Control - Switch", 0,
 		CMI8330_RMUX3D, 5, 1, 1),
 WSS_SINGLE("PC Speaker Playback Volume", 0,
 		CMI8330_OUTPUTVOL, 3, 3, 0),
-WSS_SINGLE("FM Playback Switch", 0,
-		CMI8330_RECMUX, 3, 1, 1),
+WSS_DOUBLE("FM Playback Switch", 0,
+		CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 7, 7, 1, 1),
+WSS_DOUBLE("FM Playback Volume", 0,
+		CS4231_AUX2_LEFT_INPUT, CS4231_AUX2_RIGHT_INPUT, 0, 0, 31, 1),
 WSS_SINGLE(SNDRV_CTL_NAME_IEC958("Input ", CAPTURE, SWITCH), 0,
 		CMI8330_RMUX3D, 7, 1, 1),
 WSS_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,
 	wssport[dev] = pnp_port_start(pdev, 0);
 	wssdma[dev] = pnp_dma(pdev, 0);
 	wssirq[dev] = pnp_irq(pdev, 0);
+	fmport[dev] = pnp_port_start(pdev, 1);
 
 	/* allocate SB16 resources */
 	pdev = acard->play;
@@ -487,6 +494,7 @@ static int __devinit snd_cmi8330_probe(struct snd_card *card, int dev)
 {
 	struct snd_cmi8330 *acard;
 	int i, err;
+	struct snd_opl3 *opl3;
 
 	acard = card->private_data;
 	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)
 		snd_printk(KERN_ERR PFX "failed to create pcms\n");
 		return err;
 	}
+	if (fmport[dev] != SNDRV_AUTO_PORT) {
+		if (snd_opl3_create(card,
+				    fmport[dev], fmport[dev] + 2,
+				    OPL3_HW_AUTO, 0, &opl3) < 0) {
+			snd_printk(KERN_ERR PFX
+				   "no OPL device at 0x%lx-0x%lx ?\n",
+				   fmport[dev], fmport[dev] + 2);
+		} else {
+			err = snd_opl3_timer_new(opl3, 0, 1);
+			if (err < 0)
+				return err;
+
+			err = snd_opl3_hwdep_new(opl3, 0, 1, NULL);
+			if (err < 0)
+				return err;
+		}
+	}
+
 
 	strcpy(card->driver, "CMI8330/C3D");
 	strcpy(card->shortname, "C-Media CMI8330/C3D");
-- 
1.5.2.2



----------------------------------------------------------------------
Zobacz gry internetowe dla dzieci!
sprawdz >>>http://link.interia.pl/f202c

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] cmi8330: add OPL3 support
  2009-01-21  7:18 [PATCH] cmi8330: add OPL3 support Krzysztof Helt
@ 2009-01-21  7:49 ` Clemens Ladisch
  2009-01-21  7:58   ` Takashi Iwai
  0 siblings, 1 reply; 6+ messages in thread
From: Clemens Ladisch @ 2009-01-21  7:49 UTC (permalink / raw)
  To: Krzysztof Helt; +Cc: Takashi Iwai, Alsa-devel, Rene Herman

Krzysztof Helt wrote:
> +		err = snd_opl3_timer_new(opl3, 0, 1);
> +		if (err < 0)
> +			return err;

Does this chip really have a working timer implementation?
(There is a timer test program in alsa-lib/test/.)


Best regards,
Clemens

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] cmi8330: add OPL3 support
  2009-01-21  7:49 ` Clemens Ladisch
@ 2009-01-21  7:58   ` Takashi Iwai
  2009-01-21  9:43     ` Krzysztof Helt
  0 siblings, 1 reply; 6+ messages in thread
From: Takashi Iwai @ 2009-01-21  7:58 UTC (permalink / raw)
  To: Clemens Ladisch; +Cc: Alsa-devel, Krzysztof Helt, Rene Herman

At Wed, 21 Jan 2009 08:49:54 +0100,
Clemens Ladisch wrote:
> 
> Krzysztof Helt wrote:
> > +		err = snd_opl3_timer_new(opl3, 0, 1);
> > +		if (err < 0)
> > +			return err;
> 
> Does this chip really have a working timer implementation?
> (There is a timer test program in alsa-lib/test/.)

A good question.  Krzysztof, could you check alsa-lib/test/timer
program?  First run "./timer list" and then run like
	./timer class 1 card 0 device 2
or so...

BTW, your patches were already applied now, so please send fixes as
additional patches if any.


thanks,

Takashi

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] cmi8330: add OPL3 support
  2009-01-21  7:58   ` Takashi Iwai
@ 2009-01-21  9:43     ` Krzysztof Helt
  2009-01-21 11:14       ` Clemens Ladisch
  0 siblings, 1 reply; 6+ messages in thread
From: Krzysztof Helt @ 2009-01-21  9:43 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: Alsa-devel, Clemens Ladisch, Rene Herman

On Wed, 21 Jan 2009 08:58:23 +0100
Takashi Iwai <tiwai@suse.de> wrote:

> At Wed, 21 Jan 2009 08:49:54 +0100,
> Clemens Ladisch wrote:
> > 
> > Krzysztof Helt wrote:
> > > +		err = snd_opl3_timer_new(opl3, 0, 1);
> > > +		if (err < 0)
> > > +			return err;
> > 
> > Does this chip really have a working timer implementation?
> > (There is a timer test program in alsa-lib/test/.)
> 
> A good question.  Krzysztof, could you check alsa-lib/test/timer
> program?  First run "./timer list" and then run like
> 	./timer class 1 card 0 device 2
> or so...
> 
> BTW, your patches were already applied now, so please send fixes as
> additional patches if any.
> 
> 

The test returns: "Timer time out!!". However, it returns the same
for the SC-6000 board which has the Yamaha YMF 262-M chip which is 
supposed to have the Adlib timers.

Regards,
Krzysztof

-----------------------------------------------------------------------
Promocja w Speak Up. Kwartal angielskiego za darmo. 
3 miesiace nauki gratis. Sprawdz teraz! >> http://link.interia.pl/f2019

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] cmi8330: add OPL3 support
  2009-01-21  9:43     ` Krzysztof Helt
@ 2009-01-21 11:14       ` Clemens Ladisch
  2009-01-21 11:49         ` Krzysztof Helt
  0 siblings, 1 reply; 6+ messages in thread
From: Clemens Ladisch @ 2009-01-21 11:14 UTC (permalink / raw)
  To: Krzysztof Helt; +Cc: Takashi Iwai, Alsa-devel, Rene Herman

Krzysztof Helt wrote:
> The test returns: "Timer time out!!". However, it returns the same
> for the SC-6000 board which has the Yamaha YMF 262-M chip which is
> supposed to have the Adlib timers.

Then that chip does not forward the timer interrupt to the computer,
and its driver should not create a timer device either.


Best regards,
Clemens

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] cmi8330: add OPL3 support
  2009-01-21 11:14       ` Clemens Ladisch
@ 2009-01-21 11:49         ` Krzysztof Helt
  0 siblings, 0 replies; 6+ messages in thread
From: Krzysztof Helt @ 2009-01-21 11:49 UTC (permalink / raw)
  To: Clemens Ladisch; +Cc: Takashi Iwai, Alsa-devel, Rene Herman

On Wed, 21 Jan 2009 12:14:55 +0100
Clemens Ladisch <clemens@ladisch.de> wrote:

> Krzysztof Helt wrote:
> > The test returns: "Timer time out!!". However, it returns the same
> > for the SC-6000 board which has the Yamaha YMF 262-M chip which is
> > supposed to have the Adlib timers.
> 
> Then that chip does not forward the timer interrupt to the computer,
> and its driver should not create a timer device either.
> 

I checked the status word and it changed after the timeout elapsed.

However, the IRQ is not forwarded as you wrote. The same seems true
for more drivers and they should be checked:

ad1816a
als100
azt2320
dt019x
opti92x-ad1848
sc6000

All of them create the OPL3 timers but none of them
calls the snd_opl3_interrupt (do acknowledge timer
interrupt). The only driver which does it is the opl3sa2.

I will test the ad1816a, opti93x and the sc6000. If the
interrupt is not received I will prepare patches to
remove the OPL3 timers.

Regards,
Krzysztof

-----------------------------------------------------------------------
Promocja w Speak Up. Kwartal angielskiego za darmo. 
3 miesiace nauki gratis. Sprawdz teraz! >> http://link.interia.pl/f2019

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2009-01-21 11:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-01-21  7:18 [PATCH] cmi8330: add OPL3 support Krzysztof Helt
2009-01-21  7:49 ` Clemens Ladisch
2009-01-21  7:58   ` Takashi Iwai
2009-01-21  9:43     ` Krzysztof Helt
2009-01-21 11:14       ` Clemens Ladisch
2009-01-21 11:49         ` Krzysztof Helt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.