From b4a655e81d4d1d12abc92d29dfb7550e66a08799 Mon Sep 17 00:00:00 2001
From: Takashi Iwai <tiwai@suse.de>
Date: Tue, 7 Jun 2011 12:26:56 +0200
Subject: [PATCH] ALSA: hda - Judge playback stream from stream id in azx_via_get_position()
Git-commit: b4a655e81d4d1d12abc92d29dfb7550e66a08799
Patch-mainline: 3.1-rc2
Refernces: FATE#314106,FATE#314311,FATE#313695

Instead of checking the azx_dev index with a fixed number (4), check
the stream direction of the assigned substream.

Signed-off-by: Takashi Iwai <tiwai@suse.de>

---
 sound/pci/hda/hda_intel.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -1868,7 +1868,7 @@ static unsigned int azx_via_get_position
 	unsigned int fifo_size;
 
 	link_pos = azx_sd_readl(azx_dev, SD_LPIB);
-	if (azx_dev->index >= 4) {
+	if (azx_dev->substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
 		/* Playback, no problem using link position */
 		return link_pos;
 	}
