Skip to contentSkip to conversation

add support for PC-9800 architecture (sound alsa)

PATCH In review Osamu Tomita 1 participant 1 message Oct 28, 2002 Sound

lore
Share & tools
lore
#0 lore raw

PATCH 20/23 add support for PC-9800 architecture (sound alsa)

This is part 20/23 of patchset for add support NEC PC-9800 architecture, against 2.5.44.

Summary:
ALSA sound driver related modules.
- add MPU-401 UART driver for PC-9800.
- add hardware specific initialization.

diffstat:

 include/sound/mpu401.h             |   13 
 include/sound/pc9801_118_magic.h   |  411 ++++++++++++++++++++++++
 include/sound/sound_pc9800.h       |   23 +
 sound/drivers/Config.in            |    4 
 sound/drivers/mpu401/Makefile      |    9 
 sound/drivers/mpu401/mpu401.c      |    8 
 sound/drivers/mpu401/mpu401_pc98.c |  615 +++++++++++++++++++++++++++++++++++++
 sound/drivers/opl3/opl3_lib.c      |   29 +
 sound/isa/cs423x/cs4231.c          |    7 
 sound/isa/cs423x/cs4231_lib.c      |   74 ++++
 sound/isa/cs423x/cs4236.c          |    7 
 11 files changed, 1196 insertions(+), 4 deletions(-)

patch:

sound/drivers/Config.in +4 -0
diff -urN linux/sound/drivers/Config.in linux98/sound/drivers/Config.in
@@ -8,5 +8,9 @@
 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
+dep_tristate 'NEC PC-9801 MPU-401 UART driver' CONFIG_SND_MPU98 $CONFIG_SND
+if [ "$CONFIG_SND_MPU98" != "n" ]; then
+   bool      '  Roland MPU-PC98II support' CONFIG_MPU_PC98II
+fi
 
 endmenu
sound/drivers/mpu401/Makefile +8 -1
diff -urN linux/sound/drivers/mpu401/Makefile linux98/sound/drivers/mpu401/Makefile
@@ -3,21 +3,28 @@
 # Copyright (c) 2001 by Jaroslav Kysela <[email protected]>
 #
 
-export-objs  := mpu401_uart.o
+export-objs  := mpu401_uart.o mpu401_pc98.o
 
 snd-mpu401-objs := mpu401.o
 snd-mpu401-uart-objs := mpu401_uart.o
+snd-mpu401-pc98-objs := mpu401_pc98.o
 
 # Toplevel Module Dependency
 obj-$(CONFIG_SND_MPU401) += snd-mpu401.o snd-mpu401-uart.o
+obj-$(CONFIG_SND_MPU98) += snd-mpu401.o snd-mpu401-pc98.o
 obj-$(CONFIG_SND_ALS100) += snd-mpu401-uart.o
 obj-$(CONFIG_SND_AZT2320) += snd-mpu401-uart.o
 obj-$(CONFIG_SND_DT019X) += snd-mpu401-uart.o
 obj-$(CONFIG_SND_ES18XX) += snd-mpu401-uart.o
 obj-$(CONFIG_SND_OPL3SA2) += snd-mpu401-uart.o
 obj-$(CONFIG_SND_AD1816A) += snd-mpu401-uart.o
+ifneq ($(CONFIG_PC9800),y)
 obj-$(CONFIG_SND_CS4231) += snd-mpu401-uart.o
 obj-$(CONFIG_SND_CS4232) += snd-mpu401-uart.o
+else
+obj-$(CONFIG_SND_CS4231) += snd-mpu401-pc98.o
+obj-$(CONFIG_SND_CS4232) += snd-mpu401-pc98.o
+endif
 obj-$(CONFIG_SND_CS4236) += snd-mpu401-uart.o
 obj-$(CONFIG_SND_ES1688) += snd-mpu401-uart.o
 obj-$(CONFIG_SND_GUSEXTREME) += snd-mpu401-uart.o
sound/drivers/mpu401/mpu401.c +7 -1
diff -urN linux/sound/drivers/mpu401/mpu401.c linux98/sound/drivers/mpu401/mpu401.c
@@ -76,7 +76,13 @@
 	card = snd_card_new(snd_index[dev], snd_id[dev], THIS_MODULE, 0);
 	if (card == NULL)
 		return -ENOMEM;
-	if (snd_mpu401_uart_new(card, 0, MPU401_HW_MPU401,
+
+#if defined(CONFIG_SND_MPU98) || defined(CONFIG_SND_MPU98_MODULE)
+#define SND_MPU401_UART_NEW snd_mpu401_pc98_new
+#else
+#define SND_MPU401_UART_NEW snd_mpu401_uart_new
+#endif
+	if (SND_MPU401_UART_NEW(card, 0, MPU401_HW_MPU401,
 				snd_port[dev], 0,
 				snd_irq[dev], snd_irq[dev] >= 0 ? SA_INTERRUPT : 0, NULL) < 0) {
 		printk(KERN_ERR "MPU401 not detected at 0x%lx\n", snd_port[dev]);
sound/drivers/mpu401/mpu401_pc98.c +615 -0

615 lines not on this page · raw message

sound/drivers/opl3/opl3_lib.c +29 -0
diff -urN linux/sound/drivers/opl3/opl3_lib.c linux98/sound/drivers/opl3/opl3_lib.c
@@ -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 +6 -1
diff -urN linux/sound/isa/cs423x/cs4231.c linux98/sound/isa/cs423x/cs4231.c
@@ -128,8 +128,13 @@
 		return err;
 	}
 
+#ifndef CONFIG_PC9800
+#define SND_MPU401_UART_NEW snd_mpu401_uart_new
+#else
+#define SND_MPU401_UART_NEW snd_mpu401_pc98_new
+#endif
 	if (snd_mpu_irq[dev] >= 0 && snd_mpu_irq[dev] != SNDRV_AUTO_IRQ) {
-		if (snd_mpu401_uart_new(card, 0, MPU401_HW_CS4232,
+		if (SND_MPU401_UART_NEW(card, 0, MPU401_HW_CS4232,
 					snd_mpu_port[dev], 0,
 					snd_mpu_irq[dev], SA_INTERRUPT,
 					NULL) < 0)
sound/isa/cs423x/cs4231_lib.c +74 -0

98 lines not on this page · raw message

sound/isa/cs423x/cs4236.c +6 -1
diff -urN linux/sound/isa/cs423x/cs4236.c linux98/sound/isa/cs423x/cs4236.c
@@ -522,8 +522,13 @@
 		}
 	}
 
+#ifndef CONFIG_PC9800
+#define SND_MPU401_UART_NEW snd_mpu401_uart_new
+#else
+#define SND_MPU401_UART_NEW snd_mpu401_pc98_new
+#endif
 	if (snd_mpu_port[dev] != SNDRV_AUTO_PORT) {
-		if (snd_mpu401_uart_new(card, 0, MPU401_HW_CS4232,
+		if (SND_MPU401_UART_NEW(card, 0, MPU401_HW_CS4232,
 					snd_mpu_port[dev], 0,
 					snd_mpu_irq[dev],
 					snd_mpu_irq[dev] >= 0 ? SA_INTERRUPT : 0, NULL) < 0)
include/sound/mpu401.h +13 -0
diff -urN linux/include/sound/mpu401.h linux98/include/sound/mpu401.h
@@ -96,6 +96,7 @@
 
  */
 
+#ifndef CONFIG_PC9800
 void snd_mpu401_uart_interrupt(int irq, void *dev_id, struct pt_regs *regs);
 
 int snd_mpu401_uart_new(snd_card_t * card,
@@ -106,5 +107,17 @@
 			int irq,
 			int irq_flags,
 			snd_rawmidi_t ** rrawmidi);
+#else /* CONFIG_PC9800 */
+void snd_mpu401_pc98_interrupt(int irq, void *dev_id, struct pt_regs *regs);
+
+int snd_mpu401_pc98_new(snd_card_t * card,
+			int device,
+			unsigned short hardware,
+			unsigned long port,
+			int integrated,
+			int irq,
+			int irq_flags,
+			snd_rawmidi_t ** rrawmidi);
+#endif /* !CONFIG_PC9800 */
 
 #endif /* __SOUND_MPU401_H */
include/sound/pc9801_118_magic.h +411 -0

411 lines not on this page · raw message

include/sound/sound_pc9800.h +23 -0
diff -urN linux/include/sound/sound_pc9800.h linux98/include/sound/sound_pc9800.h
@@ -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