From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Takashi Iwai <tiwai@suse.de>,
"Jason A . Donenfeld" <Jason@zx2c4.com>,
Sasha Levin <sashal@kernel.org>
Subject: [PATCH 5.15 29/76] ALSA: usb-audio: Clear fixed clock rate at closing EP
Date: Wed, 13 Mar 2024 12:41:36 -0400 [thread overview]
Message-ID: <20240313164223.615640-30-sashal@kernel.org> (raw)
In-Reply-To: <20240313164223.615640-1-sashal@kernel.org>
From: Takashi Iwai <tiwai@suse.de>
[ 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@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>
Stable-dep-of: 7822baa844a8 ("ALSA: usb-audio: add quirk for RODE NT-USB+")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
sound/usb/endpoint.c | 2 ++
1 file changed, 2 insertions(+)
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;
--
2.43.0
next prev parent reply other threads:[~2024-03-13 16:42 UTC|newest]
Thread overview: 91+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-13 16:41 [PATCH 5.15 00/76] 5.15.152-rc1 review Sasha Levin
2024-03-13 16:41 ` [PATCH 5.15 01/76] mmc: mmci: stm32: use a buffer for unaligned DMA requests Sasha Levin
2024-03-13 16:41 ` [PATCH 5.15 02/76] mmc: mmci: stm32: fix DMA API overlapping mappings warning Sasha Levin
2024-03-13 16:41 ` [PATCH 5.15 03/76] net: lan78xx: fix runtime PM count underflow on link stop Sasha Levin
2024-03-13 16:41 ` [PATCH 5.15 04/76] ixgbe: {dis, en}able irqs in ixgbe_txrx_ring_{dis, en}able Sasha Levin
2024-03-13 16:41 ` [PATCH 5.15 05/76] i40e: disable NAPI right after disabling irqs when handling xsk_pool Sasha Levin
2024-03-13 16:41 ` [PATCH 5.15 06/76] tracing/net_sched: Fix tracepoints that save qdisc_dev() as a string Sasha Levin
2024-03-13 16:41 ` [PATCH 5.15 07/76] geneve: make sure to pull inner header in geneve_rx() Sasha Levin
2024-03-13 16:41 ` [PATCH 5.15 08/76] net: sparx5: Fix use after free inside sparx5_del_mact_entry Sasha Levin
2024-03-13 16:41 ` [PATCH 5.15 09/76] net: ice: Fix potential NULL pointer dereference in ice_bridge_setlink() Sasha Levin
2024-03-13 16:41 ` [PATCH 5.15 10/76] net/ipv6: avoid possible UAF in ip6_route_mpath_notify() Sasha Levin
2024-03-13 16:41 ` [PATCH 5.15 11/76] cpumap: Zero-initialise xdp_rxq_info struct before running XDP program Sasha Levin
2024-03-13 16:41 ` [PATCH 5.15 12/76] net/rds: fix WARNING in rds_conn_connect_if_down Sasha Levin
2024-03-13 16:41 ` [PATCH 5.15 13/76] netfilter: nft_ct: fix l3num expectations with inet pseudo family Sasha Levin
2024-03-13 16:41 ` [PATCH 5.15 14/76] netfilter: nf_conntrack_h323: Add protection for bmp length out of range Sasha Levin
2024-03-13 16:41 ` [PATCH 5.15 15/76] erofs: apply proper VMA alignment for memory mapped files on THP Sasha Levin
2024-03-13 16:41 ` [PATCH 5.15 16/76] netrom: Fix a data-race around sysctl_netrom_default_path_quality Sasha Levin
2024-03-13 16:41 ` [PATCH 5.15 17/76] netrom: Fix a data-race around sysctl_netrom_obsolescence_count_initialiser Sasha Levin
2024-03-13 16:41 ` [PATCH 5.15 18/76] netrom: Fix data-races around sysctl_netrom_network_ttl_initialiser Sasha Levin
2024-03-13 16:41 ` [PATCH 5.15 19/76] netrom: Fix a data-race around sysctl_netrom_transport_timeout Sasha Levin
2024-03-13 16:41 ` [PATCH 5.15 20/76] netrom: Fix a data-race around sysctl_netrom_transport_maximum_tries Sasha Levin
2024-03-13 16:41 ` [PATCH 5.15 21/76] netrom: Fix a data-race around sysctl_netrom_transport_acknowledge_delay Sasha Levin
2024-03-13 16:41 ` [PATCH 5.15 22/76] netrom: Fix a data-race around sysctl_netrom_transport_busy_delay Sasha Levin
2024-03-13 16:41 ` [PATCH 5.15 23/76] netrom: Fix a data-race around sysctl_netrom_transport_requested_window_size Sasha Levin
2024-03-13 16:41 ` [PATCH 5.15 24/76] netrom: Fix a data-race around sysctl_netrom_transport_no_activity_timeout Sasha Levin
2024-03-13 16:41 ` [PATCH 5.15 25/76] netrom: Fix a data-race around sysctl_netrom_routing_control Sasha Levin
2024-03-13 16:41 ` [PATCH 5.15 26/76] netrom: Fix a data-race around sysctl_netrom_link_fails_count Sasha Levin
2024-03-13 16:41 ` [PATCH 5.15 27/76] netrom: Fix data-races around sysctl_net_busy_read Sasha Levin
2024-03-13 16:41 ` [PATCH 5.15 28/76] ALSA: usb-audio: Refcount multiple accesses on the single clock Sasha Levin
2024-03-13 16:41 ` Sasha Levin [this message]
2024-03-13 16:41 ` [PATCH 5.15 30/76] ALSA: usb-audio: Split endpoint setups for hw_params and prepare (take#2) Sasha Levin
2024-03-13 16:41 ` [PATCH 5.15 31/76] ALSA: usb-audio: Properly refcounting clock rate Sasha Levin
2024-03-13 16:41 ` [PATCH 5.15 32/76] ALSA: usb-audio: Apply mutex around snd_usb_endpoint_set_params() Sasha Levin
2024-03-13 16:41 ` [PATCH 5.15 33/76] ALSA: usb-audio: Correct the return code from snd_usb_endpoint_set_params() Sasha Levin
2024-03-13 16:41 ` [PATCH 5.15 34/76] ALSA: usb-audio: Avoid superfluous endpoint setup Sasha Levin
2024-03-13 16:41 ` [PATCH 5.15 35/76] ALSA: usb-audio: Add quirk for Tascam Model 12 Sasha Levin
2024-03-13 16:41 ` [PATCH 5.15 36/76] ALSA: usb-audio: Add new quirk FIXED_RATE for JBL Quantum810 Wireless Sasha Levin
2024-03-13 16:41 ` [PATCH 5.15 37/76] ALSA: usb-audio: Fix microphone sound on Nexigo webcam Sasha Levin
2024-03-13 16:41 ` [PATCH 5.15 38/76] ALSA: usb-audio: add quirk for RODE NT-USB+ Sasha Levin
2024-03-13 16:41 ` [PATCH 5.15 39/76] drm/amd/display: Fix uninitialized variable usage in core_link_ 'read_dpcd() & write_dpcd()' functions Sasha Levin
2024-03-13 16:41 ` [PATCH 5.15 40/76] nfp: flower: add goto_chain_index for ct entry Sasha Levin
2024-03-13 16:41 ` [PATCH 5.15 41/76] nfp: flower: add hardware offload check for post " Sasha Levin
2024-03-13 16:41 ` [PATCH 5.15 42/76] selftests/mm: switch to bash from sh Sasha Levin
2024-03-13 16:41 ` [PATCH 5.15 43/76] selftests: mm: fix map_hugetlb failure on 64K page size systems Sasha Levin
2024-03-13 16:41 ` [PATCH 5.15 44/76] modpost: Include '.text.*' in TEXT_SECTIONS Sasha Levin
2024-03-13 16:41 ` [PATCH 5.15 45/76] modpost: Add '.ltext' and '.ltext.*' to TEXT_SECTIONS Sasha Levin
2024-03-13 17:12 ` Nathan Chancellor
2024-03-13 20:13 ` Sasha Levin
2024-03-13 16:41 ` [PATCH 5.15 46/76] xhci: process isoc TD properly when there was a transaction error mid TD Sasha Levin
2024-03-13 16:41 ` [PATCH 5.15 47/76] xhci: handle isoc Babble and Buffer Overrun events properly Sasha Levin
2024-03-13 16:41 ` [PATCH 5.15 48/76] serial: max310x: use regmap methods for SPI batch operations Sasha Levin
2024-03-13 16:41 ` [PATCH 5.15 49/76] serial: max310x: use a separate regmap for each port Sasha Levin
2024-03-13 16:41 ` [PATCH 5.15 50/76] serial: max310x: prevent infinite while() loop in port startup Sasha Levin
2024-03-13 16:41 ` [PATCH 5.15 51/76] drm/amd/pm: do not expose the API used internally only in kv_dpm.c Sasha Levin
2024-03-13 16:41 ` [PATCH 5.15 52/76] drm/amdgpu: Reset IH OVERFLOW_CLEAR bit Sasha Levin
2024-03-13 16:42 ` [PATCH 5.15 53/76] selftests: mptcp: decrease BW in simult flows Sasha Levin
2024-03-13 16:42 ` [PATCH 5.15 54/76] hv_netvsc: use netif_is_bond_master() instead of open code Sasha Levin
2024-03-13 16:42 ` [PATCH 5.15 55/76] hv_netvsc: Register VF in netvsc_probe if NET_DEVICE_REGISTER missed Sasha Levin
2024-03-13 16:42 ` [PATCH 5.15 56/76] drm/amd/display: Re-arrange FPU code structure for dcn2x Sasha Levin
2024-03-13 16:42 ` [PATCH 5.15 57/76] drm/amd/display: move calcs folder into DML Sasha Levin
2024-03-13 16:42 ` [PATCH 5.15 58/76] drm/amd/display: remove DML Makefile duplicate lines Sasha Levin
2024-03-13 16:42 ` [PATCH 5.15 59/76] drm/amd/display: Increase frame-larger-than for all display_mode_vba files Sasha Levin
2024-03-13 16:42 ` [PATCH 5.15 60/76] getrusage: add the "signal_struct *sig" local variable Sasha Levin
2024-03-13 16:42 ` [PATCH 5.15 61/76] getrusage: move thread_group_cputime_adjusted() outside of lock_task_sighand() Sasha Levin
2024-03-13 16:42 ` [PATCH 5.15 62/76] getrusage: use __for_each_thread() Sasha Levin
2024-03-13 16:42 ` [PATCH 5.15 63/76] getrusage: use sig->stats_lock rather than lock_task_sighand() Sasha Levin
2024-03-13 16:42 ` [PATCH 5.15 64/76] proc: Use task_is_running() for wchan in /proc/$pid/stat Sasha Levin
2024-03-14 3:04 ` Kees Cook
2024-03-15 18:31 ` Sasha Levin
2024-03-13 16:42 ` [PATCH 5.15 65/76] fs/proc: do_task_stat: move thread_group_cputime_adjusted() outside of lock_task_sighand() Sasha Levin
2024-03-13 16:42 ` [PATCH 5.15 66/76] exit: Fix typo in comment: s/sub-theads/sub-threads Sasha Levin
2024-03-13 16:42 ` [PATCH 5.15 67/76] exit: wait_task_zombie: kill the no longer necessary spin_lock_irq(siglock) Sasha Levin
2024-03-13 16:42 ` [PATCH 5.15 68/76] ALSA: usb-audio: Fix wrong kfree issue in snd_usb_endpoint_free_all Sasha Levin
2024-03-13 16:42 ` [PATCH 5.15 69/76] ALSA: usb-audio: Always initialize fixed_rate in snd_usb_find_implicit_fb_sync_format() Sasha Levin
2024-03-13 16:42 ` [PATCH 5.15 70/76] ALSA: usb-audio: Add FIXED_RATE quirk for JBL Quantum610 Wireless Sasha Levin
2024-03-13 16:42 ` [PATCH 5.15 71/76] ALSA: usb-audio: Sort quirk table entries Sasha Levin
2024-03-13 16:42 ` [PATCH 5.15 72/76] regmap: allow to define reg_update_bits for no bus configuration Sasha Levin
2024-03-13 16:46 ` Mark Brown
2024-03-13 17:16 ` Sasha Levin
2024-03-13 16:42 ` [PATCH 5.15 73/76] regmap: Add bulk read/write callbacks into regmap_config Sasha Levin
2024-03-13 16:46 ` Mark Brown
2024-03-13 17:14 ` Sasha Levin
2024-03-13 16:42 ` [PATCH 5.15 74/76] serial: max310x: make accessing revision id interface-agnostic Sasha Levin
2024-03-13 16:42 ` [PATCH 5.15 75/76] serial: max310x: fix IO data corruption in batched operations Sasha Levin
2024-03-13 16:42 ` [PATCH 5.15 76/76] Linux 5.15.152-rc1 Sasha Levin
2024-03-13 19:21 ` [PATCH 5.15 00/76] 5.15.152-rc1 review Daniel Díaz
2024-03-13 20:21 ` Sasha Levin
2024-03-14 15:02 ` Harshit Mogalapalli
2024-03-14 20:14 ` Florian Fainelli
2024-03-14 23:08 ` SeongJae Park
2024-03-15 10:43 ` Shreeya Patel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240313164223.615640-30-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=Jason@zx2c4.com \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=tiwai@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).