Skip to contentSkip to conversation

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

RFC PATCH New Osamu Tomita 1 participant 1 message Oct 17, 2002 Sound

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 add support for PC-9800 architecture (23/26) 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
diff -urN linux/sound/core/Makefile linux98/sound/core/Makefile
@@ -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
diff -urN linux/sound/core/seq/Makefile linux98/sound/core/seq/Makefile
@@ -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
diff -urN linux/sound/core/seq/instr/Makefile linux98/sound/core/seq/instr/Makefile
@@ -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
diff -urN linux/sound/drivers/Config.in linux98/sound/drivers/Config.in
@@ -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
diff -urN linux/sound/drivers/opl3/Makefile linux98/sound/drivers/opl3/Makefile
@@ -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
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 +32 -0
diff -urN linux/sound/isa/cs423x/cs4231.c linux98/sound/isa/cs423x/cs4231.c
@@ -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
diff -urN linux/include/sound/mpu401.h linux98/include/sound/mpu401.h
@@ -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
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