]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - sound/hda/hdac_stream.c
Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi
[linux.git] / sound / hda / hdac_stream.c
index d01e691391648c43703eef7c818669fa8db098b1..a314b03b4a4cb1696d87ee57d5f5ed8d21eecb26 100644 (file)
@@ -631,20 +631,27 @@ void snd_hdac_stream_sync(struct hdac_stream *azx_dev, bool start,
                nwait = 0;
                i = 0;
                list_for_each_entry(s, &bus->stream_list, list) {
-                       if (streams & (1 << i)) {
-                               if (start) {
-                                       /* check FIFO gets ready */
-                                       if (!(snd_hdac_stream_readb(s, SD_STS) &
-                                             SD_STS_FIFO_READY))
-                                               nwait++;
-                               } else {
-                                       /* check RUN bit is cleared */
-                                       if (snd_hdac_stream_readb(s, SD_CTL) &
-                                           SD_CTL_DMA_START)
-                                               nwait++;
+                       if (!(streams & (1 << i++)))
+                               continue;
+
+                       if (start) {
+                               /* check FIFO gets ready */
+                               if (!(snd_hdac_stream_readb(s, SD_STS) &
+                                     SD_STS_FIFO_READY))
+                                       nwait++;
+                       } else {
+                               /* check RUN bit is cleared */
+                               if (snd_hdac_stream_readb(s, SD_CTL) &
+                                   SD_CTL_DMA_START) {
+                                       nwait++;
+                                       /*
+                                        * Perform stream reset if DMA RUN
+                                        * bit not cleared within given timeout
+                                        */
+                                       if (timeout == 1)
+                                               snd_hdac_stream_reset(s);
                                }
                        }
-                       i++;
                }
                if (!nwait)
                        break;