Re: [PATCH v2] ALSA: aloop: Add 'hrtimer' option to timer_source
From: Takashi Iwai
Date: Wed Jul 08 2026 - 06:40:01 EST
On Sun, 05 Jul 2026 14:59:30 +0200,
Yu-Hsuan Hsu wrote:
>
> The snd-aloop driver currently defaults to using the system jiffies
> timer (struct timer_list). On systems configured with a low timer
> interrupt frequency (e.g., CONFIG_HZ=250), the jiffies resolution
> (4ms per tick) is insufficient for precise audio timing. For
> example, a 10ms audio period requires 2.5 jiffies ticks, causing
> timing jitter that leads to capture underruns.
>
> Introduce "hrtimer" as a supported timer_source option. When
> timer_source="hrtimer" is set, aloop uses high-resolution timers
> (hrtimer) to drive period updates. This provides nanosecond-level
> accuracy regardless of CONFIG_HZ and operates independently of other
> hardware audio cards.
>
> Signed-off-by: Yu-Hsuan Hsu <yuhsuan@xxxxxxxxxxxx>
> ---
> v1 -> v2:
> - Guard hrtimer implementation with #ifdef CONFIG_HIGH_RES_TIMERS
> to handle kernels built without CONFIG_HIGH_RES_TIMERS.
Applied to for-next branch now. Thanks.
Takashi