ALSA: firewire-lib: add a kernel API to start AMDTP streams in AMDTP domain
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>
Sun, 4 Aug 2019 06:21:23 +0000 (15:21 +0900)
committerTakashi Iwai <tiwai@suse.de>
Mon, 5 Aug 2019 17:57:19 +0000 (19:57 +0200)
This commit adds a kernel API to start a couple of isochronous contexts
for some AMDTP streams.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/firewire/amdtp-stream.c
sound/firewire/amdtp-stream.h

index fa7989ee4769c682201c9cb916a8edc2207ff0e7..158d210caea7f1f19a36529dc84c387a0ce30b35 100644 (file)
@@ -1185,6 +1185,30 @@ int amdtp_domain_add_stream(struct amdtp_domain *d, struct amdtp_stream *s,
 }
 EXPORT_SYMBOL_GPL(amdtp_domain_add_stream);
 
+/**
+ * amdtp_domain_start - start sending packets for isoc context in the domain.
+ * @d: the AMDTP domain.
+ */
+int amdtp_domain_start(struct amdtp_domain *d)
+{
+       struct amdtp_stream *s;
+       int err = 0;
+
+       list_for_each_entry(s, &d->streams, list) {
+               err = amdtp_stream_start(s, s->channel, s->speed);
+               if (err < 0)
+                       break;
+       }
+
+       if (err < 0) {
+               list_for_each_entry(s, &d->streams, list)
+                       amdtp_stream_stop(s);
+       }
+
+       return err;
+}
+EXPORT_SYMBOL_GPL(amdtp_domain_start);
+
 /**
  * amdtp_domain_stop - stop sending packets for isoc context in the same domain.
  * @d: the AMDTP domain to which the isoc contexts belong.
index 4b102fd7529df0141e02f108adb573fdfba289b6..15d471660a43965a5900fd5e46beaecdb9891377 100644 (file)
@@ -282,6 +282,7 @@ void amdtp_domain_destroy(struct amdtp_domain *d);
 int amdtp_domain_add_stream(struct amdtp_domain *d, struct amdtp_stream *s,
                            int channel, int speed);
 
+int amdtp_domain_start(struct amdtp_domain *d);
 void amdtp_domain_stop(struct amdtp_domain *d);
 
 #endif