From 21a164df0c1c2e72d4bb78b2f67dc75a1c9d14fb Mon Sep 17 00:00:00 2001 From: Adrian Knoth Date: Fri, 19 Oct 2012 17:42:23 +0200 Subject: ALSA: hdspm - Report external rate in slave mode on PCI MADI 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 Signed-off-by: Takashi Iwai --- sound/pci/rme9652/hdspm.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'sound') diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c index 742bd5e430ab..1131a8ab3f73 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; -- cgit v1.2.3