summaryrefslogtreecommitdiffstats
path: root/include/sound/soc.h
diff options
context:
space:
mode:
authorLars-Peter Clausen2014-03-18 09:02:12 +0100
committerMark Brown2014-04-14 18:22:44 +0200
commitb37f1d123c69c0d7730704d65b83eaac780c0e3b (patch)
treef7e175bec547275fa4785efaea33690df97d472f /include/sound/soc.h
parentASoC: Track which components have been registered with snd_soc_register_compo... (diff)
downloadkernel-qcow2-linux-b37f1d123c69c0d7730704d65b83eaac780c0e3b.tar.gz
kernel-qcow2-linux-b37f1d123c69c0d7730704d65b83eaac780c0e3b.tar.xz
kernel-qcow2-linux-b37f1d123c69c0d7730704d65b83eaac780c0e3b.zip
ASoC: Let snd_soc_platform subclass snd_soc_component
There is an increasing amount of code that is very similar between platforms, CODECS and other components. Making platforms a component will allow us to share this code. For now the patch just adds component and component_driver fields to the platform and platform_driver structs and registers the platform as a component. Followup patches will be used to consolidate code between the different types of components. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'include/sound/soc.h')
-rw-r--r--include/sound/soc.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/include/sound/soc.h b/include/sound/soc.h
index f8a79c17628e..94a2dc20ad6e 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -778,6 +778,7 @@ struct snd_soc_platform_driver {
int (*remove)(struct snd_soc_platform *);
int (*suspend)(struct snd_soc_dai *dai);
int (*resume)(struct snd_soc_dai *dai);
+ struct snd_soc_component_driver component_driver;
/* pcm creation and destruction */
int (*pcm_new)(struct snd_soc_pcm_runtime *);
@@ -831,6 +832,8 @@ struct snd_soc_platform {
struct list_head list;
struct list_head card_list;
+ struct snd_soc_component component;
+
struct snd_soc_dapm_context dapm;
#ifdef CONFIG_DEBUG_FS
@@ -1107,6 +1110,19 @@ static inline struct snd_soc_codec *snd_soc_component_to_codec(
return container_of(component, struct snd_soc_codec, component);
}
+/**
+ * snd_soc_component_to_platform() - Casts a component to the platform it is embedded in
+ * @component: The component to cast to a platform
+ *
+ * This function must only be used on components that are known to be platforms.
+ * Otherwise the behavior is undefined.
+ */
+static inline struct snd_soc_platform *snd_soc_component_to_platform(
+ struct snd_soc_component *component)
+{
+ return container_of(component, struct snd_soc_platform, component);
+}
+
/* codec IO */
unsigned int snd_soc_read(struct snd_soc_codec *codec, unsigned int reg);
unsigned int snd_soc_write(struct snd_soc_codec *codec,