summaryrefslogtreecommitdiff
path: root/sound/usb/card.h
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2022-05-16 12:48:07 +0200
committerTakashi Iwai <tiwai@suse.de>2022-05-16 12:49:03 +0200
commitc11117b634f4f832c4420d3cf41c44227f140ce1 (patch)
treee5f1db89edb15c8c82bb7efad9fd8c4090ef3498 /sound/usb/card.h
parent00f87ec74c3c09628889173b0f594cfc01e74157 (diff)
ALSA: usb-audio: Refcount multiple accesses on the single clock
When a clock source is connected to multiple nodes / endpoints, the current USB-audio driver tries to set up at each time one of them is configured. Although it reads the current rate and updates only if it differs, some devices seem unhappy with this behavior and spew the errors when reading/updating the rate unnecessarily. This patch tries to reduce the redundant clock setup by introducing a refcount for each clock source. When the stream is actually running, a clock rate is "locked", and it bypasses the clock and/or refuse to change any longer. BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=215934 Link: https://lore.kernel.org/r/20220516104807.16482-1-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/usb/card.h')
-rw-r--r--sound/usb/card.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/sound/usb/card.h b/sound/usb/card.h
index 87f042d06ce0..ca75f2206170 100644
--- a/sound/usb/card.h
+++ b/sound/usb/card.h
@@ -44,6 +44,7 @@ struct audioformat {
struct snd_usb_substream;
struct snd_usb_iface_ref;
+struct snd_usb_clock_ref;
struct snd_usb_endpoint;
struct snd_usb_power_domain;
@@ -62,6 +63,7 @@ struct snd_urb_ctx {
struct snd_usb_endpoint {
struct snd_usb_audio *chip;
struct snd_usb_iface_ref *iface_ref;
+ struct snd_usb_clock_ref *clock_ref;
int opened; /* open refcount; protect with chip->mutex */
atomic_t running; /* running status */
@@ -138,7 +140,6 @@ struct snd_usb_endpoint {
unsigned int cur_period_frames;
unsigned int cur_period_bytes;
unsigned int cur_buffer_periods;
- unsigned char cur_clock;
spinlock_t lock;
struct list_head list;