Skip to contentSkip to conversation

Make pcspk like rest of audio cards

PATCH New Juan Quintela 1 participant 4 messages Aug 10, 2009 – Aug 11, 2009 Kbuild

lore
Share & tools
lore
#0 lore raw

v2 cover Make pcspk like rest of audio cards

v2

We use c99 initializers in malc style, open and closed parents in the same line, and = signs aligned.

v1:

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            |   91 +++++++++++++++++++++++--------------------------------
 3 files changed, 53 insertions(+), 59 deletions(-)
#1 lore raw

PATCH v2 1/3 Bring audio cards structs to C99 initializers

---
 vl.c |   89 +++++++++++++++++++++++++++--------------------------------------
 1 files changed, 37 insertions(+), 52 deletions(-)
vl.c +37 -52
index 8b2b289..2702036 100644
@@ -4347,82 +4347,67 @@ static const QEMUOption qemu_options[] = {
 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

PATCH v2 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 834d88e..a1db8b9 100755
@@ -1622,10 +1622,6 @@ fi
 if test "$vde" = "yes" ; then
   echo "CONFIG_VDE=y" >> $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:]'`
@@ -2207,6 +2203,11 @@ if test "$target_softmmu" = "yes" ; then
     ldflags="-Wl,-G0 $linker_script -static $ldflags"
     ;;
   esac
+
+for card in $audio_card_list; do
+    def=CONFIG_`echo $card | tr '[:lower:]' '[:upper:]'`
+    echo "$def=y" >> $config_mak
+done
 fi
 
 echo "LDFLAGS+=$ldflags" >> $config_mak
Signature · 1 line
1.6.2.5
#3 lore raw

PATCH v2 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 3f5d24a..c45d24b 100644
@@ -160,6 +160,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
 
 adlib.o fmopl.o: QEMU_CFLAGS += -DBUILD_Y8950=0
 
@@ -184,7 +185,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 isa-bus.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
@@ -212,7 +213,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 isa-bus.o pcspk.o $(sound-obj-y)
+obj-mips-y += piix_pci.o parallel.o cirrus_vga.o isa-bus.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 a1db8b9..1de6d95 100755
@@ -2208,6 +2208,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=y" >> $config_mak
+esac
 fi
 
 echo "LDFLAGS+=$ldflags" >> $config_mak
vl.c +1 -1
index 2702036..f6fabbd 100644
@@ -4346,7 +4346,7 @@ static const QEMUOption qemu_options[] = {
 #ifdef HAS_AUDIO
 struct soundhw soundhw[] = {
 #ifdef HAS_AUDIO_CHOICE
-#if defined(TARGET_I386) || defined(TARGET_MIPS)
+#ifdef CONFIG_PCSPK
     {.name          = "pcspk",
      .descr         = "PC speaker",
      .enabled       = 0,
Signature · 1 line
1.6.2.5