* 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* Re: [PATCH] for YMF PCI sound cards
2000-12-08 16:41 Pavel Roskin
@ 2000-12-08 18:31 ` Pete Zaitcev
2000-12-08 18:46 ` Jaroslav Kysela
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Pete Zaitcev @ 2000-12-08 18:31 UTC (permalink / raw)
To: Pavel Roskin; +Cc: linux-kernel, linux-sound, Pete Zaitcev, Jaroslav Kysela
> Date: Fri, 8 Dec 2000 11:41:07 -0500 (EST)
> From: Pavel Roskin <proski@gnu.org>
> To: <linux-kernel@vger.kernel.org>
> cc: <linux-sound@vger.kernel.org>, Pete Zaitcev <zaitcev@metabyte.com>,
> Jaroslav Kysela <perex@suse.cz>
> --- ./drivers/sound/Config.in Thu Dec 7 10:59:06 2000
> +++ ./drivers/sound/Config.in Fri Dec 8 11:25:08 2000
No problem here.
> --- ./drivers/sound/ymfpci.c Thu Dec 7 10:59:06 2000
> +++ ./drivers/sound/ymfpci.c Fri Dec 8 11:33:51 2000
The idea of the patch looks good but there is a small problem.
I have an open/close fix queued with Alan for post-2.2.18,
which changes the enumeration scheme for ymfcpi to make it
more friendly to other sound cards (Bug from Abhijit Menon-Sen).
This is a conflict because you use instance number to find
what card goes in first. In fact I plan to send the same
thing to Linus for 2.4 (if he have not fixed that already).
Would you please to hold on to your patch for couple of weeks
and then resync and redo it? Alternatively, I'll keep your
patch and will reapply it in the way I see sane, but you will
have to retest it before I issue it.
> --- ./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},
Are you sure it's correct? I am almost certain that no YMFxxx
has on-chip AC97. I'd like to see a document that allows you
the change quoted above.
--Pete
-
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* Re: [PATCH] for YMF PCI sound cards
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
2 siblings, 0 replies; 7+ messages in thread
From: Jaroslav Kysela @ 2000-12-08 18:46 UTC (permalink / raw)
To: Pete Zaitcev; +Cc: Pavel Roskin, linux-kernel, linux-sound
On Fri, 8 Dec 2000, Pete Zaitcev wrote:
> > +++ ./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},
>
> Are you sure it's correct? I am almost certain that no YMFxxx
> has on-chip AC97. I'd like to see a document that allows you
> the change quoted above.
It's Analog Device's AD1819 chip.
Jaroslav
-----
Jaroslav Kysela <perex@suse.cz>
SuSE Linux http://www.suse.com
ALSA project http://www.alsa-project.org
-
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* Re: [PATCH] for YMF PCI sound cards
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
2 siblings, 0 replies; 7+ messages in thread
From: Pavel Roskin @ 2000-12-08 18:56 UTC (permalink / raw)
To: Pete Zaitcev; +Cc: linux-kernel, linux-sound, Jaroslav Kysela
Hello, Pete!
> The idea of the patch looks good but there is a small problem.
> I have an open/close fix queued with Alan for post-2.2.18,
> which changes the enumeration scheme for ymfcpi to make it
> more friendly to other sound cards (Bug from Abhijit Menon-Sen).
> This is a conflict because you use instance number to find
> what card goes in first. In fact I plan to send the same
> thing to Linus for 2.4 (if he have not fixed that already).
Ok, I'm not a good kernel hacker. I simply did what I believed would be
the behaviour that minimizes the number of gotchas for the end user. If
the instance number isn't reliable then drop it and initialize OPL for all
cards.
The users of multiple cards will have to supply synth_io, but I wouldn't
fight to save few keystrokes for the insane people with more than one YMF
soundcard :-)
> Would you please to hold on to your patch for couple of weeks
> and then resync and redo it? Alternatively, I'll keep your
> patch and will reapply it in the way I see sane, but you will
> have to retest it before I issue it.
The later is better. I never know whether I'll have a free minute in a
couple of weeks.
> > + {0x41445303, "Yamaha YMF????" , NULL},
>
> Are you sure it's correct? I am almost certain that no YMFxxx
> has on-chip AC97. I'd like to see a document that allows you
> the change quoted above.
I have no documents, only the log from the patched module:
Dec 8 13:29:35 fonzie kernel: ymfpci0: YMF740C at 0xf0000000 IRQ 10
Dec 8 13:29:35 fonzie kernel: ymfpci0: set OPL3 I/O at 0x388
Dec 8 13:29:36 fonzie kernel: ac97_codec: AC97 Audio codec, id:
0x4144:0x5303 (Yamaha YMF????)
Drop it if it's not convincing.
Regards,
Pavel Roskin
-
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* Re: [PATCH] for YMF PCI sound cards
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
2 siblings, 0 replies; 7+ messages in thread
From: Alan Cox @ 2000-12-08 23:57 UTC (permalink / raw)
To: Pete Zaitcev
Cc: Pavel Roskin, linux-kernel, linux-sound, Pete Zaitcev, Jaroslav Kysela
> > {0x414B4D01, "Asahi Kasei AK4540 rev 1", NULL},
> > + {0x41445303, "Yamaha YMF????" , NULL},
>
> Are you sure it's correct? I am almost certain that no YMFxxx
Its definitely wrong
> has on-chip AC97. I'd like to see a document that allows you
> the change quoted above.
4144 is Analog Devices vendor ID.
-
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®