Skip to contentSkip to conversation

Make pcspk like rest of audio cards

PATCH Superseded Juan Quintela 2 participants 5 messages Aug 10, 2009 Kbuild

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover Make pcspk like rest of audio cards

Hi

This patch series add c99 initializers to sound cards in vl.c. Sound card support depends of target, move CONFIG_FOO generation there. Once here, I wanted to disable CONFIG_PCSPK, but found a problem.

pcskpr is registered as a port on mips_jazz.c and pc.c, and then as an audio card.

Options are:
- let things as they are (if you get a pc or mips_jazz, you get a pc speaker port and a pcspk audio card.
- be able to remove pc speaker audio support, but let the speaker port as it is now
- make pcspk_init() an empty function in hw.h depending of CONFIG_PCSPK value.

Any thoughts?

Later, Juan.

Juan Quintela (3):
Bring audio cards structs to C99 initializers
What cards to compile is a per target thing
Make pc speaker be configured the same way that the rest of the cards

 Makefile.target |    5 ++-
 configure       |   16 ++++++++---
 vl.c            |   76 +++++++++++++++++++++++++++---------------------------
 3 files changed, 53 insertions(+), 44 deletions(-)
#1 lore raw

PATCH 1/3 Bring audio cards structs to C99 initializers

---
 vl.c |   74 +++++++++++++++++++++++++++++++++---------------------------------
 1 files changed, 37 insertions(+), 37 deletions(-)
vl.c +37 -37
index a526cb0..e399f0f 100644
@@ -4405,81 +4405,81 @@ struct soundhw soundhw[] = {
 #ifdef HAS_AUDIO_CHOICE
 #if defined(TARGET_I386) || defined(TARGET_MIPS)
     {
-        "pcspk",
-        "PC speaker",
-        0,
-        1,
-        { .init_isa = pcspk_audio_init }
+        .name = "pcspk",
+        .descr = "PC speaker",
+        .enabled = 0,
+        .isa = 1,
+        .init.init_isa = pcspk_audio_init,
     },
 #endif
 
 #ifdef CONFIG_SB16
     {
-        "sb16",
-        "Creative Sound Blaster 16",
-        0,
-        1,
-        { .init_isa = SB16_init }
+        .name = "sb16",
+        .descr = "Creative Sound Blaster 16",
+        .enabled = 0,
+        .isa = 1,
+        .init.init_isa = SB16_init,
     },
 #endif
 
 #ifdef CONFIG_CS4231A
     {
-        "cs4231a",
-        "CS4231A",
-        0,
-        1,
-        { .init_isa = cs4231a_init }
+        .name = "cs4231a",
+        .descr = "CS4231A",
+        .enabled = 0,
+        .isa = 1,
+        .init.init_isa = cs4231a_init,
     },
 #endif
 
 #ifdef CONFIG_ADLIB
     {
-        "adlib",
+        .name = "adlib",
 #ifdef HAS_YMF262
-        "Yamaha YMF262 (OPL3)",
+        .descr = "Yamaha YMF262 (OPL3)",
 #else
-        "Yamaha YM3812 (OPL2)",
+        .descr = "Yamaha YM3812 (OPL2)",
 #endif
-        0,
-        1,
-        { .init_isa = Adlib_init }
+        .enabled = 0,
+        .isa = 1,
+        .init.init_isa = Adlib_init,
     },
 #endif
 
 #ifdef CONFIG_GUS
     {
-        "gus",
-        "Gravis Ultrasound GF1",
-        0,
-        1,
-        { .init_isa = GUS_init }
+        .name = "gus",
+        .descr = "Gravis Ultrasound GF1",
+        .enabled = 0,
+        .isa = 1,
+        .init.init_isa = GUS_init,
     },
 #endif
 
 #ifdef CONFIG_AC97
     {
-        "ac97",
-        "Intel 82801AA AC97 Audio",
-        0,
-        0,
-        { .init_pci = ac97_init }
+        .name = "ac97",
+        .descr = "Intel 82801AA AC97 Audio",
+        .enabled = 0,
+        .isa = 0,
+        .init.init_pci = ac97_init,
     },
 #endif
 
 #ifdef CONFIG_ES1370
     {
-        "es1370",
-        "ENSONIQ AudioPCI ES1370",
-        0,
-        0,
-        { .init_pci = es1370_init }
+        .name = "es1370",
+        .descr = "ENSONIQ AudioPCI ES1370",
+        .enabled = 0,
+        .isa = 0,
+        .init.init_pci = es1370_init,
     },
 #endif
 
 #endif /* HAS_AUDIO_CHOICE */
 
-    { NULL, NULL, 0, 0, { NULL } }
+    {  /* End of list */ }
 };
 
 static void select_soundhw (const char *optarg)
Signature · 1 line
1.6.2.5
#2 lore raw

Re: [Qemu-devel] [PATCH 1/3] Bring audio cards structs to C99 initializers

Quoted 16 lines · Juan Quintela
---
 vl.c |   74 +++++++++++++++++++++++++++++++++---------------------------------
 1 files changed, 37 insertions(+), 37 deletions(-)
vl.c +0 -2
index a526cb0..e399f0f 100644
@@ -4405,81 +4405,81 @@ struct soundhw soundhw[] = {
 #ifdef HAS_AUDIO_CHOICE
 #if defined(TARGET_I386) || defined(TARGET_MIPS)
     {
-        "pcspk",
-        "PC speaker",

vl.c struct soundhw soundhw[] = { · line 4414

Quoted 10 lines
vl.c +5 -3
-        0,
-        1,
-        { .init_isa = pcspk_audio_init }
+        .name = "pcspk",
+        .descr = "PC speaker",
+        .enabled = 0,
+        .isa = 1,
+        .init.init_isa = pcspk_audio_init,
     },
 #endif

I'd prefer this to be vertically aligned.

[..snip..]

Signature · 1 line
mailto:[email protected]
#3 lore raw

PATCH 2/3 What cards to compile is a per target thing

In reply to Juan Quintela
---
 configure |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)
configure +5 -4
index e5b9431..6679919 100755
@@ -1573,10 +1573,6 @@ if test "$vde" = "yes" ; then
   echo "CONFIG_VDE=y" >> $config_host_mak
   echo "VDE_LIBS=$vde_libs" >> $config_host_mak
 fi
-for card in $audio_card_list; do
-    def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'`
-    echo "$def=y" >> $config_host_mak
-done
 echo "CONFIG_AUDIO_DRIVERS=$audio_drv_list" >> $config_host_mak
 for drv in $audio_drv_list; do
     def=CONFIG_`echo $drv | tr '[:lower:]' '[:upper:]'`
@@ -2090,6 +2086,11 @@ if test "$target_softmmu" = "yes" ; then
     ldflags='-Wl,-G0 -Wl,-T../config-host.ld -Wl,-T,$(SRC_PATH)/$(ARCH).ld -static'
     ;;
   esac
+
+for card in $audio_card_list; do
+    def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'`
+    echo "$def=y" >> $config_mak
+done
 fi
 
 if test "$ldflags" != "" ; then
Signature · 1 line
1.6.2.5
#4 lore raw

PATCH 3/3 Make pc speaker be configured the same way that the rest of the cards

In reply to Juan Quintela
---
 Makefile.target |    5 +++--
 configure       |    7 +++++++
 vl.c            |    2 +-
 3 files changed, 11 insertions(+), 3 deletions(-)
Makefile.target +3 -2
index 49ba08d..0b58c94 100644
@@ -288,6 +288,7 @@ sound-obj-$(CONFIG_AC97) += ac97.o
 sound-obj-$(CONFIG_ADLIB) += fmopl.o adlib.o
 sound-obj-$(CONFIG_GUS) += gus.o gusemu_hal.o gusemu_mixer.o
 sound-obj-$(CONFIG_CS4231A) += cs4231a.o
+sound-obj-$(CONFIG_PCSPK) += pcspk.o
 
 ifdef CONFIG_ADLIB
 adlib.o fmopl.o: CFLAGS := ${CFLAGS} -DBUILD_Y8950=0
@@ -328,7 +329,7 @@ obj-y += wdt_ib700.o wdt_i6300esb.o
 
 # Hardware support
 obj-i386-y = ide.o pckbd.o vga.o $(sound-obj-y) dma.o
-obj-i386-y += fdc.o mc146818rtc.o serial.o i8259.o i8254.o pcspk.o pc.o
+obj-i386-y += fdc.o mc146818rtc.o serial.o i8259.o i8254.o pc.o
 obj-i386-y += cirrus_vga.o apic.o ioapic.o parallel.o acpi.o piix_pci.o
 obj-i386-y += usb-uhci.o vmmouse.o vmport.o vmware_vga.o hpet.o
 obj-i386-y += device-hotplug.o pci-hotplug.o smbios.o
@@ -366,7 +367,7 @@ obj-mips-y = mips_r4k.o mips_jazz.o mips_malta.o mips_mipssim.o
 obj-mips-y += mips_timer.o mips_int.o dma.o vga.o serial.o i8254.o i8259.o rc4030.o
 obj-mips-y += g364fb.o jazz_led.o dp8393x.o
 obj-mips-y += ide.o gt64xxx.o pckbd.o fdc.o mc146818rtc.o usb-uhci.o acpi.o ds1225y.o
-obj-mips-y += piix_pci.o parallel.o cirrus_vga.o pcspk.o $(sound-obj-y)
+obj-mips-y += piix_pci.o parallel.o cirrus_vga.o $(sound-obj-y)
 obj-mips-y += mipsnet.o
 obj-mips-y += pflash_cfi01.o
 obj-mips-y += vmware_vga.o
configure +7 -0
index 6679919..56a0dc8 100755
@@ -2091,6 +2091,13 @@ for card in $audio_card_list; do
     def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'`
     echo "$def=y" >> $config_mak
 done
+
+# MIPS and x86 always need pcspk compiled in, because
+# they used it with a port, not only as "sound card"
+case "$TARGET_BASE_ARCH" in
+i386|mips)
+  echo "CONFIG_PCSPK" >> $config_mak
+esac
 fi
 
 if test "$ldflags" != "" ; then
vl.c +1 -1
index e399f0f..abb9af1 100644
@@ -4403,7 +4403,7 @@ static const QEMUOption qemu_options[] = {
 #ifdef HAS_AUDIO
 struct soundhw soundhw[] = {
 #ifdef HAS_AUDIO_CHOICE
-#if defined(TARGET_I386) || defined(TARGET_MIPS)
+#if CONFIG_PCSPK
     {
         .name = "pcspk",
         .descr = "PC speaker",
Signature · 1 line
1.6.2.5