2001-12-19 23:28:38

by Luca Montecchiani

[permalink] [raw]
Subject: [PATCH] Trident 4DWave DX/NX joystick support

Hi!

Right now using the joystick with a trident sound card
on 2.4.x is not possible.

The joystick/pcigame give me tons of problems, like pci resource
conflicts and oops, anyway I'll came back soon with more detailed
data about that...

Forgetting the enhanced game port we can use the old legacy ISA ns558
driver but is a no go because the trident sound driver doesn't enable
that port :(

This patch allow to enable the legacy joystick port on
Trident 4DWave DX/NX.
The patch adds a new trident module param (joystick)
and a new config option.
I didn't try with a monolithic kernel, I hope that joy driver
driver will came after the sound driver..

Before xmas I need to turn my linux server on a X11box ;)

happy gaming,
luca

follow patch against 2.4.17rc2 inspired from a 1999 alsa-devel post:

diff -ur linux/Documentation/Configure.help /usr/src/linux/Documentation/Configure.help
--- linux/Documentation/Configure.help Wed Dec 19 23:17:07 2001
+++ /usr/src/linux/Documentation/Configure.help Wed Dec 19 22:11:34 2001
@@ -18576,7 +18576,7 @@

Enable joystick
CONFIG_SOUND_CMPCI_JOYSTICK
- Say here in order to enable the joystick port on a sound crd using
+ Say Y here in order to enable the joystick port on a sound card using
the CMI8338 or the CMI8738 chipset. Data on these chips are
available at <http://www.cmedia.com.tw/>.

@@ -18702,6 +18702,11 @@
This driver differs slightly from OSS/Free, so PLEASE READ the
comments at the top of <file:drivers/sound/trident.c>.

+Trident Joystick Interface
+CONFIG_SOUND_TRIDENT_JOYSTICK
+ Say Y here in order to enable the joystick interface of the
+ Trident 4D Wave DX or NX.
+
Rockwell WaveArtist
CONFIG_SOUND_WAVEARTIST
Say Y here to include support for the Rockwell WaveArtist sound
diff -ur linux/drivers/sound/Config.in /usr/src/linux/drivers/sound/Config.in
--- linux/drivers/sound/Config.in Wed Dec 19 23:17:11 2001
+++ /usr/src/linux/drivers/sound/Config.in Wed Dec 19 22:07:55 2001
@@ -52,7 +52,9 @@
dep_tristate ' NEC Vrc5477 AC97 sound' CONFIG_SOUND_VRC5477 $CONFIG_SOUND
fi
dep_tristate ' Trident 4DWave DX/NX, SiS 7018 or ALi 5451 PCI Audio Core' CONFIG_SOUND_TRIDENT $CONFIG_SOUND
-
+if [ "$CONFIG_SOUND_TRIDENT" = "y" -o "$CONFIG_SOUND_TRIDENT" = "m" ]; then
+ bool ' Enable trident joystick port' CONFIG_SOUND_TRIDENT_JOYSTICK
+fi
dep_tristate ' Support for Turtle Beach MultiSound Classic, Tahiti, Monterey' CONFIG_SOUND_MSNDCLAS $CONFIG_SOUND
if [ "$CONFIG_SOUND_MSNDCLAS" = "y" -o "$CONFIG_SOUND_MSNDCLAS" = "m" ]; then
if [ "$CONFIG_SOUND_MSNDCLAS" = "y" ]; then
diff -ur linux/drivers/sound/trident.c /usr/src/linux/drivers/sound/trident.c
--- linux/drivers/sound/trident.c Mon Dec 17 14:50:31 2001
+++ /usr/src/linux/drivers/sound/trident.c Wed Dec 19 23:08:27 2001
@@ -36,6 +36,10 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* History
+ *
+ * v0.14.9e
+ * December 20 2001 Luca Montecchiani <[email protected]>
+ * enable joystick legacy port on Trident 4Dwave DX/NX
* v0.14.9d
* October 8 2001 Arnaldo Carvalho de Melo <[email protected]>
* use set_current_state, properly release resources on failure in
@@ -180,7 +184,13 @@

#include <linux/pm.h>

-#define DRIVER_VERSION "0.14.9d"
+#define DRIVER_VERSION "0.14.9e"
+
+#ifdef CONFIG_SOUND_TRIDENT_JOYSTICK
+static int joystick = 1;
+#else
+static int joystick = 0;
+#endif

/* magic numbers to protect our data structures */
#define TRIDENT_CARD_MAGIC 0x5072696E /* "Prin" */
@@ -4070,6 +4080,14 @@
printk(KERN_ERR "trident: couldn't register DSP device!\n");
goto out_free_irq;
}
+
+ /* enable joystick legacy port by [email protected] */
+ if ((card->pci_id == PCI_DEVICE_ID_TRIDENT_4DWAVE_DX ||
+ card->pci_id == PCI_DEVICE_ID_TRIDENT_4DWAVE_NX) && joystick) {
+ pci_write_config_byte(pci_dev, 0x44, 0x20);
+ printk(KERN_INFO "trident: joystick port enabled.\n");
+ }
+
card->mixer_regs_ready = 0;
/* initialize AC97 codec and register /dev/mixer */
if (trident_ac97_init(card) <= 0) {
@@ -4183,6 +4201,8 @@
pci_set_drvdata(pci_dev, NULL);
}

+MODULE_PARM(joystick, "i");
+MODULE_PARM_DESC(joystick, "(1/0) Enable joystick interface, still need joystick driver");
MODULE_AUTHOR("Alan Cox, Aaron Holtzman, Ollie Lho, Ching Ling Lee");
MODULE_DESCRIPTION("Trident 4DWave/SiS 7018/ALi 5451 and Tvia/IGST CyberPro5050 PCI Audio Driver");
MODULE_LICENSE("GPL");

--
----------------------------------------------------------
Luca Montecchiani <[email protected]>
http://www.geocities.com/montecchiani
SpeakFreely:sflwl -hlwl.fourmilab.ch luca@ ICQ:17655604
-------------------=(Linux since 1995)=-------------------


2001-12-20 14:39:17

by Vojtech Pavlik

[permalink] [raw]
Subject: Re: [PATCH] Trident 4DWave DX/NX joystick support

Hi!

I must say I don't like the patch much. If there is anything going to be
added to trident.c in regards to enabling the joystick, I think most of
the pcigame.c code should be moved in there. That way, there won't be
resource conflicts and we won't lose any functionality.

Vojtech

On Thu, Dec 20, 2001 at 12:28:31AM +0100, Luca Montecchiani wrote:
> Hi!
>
> Right now using the joystick with a trident sound card
> on 2.4.x is not possible.
>
> The joystick/pcigame give me tons of problems, like pci resource
> conflicts and oops, anyway I'll came back soon with more detailed
> data about that...
>
> Forgetting the enhanced game port we can use the old legacy ISA ns558
> driver but is a no go because the trident sound driver doesn't enable
> that port :(
>
> This patch allow to enable the legacy joystick port on
> Trident 4DWave DX/NX.
> The patch adds a new trident module param (joystick)
> and a new config option.
> I didn't try with a monolithic kernel, I hope that joy driver
> driver will came after the sound driver..
>
> Before xmas I need to turn my linux server on a X11box ;)
>
> happy gaming,
> luca
>
> follow patch against 2.4.17rc2 inspired from a 1999 alsa-devel post:
>
> diff -ur linux/Documentation/Configure.help /usr/src/linux/Documentation/Configure.help
> --- linux/Documentation/Configure.help Wed Dec 19 23:17:07 2001
> +++ /usr/src/linux/Documentation/Configure.help Wed Dec 19 22:11:34 2001
> @@ -18576,7 +18576,7 @@
>
> Enable joystick
> CONFIG_SOUND_CMPCI_JOYSTICK
> - Say here in order to enable the joystick port on a sound crd using
> + Say Y here in order to enable the joystick port on a sound card using
> the CMI8338 or the CMI8738 chipset. Data on these chips are
> available at <http://www.cmedia.com.tw/>.
>
> @@ -18702,6 +18702,11 @@
> This driver differs slightly from OSS/Free, so PLEASE READ the
> comments at the top of <file:drivers/sound/trident.c>.
>
> +Trident Joystick Interface
> +CONFIG_SOUND_TRIDENT_JOYSTICK
> + Say Y here in order to enable the joystick interface of the
> + Trident 4D Wave DX or NX.
> +
> Rockwell WaveArtist
> CONFIG_SOUND_WAVEARTIST
> Say Y here to include support for the Rockwell WaveArtist sound
> diff -ur linux/drivers/sound/Config.in /usr/src/linux/drivers/sound/Config.in
> --- linux/drivers/sound/Config.in Wed Dec 19 23:17:11 2001
> +++ /usr/src/linux/drivers/sound/Config.in Wed Dec 19 22:07:55 2001
> @@ -52,7 +52,9 @@
> dep_tristate ' NEC Vrc5477 AC97 sound' CONFIG_SOUND_VRC5477 $CONFIG_SOUND
> fi
> dep_tristate ' Trident 4DWave DX/NX, SiS 7018 or ALi 5451 PCI Audio Core' CONFIG_SOUND_TRIDENT $CONFIG_SOUND
> -
> +if [ "$CONFIG_SOUND_TRIDENT" = "y" -o "$CONFIG_SOUND_TRIDENT" = "m" ]; then
> + bool ' Enable trident joystick port' CONFIG_SOUND_TRIDENT_JOYSTICK
> +fi
> dep_tristate ' Support for Turtle Beach MultiSound Classic, Tahiti, Monterey' CONFIG_SOUND_MSNDCLAS $CONFIG_SOUND
> if [ "$CONFIG_SOUND_MSNDCLAS" = "y" -o "$CONFIG_SOUND_MSNDCLAS" = "m" ]; then
> if [ "$CONFIG_SOUND_MSNDCLAS" = "y" ]; then
> diff -ur linux/drivers/sound/trident.c /usr/src/linux/drivers/sound/trident.c
> --- linux/drivers/sound/trident.c Mon Dec 17 14:50:31 2001
> +++ /usr/src/linux/drivers/sound/trident.c Wed Dec 19 23:08:27 2001
> @@ -36,6 +36,10 @@
> * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
> *
> * History
> + *
> + * v0.14.9e
> + * December 20 2001 Luca Montecchiani <[email protected]>
> + * enable joystick legacy port on Trident 4Dwave DX/NX
> * v0.14.9d
> * October 8 2001 Arnaldo Carvalho de Melo <[email protected]>
> * use set_current_state, properly release resources on failure in
> @@ -180,7 +184,13 @@
>
> #include <linux/pm.h>
>
> -#define DRIVER_VERSION "0.14.9d"
> +#define DRIVER_VERSION "0.14.9e"
> +
> +#ifdef CONFIG_SOUND_TRIDENT_JOYSTICK
> +static int joystick = 1;
> +#else
> +static int joystick = 0;
> +#endif
>
> /* magic numbers to protect our data structures */
> #define TRIDENT_CARD_MAGIC 0x5072696E /* "Prin" */
> @@ -4070,6 +4080,14 @@
> printk(KERN_ERR "trident: couldn't register DSP device!\n");
> goto out_free_irq;
> }
> +
> + /* enable joystick legacy port by [email protected] */
> + if ((card->pci_id == PCI_DEVICE_ID_TRIDENT_4DWAVE_DX ||
> + card->pci_id == PCI_DEVICE_ID_TRIDENT_4DWAVE_NX) && joystick) {
> + pci_write_config_byte(pci_dev, 0x44, 0x20);
> + printk(KERN_INFO "trident: joystick port enabled.\n");
> + }
> +
> card->mixer_regs_ready = 0;
> /* initialize AC97 codec and register /dev/mixer */
> if (trident_ac97_init(card) <= 0) {
> @@ -4183,6 +4201,8 @@
> pci_set_drvdata(pci_dev, NULL);
> }
>
> +MODULE_PARM(joystick, "i");
> +MODULE_PARM_DESC(joystick, "(1/0) Enable joystick interface, still need joystick driver");
> MODULE_AUTHOR("Alan Cox, Aaron Holtzman, Ollie Lho, Ching Ling Lee");
> MODULE_DESCRIPTION("Trident 4DWave/SiS 7018/ALi 5451 and Tvia/IGST CyberPro5050 PCI Audio Driver");
> MODULE_LICENSE("GPL");
>
> --
> ----------------------------------------------------------
> Luca Montecchiani <[email protected]>
> http://www.geocities.com/montecchiani
> SpeakFreely:sflwl -hlwl.fourmilab.ch luca@ ICQ:17655604
> -------------------=(Linux since 1995)=-------------------

--
Vojtech Pavlik
SuSE Labs

2001-12-20 16:09:58

by Luca Montecchiani

[permalink] [raw]
Subject: Re: [PATCH] Trident 4DWave DX/NX joystick support

Vojtech Pavlik wrote:

> I must say I don't like the patch much.

There are couples of other pci cards that do the same
and right now is the only way to make joystick works with
trident sound card.
I hope to help some users around here.

> If there is anything going to be added to trident.c
> in regards to enabling the joystick, I think most of
> the pcigame.c code should be moved in there.

Not necessary, 2.2.19 joy-pci code works fine, no conflict
no oops, what about comparing against 2.4.x pcigame ?

Unfortunately I don't know how do that, but I can help you
testing patch, etc...

I hope to provide you the oops I've got insmodding analog
tomorrow.

> That way, there won't be
> resource conflicts and we won't lose any functionality.

I don't understand where the problem came from, with
2.2.19 everything work fine, I can use the joy-pci with
the trident module up and running, with the 2.4.17rc2
trident and pcigame are mutually exclusive.
Because of the 2.4.x pci changes ? Let's see.

ciao,
luca

2001-12-20 20:58:16

by Vojtech Pavlik

[permalink] [raw]
Subject: Re: [PATCH] Trident 4DWave DX/NX joystick support

On Thu, Dec 20, 2001 at 05:05:25PM +0100, Luca Montecchiani wrote:

> > I must say I don't like the patch much.
>
> There are couples of other pci cards that do the same
> and right now is the only way to make joystick works with
> trident sound card.
> I hope to help some users around here.
>
> > If there is anything going to be added to trident.c
> > in regards to enabling the joystick, I think most of
> > the pcigame.c code should be moved in there.
>
> Not necessary, 2.2.19 joy-pci code works fine, no conflict
> no oops, what about comparing against 2.4.x pcigame ?
>
> Unfortunately I don't know how do that, but I can help you
> testing patch, etc...
>
> I hope to provide you the oops I've got insmodding analog
> tomorrow.

If you'll be able to get me the decoded oops, I'll be very grateful,
because I've got some reports about analog oopsing and I haven't been
able to reproduce that.

> > That way, there won't be
> > resource conflicts and we won't lose any functionality.
>
> I don't understand where the problem came from, with
> 2.2.19 everything work fine, I can use the joy-pci with
> the trident module up and running, with the 2.4.17rc2
> trident and pcigame are mutually exclusive.
> Because of the 2.4.x pci changes ? Let's see.

--
Vojtech Pavlik
SuSE Labs