[alsa-devel] [PATCH 2/8] ALSA: hdspm - Fix buffer handling on RME MADI/MADIface/AES(32)

Adrian Knoth adi at drcomp.erfurt.thur.de
Wed Feb 23 11:43:09 CET 2011


Only RayDAT and AIO provide sane buffer pointers that can be used with
HDSPM_BufferPositionMask, on all other cards, this would result in a
wrong HW pointer leading to xruns and these messages:

[260808.916788] BUG: pcmC0D0p:0, pos = 2976, buffer size = 1024, period size = 512
[260808.961124] BUG: pcmC0D0c:0, pos = 4944, buffer size = 1024, period size = 512

Signed-off-by: Adrian Knoth <adi at drcomp.erfurt.thur.de>

diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c
index 9258897..509a35a 100644
--- a/sound/pci/rme9652/hdspm.c
+++ b/sound/pci/rme9652/hdspm.c
@@ -1231,8 +1231,17 @@ static snd_pcm_uframes_t hdspm_hw_pointer(struct hdspm *hdspm)
 	int position;
 
 	position = hdspm_read(hdspm, HDSPM_statusRegister);
-	position &= HDSPM_BufferPositionMask;
-	position /= 4; /* Bytes per sample */
+
+	switch (hdspm->io_type) {
+	case RayDAT:
+	case AIO:
+		position &= HDSPM_BufferPositionMask;
+		position /= 4; /* Bytes per sample */
+		break;
+	default:
+		position = (position & HDSPM_BufferID) ?
+			(hdspm->period_bytes / 4) : 0;
+	}
 
 	return position;
 }
-- 
1.7.2.3



More information about the Alsa-devel mailing list