Skip to content

Commit 262542e

Browse files
takaswietiwai
authored andcommitted
ALSA: firewire-tascam: 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-8-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent 18b7f18 commit 262542e

3 files changed

Lines changed: 15 additions & 3 deletions

File tree

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

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

100100
if (substream->runtime->status->state == SNDRV_PCM_STATE_OPEN) {
101101
unsigned int rate = params_rate(hw_params);
102+
unsigned int frames_per_period = params_period_size(hw_params);
102103

103104
mutex_lock(&tscm->mutex);
104-
err = snd_tscm_stream_reserve_duplex(tscm, rate);
105+
err = snd_tscm_stream_reserve_duplex(tscm, rate,
106+
frames_per_period);
105107
if (err >= 0)
106108
++tscm->substreams_counter;
107109
mutex_unlock(&tscm->mutex);

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,8 @@ void snd_tscm_stream_destroy_duplex(struct snd_tscm *tscm)
383383
destroy_stream(tscm, &tscm->tx_stream);
384384
}
385385

386-
int snd_tscm_stream_reserve_duplex(struct snd_tscm *tscm, unsigned int rate)
386+
int snd_tscm_stream_reserve_duplex(struct snd_tscm *tscm, unsigned int rate,
387+
unsigned int frames_per_period)
387388
{
388389
unsigned int curr_rate;
389390
int err;
@@ -413,6 +414,14 @@ int snd_tscm_stream_reserve_duplex(struct snd_tscm *tscm, unsigned int rate)
413414
fw_iso_resources_free(&tscm->tx_resources);
414415
return err;
415416
}
417+
418+
err = amdtp_domain_set_events_per_period(&tscm->domain,
419+
frames_per_period);
420+
if (err < 0) {
421+
fw_iso_resources_free(&tscm->tx_resources);
422+
fw_iso_resources_free(&tscm->rx_resources);
423+
return err;
424+
}
416425
}
417426

418427
return 0;

‎sound/firewire/tascam/tascam.h‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,8 @@ int snd_tscm_stream_get_clock(struct snd_tscm *tscm,
168168
int snd_tscm_stream_init_duplex(struct snd_tscm *tscm);
169169
void snd_tscm_stream_update_duplex(struct snd_tscm *tscm);
170170
void snd_tscm_stream_destroy_duplex(struct snd_tscm *tscm);
171-
int snd_tscm_stream_reserve_duplex(struct snd_tscm *tscm, unsigned int rate);
171+
int snd_tscm_stream_reserve_duplex(struct snd_tscm *tscm, unsigned int rate,
172+
unsigned int frames_per_period);
172173
int snd_tscm_stream_start_duplex(struct snd_tscm *tscm, unsigned int rate);
173174
void snd_tscm_stream_stop_duplex(struct snd_tscm *tscm);
174175

0 commit comments

Comments
 (0)