ALSA: firewire-lib: add a member into AMDTP domain for events per period
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>
Mon, 7 Oct 2019 11:05:16 +0000 (20:05 +0900)
committerTakashi Iwai <tiwai@suse.de>
Thu, 17 Oct 2019 10:02:40 +0000 (12:02 +0200)
In IEC 61883-6, it's called as 'event' what has presentation time
represented by timestamp in CIP header. Although the ratio of the number
of event against the number of data block is different depending on
event data type represented by the specific field in CIP header, it's
just one in the most cases supported by ALSA IEC 61883-1/6 engine.

In 1394 OHCI specification, applications can schedule hardware IRQ
by configuring descriptor with IRQ flag for packet against each
isochronous cycle. For future commit, I use the hardware IRQ for
isoc IT context to acknowledge the elapse of PCM period for both
playback/capture directions on AMDTP streams in the same domain.

This commit is a preparation for the above idea. This commit adds
a member into AMDTP domain structure to record the number of PCM frames.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Link: https://lore.kernel.org/r/20191007110532.30270-2-o-takashi@sakamocchi.jp
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/firewire/amdtp-stream.c
sound/firewire/amdtp-stream.h

index e50e28f77e74e3308cd49a2647d1099b3eb76cb1..838f695b20de77d38b37c3bcb9a451a6c35e571a 100644 (file)
@@ -1143,6 +1143,8 @@ int amdtp_domain_init(struct amdtp_domain *d)
 {
        INIT_LIST_HEAD(&d->streams);
 
+       d->events_per_period = 0;
+
        return 0;
 }
 EXPORT_SYMBOL_GPL(amdtp_domain_init);
@@ -1221,5 +1223,7 @@ void amdtp_domain_stop(struct amdtp_domain *d)
 
                amdtp_stream_stop(s);
        }
+
+       d->events_per_period = 0;
 }
 EXPORT_SYMBOL_GPL(amdtp_domain_stop);
index bbbca964b9b46be5b7ef4376f6318fd9ae51049a..d95a4ed15f20d5bc24e362b0bd0931ef72c424a3 100644 (file)
@@ -272,6 +272,8 @@ static inline bool amdtp_stream_wait_callback(struct amdtp_stream *s,
 
 struct amdtp_domain {
        struct list_head streams;
+
+       unsigned int events_per_period;
 };
 
 int amdtp_domain_init(struct amdtp_domain *d);
@@ -283,4 +285,12 @@ int amdtp_domain_add_stream(struct amdtp_domain *d, struct amdtp_stream *s,
 int amdtp_domain_start(struct amdtp_domain *d);
 void amdtp_domain_stop(struct amdtp_domain *d);
 
+static inline int amdtp_domain_set_events_per_period(struct amdtp_domain *d,
+                                               unsigned int events_per_period)
+{
+       d->events_per_period = events_per_period;
+
+       return 0;
+}
+
 #endif