diff mbox series

[v4,32/32] sound: soc: soc-usb: Rediscover USB SND devices on USB port add

Message ID 20230725023416.11205-33-quic_wcheng@quicinc.com
State New
Headers show
Series Introduce QC USB SND audio offloading support | expand

Commit Message

Wesley Cheng July 25, 2023, 2:34 a.m. UTC
In case the USB backend device has not been initialized/probed, USB SND
device connections can still occur.  When the USB backend is eventually
made available, previous USB SND device connections are not communicated to
the USB backend.  Call snd_usb_rediscover_devices() to generate the connect
callbacks for all USB SND devices connected.  This will allow for the USB
backend to be updated with the current set of devices available.

Signed-off-by: Wesley Cheng <quic_wcheng@quicinc.com>
---
 sound/soc/soc-usb.c | 2 ++
 sound/usb/card.h    | 3 ++-
 2 files changed, 4 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/sound/soc/soc-usb.c b/sound/soc/soc-usb.c
index 84dc6d0b2eab..a9413e3d18df 100644
--- a/sound/soc/soc-usb.c
+++ b/sound/soc/soc-usb.c
@@ -111,6 +111,8 @@  struct snd_soc_usb *snd_soc_usb_add_port(struct device *dev, void *priv,
 	list_add_tail(&usb->list, &usb_ctx_list);
 	mutex_unlock(&ctx_mutex);
 
+	snd_usb_rediscover_devices();
+
 	return usb;
 }
 EXPORT_SYMBOL_GPL(snd_soc_usb_add_port);
diff --git a/sound/usb/card.h b/sound/usb/card.h
index dfd241334e3d..6a14b74b47da 100644
--- a/sound/usb/card.h
+++ b/sound/usb/card.h
@@ -236,6 +236,7 @@  static struct snd_usb_stream *snd_usb_find_suppported_substream(int card_idx,
 {
 	return NULL;
 }
-void snd_usb_rediscover_devices(void) { }
+
+static void snd_usb_rediscover_devices(void) { }
 #endif /* IS_ENABLED(CONFIG_SND_USB_AUDIO) */
 #endif /* __USBAUDIO_CARD_H */