Allow for different platforms to be notified on USB SND connect/disconnect
seqeunces. This allows for platform USB SND modules to properly initialize
and populate internal structures with references to the USB SND chip
device.
Signed-off-by: Wesley Cheng <quic_wcheng@xxxxxxxxxxx>
---
sound/usb/card.c | 36 ++++++++++++++++++++++++++++++++++++
sound/usb/card.h | 20 ++++++++++++++++++++
2 files changed, 56 insertions(+)
diff --git a/sound/usb/card.c b/sound/usb/card.c
index 26268ffb8274..9bcbaa0c0a55 100644
--- a/sound/usb/card.c
+++ b/sound/usb/card.c
@@ -117,6 +117,30 @@ MODULE_PARM_DESC(skip_validation, "Skip unit descriptor validation (default: no)
static DEFINE_MUTEX(register_mutex);
static struct snd_usb_audio *usb_chip[SNDRV_CARDS];
static struct usb_driver usb_audio_driver;
+static struct snd_usb_platform_ops *platform_ops;
+
+int snd_usb_register_platform_ops(struct snd_usb_platform_ops *ops)
+{
+ if (platform_ops)
+ return -EEXIST;
+
+ mutex_lock(®ister_mutex);
+ platform_ops = ops;
+ mutex_unlock(®ister_mutex);