mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Re: [PATCH] for YMF PCI sound cards
@ 2000-12-08 17:55 Adam J. Richter
  2000-12-08 23:51 ` Alan Cox
  0 siblings, 1 reply; 7+ messages in thread
From: Adam J. Richter @ 2000-12-08 17:55 UTC (permalink / raw)
  To: proski; +Cc: kai, linux-kernel


	This ALSA-based Yamaha PCI driver does not have the changes
from ALSA that were necessary to make it run on the Transmeta-based
Sony PictureBooks, right?  I tried the driver in 2.4.0-test12pre7,
and that driver with Pavel's patch, and that driver with Pavel's
patch with "#include <linux/config.h>, #undef CONFIG_SMP", and
got the same behavior in all three cases:

	Loading the module would cause a very loud monotone
squeal, like some kind of theft detection device.  The computer
would still work while it was sqealing, but sync'ing the discs
would never return.  rmmod'ing the module would cause a second
noise to be superimposed on the first, one that sounded like a
worn down fan or the purr that some BIOS'es make when they are
testing RAM.

	If this version does not have whatever changes were
need for the Transmeta-baed Picturebook, then never mind.
If it is not some obvious oversight, I guess I will try installing
ALSA and comparing the drivers.

Adam J. Richter     __     ______________   4880 Stevens Creek Blvd, Suite 104
adam@yggdrasil.com     \ /                  San Jose, California 95129-1034
+1 408 261-6630         | g g d r a s i l   United States of America
fax +1 408 261-6631      "Free Software For The Rest Of Us."
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 7+ messages in thread
* [PATCH] for YMF PCI sound cards
@ 2000-12-08 16:41 Pavel Roskin
  2000-12-08 18:31 ` Pete Zaitcev
  0 siblings, 1 reply; 7+ messages in thread
From: Pavel Roskin @ 2000-12-08 16:41 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-sound, Pete Zaitcev, Jaroslav Kysela

Hello!

Description of the changes:

Changed logic in drivers/sound/Config.in so that both drivers for YMF PCI
can be compiled as modules, but neither of them is enabled if the other
one is linked into the kernel (just like the UHCI drivers).

Don't use ENOTTY in the ioctl routine in drivers/sound/ymfpci.c - use
EINVAL instead.

Initialize the legacy OPL3 interface in drivers/sound/ymfpci.c since there
is no native synthesizer support yet. Added parameter synth_io to specify
the address of the OPL3 interface.

Add YMF cards to the table of known codecs in drivers/sound/ac97_codec.c

For your convenience, the patch is also available at
http://www.red-bean.com/~proski/ymf.patch

Regards,
Pavel Roskin

_________________________________
--- ./drivers/sound/Config.in	Thu Dec  7 10:59:06 2000
+++ ./drivers/sound/Config.in	Fri Dec  8 11:25:08 2000
@@ -142,8 +142,10 @@
    dep_tristate '    Yamaha FM synthesizer (YM3812/OPL-3) support' CONFIG_SOUND_YM3812 $CONFIG_SOUND_OSS
    dep_tristate '    Yamaha OPL3-SA1 audio controller' CONFIG_SOUND_OPL3SA1 $CONFIG_SOUND_OSS
    dep_tristate '    Yamaha OPL3-SA2, SA3, and SAx based PnP cards' CONFIG_SOUND_OPL3SA2 $CONFIG_SOUND_OSS
-   dep_tristate '    Yamaha YMF7xx PCI audio (legacy mode)' CONFIG_SOUND_YMPCI $CONFIG_SOUND_OSS $CONFIG_PCI
-   if [ "$CONFIG_SOUND_YMPCI" = "n" ]; then
+   if [ "$CONFIG_SOUND_YMFPCI" != "y" ]; then
+      dep_tristate '    Yamaha YMF7xx PCI audio (legacy mode)' CONFIG_SOUND_YMPCI $CONFIG_SOUND_OSS $CONFIG_PCI
+   fi
+   if [ "$CONFIG_SOUND_YMPCI" != "y" ]; then
       dep_tristate '    Yamaha YMF7xx PCI audio (native mode) (EXPERIMENTAL)' CONFIG_SOUND_YMFPCI $CONFIG_SOUND_OSS $CONFIG_PCI $CONFIG_EXPERIMENTAL
    fi
    dep_tristate '    6850 UART support' CONFIG_SOUND_UART6850 $CONFIG_SOUND_OSS
--- ./drivers/sound/ymfpci.c	Thu Dec  7 10:59:06 2000
+++ ./drivers/sound/ymfpci.c	Fri Dec  8 11:33:51 2000
@@ -81,6 +81,13 @@
 };
 MODULE_DEVICE_TABLE(pci, ymf_id_tbl);

+#ifdef MODULE
+static int synth_io = 0;
+MODULE_PARM(synth_io, "i");
+#else
+static int synth_io   = 0x388;
+#endif
+
 /*
  * Mindlessly copied from cs46xx XXX
  */
@@ -1868,7 +1875,7 @@
 	case SNDCTL_DSP_SETSYNCRO:
 	case SOUND_PCM_WRITE_FILTER:
 	case SOUND_PCM_READ_FILTER:
-		return -ENOTTY;
+		return -EINVAL;

 	default:
 	/* P3 */ printk(KERN_WARNING "ymfpci: unknown ioctl cmd 0x%x\n", cmd);
@@ -1879,7 +1886,76 @@
 		 * XXX Is there sound_generic_ioctl() around?
 		 */
 	}
-	return -ENOTTY;
+	return -EINVAL;
+}
+
+#define	YMFSB_PCIR_LEGCTRL              0x40
+#define	YMFSB_PCIR_ELEGCTRL             0x42
+#define YMFSB_PCIR_OPLADR               0x60
+static int ymfpci_opl3_init(struct pci_dev *pcidev, int instance)
+{
+	int v;
+	int oplio = 0;
+
+	switch(synth_io) {
+	case 0:
+		/* Only enable OPL3 by default for the first card */
+		if (instance == 0) {
+			synth_io = 0x388;
+		} else {
+			return 0;
+		}
+		break;
+	case 0x388:
+		oplio = 0;
+		break;
+	case 0x398:
+		oplio = 1;
+		break;
+	case 0x3a0:
+		oplio = 2;
+		break;
+	case 0x3a8:
+		oplio = 3;
+		break;
+	case -1:
+		return 0;
+		break;
+	default:
+		printk(KERN_ERR
+		       "ymfpci%d: synth_io=0x%x is not valid\n",
+		       instance, synth_io);
+		return -1;
+		break;
+	}
+
+	printk("ymfpci%d: set OPL3 I/O at 0x%x\n", instance, synth_io);
+
+	v = 0x003f;
+	pci_write_config_word(pcidev, YMFSB_PCIR_LEGCTRL, v);
+
+	v = 0x8800;
+	switch( pcidev->device ) {
+	case PCI_DEVICE_ID_YAMAHA_724:
+	case PCI_DEVICE_ID_YAMAHA_724F:
+	case PCI_DEVICE_ID_YAMAHA_740:
+	case PCI_DEVICE_ID_YAMAHA_740C:
+		v = v | (oplio & 0x03);
+		pci_write_config_word(pcidev, YMFSB_PCIR_ELEGCTRL, v);
+		break;
+
+	case PCI_DEVICE_ID_YAMAHA_744:
+	case PCI_DEVICE_ID_YAMAHA_754:
+		pci_write_config_word(pcidev, YMFSB_PCIR_ELEGCTRL, v);
+		pci_write_config_word(pcidev, YMFSB_PCIR_OPLADR, synth_io);
+		break;
+
+	default:
+		return -1;
+		break;
+	}
+
+	return 0;
 }

 static int ymf_open(struct inode *inode, struct file *file)
@@ -2290,6 +2366,8 @@

 	printk(KERN_INFO "ymfpci%d: %s at 0x%lx IRQ %d\n", ymf_instance,
 	    (char *)ent->driver_data, pci_resource_start(pcidev, 0), pcidev->irq);
+
+	ymfpci_opl3_init(pcidev, ymf_instance);

 	ymfpci_aclink_reset(pcidev);
 	if (ymfpci_codec_ready(codec, 0, 1) < 0)
--- ./drivers/sound/ac97_codec.c	Thu Dec  7 10:59:06 2000
+++ ./drivers/sound/ac97_codec.c	Thu Dec  7 11:00:44 2000
@@ -61,6 +61,7 @@
 } ac97_codec_ids[] = {
 	{0x414B4D00, "Asahi Kasei AK4540 rev 0", NULL},
 	{0x414B4D01, "Asahi Kasei AK4540 rev 1", NULL},
+	{0x41445303, "Yamaha YMF????"          , NULL},
 	{0x41445340, "Analog Devices AD1881"  , NULL},
 	{0x41445360, "Analog Devices AD1885"  , enable_eapd},
 	{0x43525900, "Cirrus Logic CS4297"    , NULL},
_________________________________


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/

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

end of thread, other threads:[~2000-12-09  0:26 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-12-08 17:55 [PATCH] for YMF PCI sound cards Adam J. Richter
2000-12-08 23:51 ` Alan Cox
  -- strict thread matches above, loose matches on Subject: below --
2000-12-08 16:41 Pavel Roskin
2000-12-08 18:31 ` Pete Zaitcev
2000-12-08 18:46   ` Jaroslav Kysela
2000-12-08 18:56   ` Pavel Roskin
2000-12-08 23:57   ` Alan Cox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®