All of lore.kernel.org
 help / color / mirror / Atom feed
From: Adrian Knoth <adi@drcomp.erfurt.thur.de>
To: patch@alsa-project.org
Cc: Adrian Knoth <adi@drcomp.erfurt.thur.de>, alsa-devel@alsa-project.org
Subject: [PATCH 2/3] ALSA: hdspm - Fix reported external sample rate on RME MADI and MADIface
Date: Fri, 29 Jul 2011 03:11:03 +0200	[thread overview]
Message-ID: <1311901864-29021-3-git-send-email-adi@drcomp.erfurt.thur.de> (raw)
In-Reply-To: <1311901864-29021-1-git-send-email-adi@drcomp.erfurt.thur.de>

In slave mode, the card can only detect the base frequency (32..48kHz)
on the MADI link (exception: 96k frames), so the real external sample
rate is this base frequency multiplied by 1, 2 or 4 depending on the
speed mode.

This patch enables 64..192kHz sample rates in clock slave mode, which
failed before due to an alleged sample rate mismatch between the MADI
link (e.g., 48kHz) and the application in DS/QS mode (e.g., 96kHz,
192kHz).

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

diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c
index d219649..88ae274 100644
--- a/sound/pci/rme9652/hdspm.c
+++ b/sound/pci/rme9652/hdspm.c
@@ -1217,6 +1217,22 @@ static int hdspm_external_sample_rate(struct hdspm *hdspm)
 				rate = 0;
 				break;
 			}
+
+			/* QS and DS rates normally can not be detected
+			 * automatically by the card. Only exception is MADI
+			 * in 96k frame mode.
+			 *
+			 * So if we read SS values (32 .. 48k), check for
+			 * user-provided DS/QS bits in the control register
+			 * and multiply the base frequency accordingly.
+			 */
+			if (rate <= 48000) {
+				if (hdspm->control_register & HDSPM_QuadSpeed)
+					rate *= 4;
+				else if (hdspm->control_register &
+						HDSPM_DoubleSpeed)
+					rate *= 2;
+			}
 		}
 		break;
 	}
-- 
1.7.5.4

  parent reply	other threads:[~2011-07-29  1:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-29  1:11 [PATCH 0/3] [RME - HDSPM/MADI] Speed mode selector Adrian Knoth
2011-07-29  1:11 ` [PATCH 1/3] ALSA: hdspm - Provide MADI speed mode selector on RME MADI and MADIface Adrian Knoth
2011-07-29  1:11 ` Adrian Knoth [this message]
2011-07-29  1:11 ` [PATCH 3/3] ALSA: hdspm - Add firmware revision 0xcc for RME MADI Adrian Knoth
2011-07-29  5:49 ` [PATCH 0/3] [RME - HDSPM/MADI] Speed mode selector Takashi Iwai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1311901864-29021-3-git-send-email-adi@drcomp.erfurt.thur.de \
    --to=adi@drcomp.erfurt.thur.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=patch@alsa-project.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.