[alsa-devel] conversion of opti93x driver to use cs4231-lib
Hi,
I posted some time ago two patches which converts opti93x driver to use cs4231-lib library.
The opti93x chips are almost compatible with the cs4231 differing mostly by mixer.
This change greatly reduces the source of the opti drivers.
Here are patches: [addition of opti93x details to the cs4231-lib] http://mailman.alsa-project.org/pipermail/alsa-devel/2007-September/003395.h...
and [conversion of opti93x driver to use cs4231-lib] http://mailman.alsa-project.org/pipermail/alsa-devel/2007-September/003396.h...
I will rediff the second patch as there were some changes to opti93x driver after sending the patch.
If it is not a good idea to do such conversion, please reply and drop patches.
Regards, Krzysztof
------------------------------------------------------------ Walcz w kosmicznej wojnie w nowej grze! Kliknij >>> http://link.interia.pl/f1cc1
At Mon, 7 Jan 2008 20:08:01 +0100, Krzysztof Helt wrote:
Hi,
I posted some time ago two patches which converts opti93x driver to use cs4231-lib library.
The opti93x chips are almost compatible with the cs4231 differing mostly by mixer.
This change greatly reduces the source of the opti drivers.
Here are patches: [addition of opti93x details to the cs4231-lib] http://mailman.alsa-project.org/pipermail/alsa-devel/2007-September/003395.h...
and [conversion of opti93x driver to use cs4231-lib] http://mailman.alsa-project.org/pipermail/alsa-devel/2007-September/003396.h...
I will rediff the second patch as there were some changes to opti93x driver after sending the patch.
If it is not a good idea to do such conversion, please reply and drop patches.
The only concern is whether this breaks the workign opti9xx stuff. If someone can confirm it's OK, then I'm 100% for these patches.
Added Rene to Cc to hear his opinion.
Takashi
On 08-01-08 12:38, Takashi Iwai wrote:
Jaroslav -- do you know/remember why opti93x didn't use cs4231-lib?
At Mon, 7 Jan 2008 20:08:01 +0100, Krzysztof Helt wrote:
Hi,
I posted some time ago two patches which converts opti93x driver to use cs4231-lib library.
The opti93x chips are almost compatible with the cs4231 differing mostly by mixer.
This change greatly reduces the source of the opti drivers.
Here are patches: [addition of opti93x details to the cs4231-lib] http://mailman.alsa-project.org/pipermail/alsa-devel/2007-September/003395.h...
and [conversion of opti93x driver to use cs4231-lib] http://mailman.alsa-project.org/pipermail/alsa-devel/2007-September/003396.h...
I will rediff the second patch as there were some changes to opti93x driver after sending the patch.
If it is not a good idea to do such conversion, please reply and drop patches.
The only concern is whether this breaks the workign opti9xx stuff. If someone can confirm it's OK, then I'm 100% for these patches.
Added Rene to Cc to hear his opinion.
Missed this one originally. I'll look into this in some detail but will need a few days. Obviously, if it works, it's desirable. Maybe Jaroslav knows why it's not that way now?
Rene.
On 08-01-08 15:16, Rene Herman wrote:
At Mon, 7 Jan 2008 20:08:01 +0100, Krzysztof Helt wrote:
I will rediff the second patch as there were some changes to opti93x driver after sending the patch.
Missed this one originally. I'll look into this in some detail but will need a few days. Obviously, if it works, it's desirable. Maybe Jaroslav knows why it's not that way now?
Oh, and by the way, I suppose it'll be trivial but a rediff would be good for testing.
Rene.
On 08-01-08 15:36, Rene Herman wrote:
Missed this one originally. I'll look into this in some detail but will need a few days. Obviously, if it works, it's desirable. Maybe Jaroslav knows why it's not that way now?
Oh, and by the way, I suppose it'll be trivial but a rediff would be good for testing.
Just now found time but could you provide an updated one? Mucho reject on cs4231_lib (which I didn't actually look at). Against some mainline tree (2.6.23.x or 2.6.24-rc) is preferred. The test box is not my main box and recompiling stuff on it is failry painful.
(I have 930, 931 and 933 to test with by the way...)
Rene.
On Tue, 8 Jan 2008, Rene Herman wrote:
On 08-01-08 12:38, Takashi Iwai wrote:
Jaroslav -- do you know/remember why opti93x didn't use cs4231-lib?
At Mon, 7 Jan 2008 20:08:01 +0100, Krzysztof Helt wrote:
Hi,
I posted some time ago two patches which converts opti93x driver to use cs4231-lib library.
The opti93x chips are almost compatible with the cs4231 differing mostly by mixer.
This change greatly reduces the source of the opti drivers.
Here are patches: [addition of opti93x details to the cs4231-lib] http://mailman.alsa-project.org/pipermail/alsa-devel/2007-September/003395.h...
and [conversion of opti93x driver to use cs4231-lib] http://mailman.alsa-project.org/pipermail/alsa-devel/2007-September/003396.h...
I will rediff the second patch as there were some changes to opti93x driver after sending the patch.
If it is not a good idea to do such conversion, please reply and drop patches.
The only concern is whether this breaks the workign opti9xx stuff. If someone can confirm it's OK, then I'm 100% for these patches.
Added Rene to Cc to hear his opinion.
Missed this one originally. I'll look into this in some detail but will need a few days. Obviously, if it works, it's desirable. Maybe Jaroslav knows why it's not that way now?
I think that it was opti driver author decision, but I also don't see any problem to use common code (if verified to be working, of course).
Jaroslav
----- Jaroslav Kysela perex@perex.cz Linux Kernel Sound Maintainer ALSA Project, Red Hat, Inc.
On Tue, 08 Jan 2008 15:16:57 +0100 Rene Herman rene.herman@keyaccess.nl wrote:
On 08-01-08 12:38, Takashi Iwai wrote:
Jaroslav -- do you know/remember why opti93x didn't use cs4231-lib?
One reason is that OPTi93x mixer has slightly different control bits. That's why the first patch is added.
A big part of the second patch changes (removes) lines from the code ifdef-ed for opti93x only. Below is the part of patch which shows differences in common paths with opti92x. It is much much shorter.
One thing to notice - the changed code has no common patch with opti92x-ad1848 as it is always ifdef-ed as CS4231 code. So only opti92x-cs4231 can be affected. Judge it from the diff below.
@@ -34,15 +34,10 @@ #include <asm/io.h> #include <asm/dma.h> #include <sound/core.h> -#ifdef CS4231 +#if defined(CS4231) || defined(OPTi93X) #include <sound/cs4231.h> #else -#ifndef OPTi93X #include <sound/ad1848.h> -#else -#include <sound/control.h> -#include <sound/pcm.h> -#endif /* OPTi93X */ #endif /* CS4231 */ #include <sound/mpu401.h> #include <sound/opl3.h> @@ -110,7 +105,6 @@ module_param(dma2, int, 0444); MODULE_PARM_DESC(dma2, "2nd dma # for opti9xx driver."); #endif /* CS4231 || OPTi93X */
-#define OPTi9XX_HW_DETECT 0 #define OPTi9XX_HW_82C928 1 #define OPTi9XX_HW_82C929 2 #define OPTi9XX_HW_82C924 3 @@ -1783,11 +748,11 @@ static int __devinit snd_opti9xx_probe(s static long possible_ports[] = {0x530, 0xe80, 0xf40, 0x604, -1}; int error; struct snd_opti9xx *chip = card->private_data; -#if defined(OPTi93X) - struct snd_opti93x *codec; -#elif defined(CS4231) +#if defined(CS4231) || defined(OPTi93X) struct snd_cs4231 *codec; +#ifdef CS4231 struct snd_timer *timer; +#endif #else struct snd_ad1848 *codec; #endif @@ -1819,26 +784,31 @@ static int __devinit snd_opti9xx_probe(s if ((error = snd_opti9xx_configure(chip))) return error;
-#if defined(OPTi93X) - if ((error = snd_opti93x_create(card, chip, chip->dma1, chip->dma2, &codec))) - return error; - if ((error = snd_opti93x_pcm(codec, 0, &pcm)) < 0) - return error; - if ((error = snd_opti93x_mixer(codec)) < 0) - return error; -#elif defined(CS4231) +#if defined(CS4231) || defined(OPTi93X) if ((error = snd_cs4231_create(card, chip->wss_base + 4, -1, chip->irq, chip->dma1, chip->dma2, - CS4231_HW_DETECT, - 0, +#ifdef CS4231 + CS4231_HW_DETECT, 0, +#else /* OPTi93x */ + CS4231_HW_OPTI93X, CS4231_HWSHARE_IRQ, +#endif &codec)) < 0) return error; + chip->codec = codec; if ((error = snd_cs4231_pcm(codec, 0, &pcm)) < 0) return error; if ((error = snd_cs4231_mixer(codec)) < 0) return error; +#ifdef CS4231 if ((error = snd_cs4231_timer(codec, 0, &timer)) < 0) return error; +#else /* OPTI93X */ + error = request_irq(chip->irq, snd_opti93x_interrupt, IRQF_DISABLED, DEV_NAME" - WSS", codec); + if (error < 0) { + snd_printk(KERN_ERR "opti9xx: can't grab IRQ %d\n", chip->irq); + return error; + } +#endif #else if ((error = snd_ad1848_create(card, chip->wss_base + 4, chip->irq, chip->dma1,
---------------------------------------------------------------------- Chcesz kupic aparat? Sprawdz, ktory jest najlepszy! Kliknij >>> http://link.interia.pl/f1cd3
participants (5)
-
Jaroslav Kysela
-
Krzysztof Helt
-
Massimo Piccioni
-
Rene Herman
-
Takashi Iwai