summaryrefslogtreecommitdiff
path: root/sound/firewire/dice/dice-stream.c
diff options
context:
space:
mode:
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>2014-12-09 00:10:37 +0900
committerTakashi Iwai <tiwai@suse.de>2014-12-10 10:45:28 +0100
commit8fc01fc0674e3ea7fdd13bd3d138793619227f89 (patch)
tree2098bbdcc0248276ca589c35bd2f8bd1aa929a48 /sound/firewire/dice/dice-stream.c
parent9a02843caefbc370ef6d5895881101f9436f98da (diff)
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-stream.c')
-rw-r--r--sound/firewire/dice/dice-stream.c35
1 files changed, 23 insertions, 12 deletions
diff --git a/sound/firewire/dice/dice-stream.c b/sound/firewire/dice/dice-stream.c
index e60b84d7a0f6..20765a05d294 100644
--- a/sound/firewire/dice/dice-stream.c
+++ b/sound/firewire/dice/dice-stream.c
@@ -161,9 +161,29 @@ end:
static int get_sync_mode(struct snd_dice *dice, enum cip_flags *sync_mode)
{
- /* Currently, clock source is fixed at SYT-Match mode. */
- *sync_mode = 0;
- return 0;
+ u32 source;
+ int err;
+
+ err = snd_dice_transaction_get_clock_source(dice, &source);
+ if (err < 0)
+ goto end;
+
+ switch (source) {
+ /* So-called 'SYT Match' modes, sync_to_syt value of packets received */
+ case CLOCK_SOURCE_ARX4: /* in 4th stream */
+ case CLOCK_SOURCE_ARX3: /* in 3rd stream */
+ case CLOCK_SOURCE_ARX2: /* in 2nd stream */
+ err = -ENOSYS;
+ break;
+ case CLOCK_SOURCE_ARX1: /* in 1st stream, which this driver uses */
+ *sync_mode = 0;
+ break;
+ default:
+ *sync_mode = CIP_SYNC_TO_DEVICE;
+ break;
+ }
+end:
+ return err;
}
int snd_dice_stream_start_duplex(struct snd_dice *dice, unsigned int rate)
@@ -310,15 +330,6 @@ int snd_dice_stream_init_duplex(struct snd_dice *dice)
goto end;
err = init_stream(dice, &dice->rx_stream);
- if (err < 0)
- goto end;
-
- /* Currently, clock source is fixed at SYT-Match mode. */
- err = snd_dice_transaction_set_clock_source(dice, CLOCK_SOURCE_ARX1);
- if (err < 0) {
- destroy_stream(dice, &dice->rx_stream);
- destroy_stream(dice, &dice->tx_stream);
- }
end:
return err;
}