[PATCH v2 13/13] [RFC] audio: try use onboard audiodev for pcspk

Gerd Hoffmann kraxel at redhat.com
Fri May 15 14:35:28 UTC 2020


New naming convention:  Use "onboard" audiodev for onboard audio
devices, using "-audiodev pa,id=onboard" for example.

This patchs implements it for pcspk, it will try to use "onboard" by
default.  Setting another name using "-global pcspk.audiodev=<name>"
continues to work.

If we want go this route we should do the same for other onboard
audio devices too (arm boards, ...).

Signed-off-by: Gerd Hoffmann <kraxel at redhat.com>
---
 hw/audio/pcspk.c           | 3 +++
 docs/system/deprecated.rst | 4 ++--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/hw/audio/pcspk.c b/hw/audio/pcspk.c
index ab290e686783..9a08e9d8e05b 100644
--- a/hw/audio/pcspk.c
+++ b/hw/audio/pcspk.c
@@ -190,6 +190,9 @@ static void pcspk_realizefn(DeviceState *dev, Error **errp)
 
     isa_register_ioport(isadev, &s->ioport, s->iobase);
 
+    if (!s->card.state) {
+        s->card.state = audio_state_by_name("onboard");
+    }
     if (s->card.state) {
         pcspk_audio_init(s);
     }
diff --git a/docs/system/deprecated.rst b/docs/system/deprecated.rst
index 7de1045b7e27..34312fc0a963 100644
--- a/docs/system/deprecated.rst
+++ b/docs/system/deprecated.rst
@@ -94,8 +94,8 @@ Creating sound card devices using ``-soundhw`` (since 5.1)
 Sound card devices should be created using ``-device`` instead.  The
 names are the same for most devices.  The exceptions are ``hda`` which
 needs two devices (``-device intel-hda --device hda-duplex``) and
-``pcspk`` which can be activated using ``-global
-pcspk.audiodev=<name>``.
+``pcspk`` which can be activated by creating an audiodev named
+``onboard``.
 
 ``-mon ...,control=readline,pretty=on|off`` (since 4.1)
 '''''''''''''''''''''''''''''''''''''''''''''''''''''''
-- 
2.18.4




More information about the libvir-list mailing list