Commit 36cd6f6f authored by Paolo Bonzini's avatar Paolo Bonzini Committed by Anthony Liguori
Browse files

audio: remove the need for audio card CONFIG_* symbols



Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
Message-id: 1366303444-24620-3-git-send-email-pbonzini@redhat.com
Signed-off-by: default avatarAnthony Liguori <aliguori@us.ibm.com>
parent 8c444a19
Loading
Loading
Loading
Loading
+31 −97
Original line number Diff line number Diff line
@@ -899,96 +899,30 @@ struct soundhw {
    } init;
};

static struct soundhw soundhw[] = {
#ifdef HAS_AUDIO_CHOICE
#ifdef CONFIG_PCSPK
    {
        "pcspk",
        "PC speaker",
        0,
        1,
        { .init_isa = pcspk_audio_init }
    },
#endif

#ifdef CONFIG_SB16
    {
        "sb16",
        "Creative Sound Blaster 16",
        0,
        1,
        { .init_isa = SB16_init }
    },
#endif

#ifdef CONFIG_CS4231A
    {
        "cs4231a",
        "CS4231A",
        0,
        1,
        { .init_isa = cs4231a_init }
    },
#endif

#ifdef CONFIG_ADLIB
    {
        "adlib",
#ifdef HAS_YMF262
        "Yamaha YMF262 (OPL3)",
#else
        "Yamaha YM3812 (OPL2)",
#endif
        0,
        1,
        { .init_isa = Adlib_init }
    },
#endif

#ifdef CONFIG_GUS
    {
        "gus",
        "Gravis Ultrasound GF1",
        0,
        1,
        { .init_isa = GUS_init }
    },
#endif

#ifdef CONFIG_AC97
    {
        "ac97",
        "Intel 82801AA AC97 Audio",
        0,
        0,
        { .init_pci = ac97_init }
    },
#endif
static struct soundhw soundhw[9];
static int soundhw_count;

#ifdef CONFIG_ES1370
void isa_register_soundhw(const char *name, const char *descr,
                          int (*init_isa)(ISABus *bus))
{
        "es1370",
        "ENSONIQ AudioPCI ES1370",
        0,
        0,
        { .init_pci = es1370_init }
    },
#endif
    assert(soundhw_count < ARRAY_SIZE(soundhw) - 1);
    soundhw[soundhw_count].name = name;
    soundhw[soundhw_count].descr = descr;
    soundhw[soundhw_count].isa = 1;
    soundhw[soundhw_count].init.init_isa = init_isa;
    soundhw_count++;
}

#ifdef CONFIG_HDA
void pci_register_soundhw(const char *name, const char *descr,
                          int (*init_pci)(PCIBus *bus))
{
        "hda",
        "Intel HD Audio",
        0,
        0,
        { .init_pci = intel_hda_and_codec_init }
    },
#endif

#endif /* HAS_AUDIO_CHOICE */

    { NULL, NULL, 0, 0, { NULL } }
};
    assert(soundhw_count < ARRAY_SIZE(soundhw) - 1);
    soundhw[soundhw_count].name = name;
    soundhw[soundhw_count].descr = descr;
    soundhw[soundhw_count].isa = 0;
    soundhw[soundhw_count].init.init_pci = init_pci;
    soundhw_count++;
}

void select_soundhw(const char *optarg)
{
@@ -997,16 +931,16 @@ void select_soundhw(const char *optarg)
    if (is_help_option(optarg)) {
    show_valid_cards:

#ifdef HAS_AUDIO_CHOICE
        if (soundhw_count) {
             printf("Valid sound card names (comma separated):\n");
             for (c = soundhw; c->name; ++c) {
                 printf ("%-11s %s\n", c->name, c->descr);
             }
             printf("\n-soundhw all will enable all of the above\n");
#else
        } else {
             printf("Machine has no user-selectable audio hardware "
                    "(it may or may not have always-present audio hardware).\n");
#endif
        }
        exit(!is_help_option(optarg));
    }
    else {
+1 −7
Original line number Diff line number Diff line
@@ -4459,15 +4459,9 @@ esac

if test "$target_softmmu" = "yes" ; then
  case "$TARGET_BASE_ARCH" in
  arm)
  arm|lm32|i386|mips|ppc)
    cflags="-DHAS_AUDIO $cflags"
  ;;
  lm32)
    cflags="-DHAS_AUDIO $cflags"
  ;;
  i386|mips|ppc)
    cflags="-DHAS_AUDIO -DHAS_AUDIO_CHOICE $cflags"
  ;;
  esac
fi

+2 −1
Original line number Diff line number Diff line
@@ -1396,7 +1396,7 @@ static void ac97_exitfn (PCIDevice *dev)
    memory_region_destroy (&s->io_nabm);
}

int ac97_init (PCIBus *bus)
static int ac97_init (PCIBus *bus)
{
    pci_create_simple (bus, -1, "AC97");
    return 0;
@@ -1433,6 +1433,7 @@ static const TypeInfo ac97_info = {
static void ac97_register_types (void)
{
    type_register_static (&ac97_info);
    pci_register_soundhw("ac97", "Intel 82801AA AC97 Audio", ac97_init);
}

type_init (ac97_register_types)
+2 −1
Original line number Diff line number Diff line
@@ -372,7 +372,7 @@ static const TypeInfo adlib_info = {
    .class_init    = adlib_class_initfn,
};

int Adlib_init (ISABus *bus)
static int Adlib_init (ISABus *bus)
{
    isa_create_simple (bus, TYPE_ADLIB);
    return 0;
@@ -381,6 +381,7 @@ int Adlib_init (ISABus *bus)
static void adlib_register_types (void)
{
    type_register_static (&adlib_info);
    isa_register_soundhw("adlib", ADLIB_DESC, Adlib_init);
}

type_init (adlib_register_types)
+2 −1
Original line number Diff line number Diff line
@@ -659,7 +659,7 @@ static int cs4231a_initfn (ISADevice *dev)
    return 0;
}

int cs4231a_init (ISABus *bus)
static int cs4231a_init (ISABus *bus)
{
    isa_create_simple (bus, "cs4231a");
    return 0;
@@ -692,6 +692,7 @@ static const TypeInfo cs4231a_info = {
static void cs4231a_register_types (void)
{
    type_register_static (&cs4231a_info);
    isa_register_soundhw("cs4231a", "CS4231A", cs4231a_init);
}

type_init (cs4231a_register_types)
Loading