This is a note to let you know that I've just added the patch titled ALSA: usb-audio: Clear fixed clock rate at closing EP to the 5.15-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: alsa-usb-audio-clear-fixed-clock-rate-at-closing-ep.patch and it can be found in the queue-5.15 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. commit a0573be416ef827a9a82df1737196e584fd0af79 Author: Takashi Iwai <tiwai@xxxxxxx> Date: Wed Sep 7 12:04:21 2022 +0200 ALSA: usb-audio: Clear fixed clock rate at closing EP [ Upstream commit 809f44a0cc5ad4b1209467a6287f8ac0eb49d393 ] The recent commit c11117b634f4 ("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: c11117b634f4 ("ALSA: usb-audio: Refcount multiple accesses on the single clock") Reported-by: Jason A. Donenfeld <Jason@xxxxxxxxx> Tested-by: Jason A. Donenfeld <Jason@xxxxxxxxx> Cc: <stable@xxxxxxxxxxxxxxx> Link: https://lore.kernel.org/all/YxXIWv8dYmg1tnXP@xxxxxxxxx/ Link: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/2620 Link: https://lore.kernel.org/r/20220907100421.6443-1-tiwai@xxxxxxx Signed-off-by: Takashi Iwai <tiwai@xxxxxxx> Stable-dep-of: 7822baa844a8 ("ALSA: usb-audio: add quirk for RODE NT-USB+") Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx> diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c index 803053d4c9dbc..13c0264881499 100644 --- a/sound/usb/endpoint.c +++ b/sound/usb/endpoint.c @@ -932,6 +932,8 @@ void snd_usb_endpoint_close(struct snd_usb_audio *chip, endpoint_set_interface(chip, ep, false); if (!--ep->opened) { + if (ep->clock_ref && !atomic_read(&ep->clock_ref->locked)) + ep->clock_ref->rate = 0; ep->iface = 0; ep->altsetting = 0; ep->cur_audiofmt = NULL;