]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
ASoC: Add platform registration API
authorMark Brown <broonie@opensource.wolfsonmicro.com>
Wed, 3 Dec 2008 19:40:30 +0000 (19:40 +0000)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Tue, 9 Dec 2008 10:49:27 +0000 (10:49 +0000)
ASoC v2 allows platform drivers to instantiate independantly of the
overall ASoC card. This API allows drivers to notify the core when
they are registered.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
include/sound/soc.h
sound/soc/soc-core.c

index 4a578b5d855c08652de6615dac9e8e07ede19391..ce3661d07c24bfc7ad8ccf09ca121034210461af 100644 (file)
@@ -149,6 +149,7 @@ struct snd_soc_ops;
 struct snd_soc_dai_mode;
 struct snd_soc_pcm_runtime;
 struct snd_soc_dai;
+struct snd_soc_platform;
 struct snd_soc_codec;
 struct soc_enum;
 struct snd_soc_ac97_ops;
@@ -158,6 +159,9 @@ typedef int (*hw_read_t)(void *,char* ,int);
 
 extern struct snd_ac97_bus_ops soc_ac97_ops;
 
+int snd_soc_register_platform(struct snd_soc_platform *platform);
+void snd_soc_unregister_platform(struct snd_soc_platform *platform);
+
 /* pcm <-> DAI connect */
 void snd_soc_free_pcms(struct snd_soc_device *socdev);
 int snd_soc_new_pcms(struct snd_soc_device *socdev, int idx, const char *xid);
@@ -296,6 +300,7 @@ struct snd_soc_codec_device {
 /* SoC platform interface */
 struct snd_soc_platform {
        char *name;
+       struct list_head list;
 
        int (*probe)(struct platform_device *pdev);
        int (*remove)(struct platform_device *pdev);
index 03460b068f1ed63acec4af0ded41541ffab283dd..ffae370b45df7eb799dbaa2f21a1d1d5a40fee68 100644 (file)
@@ -46,6 +46,7 @@ static struct dentry *debugfs_root;
 static DEFINE_MUTEX(client_mutex);
 static LIST_HEAD(card_list);
 static LIST_HEAD(dai_list);
+static LIST_HEAD(platform_list);
 
 static int snd_soc_register_card(struct snd_soc_card *card);
 static int snd_soc_unregister_card(struct snd_soc_card *card);
@@ -2102,6 +2103,43 @@ void snd_soc_unregister_dais(struct snd_soc_dai *dai, size_t count)
 }
 EXPORT_SYMBOL_GPL(snd_soc_unregister_dais);
 
+/**
+ * snd_soc_register_platform - Register a platform with the ASoC core
+ *
+ * @param platform platform to register
+ */
+int snd_soc_register_platform(struct snd_soc_platform *platform)
+{
+       if (!platform->name)
+               return -EINVAL;
+
+       INIT_LIST_HEAD(&platform->list);
+
+       mutex_lock(&client_mutex);
+       list_add(&platform->list, &platform_list);
+       mutex_unlock(&client_mutex);
+
+       pr_debug("Registered platform '%s'\n", platform->name);
+
+       return 0;
+}
+EXPORT_SYMBOL_GPL(snd_soc_register_platform);
+
+/**
+ * snd_soc_unregister_platform - Unregister a platform from the ASoC core
+ *
+ * @param platform platform to unregister
+ */
+void snd_soc_unregister_platform(struct snd_soc_platform *platform)
+{
+       mutex_lock(&client_mutex);
+       list_del(&platform->list);
+       mutex_unlock(&client_mutex);
+
+       pr_debug("Unregistered platform '%s'\n", platform->name);
+}
+EXPORT_SYMBOL_GPL(snd_soc_unregister_platform);
+
 static int __devinit snd_soc_init(void)
 {
 #ifdef CONFIG_DEBUG_FS