From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50367) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VsXEJ-0003dK-1Y for qemu-devel@nongnu.org; Mon, 16 Dec 2013 07:25:05 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VsXED-0003aq-3W for qemu-devel@nongnu.org; Mon, 16 Dec 2013 07:24:58 -0500 Received: from mx1.redhat.com ([209.132.183.28]:31873) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VsXEC-0003ai-Qn for qemu-devel@nongnu.org; Mon, 16 Dec 2013 07:24:53 -0500 From: Gerd Hoffmann Date: Mon, 16 Dec 2013 13:24:33 +0100 Message-Id: <1387196673-31911-1-git-send-email-kraxel@redhat.com> Subject: [Qemu-devel] [PATCH] hda-codec: disable streams on reset List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: "Vassili Karpov (malc)" , Gerd Hoffmann Signed-off-by: Gerd Hoffmann --- hw/audio/hda-codec.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/hw/audio/hda-codec.c b/hw/audio/hda-codec.c index 07a43bf..986f2a9 100644 --- a/hw/audio/hda-codec.c +++ b/hw/audio/hda-codec.c @@ -559,6 +559,21 @@ static int hda_audio_post_load(void *opaque, int version) return 0; } +static void hda_audio_reset(DeviceState *dev) +{ + HDAAudioState *a = DO_UPCAST(HDAAudioState, hda.qdev, dev); + HDAAudioStream *st; + int i; + + dprint(a, 1, "%s\n", __func__); + for (i = 0; i < ARRAY_SIZE(a->st); i++) { + st = a->st + i; + if (st->node != NULL) { + hda_audio_set_running(st, false); + } + } +} + static const VMStateDescription vmstate_hda_audio_stream = { .name = "hda-audio-stream", .version_id = 1, @@ -640,6 +655,7 @@ static void hda_audio_output_class_init(ObjectClass *klass, void *data) k->stream = hda_audio_stream; set_bit(DEVICE_CATEGORY_SOUND, dc->categories); dc->desc = "HDA Audio Codec, output-only (line-out)"; + dc->reset = hda_audio_reset; dc->vmsd = &vmstate_hda_audio; dc->props = hda_audio_properties; } @@ -662,6 +678,7 @@ static void hda_audio_duplex_class_init(ObjectClass *klass, void *data) k->stream = hda_audio_stream; set_bit(DEVICE_CATEGORY_SOUND, dc->categories); dc->desc = "HDA Audio Codec, duplex (line-out, line-in)"; + dc->reset = hda_audio_reset; dc->vmsd = &vmstate_hda_audio; dc->props = hda_audio_properties; } @@ -684,6 +701,7 @@ static void hda_audio_micro_class_init(ObjectClass *klass, void *data) k->stream = hda_audio_stream; set_bit(DEVICE_CATEGORY_SOUND, dc->categories); dc->desc = "HDA Audio Codec, duplex (speaker, microphone)"; + dc->reset = hda_audio_reset; dc->vmsd = &vmstate_hda_audio; dc->props = hda_audio_properties; } -- 1.8.3.1