add support for PC-9800 architecture (sound alsa)
PATCH 22/25 add support for PC-9800 architecture (sound alsa)
This is part 23/26 of patchset for add support NEC PC-9800 architecture, against 2.5.43.
Summary:
ALSA sound driver related modules.
- add feature to support CS4231+OPL3 (not PNP)
- add hardware specific initialization.
diffstat:
include/sound/mpu401.h | 4 include/sound/pc9801_118_magic.h | 411 +++++++++++++++++++++++++++++++++++++ include/sound/sound_pc9800.h | 23 ++ sound/core/Makefile | 4 sound/core/seq/Makefile | 4 sound/core/seq/instr/Makefile | 3 sound/drivers/Config.in | 3 sound/drivers/mpu401/mpu401_uart.c | 173 +++++++++++++++ sound/drivers/opl3/Makefile | 6 sound/drivers/opl3/opl3_lib.c | 29 ++ sound/isa/cs423x/cs4231.c | 32 ++ sound/isa/cs423x/cs4231_lib.c | 74 ++++++ 12 files changed, 765 insertions(+), 1 deletion(-)
patch:
sound/core/Makefile +4 -0
@@ -53,7 +53,11 @@ obj-$(CONFIG_SND_SGALAXY) += snd-pcm.o snd-timer.o snd.o obj-$(CONFIG_SND_AD1816A) += snd-pcm.o snd-timer.o snd.o snd-rawmidi.o snd-hwdep.o obj-$(CONFIG_SND_AD1848) += snd-pcm.o snd-timer.o snd.o +ifeq ($(CONFIG_PC9800),y) +obj-$(CONFIG_SND_CS4231) += snd-pcm.o snd-timer.o snd.o snd-rawmidi.o snd-hwdep.o +else obj-$(CONFIG_SND_CS4231) += snd-pcm.o snd-timer.o snd.o snd-rawmidi.o +endif obj-$(CONFIG_SND_CS4232) += snd-pcm.o snd-timer.o snd.o snd-rawmidi.o snd-hwdep.o obj-$(CONFIG_SND_CS4236) += snd-pcm.o snd-timer.o snd.o snd-rawmidi.o snd-hwdep.o obj-$(CONFIG_SND_ES1688) += snd-pcm.o snd-timer.o snd.o snd-rawmidi.o snd-hwdep.o
sound/core/seq/Makefile +4 -0
@@ -39,7 +39,11 @@ obj-$(CONFIG_SND_ES18XX) += snd-seq-midi.o snd-seq.o snd-seq-device.o snd-seq-midi-event.o snd-seq-midi-emul.o snd-seq-instr.o obj-$(CONFIG_SND_OPL3SA2) += snd-seq-midi.o snd-seq.o snd-seq-device.o snd-seq-midi-event.o snd-seq-midi-emul.o snd-seq-instr.o obj-$(CONFIG_SND_AD1816A) += snd-seq-midi.o snd-seq.o snd-seq-device.o snd-seq-midi-event.o snd-seq-midi-emul.o snd-seq-instr.o +ifeq ($(CONFIG_PC9800),y) +obj-$(CONFIG_SND_CS4231) += snd-seq-midi.o snd-seq.o snd-seq-device.o snd-seq-midi-event.o snd-seq-midi-emul.o snd-seq-instr.o +else obj-$(CONFIG_SND_CS4231) += snd-seq-midi.o snd-seq.o snd-seq-device.o snd-seq-midi-event.o +endif obj-$(CONFIG_SND_CS4232) += snd-seq-midi.o snd-seq.o snd-seq-device.o snd-seq-midi-event.o snd-seq-midi-emul.o snd-seq-instr.o obj-$(CONFIG_SND_CS4236) += snd-seq-midi.o snd-seq.o snd-seq-device.o snd-seq-midi-event.o snd-seq-midi-emul.o snd-seq-instr.o obj-$(CONFIG_SND_ES1688) += snd-seq-midi.o snd-seq.o snd-seq-device.o snd-seq-midi-event.o snd-seq-midi-emul.o snd-seq-instr.o
sound/core/seq/instr/Makefile +3 -0
@@ -17,6 +17,9 @@ obj-$(CONFIG_SND_ES18XX) += snd-ainstr-fm.o obj-$(CONFIG_SND_OPL3SA2) += snd-ainstr-fm.o obj-$(CONFIG_SND_AD1816A) += snd-ainstr-fm.o +ifeq ($(CONFIG_PC9800),y) + obj-$(CONFIG_SND_CS4231) += snd-ainstr-fm.o +endif obj-$(CONFIG_SND_CS4232) += snd-ainstr-fm.o obj-$(CONFIG_SND_CS4236) += snd-ainstr-fm.o obj-$(CONFIG_SND_ES1688) += snd-ainstr-fm.o
sound/drivers/Config.in +3 -0
@@ -8,5 +8,8 @@ dep_tristate 'MOTU MidiTimePiece AV multiport MIDI' CONFIG_SND_MTPAV $CONFIG_SND dep_tristate 'UART16550 - MIDI only driver' CONFIG_SND_SERIAL_U16550 $CONFIG_SND dep_tristate 'Generic MPU-401 UART driver' CONFIG_SND_MPU401 $CONFIG_SND +if [ "$CONFIG_SND_MPU401" != "n" -a "$CONFIG_PC9800" = "y" ]; then + dep_bool ' Roland MPU-PC98II support' CONFIG_MPU_PC98II y +fi endmenu
sound/drivers/mpu401/mpu401_uart.c +172 -1
199 lines not on this page · raw message
sound/drivers/opl3/Makefile +6 -0
@@ -38,6 +38,9 @@ obj-$(CONFIG_SND_FM801) += snd-opl3-lib.o obj-$(CONFIG_SND_SONICVIBES) += snd-opl3-lib.o obj-$(CONFIG_SND_YMFPCI) += snd-opl3-lib.o +ifeq ($(CONFIG_PC9800),y) + obj-$(CONFIG_SND_CS4231) += snd-opl3-lib.o +endif ifeq ($(subst m,y,$(CONFIG_SND_SEQUENCER)),y) obj-$(CONFIG_SND_ALS100) += snd-opl3-synth.o obj-$(CONFIG_SND_AZT2320) += snd-opl3-synth.o
@@ -63,6 +66,9 @@ obj-$(CONFIG_SND_FM801) += snd-opl3-synth.o obj-$(CONFIG_SND_SONICVIBES) += snd-opl3-synth.o obj-$(CONFIG_SND_YMFPCI) += snd-opl3-synth.o + ifeq ($(CONFIG_PC9800),y) + obj-$(CONFIG_SND_CS4231) += snd-opl3-synth.o + endif endif obj-m := $(sort $(obj-m))
sound/drivers/opl3/opl3_lib.c +29 -0
@@ -31,6 +31,10 @@#include <linux/ioport.h> #include <sound/minors.h> +#ifdef CONFIG_PC9800 +#include <sound/sound_pc9800.h> +#endif +MODULE_AUTHOR ("Jaroslav Kysela <[email protected]>, Hannu Savolainen 1993-1996, Rob Hooft" );MODULE_DESCRIPTION ("Routines for control of AdLib FM cards (OPL2/OPL3/OPL4 chips)" );MODULE_LICENSE ("GPL" );
@@ -438,6 +442,31 @@ opl3->command = &snd_opl3_command; } } + +#ifdef CONFIG_PC9800 +/* ??? */ +outb (0x00 , opl3->l_port +6 ); +inb (opl3->l_port +7 ); +/* Enable OPL-3 Function */ +outb (inb (PC9800_SOUND_IO_ID ) |0x03 ,PC9800_SOUND_IO_ID ); + +/* Initialize? */ + opl3->command (opl3,OPL3_RIGHT |0x05 ,0x05 ); + opl3->command (opl3,OPL3_RIGHT |0x08 ,0x04 ); + opl3->command (opl3,OPL3_RIGHT |0x08 ,0x00 ); + opl3->command (opl3,OPL3_LEFT |0xf7 ,0x00 ); + opl3->command (opl3,OPL3_LEFT |0x04 ,0x60 ); + opl3->command (opl3,OPL3_LEFT |0x04 ,0x80 ); +inb (opl3->l_port); + + opl3->command (opl3,OPL3_LEFT |0x02 ,0xff ); + opl3->command (opl3,OPL3_LEFT |0x04 ,0x21 ); +inb (opl3->l_port); + + opl3->command (opl3,OPL3_LEFT |0x04 ,0x60 ); + opl3->command (opl3,OPL3_LEFT |0x04 ,0x80 ); +#endif + opl3->command (opl3,OPL3_LEFT |OPL3_REG_TEST ,OPL3_ENABLE_WAVE_SELECT ); opl3->command (opl3,OPL3_LEFT |OPL3_REG_PERCUSSION ,0x00 );/* Melodic mode */
sound/isa/cs423x/cs4231.c +32 -0
@@ -27,6 +27,9 @@#include <sound/core.h> #include <sound/cs4231.h> #include <sound/mpu401.h> +#ifdef CONFIG_PC9800 +#include <sound/opl3.h> +#endif #define SNDRV_GET_ID #include <sound/initval.h>
@@ -42,6 +45,9 @@static char *snd_id[SNDRV_CARDS ] =SNDRV_DEFAULT_STR ;/* ID for this card */ static int snd_enable[SNDRV_CARDS ] =SNDRV_DEFAULT_ENABLE ;/* Enable this card */ static long snd_port[SNDRV_CARDS ] =SNDRV_DEFAULT_PORT ;/* PnP setup */ +#ifdef CONFIG_PC9800 +static long snd_fm_port[SNDRV_CARDS ] =SNDRV_DEFAULT_PORT ;/* PnP setup */ +#endif static long snd_mpu_port[SNDRV_CARDS ] =SNDRV_DEFAULT_PORT ;/* PnP setup */ static int snd_irq[SNDRV_CARDS ] =SNDRV_DEFAULT_IRQ ;/* 5,7,9,11,12,15 */ static int snd_mpu_irq[SNDRV_CARDS ] =SNDRV_DEFAULT_IRQ ;/* 9,11,12,15 */
@@ -63,6 +69,11 @@ MODULE_PARM(snd_mpu_port, "1-" __MODULE_STRING(SNDRV_CARDS) "l");MODULE_PARM_DESC (snd_mpu_port,"MPU-401 port # for CS4231 driver." );MODULE_PARM_SYNTAX (snd_mpu_port,SNDRV_PORT12_DESC ); +#ifdef CONFIG_PC9800 +MODULE_PARM(snd_fm_port, "1-" __MODULE_STRING(SNDRV_CARDS) "l"); +MODULE_PARM_DESC (snd_fm_port,"FM port # for CS4231 driver." ); +MODULE_PARM_SYNTAX (snd_fm_port,SNDRV_PORT12_DESC ); +#endif MODULE_PARM(snd_irq, "1-" __MODULE_STRING(SNDRV_CARDS) "i");MODULE_PARM_DESC (snd_irq,"IRQ # for CS4231 driver." );MODULE_PARM_SYNTAX (snd_irq,SNDRV_IRQ_DESC );
@@ -85,6 +96,9 @@struct snd_card_cs4231 *acard;snd_pcm_t *pcm =NULL ;cs4231_t *chip; +#ifdef CONFIG_PC9800 +opl3_t *opl3; +#endif int err;if (snd_port[dev] ==SNDRV_AUTO_PORT ) {
@@ -128,6 +142,21 @@return err; } +#ifdef CONFIG_PC9800 +if (snd_fm_port[dev] >=0 && snd_fm_port[dev] !=SNDRV_AUTO_PORT ) { +if (snd_opl3_create (card, + snd_fm_port[dev], snd_fm_port[dev] +2 , +OPL3_HW_OPL3_CS ,0 , &opl3) <0 ) { +printk (KERN_ERR "CS4231: OPL3 not detected\n" ); + }else { +if ((err =snd_opl3_hwdep_new (opl3,0 ,1 ,NULL )) <0 ) { +snd_card_free (card); +return err; + } + } + } +#endif +if (snd_mpu_irq[dev] >=0 && snd_mpu_irq[dev] !=SNDRV_AUTO_IRQ ) { if (snd_mpu401_uart_new(card, 0, MPU401_HW_CS4232, snd_mpu_port[dev], 0,
@@ -196,6 +225,9 @@ get_option(&str,&pnp) == 2 && get_option(&str,(int *)&snd_port[nr_dev]) == 2 && get_option(&str,(int *)&snd_mpu_port[nr_dev]) == 2 && +#ifdef CONFIG_PC9800 + get_option(&str,(int *)&snd_fm_port[nr_dev]) == 2 && +#endif get_option(&str,&snd_irq[nr_dev]) == 2 && get_option(&str,&snd_mpu_irq[nr_dev]) == 2 && get_option(&str,&snd_dma1[nr_dev]) == 2 &&
sound/isa/cs423x/cs4231_lib.c +74 -0
98 lines not on this page · raw message
include/sound/mpu401.h +4 -0
@@ -89,7 +89,11 @@/* I/O ports */ +#ifndef CONFIG_MPU_PC98II #define MPU401C (mpu) ((mpu)->port + 1) +#else +#define MPU401C (mpu) ((mpu)->port + 2) +#endif #define MPU401D (mpu) ((mpu)->port + 0)/*
include/sound/pc9801_118_magic.h +411 -0
411 lines not on this page · raw message
include/sound/sound_pc9800.h +23 -0
@@ -0,0 +1,23 @@ +#ifndef _SOUND_PC9800_H_ +#define _SOUND_PC9800_H_ + +#include <asm/io.h> + +#define PC9800_SOUND_IO_ID 0xa460 + +/* Sound Functions ID. */ +#define PC9800_SOUND_ID () ((inb(PC9800_SOUND_IO_ID) >> 4) & 0x0f) + +#define PC9800_SOUND_ID_DO 0x0/* PC-98DO+ Internal */ +#define PC9800_SOUND_ID_GS 0x1/* PC-98GS Internal */ +#define PC9800_SOUND_ID_73 0x2/* PC-9801-73 (base 0x18x) */ +#define PC9800_SOUND_ID_73A 0x3/* PC-9801-73/76 (base 0x28x) */ +#define PC9800_SOUND_ID_86 0x4/* PC-9801-86 and compatible (base 0x18x) */ +#define PC9800_SOUND_ID_86A 0x5/* PC-9801-86 (base 0x28x) */ +#define PC9800_SOUND_ID_NF 0x6/* PC-9821Nf/Np Internal */ +#define PC9800_SOUND_ID_XMATE 0x7/* X-Mate Internal and compatible */ +#define PC9800_SOUND_ID_118 0x8/* PC-9801-118 and compatible(CanBe Internal, etc.) */ + +#define PC9800_SOUND_ID_UNKNOWN 0xf/* Unknown (No Sound System or PC-9801-26) */ + +#endif
Hi,
At Sat, 19 Oct 2002 01:56:53 +0900,
Quoted 7 lines · Osamu Tomita
This is part 23/26 of patchset for add support NEC PC-9800 architecture, against 2.5.43.
Summary:
ALSA sound driver related modules.
- add feature to support CS4231+OPL3 (not PNP)
Are you sure that it's really CS4231?
If it's a higher model, such as cs4232, cs4235 or cs4236, FM OPL3 is already supported (although additional codes to opl3 module are necessary for PC9800).
Quoted 1 line
- add hardware specific initialization.
The MPU401 hack looks odd.
I'd propose to split a PC9800 specific driver up, rather than including bunch of ifdefs...
Regards,
Signature · 2 lines
Takashi Iwai <[email protected]> SuSE Linux AG - www.suse.de ALSA Developer ALSA Project - www.alsa-project.org
Thanks for comments.
Quoted 6 lines · Takashi Iwai
At Sat, 19 Oct 2002 01:56:53 +0900,
Quoted 4 lines · Osamu Tomita
This is part 23/26 of patchset for add support NEC PC-9800 architecture, against 2.5.43.
Quoted 8 lines
Quoted 3 lines
Summary:
ALSA sound driver related modules.
- add feature to support CS4231+OPL3 (not PNP)Are you sure that it's really CS4231?
If it's a higher model, such as cs4232, cs4235 or cs4236, FM OPL3 is already supported (although additional codes to opl3 module are necessary for PC9800).
Your comment is reasonable. Some card has CS4232. But CS4232 is used as CS4231. I guess there is some hardwired circuit. And some card has CS4231. CS4231 driver works fine for ether chip on PC-9800. So I choose CS4231 driver for PC-9800.
Quoted 5 lines
Quoted 1 line
- add hardware specific initialization.
The MPU401 hack looks odd.
I'd propose to split a PC9800 specific driver up, rather than including bunch of ifdefs...
I see. I'll split MPU401 driver.
Regards
Osamu Tomita
Hi,
At Thu, 24 Oct 2002 00:35:25 +0900,
Quoted 14 lines · Osamu Tomita
Thanks for comments.
Quoted 10 lines · Takashi Iwai
At Sat, 19 Oct 2002 01:56:53 +0900,
Quoted 7 lines · Osamu Tomita
This is part 23/26 of patchset for add support NEC PC-9800 architecture, against 2.5.43.
Summary:
ALSA sound driver related modules.
- add feature to support CS4231+OPL3 (not PNP)
Quoted 8 lines
Quoted 4 lines
Are you sure that it's really CS4231?
If it's a higher model, such as cs4232, cs4235 or cs4236, FM OPL3 is already supported (although additional codes to opl3 module are necessary for PC9800).Your comment is reasonable. Some card has CS4232. But CS4232 is used as CS4231. I guess there is some hardwired circuit. And some card has CS4231. CS4231 driver works fine for ether chip on PC-9800. So I choose CS4231 driver for PC-9800.
well, in fact, cs4232 is backward compatible to cs4231.
the question is, whether cs4232 module works on PC9800, or not. i guess the control-port is not used on this card. in such a case, you can deactivate the control-port via module option (or even add ifdef for the specific kernel config).
if cs4232 doesn't work, we'll apply your patch to cs4231.
Quoted 6 lines
Quoted 5 lines
Quoted 1 line
- add hardware specific initialization.
The MPU401 hack looks odd.
I'd propose to split a PC9800 specific driver up, rather than including bunch of ifdefs...I see. I'll split MPU401 driver.
thanks.
please send me the new patch to me, too, so that i can merge it also to ALSA tree.
Takashi
Quoted 4 lines · Takashi Iwai
the question is, whether cs4232 module works on PC9800, or not. i guess the control-port is not used on this card. in such a case, you can deactivate the control-port via module option (or even add ifdef for the specific kernel config).
In the longer run it may well be much cleaner to make pc98 a variable just like eisa, mca are. On a non pc98 box it might happen to be a constant 0 and optimised but that is a detail.
Its much easier to follow
if(!pc98) outb(a,b);
Quoted 42 lines · Takashi Iwai
Hi,
At Thu, 24 Oct 2002 00:35:25 +0900,
Quoted 14 lines · Osamu Tomita
Thanks for comments.
Quoted 10 lines · Takashi Iwai
At Sat, 19 Oct 2002 01:56:53 +0900,
Quoted 7 lines · Osamu Tomita
This is part 23/26 of patchset for add support NEC PC-9800 architecture, against 2.5.43.
Summary:
ALSA sound driver related modules.
- add feature to support CS4231+OPL3 (not PNP)Quoted 8 lines
Quoted 4 lines
Are you sure that it's really CS4231?
If it's a higher model, such as cs4232, cs4235 or cs4236, FM OPL3 is already supported (although additional codes to opl3 module are necessary for PC9800).Your comment is reasonable. Some card has CS4232. But CS4232 is used as CS4231. I guess there is some hardwired circuit. And some card has CS4231. CS4231 driver works fine for ether chip on PC-9800. So I choose CS4231 driver for PC-9800.
well, in fact, cs4232 is backward compatible to cs4231.
the question is, whether cs4232 module works on PC9800, or not. i guess the control-port is not used on this card. in such a case, you can deactivate the control-port via module option (or even add ifdef for the specific kernel config).
if cs4232 doesn't work, we'll apply your patch to cs4231.
Quoted 5 lines
Quoted 5 lines
Quoted 1 line
- add hardware specific initialization.
The MPU401 hack looks odd.
I'd propose to split a PC9800 specific driver up, rather than including bunch of ifdefs...
Quoted 6 lines
Quoted 1 line
I see. I'll split MPU401 driver.
thanks.
please send me the new patch to me, too, so that i can merge it also to ALSA tree.
Thanks! I'll do everythig.
Regard
Osamu Tomita