All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC] cmi8330: Add basic CMI8329 support
@ 2009-06-27 15:07 Ondrej Zary
  2009-06-29  6:25 ` Takashi Iwai
  0 siblings, 1 reply; 4+ messages in thread
From: Ondrej Zary @ 2009-06-27 15:07 UTC (permalink / raw)
  To: alsa-devel

Add basic support for CMI8329 cards. It seems to be very similar to CMI8330,
but the PnP devices are different:
 - AD1848 (WSS) and SB16 device IDs are swapped
 - the OPL3 port is contained in SB16 device, not AD1848 (WSS)
 - there is A@@0001 device (looks like some control interface - it has only
   one 8-bit I/O address)

Is my detection code correct, shouldn't the struct pnp_dev returned
pnp_request_card_device() be released somehow?

Also the mixer seems to be a bit different - master volume does not work
currently.

My card includes wavetable MIDI - it works in Windows when MPU-401 is
selected. It does not work with this driver - pmidi plays but no sound
comes out. OPL3 works.

My card has also an IDE interface but it's not visible as PnP device and
it does not work even in Windows (and I'm unable to find any driver for it
for any OS).

Here's a scan of the card: http://www.rainbow-software.org/images/hardware/cmi8329a_.jpg
The main chip is labelled AD Chips CMI8329A.


--- linux-test/sound/isa/cmi8330.c	2009-06-27 16:32:13.000000000 +0200
+++ linux-2.6.30-pentium/sound/isa/cmi8330.c	2009-06-27 16:33:25.000000000 +0200
@@ -156,6 +156,11 @@
 
 typedef int (*snd_pcm_open_callback_t)(struct snd_pcm_substream *);
 
+enum card_type {
+	CMI8329,
+	CMI8330
+};
+
 struct snd_cmi8330 {
 #ifdef CONFIG_PNP
 	struct pnp_dev *cap;
@@ -172,6 +177,8 @@
 		snd_pcm_open_callback_t open;
 		void *private_data; /* sb or wss */
 	} streams[2];
+
+	enum card_type type;
 };
 
 #ifdef CONFIG_PNP
@@ -328,12 +335,26 @@
 {
 	struct pnp_dev *pdev;
 	int err;
+	const char *sb16_id, *wss_id;
+
+	/* CMI8329 has a device with ID A@@0001, CMI8330 does not */
+	pdev = pnp_request_card_device(card, "A@@0001", NULL);
+	if (pdev) {
+		acard->type = CMI8329;
+		pnp_release_card_device(pdev);
+		sb16_id = id->devs[0].id;
+		wss_id = id->devs[1].id;
+	} else {
+		acard->type = CMI8330;
+		sb16_id = id->devs[1].id;
+		wss_id = id->devs[0].id;
+	}
 
-	acard->cap = pnp_request_card_device(card, id->devs[0].id, NULL);
+	acard->cap = pnp_request_card_device(card, wss_id, NULL);
 	if (acard->cap == NULL)
 		return -EBUSY;
 
-	acard->play = pnp_request_card_device(card, id->devs[1].id, NULL);
+	acard->play = pnp_request_card_device(card, sb16_id, NULL);
 	if (acard->play == NULL)
 		return -EBUSY;
 
@@ -351,7 +372,8 @@
 	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);
+	if (acard->type == CMI8330)
+		fmport[dev] = pnp_port_start(pdev, 1);
 
 	/* allocate SB16 resources */
 	pdev = acard->play;
@@ -365,6 +387,8 @@
 	sbdma8[dev] = pnp_dma(pdev, 0);
 	sbdma16[dev] = pnp_dma(pdev, 1);
 	sbirq[dev] = pnp_irq(pdev, 0);
+	if (acard->type == CMI8329)
+		fmport[dev] = pnp_port_start(pdev, 1);
 
 	/* allocate MPU-401 resources */
 	pdev = acard->mpu;

-- 
Ondrej Zary

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

end of thread, other threads:[~2009-07-05  9:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-06-27 15:07 [RFC] cmi8330: Add basic CMI8329 support Ondrej Zary
2009-06-29  6:25 ` Takashi Iwai
2009-07-04 20:25   ` Ondrej Zary
2009-07-05  9:51     ` Takashi Iwai

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.