Skip to content

Commit 0d39cd0

Browse files
takaswietiwai
authored andcommitted
ALSA: firewire-motu: register the size of PCM period to AMDTP domain
This commit is a preparation to share the size of PCM period between PCM substreams on AMDTP streams in the same domain. At this time, the size of PCM period in PCM substream which starts AMDTP streams in the same domain is recorded. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20191007110532.30270-9-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent 262542e commit 0d39cd0

4 files changed

Lines changed: 16 additions & 4 deletions

File tree

‎sound/firewire/motu/motu-midi.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ static int midi_open(struct snd_rawmidi_substream *substream)
1717

1818
mutex_lock(&motu->mutex);
1919

20-
err = snd_motu_stream_reserve_duplex(motu, 0);
20+
err = snd_motu_stream_reserve_duplex(motu, 0, 0);
2121
if (err >= 0) {
2222
++motu->substreams_counter;
2323
err = snd_motu_stream_start_duplex(motu);

‎sound/firewire/motu/motu-pcm.c‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,9 +202,11 @@ static int pcm_hw_params(struct snd_pcm_substream *substream,
202202

203203
if (substream->runtime->status->state == SNDRV_PCM_STATE_OPEN) {
204204
unsigned int rate = params_rate(hw_params);
205+
unsigned int frames_per_period = params_period_size(hw_params);
205206

206207
mutex_lock(&motu->mutex);
207-
err = snd_motu_stream_reserve_duplex(motu, rate);
208+
err = snd_motu_stream_reserve_duplex(motu, rate,
209+
frames_per_period);
208210
if (err >= 0)
209211
++motu->substreams_counter;
210212
mutex_unlock(&motu->mutex);

‎sound/firewire/motu/motu-stream.c‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,8 @@ int snd_motu_stream_cache_packet_formats(struct snd_motu *motu)
133133
return 0;
134134
}
135135

136-
int snd_motu_stream_reserve_duplex(struct snd_motu *motu, unsigned int rate)
136+
int snd_motu_stream_reserve_duplex(struct snd_motu *motu, unsigned int rate,
137+
unsigned int frames_per_period)
137138
{
138139
unsigned int curr_rate;
139140
int err;
@@ -171,6 +172,14 @@ int snd_motu_stream_reserve_duplex(struct snd_motu *motu, unsigned int rate)
171172
fw_iso_resources_free(&motu->tx_resources);
172173
return err;
173174
}
175+
176+
err = amdtp_domain_set_events_per_period(&motu->domain,
177+
frames_per_period);
178+
if (err < 0) {
179+
fw_iso_resources_free(&motu->tx_resources);
180+
fw_iso_resources_free(&motu->rx_resources);
181+
return err;
182+
}
174183
}
175184

176185
return 0;

‎sound/firewire/motu/motu.h‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,8 @@ void snd_motu_transaction_unregister(struct snd_motu *motu);
154154
int snd_motu_stream_init_duplex(struct snd_motu *motu);
155155
void snd_motu_stream_destroy_duplex(struct snd_motu *motu);
156156
int snd_motu_stream_cache_packet_formats(struct snd_motu *motu);
157-
int snd_motu_stream_reserve_duplex(struct snd_motu *motu, unsigned int rate);
157+
int snd_motu_stream_reserve_duplex(struct snd_motu *motu, unsigned int rate,
158+
unsigned int frames_per_period);
158159
int snd_motu_stream_start_duplex(struct snd_motu *motu);
159160
void snd_motu_stream_stop_duplex(struct snd_motu *motu);
160161
int snd_motu_stream_lock_try(struct snd_motu *motu);

0 commit comments

Comments
 (0)