0a122b
From 22f1816abcb97b9df9f0c7b896202a4c3c5d89ec Mon Sep 17 00:00:00 2001
0a122b
From: Gerd Hoffmann <kraxel@redhat.com>
0a122b
Date: Mon, 3 Feb 2014 14:18:24 -0500
0a122b
Subject: [PATCH 4/6] hda-codec: disable streams on reset
0a122b
0a122b
Message-id: <1391437104-22283-2-git-send-email-kraxel@redhat.com>
0a122b
Patchwork-id: 57073
0a122b
O-Subject: [RHEL-7 qemu-kvm PATCH 1/1] hda-codec: disable streams on reset
0a122b
Bugzilla: 947812
0a122b
RH-Acked-by: Markus Armbruster <armbru@redhat.com>
0a122b
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
0a122b
RH-Acked-by: Bandan Das <bsd@redhat.com>
0a122b
0a122b
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
0a122b
(cherry picked from commit 39e6a38cdd4b235b2918b4977f31fde2c0da3bc4)
0a122b
---
0a122b
 hw/audio/hda-codec.c | 18 ++++++++++++++++++
0a122b
 1 file changed, 18 insertions(+)
0a122b
0a122b
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
0a122b
---
0a122b
 hw/audio/hda-codec.c | 18 ++++++++++++++++++
0a122b
 1 file changed, 18 insertions(+)
0a122b
0a122b
diff --git a/hw/audio/hda-codec.c b/hw/audio/hda-codec.c
0a122b
index 07a43bf..986f2a9 100644
0a122b
--- a/hw/audio/hda-codec.c
0a122b
+++ b/hw/audio/hda-codec.c
0a122b
@@ -559,6 +559,21 @@ static int hda_audio_post_load(void *opaque, int version)
0a122b
     return 0;
0a122b
 }
0a122b
 
0a122b
+static void hda_audio_reset(DeviceState *dev)
0a122b
+{
0a122b
+    HDAAudioState *a = DO_UPCAST(HDAAudioState, hda.qdev, dev);
0a122b
+    HDAAudioStream *st;
0a122b
+    int i;
0a122b
+
0a122b
+    dprint(a, 1, "%s\n", __func__);
0a122b
+    for (i = 0; i < ARRAY_SIZE(a->st); i++) {
0a122b
+        st = a->st + i;
0a122b
+        if (st->node != NULL) {
0a122b
+            hda_audio_set_running(st, false);
0a122b
+        }
0a122b
+    }
0a122b
+}
0a122b
+
0a122b
 static const VMStateDescription vmstate_hda_audio_stream = {
0a122b
     .name = "hda-audio-stream",
0a122b
     .version_id = 1,
0a122b
@@ -640,6 +655,7 @@ static void hda_audio_output_class_init(ObjectClass *klass, void *data)
0a122b
     k->stream = hda_audio_stream;
0a122b
     set_bit(DEVICE_CATEGORY_SOUND, dc->categories);
0a122b
     dc->desc = "HDA Audio Codec, output-only (line-out)";
0a122b
+    dc->reset = hda_audio_reset;
0a122b
     dc->vmsd = &vmstate_hda_audio;
0a122b
     dc->props = hda_audio_properties;
0a122b
 }
0a122b
@@ -662,6 +678,7 @@ static void hda_audio_duplex_class_init(ObjectClass *klass, void *data)
0a122b
     k->stream = hda_audio_stream;
0a122b
     set_bit(DEVICE_CATEGORY_SOUND, dc->categories);
0a122b
     dc->desc = "HDA Audio Codec, duplex (line-out, line-in)";
0a122b
+    dc->reset = hda_audio_reset;
0a122b
     dc->vmsd = &vmstate_hda_audio;
0a122b
     dc->props = hda_audio_properties;
0a122b
 }
0a122b
@@ -684,6 +701,7 @@ static void hda_audio_micro_class_init(ObjectClass *klass, void *data)
0a122b
     k->stream = hda_audio_stream;
0a122b
     set_bit(DEVICE_CATEGORY_SOUND, dc->categories);
0a122b
     dc->desc = "HDA Audio Codec, duplex (speaker, microphone)";
0a122b
+    dc->reset = hda_audio_reset;
0a122b
     dc->vmsd = &vmstate_hda_audio;
0a122b
     dc->props = hda_audio_properties;
0a122b
 }
0a122b
-- 
0a122b
1.8.3.1
0a122b