Skip to content

Commit df52156

Browse files
perexgtiwai
authored andcommitted
ALSA: hda: fix trigger_tstamp_latched
When the trigger_tstamp_latched flag is set, the PCM core code assumes that the low-level driver handles the trigger timestamping itself. Ensure that runtime->trigger_tstamp is always updated. Buglink: alsa-project/alsa-lib#387 Reported-by: Zeno Endemann <[email protected]> Signed-off-by: Jaroslav Kysela <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Takashi Iwai <[email protected]>
1 parent d75dba4 commit df52156

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

include/sound/hdaudio.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -590,7 +590,7 @@ void snd_hdac_stream_sync_trigger(struct hdac_stream *azx_dev, bool set,
590590
void snd_hdac_stream_sync(struct hdac_stream *azx_dev, bool start,
591591
unsigned int streams);
592592
void snd_hdac_stream_timecounter_init(struct hdac_stream *azx_dev,
593-
unsigned int streams);
593+
unsigned int streams, bool start);
594594
int snd_hdac_get_stream_stripe_ctl(struct hdac_bus *bus,
595595
struct snd_pcm_substream *substream);
596596

sound/hda/hdac_stream.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -664,14 +664,17 @@ static void azx_timecounter_init(struct hdac_stream *azx_dev,
664664
* updated accordingly, too.
665665
*/
666666
void snd_hdac_stream_timecounter_init(struct hdac_stream *azx_dev,
667-
unsigned int streams)
667+
unsigned int streams, bool start)
668668
{
669669
struct hdac_bus *bus = azx_dev->bus;
670670
struct snd_pcm_runtime *runtime = azx_dev->substream->runtime;
671671
struct hdac_stream *s;
672672
bool inited = false;
673673
u64 cycle_last = 0;
674674

675+
if (!start)
676+
goto skip;
677+
675678
list_for_each_entry(s, &bus->stream_list, list) {
676679
if ((streams & (1 << s->index))) {
677680
azx_timecounter_init(s, inited, cycle_last);
@@ -682,6 +685,7 @@ void snd_hdac_stream_timecounter_init(struct hdac_stream *azx_dev,
682685
}
683686
}
684687

688+
skip:
685689
snd_pcm_gettime(runtime, &runtime->trigger_tstamp);
686690
runtime->trigger_tstamp_latched = true;
687691
}

sound/pci/hda/hda_controller.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -275,8 +275,7 @@ static int azx_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
275275
spin_lock(&bus->reg_lock);
276276
/* reset SYNC bits */
277277
snd_hdac_stream_sync_trigger(hstr, false, sbits, sync_reg);
278-
if (start)
279-
snd_hdac_stream_timecounter_init(hstr, sbits);
278+
snd_hdac_stream_timecounter_init(hstr, sbits, start);
280279
spin_unlock(&bus->reg_lock);
281280
return 0;
282281
}

0 commit comments

Comments
 (0)