Skip to content

Commit 8796c64

Browse files
committed
Merge remote-tracking branch 'remotes/kraxel/tags/audio-20200706-pull-request' into staging
audio: deprecate -soundhw # gpg: Signature made Mon 06 Jul 2020 20:29:07 BST # gpg: using RSA key 4CB6D8EED3E87138 # gpg: Good signature from "Gerd Hoffmann (work) <[email protected]>" [full] # gpg: aka "Gerd Hoffmann <[email protected]>" [full] # gpg: aka "Gerd Hoffmann (private) <[email protected]>" [full] # Primary key fingerprint: A032 8CFF B93A 17A7 9901 FE7D 4CB6 D8EE D3E8 7138 * remotes/kraxel/tags/audio-20200706-pull-request: audio: set default value for pcspk.iobase property pcspk: update docs/system/target-i386-desc.rst.inc audio: add soundhw deprecation notice audio: deprecate -soundhw pcspk audio: create pcspk device early audio: rework pcspk_init() softmmu: initialize spice and audio earlier pc_basic_device_init: drop no_vmport arg pc_basic_device_init: drop has_pit arg pc_basic_device_init: pass PCMachineState audio: deprecate -soundhw hda audio: deprecate -soundhw sb16 audio: deprecate -soundhw gus audio: deprecate -soundhw cs4231a audio: deprecate -soundhw adlib audio: deprecate -soundhw es1370 audio: deprecate -soundhw ac97 audio: add deprecated_register_soundhw stubs: add pci_create_simple stubs: add isa_create_simple Signed-off-by: Peter Maydell <[email protected]>
2 parents cd95576 + 2336172 commit 8796c64

File tree

24 files changed

+121
-79
lines changed

24 files changed

+121
-79
lines changed

docs/system/deprecated.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,15 @@ should specify an ``audiodev=`` property. Additionally, when using
8282
vnc, you should specify an ``audiodev=`` propery if you plan to
8383
transmit audio through the VNC protocol.
8484

85+
Creating sound card devices using ``-soundhw`` (since 5.1)
86+
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
87+
88+
Sound card devices should be created using ``-device`` instead. The
89+
names are the same for most devices. The exceptions are ``hda`` which
90+
needs two devices (``-device intel-hda -device hda-duplex``) and
91+
``pcspk`` which can be activated using ``-machine
92+
pcspk-audiodev=<name>``.
93+
8594
``-mon ...,control=readline,pretty=on|off`` (since 4.1)
8695
'''''''''''''''''''''''''''''''''''''''''''''''''''''''
8796

docs/system/target-i386-desc.rst.inc

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ The QEMU PC System emulator simulates the following peripherals:
3131

3232
- CS4231A compatible sound card
3333

34+
- PC speaker
35+
3436
- PCI UHCI, OHCI, EHCI or XHCI USB controller and a virtual USB-1.1
3537
hub.
3638

@@ -49,7 +51,7 @@ must be told to not have parallel ports to have working GUS.
4951
5052
.. parsed-literal::
5153
52-
|qemu_system_x86| dos.img -soundhw gus -parallel none
54+
|qemu_system_x86| dos.img -device gus -parallel none
5355
5456
Alternatively:
5557
@@ -60,3 +62,12 @@ Alternatively:
6062
Or some other unclaimed IRQ.
6163
6264
CS4231A is the chip used in Windows Sound System and GUSMAX products
65+
66+
The PC speaker audio device can be configured using the pcspk-audiodev
67+
machine property, i.e.
68+
69+
.. parsed-literal::
70+
71+
|qemu_system_x86| some.img \
72+
-audiodev <backend>,id=<name> \
73+
-machine pcspk-audiodev=<name>

hw/audio/ac97.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1393,12 +1393,6 @@ static void ac97_exit(PCIDevice *dev)
13931393
AUD_remove_card(&s->card);
13941394
}
13951395

1396-
static int ac97_init (PCIBus *bus)
1397-
{
1398-
pci_create_simple(bus, -1, TYPE_AC97);
1399-
return 0;
1400-
}
1401-
14021396
static Property ac97_properties[] = {
14031397
DEFINE_AUDIO_PROPERTIES(AC97LinkState, card),
14041398
DEFINE_PROP_END_OF_LIST (),
@@ -1436,7 +1430,8 @@ static const TypeInfo ac97_info = {
14361430
static void ac97_register_types (void)
14371431
{
14381432
type_register_static (&ac97_info);
1439-
pci_register_soundhw("ac97", "Intel 82801AA AC97 Audio", ac97_init);
1433+
deprecated_register_soundhw("ac97", "Intel 82801AA AC97 Audio",
1434+
0, TYPE_AC97);
14401435
}
14411436

14421437
type_init (ac97_register_types)

hw/audio/adlib.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -319,16 +319,10 @@ static const TypeInfo adlib_info = {
319319
.class_init = adlib_class_initfn,
320320
};
321321

322-
static int Adlib_init (ISABus *bus)
323-
{
324-
isa_create_simple (bus, TYPE_ADLIB);
325-
return 0;
326-
}
327-
328322
static void adlib_register_types (void)
329323
{
330324
type_register_static (&adlib_info);
331-
isa_register_soundhw("adlib", ADLIB_DESC, Adlib_init);
325+
deprecated_register_soundhw("adlib", ADLIB_DESC, 1, TYPE_ADLIB);
332326
}
333327

334328
type_init (adlib_register_types)

hw/audio/cs4231a.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -683,12 +683,6 @@ static void cs4231a_realizefn (DeviceState *dev, Error **errp)
683683
AUD_register_card ("cs4231a", &s->card);
684684
}
685685

686-
static int cs4231a_init (ISABus *bus)
687-
{
688-
isa_create_simple (bus, TYPE_CS4231A);
689-
return 0;
690-
}
691-
692686
static Property cs4231a_properties[] = {
693687
DEFINE_AUDIO_PROPERTIES(CSState, card),
694688
DEFINE_PROP_UINT32 ("iobase", CSState, port, 0x534),
@@ -720,7 +714,7 @@ static const TypeInfo cs4231a_info = {
720714
static void cs4231a_register_types (void)
721715
{
722716
type_register_static (&cs4231a_info);
723-
isa_register_soundhw("cs4231a", "CS4231A", cs4231a_init);
717+
deprecated_register_soundhw("cs4231a", "CS4231A", 1, TYPE_CS4231A);
724718
}
725719

726720
type_init (cs4231a_register_types)

hw/audio/es1370.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -884,12 +884,6 @@ static void es1370_exit(PCIDevice *dev)
884884
AUD_remove_card(&s->card);
885885
}
886886

887-
static int es1370_init (PCIBus *bus)
888-
{
889-
pci_create_simple (bus, -1, TYPE_ES1370);
890-
return 0;
891-
}
892-
893887
static Property es1370_properties[] = {
894888
DEFINE_AUDIO_PROPERTIES(ES1370State, card),
895889
DEFINE_PROP_END_OF_LIST(),
@@ -928,7 +922,8 @@ static const TypeInfo es1370_info = {
928922
static void es1370_register_types (void)
929923
{
930924
type_register_static (&es1370_info);
931-
pci_register_soundhw("es1370", "ENSONIQ AudioPCI ES1370", es1370_init);
925+
deprecated_register_soundhw("es1370", "ENSONIQ AudioPCI ES1370",
926+
0, TYPE_ES1370);
932927
}
933928

934929
type_init (es1370_register_types)

hw/audio/gus.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -286,12 +286,6 @@ static void gus_realizefn (DeviceState *dev, Error **errp)
286286
AUD_set_active_out (s->voice, 1);
287287
}
288288

289-
static int GUS_init (ISABus *bus)
290-
{
291-
isa_create_simple (bus, TYPE_GUS);
292-
return 0;
293-
}
294-
295289
static Property gus_properties[] = {
296290
DEFINE_AUDIO_PROPERTIES(GUSState, card),
297291
DEFINE_PROP_UINT32 ("freq", GUSState, freq, 44100),
@@ -322,7 +316,7 @@ static const TypeInfo gus_info = {
322316
static void gus_register_types (void)
323317
{
324318
type_register_static (&gus_info);
325-
isa_register_soundhw("gus", "Gravis Ultrasound GF1", GUS_init);
319+
deprecated_register_soundhw("gus", "Gravis Ultrasound GF1", 1, TYPE_GUS);
326320
}
327321

328322
type_init (gus_register_types)

hw/audio/intel-hda.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include "qemu/bitops.h"
2626
#include "qemu/log.h"
2727
#include "qemu/module.h"
28+
#include "qemu/error-report.h"
2829
#include "hw/audio/soundhw.h"
2930
#include "intel-hda.h"
3031
#include "migration/vmstate.h"
@@ -1307,6 +1308,8 @@ static int intel_hda_and_codec_init(PCIBus *bus)
13071308
BusState *hdabus;
13081309
DeviceState *codec;
13091310

1311+
warn_report("'-soundhw hda' is deprecated, "
1312+
"please use '-device intel-hda -device hda-duplex' instead");
13101313
controller = DEVICE(pci_create_simple(bus, -1, "intel-hda"));
13111314
hdabus = QLIST_FIRST(&controller->child_bus);
13121315
codec = qdev_new("hda-duplex");

hw/audio/pcspk.c

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include "audio/audio.h"
2929
#include "qemu/module.h"
3030
#include "qemu/timer.h"
31+
#include "qemu/error-report.h"
3132
#include "hw/timer/i8254.h"
3233
#include "migration/vmstate.h"
3334
#include "hw/audio/pcspk.h"
@@ -112,11 +113,15 @@ static void pcspk_callback(void *opaque, int free)
112113
}
113114
}
114115

115-
static int pcspk_audio_init(ISABus *bus)
116+
static int pcspk_audio_init(PCSpkState *s)
116117
{
117-
PCSpkState *s = pcspk_state;
118118
struct audsettings as = {PCSPK_SAMPLE_RATE, 1, AUDIO_FORMAT_U8, 0};
119119

120+
if (s->voice) {
121+
/* already initialized */
122+
return 0;
123+
}
124+
120125
AUD_register_card(s_spk, &s->card);
121126

122127
s->voice = AUD_open_out(&s->card, s->voice, s_spk, s, pcspk_callback, &as);
@@ -185,6 +190,10 @@ static void pcspk_realizefn(DeviceState *dev, Error **errp)
185190

186191
isa_register_ioport(isadev, &s->ioport, s->iobase);
187192

193+
if (s->card.state) {
194+
pcspk_audio_init(s);
195+
}
196+
188197
pcspk_state = s;
189198
}
190199

@@ -210,7 +219,7 @@ static const VMStateDescription vmstate_spk = {
210219

211220
static Property pcspk_properties[] = {
212221
DEFINE_AUDIO_PROPERTIES(PCSpkState, card),
213-
DEFINE_PROP_UINT32("iobase", PCSpkState, iobase, -1),
222+
DEFINE_PROP_UINT32("iobase", PCSpkState, iobase, 0x61),
214223
DEFINE_PROP_BOOL("migrate", PCSpkState, migrate, true),
215224
DEFINE_PROP_END_OF_LIST(),
216225
};
@@ -236,9 +245,18 @@ static const TypeInfo pcspk_info = {
236245
.class_init = pcspk_class_initfn,
237246
};
238247

248+
static int pcspk_audio_init_soundhw(ISABus *bus)
249+
{
250+
PCSpkState *s = pcspk_state;
251+
252+
warn_report("'-soundhw pcspk' is deprecated, "
253+
"please set a backend using '-machine pcspk-audiodev=<name>' instead");
254+
return pcspk_audio_init(s);
255+
}
256+
239257
static void pcspk_register(void)
240258
{
241259
type_register_static(&pcspk_info);
242-
isa_register_soundhw("pcspk", "PC speaker", pcspk_audio_init);
260+
isa_register_soundhw("pcspk", "PC speaker", pcspk_audio_init_soundhw);
243261
}
244262
type_init(pcspk_register)

hw/audio/sb16.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1415,12 +1415,6 @@ static void sb16_realizefn (DeviceState *dev, Error **errp)
14151415
AUD_register_card ("sb16", &s->card);
14161416
}
14171417

1418-
static int SB16_init (ISABus *bus)
1419-
{
1420-
isa_create_simple (bus, TYPE_SB16);
1421-
return 0;
1422-
}
1423-
14241418
static Property sb16_properties[] = {
14251419
DEFINE_AUDIO_PROPERTIES(SB16State, card),
14261420
DEFINE_PROP_UINT32 ("version", SB16State, ver, 0x0405), /* 4.5 */
@@ -1453,7 +1447,8 @@ static const TypeInfo sb16_info = {
14531447
static void sb16_register_types (void)
14541448
{
14551449
type_register_static (&sb16_info);
1456-
isa_register_soundhw("sb16", "Creative Sound Blaster 16", SB16_init);
1450+
deprecated_register_soundhw("sb16", "Creative Sound Blaster 16",
1451+
1, TYPE_SB16);
14571452
}
14581453

14591454
type_init (sb16_register_types)

0 commit comments

Comments
 (0)