Skip to content

Commit 9d9ff58

Browse files
takaswietiwai
authored andcommitted
ALSA: fireface: 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-10-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent 0d39cd0 commit 9d9ff58

3 files changed

Lines changed: 14 additions & 3 deletions

File tree

‎sound/firewire/fireface/ff-pcm.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,9 +211,10 @@ static int pcm_hw_params(struct snd_pcm_substream *substream,
211211

212212
if (substream->runtime->status->state == SNDRV_PCM_STATE_OPEN) {
213213
unsigned int rate = params_rate(hw_params);
214+
unsigned int frames_per_period = params_period_size(hw_params);
214215

215216
mutex_lock(&ff->mutex);
216-
err = snd_ff_stream_reserve_duplex(ff, rate);
217+
err = snd_ff_stream_reserve_duplex(ff, rate, frames_per_period);
217218
if (err >= 0)
218219
++ff->substreams_counter;
219220
mutex_unlock(&ff->mutex);

‎sound/firewire/fireface/ff-stream.c‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,8 @@ void snd_ff_stream_destroy_duplex(struct snd_ff *ff)
106106
destroy_stream(ff, &ff->tx_stream);
107107
}
108108

109-
int snd_ff_stream_reserve_duplex(struct snd_ff *ff, unsigned int rate)
109+
int snd_ff_stream_reserve_duplex(struct snd_ff *ff, unsigned int rate,
110+
unsigned int frames_per_period)
110111
{
111112
unsigned int curr_rate;
112113
enum snd_ff_clock_src src;
@@ -150,6 +151,14 @@ int snd_ff_stream_reserve_duplex(struct snd_ff *ff, unsigned int rate)
150151
err = ff->spec->protocol->allocate_resources(ff, rate);
151152
if (err < 0)
152153
return err;
154+
155+
err = amdtp_domain_set_events_per_period(&ff->domain,
156+
frames_per_period);
157+
if (err < 0) {
158+
fw_iso_resources_free(&ff->tx_resources);
159+
fw_iso_resources_free(&ff->rx_resources);
160+
return err;
161+
}
153162
}
154163

155164
return 0;

‎sound/firewire/fireface/ff.h‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,8 @@ int snd_ff_stream_get_multiplier_mode(enum cip_sfc sfc,
139139
enum snd_ff_stream_mode *mode);
140140
int snd_ff_stream_init_duplex(struct snd_ff *ff);
141141
void snd_ff_stream_destroy_duplex(struct snd_ff *ff);
142-
int snd_ff_stream_reserve_duplex(struct snd_ff *ff, unsigned int rate);
142+
int snd_ff_stream_reserve_duplex(struct snd_ff *ff, unsigned int rate,
143+
unsigned int frames_per_period);
143144
int snd_ff_stream_start_duplex(struct snd_ff *ff, unsigned int rate);
144145
void snd_ff_stream_stop_duplex(struct snd_ff *ff);
145146
void snd_ff_stream_update_duplex(struct snd_ff *ff);

0 commit comments

Comments
 (0)