Skip to content

Commit e6dcc92

Browse files
takaswietiwai
authored andcommitted
ALSA: firewire-lib: replace ack callback to flush isoc contexts in AMDTP domain
An isoc context for AMDTP stream is flushed to queue packet by a call of pcm.ack. This commit extends this for AMDTP domain. Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Link: https://lore.kernel.org/r/20191018061911.24909-4-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent f890f9a commit e6dcc92

10 files changed

Lines changed: 33 additions & 26 deletions

File tree

‎sound/firewire/amdtp-stream.c‎

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1139,23 +1139,29 @@ unsigned long amdtp_domain_stream_pcm_pointer(struct amdtp_domain *d,
11391139
EXPORT_SYMBOL_GPL(amdtp_domain_stream_pcm_pointer);
11401140

11411141
/**
1142-
* amdtp_stream_pcm_ack - acknowledge queued PCM frames
1142+
* amdtp_domain_stream_pcm_ack - acknowledge queued PCM frames
1143+
* @d: the AMDTP domain.
11431144
* @s: the AMDTP stream that transfers the PCM frames
11441145
*
11451146
* Returns zero always.
11461147
*/
1147-
int amdtp_stream_pcm_ack(struct amdtp_stream *s)
1148+
int amdtp_domain_stream_pcm_ack(struct amdtp_domain *d, struct amdtp_stream *s)
11481149
{
1149-
/*
1150-
* Process isochronous packets for recent isochronous cycle to handle
1151-
* queued PCM frames.
1152-
*/
1153-
if (amdtp_stream_running(s))
1154-
fw_iso_context_flush_completions(s->context);
1150+
struct amdtp_stream *irq_target = d->irq_target;
1151+
1152+
// Process isochronous packets for recent isochronous cycle to handle
1153+
// queued PCM frames.
1154+
if (irq_target && amdtp_stream_running(irq_target)) {
1155+
// Queued packet should be processed without any kernel
1156+
// preemption to keep latency against bus cycle.
1157+
preempt_disable();
1158+
fw_iso_context_flush_completions(irq_target->context);
1159+
preempt_enable();
1160+
}
11551161

11561162
return 0;
11571163
}
1158-
EXPORT_SYMBOL(amdtp_stream_pcm_ack);
1164+
EXPORT_SYMBOL_GPL(amdtp_domain_stream_pcm_ack);
11591165

11601166
/**
11611167
* amdtp_stream_update - update the stream after a bus reset

‎sound/firewire/amdtp-stream.h‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,6 @@ int amdtp_stream_add_pcm_hw_constraints(struct amdtp_stream *s,
198198
struct snd_pcm_runtime *runtime);
199199

200200
void amdtp_stream_pcm_prepare(struct amdtp_stream *s);
201-
int amdtp_stream_pcm_ack(struct amdtp_stream *s);
202201
void amdtp_stream_pcm_abort(struct amdtp_stream *s);
203202

204203
extern const unsigned int amdtp_syt_intervals[CIP_SFC_COUNT];
@@ -303,4 +302,6 @@ static inline int amdtp_domain_set_events_per_period(struct amdtp_domain *d,
303302

304303
unsigned long amdtp_domain_stream_pcm_pointer(struct amdtp_domain *d,
305304
struct amdtp_stream *s);
305+
int amdtp_domain_stream_pcm_ack(struct amdtp_domain *d, struct amdtp_stream *s);
306+
306307
#endif

‎sound/firewire/bebob/bebob_pcm.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -332,14 +332,14 @@ static int pcm_capture_ack(struct snd_pcm_substream *substream)
332332
{
333333
struct snd_bebob *bebob = substream->private_data;
334334

335-
return amdtp_stream_pcm_ack(&bebob->tx_stream);
335+
return amdtp_domain_stream_pcm_ack(&bebob->domain, &bebob->tx_stream);
336336
}
337337

338338
static int pcm_playback_ack(struct snd_pcm_substream *substream)
339339
{
340340
struct snd_bebob *bebob = substream->private_data;
341341

342-
return amdtp_stream_pcm_ack(&bebob->rx_stream);
342+
return amdtp_domain_stream_pcm_ack(&bebob->domain, &bebob->rx_stream);
343343
}
344344

345345
int snd_bebob_create_pcm_devices(struct snd_bebob *bebob)

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -394,15 +394,15 @@ static int capture_ack(struct snd_pcm_substream *substream)
394394
struct snd_dice *dice = substream->private_data;
395395
struct amdtp_stream *stream = &dice->tx_stream[substream->pcm->device];
396396

397-
return amdtp_stream_pcm_ack(stream);
397+
return amdtp_domain_stream_pcm_ack(&dice->domain, stream);
398398
}
399399

400400
static int playback_ack(struct snd_pcm_substream *substream)
401401
{
402402
struct snd_dice *dice = substream->private_data;
403403
struct amdtp_stream *stream = &dice->rx_stream[substream->pcm->device];
404404

405-
return amdtp_stream_pcm_ack(stream);
405+
return amdtp_domain_stream_pcm_ack(&dice->domain, stream);
406406
}
407407

408408
int snd_dice_create_pcm(struct snd_dice *dice)

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,14 +315,14 @@ static int pcm_capture_ack(struct snd_pcm_substream *substream)
315315
{
316316
struct snd_dg00x *dg00x = substream->private_data;
317317

318-
return amdtp_stream_pcm_ack(&dg00x->tx_stream);
318+
return amdtp_domain_stream_pcm_ack(&dg00x->domain, &dg00x->tx_stream);
319319
}
320320

321321
static int pcm_playback_ack(struct snd_pcm_substream *substream)
322322
{
323323
struct snd_dg00x *dg00x = substream->private_data;
324324

325-
return amdtp_stream_pcm_ack(&dg00x->rx_stream);
325+
return amdtp_domain_stream_pcm_ack(&dg00x->domain, &dg00x->rx_stream);
326326
}
327327

328328
int snd_dg00x_create_pcm_devices(struct snd_dg00x *dg00x)

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,14 +355,14 @@ static int pcm_capture_ack(struct snd_pcm_substream *substream)
355355
{
356356
struct snd_ff *ff = substream->private_data;
357357

358-
return amdtp_stream_pcm_ack(&ff->tx_stream);
358+
return amdtp_domain_stream_pcm_ack(&ff->domain, &ff->tx_stream);
359359
}
360360

361361
static int pcm_playback_ack(struct snd_pcm_substream *substream)
362362
{
363363
struct snd_ff *ff = substream->private_data;
364364

365-
return amdtp_stream_pcm_ack(&ff->rx_stream);
365+
return amdtp_domain_stream_pcm_ack(&ff->domain, &ff->rx_stream);
366366
}
367367

368368
int snd_ff_create_pcm_devices(struct snd_ff *ff)

‎sound/firewire/fireworks/fireworks_pcm.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -362,14 +362,14 @@ static int pcm_capture_ack(struct snd_pcm_substream *substream)
362362
{
363363
struct snd_efw *efw = substream->private_data;
364364

365-
return amdtp_stream_pcm_ack(&efw->tx_stream);
365+
return amdtp_domain_stream_pcm_ack(&efw->domain, &efw->tx_stream);
366366
}
367367

368368
static int pcm_playback_ack(struct snd_pcm_substream *substream)
369369
{
370370
struct snd_efw *efw = substream->private_data;
371371

372-
return amdtp_stream_pcm_ack(&efw->rx_stream);
372+
return amdtp_domain_stream_pcm_ack(&efw->domain, &efw->rx_stream);
373373
}
374374

375375
int snd_efw_create_pcm_devices(struct snd_efw *efw)

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,14 +333,14 @@ static int capture_ack(struct snd_pcm_substream *substream)
333333
{
334334
struct snd_motu *motu = substream->private_data;
335335

336-
return amdtp_stream_pcm_ack(&motu->tx_stream);
336+
return amdtp_domain_stream_pcm_ack(&motu->domain, &motu->tx_stream);
337337
}
338338

339339
static int playback_ack(struct snd_pcm_substream *substream)
340340
{
341341
struct snd_motu *motu = substream->private_data;
342342

343-
return amdtp_stream_pcm_ack(&motu->rx_stream);
343+
return amdtp_domain_stream_pcm_ack(&motu->domain, &motu->rx_stream);
344344
}
345345

346346
int snd_motu_create_pcm_devices(struct snd_motu *motu)

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -406,14 +406,14 @@ static int pcm_capture_ack(struct snd_pcm_substream *substream)
406406
{
407407
struct snd_oxfw *oxfw = substream->private_data;
408408

409-
return amdtp_stream_pcm_ack(&oxfw->tx_stream);
409+
return amdtp_domain_stream_pcm_ack(&oxfw->domain, &oxfw->tx_stream);
410410
}
411411

412412
static int pcm_playback_ack(struct snd_pcm_substream *substream)
413413
{
414414
struct snd_oxfw *oxfw = substream->private_data;
415415

416-
return amdtp_stream_pcm_ack(&oxfw->rx_stream);
416+
return amdtp_domain_stream_pcm_ack(&oxfw->domain, &oxfw->rx_stream);
417417
}
418418

419419
int snd_oxfw_create_pcm(struct snd_oxfw *oxfw)

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,14 +244,14 @@ static int pcm_capture_ack(struct snd_pcm_substream *substream)
244244
{
245245
struct snd_tscm *tscm = substream->private_data;
246246

247-
return amdtp_stream_pcm_ack(&tscm->tx_stream);
247+
return amdtp_domain_stream_pcm_ack(&tscm->domain, &tscm->tx_stream);
248248
}
249249

250250
static int pcm_playback_ack(struct snd_pcm_substream *substream)
251251
{
252252
struct snd_tscm *tscm = substream->private_data;
253253

254-
return amdtp_stream_pcm_ack(&tscm->rx_stream);
254+
return amdtp_domain_stream_pcm_ack(&tscm->domain, &tscm->rx_stream);
255255
}
256256

257257
int snd_tscm_create_pcm_devices(struct snd_tscm *tscm)

0 commit comments

Comments
 (0)