]> git.baikalelectronics.ru Git - kernel.git/commit
ALSA: usb-audio: Clear fixed clock rate at closing EP
authorTakashi Iwai <tiwai@suse.de>
Wed, 7 Sep 2022 10:04:21 +0000 (12:04 +0200)
committerTakashi Iwai <tiwai@suse.de>
Wed, 7 Sep 2022 11:06:52 +0000 (13:06 +0200)
commite96b51a38dea1f85b86fcbbcce22aa7855be5860
tree66a0fbf3c15fb79b5b9652b1e058be3daec17279
parent4e500e63ba9f5c11a997c153f1b430eb21a1cce3
ALSA: usb-audio: Clear fixed clock rate at closing EP

The recent commit 2bf7e912cb23 ("ALSA: usb-audio: Refcount multiple
accesses on the single clock") tries to manage the clock rate shared
by several endpoints.  This was intended for avoiding the unmatched
rate by a different endpoint, but unfortunately, it introduced a
regression for PulseAudio and pipewire, too; those applications try to
probe the multiple possible rates (44.1k and 48kHz) and setting up the
normal rate fails but only the last rate is applied.

The cause is that the last sample rate is still left to the clock
reference even after closing the endpoint, and this value is still
used at the next open.  It happens only when applications set up via
PCM prepare but don't start/stop the stream; the rate is reset when
the stream is stopped, but it's not cleared at close.

This patch addresses the issue above, simply by clearing the rate set
in the clock reference at the last close of each endpoint.

Fixes: 2bf7e912cb23 ("ALSA: usb-audio: Refcount multiple accesses on the single clock")
Reported-by: Jason A. Donenfeld <Jason@zx2c4.com>
Tested-by: Jason A. Donenfeld <Jason@zx2c4.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/all/YxXIWv8dYmg1tnXP@zx2c4.com/
Link: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/2620
Link: https://lore.kernel.org/r/20220907100421.6443-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/usb/endpoint.c