summaryrefslogtreecommitdiffstats
path: root/sound/firewire/dice/dice-pcm.c
diff options
context:
space:
mode:
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>2014-12-08 16:10:37 +0100
committerTakashi Iwai <tiwai@suse.de>2014-12-10 10:45:28 +0100
commit8fc01fc0674e3ea7fdd13bd3d138793619227f89 (patch)
tree2098bbdcc0248276ca589c35bd2f8bd1aa929a48 /sound/firewire/dice/dice-pcm.c
parentALSA: dice: Add support for duplex streams with synchronization (diff)
downloadlinux-8fc01fc0674e3ea7fdd13bd3d138793619227f89.tar.xz
linux-8fc01fc0674e3ea7fdd13bd3d138793619227f89.zip
ALSA: dice: Support for non SYT-Match sampling clock source mode
This commit allows this driver to handle devices with non SYT-Match sampling clock source. When sampling clock source is SYT-Match mode, devices handle 'presentation timestamp' in received packets and generates sampling clock according to the information. In this case, driver is synchronization master and must transfer correct value in SYT field of each packets in outgoing stream, then the outgoing stream is a master stream. On the other hand, non SYT-Match mode, devices do this. So drivers must pick up the value in SYT field of incoming packets and use the value for outgoing stream. Currently firewire-lib module achieve this work. Furthermore, without SYT-Match and internal clock source, the sampling rate should be fixed for the other devices connected to the handled device. This commit add a restriction of sampling rate at this situation. With these implementations, this driver has no need to set clock source. This commit remove set function. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Acked-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/firewire/dice/dice-pcm.c')
-rw-r--r--sound/firewire/dice/dice-pcm.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/sound/firewire/dice/dice-pcm.c b/sound/firewire/dice/dice-pcm.c
index b9ce0264a2d9..062b7a3b7fd0 100644
--- a/sound/firewire/dice/dice-pcm.c
+++ b/sound/firewire/dice/dice-pcm.c
@@ -140,6 +140,8 @@ end:
static int pcm_open(struct snd_pcm_substream *substream)
{
struct snd_dice *dice = substream->private_data;
+ unsigned int source, rate;
+ bool internal;
int err;
err = snd_dice_stream_lock_try(dice);
@@ -149,6 +151,39 @@ static int pcm_open(struct snd_pcm_substream *substream)
err = init_hw_info(dice, substream);
if (err < 0)
goto err_locked;
+
+ err = snd_dice_transaction_get_clock_source(dice, &source);
+ if (err < 0)
+ goto err_locked;
+ switch (source) {
+ case CLOCK_SOURCE_AES1:
+ case CLOCK_SOURCE_AES2:
+ case CLOCK_SOURCE_AES3:
+ case CLOCK_SOURCE_AES4:
+ case CLOCK_SOURCE_AES_ANY:
+ case CLOCK_SOURCE_ADAT:
+ case CLOCK_SOURCE_TDIF:
+ case CLOCK_SOURCE_WC:
+ internal = false;
+ break;
+ default:
+ internal = true;
+ break;
+ }
+
+ /*
+ * When source of clock is not internal, available sampling rate is
+ * limited at current sampling rate.
+ */
+ if (!internal) {
+ err = snd_dice_transaction_get_rate(dice, &rate);
+ if (err < 0)
+ goto err_locked;
+ substream->runtime->hw.rate_min = rate;
+ substream->runtime->hw.rate_max = rate;
+ }
+
+ snd_pcm_set_sync(substream);
end:
return err;
err_locked: