ALSA: fireface: add protocol-specific operation to allocate isochronous resources
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>
Sun, 2 Jun 2019 07:12:52 +0000 (16:12 +0900)
committerTakashi Iwai <tiwai@suse.de>
Tue, 11 Jun 2019 09:36:22 +0000 (11:36 +0200)
This commit is a part of preparation to perform allocation/release
of isochronous channels in pcm.hw_params/hw_free callbacks.

In ALSA fireface driver, the allocation of isochronous resources is
programmed in each implementation of protocol. This commit adds
protocol-specific operation for the allocation separated from
the operation to begin session.

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

index a8a90f1ae09e218ac13a976dd259b66342a01ce3..740963e4e1c941cc116556298f263f103e6fbdac 100644 (file)
@@ -156,6 +156,10 @@ int snd_ff_stream_start_duplex(struct snd_ff *ff, unsigned int rate)
                if (err < 0)
                        return err;
 
+               err = ff->spec->protocol->allocate_resources(ff, rate);
+               if (err < 0)
+                       goto error;
+
                err = ff->spec->protocol->begin_session(ff, rate);
                if (err < 0)
                        goto error;
index ed8fea0ff5e182ed109ba65ec9c536cecbffd445..c478103388a23a29196548a4e181e376d675740e 100644 (file)
@@ -113,6 +113,7 @@ struct snd_ff_protocol {
        int (*get_clock)(struct snd_ff *ff, unsigned int *rate,
                         enum snd_ff_clock_src *src);
        int (*switch_fetching_mode)(struct snd_ff *ff, bool enable);
+       int (*allocate_resources)(struct snd_ff *ff, unsigned int rate);
        int (*begin_session)(struct snd_ff *ff, unsigned int rate);
        void (*finish_session)(struct snd_ff *ff);
        void (*dump_status)(struct snd_ff *ff, struct snd_info_buffer *buffer);