aboutsummaryrefslogtreecommitdiffstats
path: root/include/sound
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2014-03-18 04:02:12 -0400
committerMark Brown <broonie@linaro.org>2014-04-14 12:22:44 -0400
commitb37f1d123c69c0d7730704d65b83eaac780c0e3b (patch)
treef7e175bec547275fa4785efaea33690df97d472f /include/sound
parent98e639fb8a3ed1bf2bd512626c3cfc2992a57113 (diff)
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')
-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 {
778 int (*remove)(struct snd_soc_platform *); 778 int (*remove)(struct snd_soc_platform *);
779 int (*suspend)(struct snd_soc_dai *dai); 779 int (*suspend)(struct snd_soc_dai *dai);
780 int (*resume)(struct snd_soc_dai *dai); 780 int (*resume)(struct snd_soc_dai *dai);
781 struct snd_soc_component_driver component_driver;
781 782
782 /* pcm creation and destruction */ 783 /* pcm creation and destruction */
783 int (*pcm_new)(struct snd_soc_pcm_runtime *); 784 int (*pcm_new)(struct snd_soc_pcm_runtime *);
@@ -831,6 +832,8 @@ struct snd_soc_platform {
831 struct list_head list; 832 struct list_head list;
832 struct list_head card_list; 833 struct list_head card_list;
833 834
835 struct snd_soc_component component;
836
834 struct snd_soc_dapm_context dapm; 837 struct snd_soc_dapm_context dapm;
835 838
836#ifdef CONFIG_DEBUG_FS 839#ifdef CONFIG_DEBUG_FS
@@ -1107,6 +1110,19 @@ static inline struct snd_soc_codec *snd_soc_component_to_codec(
1107 return container_of(component, struct snd_soc_codec, component); 1110 return container_of(component, struct snd_soc_codec, component);
1108} 1111}
1109 1112
1113/**
1114 * snd_soc_component_to_platform() - Casts a component to the platform it is embedded in
1115 * @component: The component to cast to a platform
1116 *
1117 * This function must only be used on components that are known to be platforms.
1118 * Otherwise the behavior is undefined.
1119 */
1120static inline struct snd_soc_platform *snd_soc_component_to_platform(
1121 struct snd_soc_component *component)
1122{
1123 return container_of(component, struct snd_soc_platform, component);
1124}
1125
1110/* codec IO */ 1126/* codec IO */
1111unsigned int snd_soc_read(struct snd_soc_codec *codec, unsigned int reg); 1127unsigned int snd_soc_read(struct snd_soc_codec *codec, unsigned int reg);
1112unsigned int snd_soc_write(struct snd_soc_codec *codec, 1128unsigned int snd_soc_write(struct snd_soc_codec *codec,