summaryrefslogtreecommitdiffstats
path: root/sound/soc/soc-core.c
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2008-12-03 19:40:30 +0000
committerMark Brown <broonie@opensource.wolfsonmicro.com>2008-12-09 10:49:27 +0000
commit12a48a8c0087ba39d926cf1d63938ccbdb9752c3 (patch)
tree4fc400e27b9f524a908ec24b854131c435be2722 /sound/soc/soc-core.c
parent3f4b783cfdebb559814690572041a17bc9744cf3 (diff)
downloadop-kernel-dev-12a48a8c0087ba39d926cf1d63938ccbdb9752c3.zip
op-kernel-dev-12a48a8c0087ba39d926cf1d63938ccbdb9752c3.tar.gz
ASoC: Add platform registration API
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>
Diffstat (limited to 'sound/soc/soc-core.c')
-rw-r--r--sound/soc/soc-core.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 03460b0..ffae370 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -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
OpenPOWER on IntegriCloud