cd9d161
From 05a5f7c79ad8dc4887e7cd60c2572121b51adce7 Mon Sep 17 00:00:00 2001
cd9d161
From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= <marcandre.lureau@gmail.com>
cd9d161
Date: Tue, 25 Oct 2011 16:53:00 +0200
cd9d161
Subject: [PATCH] hda: do not mix output and input streams, RHBZ #740493
cd9d161
MIME-Version: 1.0
cd9d161
Content-Type: text/plain; charset=UTF-8
cd9d161
Content-Transfer-Encoding: 8bit
cd9d161
cd9d161
Windows 7 may use the same stream number for input and output.
cd9d161
That will result in lot of garbage on playback.
cd9d161
cd9d161
The hardcoded value of 4 needs to be in sync with GCAP streams
cd9d161
description and IN/OUT registers.
cd9d161
cd9d161
Signed-off-by: Marc-Andr? Lureau <marcandre.lureau@redhat.com>
cd9d161
Signed-off-by: malc <av1474@comtv.ru>
cd9d161
(cherry picked from commit 36ac4ad3d054a7b4962a6393630a73591cfa9558)
cd9d161
cd9d161
Signed-off-by: Bruce Rogers <brogers@suse.com>
cd9d161
Signed-off-by: Andreas Färber <afaerber@suse.de>
cd9d161
---
cd9d161
 hw/intel-hda.c | 9 +++++----
cd9d161
 1 file changed, 5 insertions(+), 4 deletions(-)
cd9d161
cd9d161
diff --git a/hw/intel-hda.c b/hw/intel-hda.c
cd9d161
index 5a2bc3a..7d02558 100644
cd9d161
--- a/hw/intel-hda.c
cd9d161
+++ b/hw/intel-hda.c
cd9d161
@@ -389,14 +389,15 @@ static bool intel_hda_xfer(HDACodecDevice *dev, uint32_t stnr, bool output,
cd9d161
 {
cd9d161
     HDACodecBus *bus = DO_UPCAST(HDACodecBus, qbus, dev->qdev.parent_bus);
cd9d161
     IntelHDAState *d = container_of(bus, IntelHDAState, codecs);
cd9d161
-    IntelHDAStream *st = NULL;
cd9d161
     target_phys_addr_t addr;
cd9d161
     uint32_t s, copy, left;
cd9d161
+    IntelHDAStream *st;
cd9d161
     bool irq = false;
cd9d161
 
cd9d161
-    for (s = 0; s < ARRAY_SIZE(d->st); s++) {
cd9d161
-        if (stnr == ((d->st[s].ctl >> 20) & 0x0f)) {
cd9d161
-            st = d->st + s;
cd9d161
+    st = output ? d->st + 4 : d->st;
cd9d161
+    for (s = 0; s < 4; s++) {
cd9d161
+        if (stnr == ((st[s].ctl >> 20) & 0x0f)) {
cd9d161
+            st = st + s;
cd9d161
             break;
cd9d161
         }
cd9d161
     }
cd9d161
-- 
cd9d161
1.7.11.2
cd9d161