alsa-devel.alsa-project.org archive mirror
 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, andre.schramm@iosono-sound.com
Subject: [PATCH 2/9] ALSA: hdspm - Report external rate in slave mode on PCI MADI
Date: Fri, 19 Oct 2012 17:42:23 +0200	[thread overview]
Message-ID: <1350661350-5000-3-git-send-email-adi@drcomp.erfurt.thur.de> (raw)
In-Reply-To: <1350661350-5000-1-git-send-email-adi@drcomp.erfurt.thur.de>

As a follow-up to a97bda7d29d02a2e9c6609d0947b15e55f5200e5, report the
external sample rate as system_sample_rate when in slave mode.

For PCIe MADI cards, the DDS value automatically contains the external
sample rate, but the PCI version needs this manual workaround.

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 742bd5e..1131a8a 100644
--- a/sound/pci/rme9652/hdspm.c
+++ b/sound/pci/rme9652/hdspm.c
@@ -971,6 +971,7 @@ static inline void snd_hdspm_initialize_midi_flush(struct hdspm *hdspm);
 static int hdspm_update_simple_mixer_controls(struct hdspm *hdspm);
 static int hdspm_autosync_ref(struct hdspm *hdspm);
 static int snd_hdspm_set_defaults(struct hdspm *hdspm);
+static int hdspm_system_clock_mode(struct hdspm *hdspm);
 static void hdspm_set_sgbuf(struct hdspm *hdspm,
 			    struct snd_pcm_substream *substream,
 			     unsigned int reg, int channels);
@@ -1989,10 +1990,14 @@ static int hdspm_get_system_sample_rate(struct hdspm *hdspm)
 	rate = hdspm_calc_dds_value(hdspm, period);
 
 	if (rate > 207000) {
-		/* Unreasonable high sample rate as seen on PCI MADI cards.
-		 * Use the cached value instead.
-		 */
-		rate = hdspm->system_sample_rate;
+		/* Unreasonable high sample rate as seen on PCI MADI cards. */
+		if (0 == hdspm_system_clock_mode(hdspm)) {
+			/* master mode, return internal sample rate */
+			rate = hdspm->system_sample_rate;
+		} else {
+			/* slave mode, return external sample rate */
+			rate = hdspm_external_sample_rate(hdspm);
+		}
 	}
 
 	return rate;
-- 
1.7.10.4

  parent reply	other threads:[~2012-10-19 15:42 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-19 15:42 [PATCH 0/9] Fixes for RME MADI cards Adrian Knoth
2012-10-19 15:42 ` [PATCH 1/9] ALSA: hdspm - Allow DDS/Varispeed to be set from userspace Adrian Knoth
2012-10-19 20:48   ` Takashi Iwai
2012-10-20  8:35     ` Adrian Knoth
2012-10-20  8:46       ` Takashi Iwai
2012-10-19 15:42 ` Adrian Knoth [this message]
2012-10-19 15:42 ` [PATCH 3/9] ALSA: hdspm - Fix sync check reporting on all RME HDSPM cards Adrian Knoth
2012-10-19 15:42 ` [PATCH 4/9] ALSA: hdspm - Fix reported autosync_sample_rate Adrian Knoth
2012-10-19 15:42 ` [PATCH 5/9] ALSA: hdspm - Also report autosync_sample_rate on MADI and MADIface Adrian Knoth
2012-10-20  8:46   ` Takashi Iwai
2012-10-19 15:42 ` [PATCH 6/9] ALSA: hdspm - Fix sync_in reporting on RME MADI cards Adrian Knoth
2012-10-19 15:42 ` [PATCH 7/9] ALSA: hdspm - Fix sync_in detection on AES/AES32 Adrian Knoth
2012-10-19 15:42 ` [PATCH 8/9] ALSA: hdspm - Fix typo in kcontrol element on RME MADI cards Adrian Knoth
2012-10-19 15:42 ` [PATCH 9/9] ALSA: hdspm - Fix coding style in CTL_ELEM macros Adrian Knoth

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=1350661350-5000-3-git-send-email-adi@drcomp.erfurt.thur.de \
    --to=adi@drcomp.erfurt.thur.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=andre.schramm@iosono-sound.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).