aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorMark Brown <broonie@linaro.org>2014-04-14 12:42:28 -0400
committerMark Brown <broonie@linaro.org>2014-04-14 12:42:28 -0400
commitaa0258adf6078a41a3db06f4e498253aff64d151 (patch)
tree26d293e3cd249d2946c6def872fa4bd88ed65669 /include
parent1a39019e939f620f39a1b914231ab6ba9013b208 (diff)
parentb37f1d123c69c0d7730704d65b83eaac780c0e3b (diff)
Merge branch 'topic/component' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-core
Conflicts: sound/soc/soc-core.c
Diffstat (limited to 'include')
-rw-r--r--include/sound/soc.h59
1 files changed, 45 insertions, 14 deletions
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 4ed706bf11d1..81bc331c520f 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -393,12 +393,6 @@ int devm_snd_soc_register_component(struct device *dev,
393 const struct snd_soc_component_driver *cmpnt_drv, 393 const struct snd_soc_component_driver *cmpnt_drv,
394 struct snd_soc_dai_driver *dai_drv, int num_dai); 394 struct snd_soc_dai_driver *dai_drv, int num_dai);
395void snd_soc_unregister_component(struct device *dev); 395void snd_soc_unregister_component(struct device *dev);
396int snd_soc_codec_volatile_register(struct snd_soc_codec *codec,
397 unsigned int reg);
398int snd_soc_codec_readable_register(struct snd_soc_codec *codec,
399 unsigned int reg);
400int snd_soc_codec_writable_register(struct snd_soc_codec *codec,
401 unsigned int reg);
402int snd_soc_codec_set_cache_io(struct snd_soc_codec *codec, 396int snd_soc_codec_set_cache_io(struct snd_soc_codec *codec,
403 struct regmap *regmap); 397 struct regmap *regmap);
404int snd_soc_cache_sync(struct snd_soc_codec *codec); 398int snd_soc_cache_sync(struct snd_soc_codec *codec);
@@ -668,6 +662,7 @@ struct snd_soc_component {
668 unsigned int active; 662 unsigned int active;
669 663
670 unsigned int ignore_pmdown_time:1; /* pmdown_time is ignored at stop */ 664 unsigned int ignore_pmdown_time:1; /* pmdown_time is ignored at stop */
665 unsigned int registered_as_component:1;
671 666
672 struct list_head list; 667 struct list_head list;
673 668
@@ -692,9 +687,6 @@ struct snd_soc_codec {
692 struct list_head list; 687 struct list_head list;
693 struct list_head card_list; 688 struct list_head card_list;
694 int num_dai; 689 int num_dai;
695 int (*volatile_register)(struct snd_soc_codec *, unsigned int);
696 int (*readable_register)(struct snd_soc_codec *, unsigned int);
697 int (*writable_register)(struct snd_soc_codec *, unsigned int);
698 690
699 /* runtime */ 691 /* runtime */
700 struct snd_ac97 *ac97; /* for ad-hoc ac97 devices */ 692 struct snd_ac97 *ac97; /* for ad-hoc ac97 devices */
@@ -756,11 +748,6 @@ struct snd_soc_codec_driver {
756 /* codec IO */ 748 /* codec IO */
757 unsigned int (*read)(struct snd_soc_codec *, unsigned int); 749 unsigned int (*read)(struct snd_soc_codec *, unsigned int);
758 int (*write)(struct snd_soc_codec *, unsigned int, unsigned int); 750 int (*write)(struct snd_soc_codec *, unsigned int, unsigned int);
759 int (*display_register)(struct snd_soc_codec *, char *,
760 size_t, unsigned int);
761 int (*volatile_register)(struct snd_soc_codec *, unsigned int);
762 int (*readable_register)(struct snd_soc_codec *, unsigned int);
763 int (*writable_register)(struct snd_soc_codec *, unsigned int);
764 unsigned int reg_cache_size; 751 unsigned int reg_cache_size;
765 short reg_cache_step; 752 short reg_cache_step;
766 short reg_word_size; 753 short reg_word_size;
@@ -791,6 +778,7 @@ struct snd_soc_platform_driver {
791 int (*remove)(struct snd_soc_platform *); 778 int (*remove)(struct snd_soc_platform *);
792 int (*suspend)(struct snd_soc_dai *dai); 779 int (*suspend)(struct snd_soc_dai *dai);
793 int (*resume)(struct snd_soc_dai *dai); 780 int (*resume)(struct snd_soc_dai *dai);
781 struct snd_soc_component_driver component_driver;
794 782
795 /* pcm creation and destruction */ 783 /* pcm creation and destruction */
796 int (*pcm_new)(struct snd_soc_pcm_runtime *); 784 int (*pcm_new)(struct snd_soc_pcm_runtime *);
@@ -844,6 +832,8 @@ struct snd_soc_platform {
844 struct list_head list; 832 struct list_head list;
845 struct list_head card_list; 833 struct list_head card_list;
846 834
835 struct snd_soc_component component;
836
847 struct snd_soc_dapm_context dapm; 837 struct snd_soc_dapm_context dapm;
848 838
849#ifdef CONFIG_DEBUG_FS 839#ifdef CONFIG_DEBUG_FS
@@ -1120,6 +1110,19 @@ static inline struct snd_soc_codec *snd_soc_component_to_codec(
1120 return container_of(component, struct snd_soc_codec, component); 1110 return container_of(component, struct snd_soc_codec, component);
1121} 1111}
1122 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
1123/* codec IO */ 1126/* codec IO */
1124unsigned 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);
1125unsigned int snd_soc_write(struct snd_soc_codec *codec, 1128unsigned int snd_soc_write(struct snd_soc_codec *codec,
@@ -1228,6 +1231,34 @@ static inline bool snd_soc_codec_is_active(struct snd_soc_codec *codec)
1228 return snd_soc_component_is_active(&codec->component); 1231 return snd_soc_component_is_active(&codec->component);
1229} 1232}
1230 1233
1234/**
1235 * snd_soc_kcontrol_codec() - Returns the CODEC that registered the control
1236 * @kcontrol: The control for which to get the CODEC
1237 *
1238 * Note: This function will only work correctly if the control has been
1239 * registered with snd_soc_add_codec_controls() or via table based setup of
1240 * snd_soc_codec_driver. Otherwise the behavior is undefined.
1241 */
1242static inline struct snd_soc_codec *snd_soc_kcontrol_codec(
1243 struct snd_kcontrol *kcontrol)
1244{
1245 return snd_kcontrol_chip(kcontrol);
1246}
1247
1248/**
1249 * snd_soc_kcontrol_platform() - Returns the platform that registerd the control
1250 * @kcontrol: The control for which to get the platform
1251 *
1252 * Note: This function will only work correctly if the control has been
1253 * registered with snd_soc_add_platform_controls() or via table based setup of
1254 * a snd_soc_platform_driver. Otherwise the behavior is undefined.
1255 */
1256static inline struct snd_soc_codec *snd_soc_kcontrol_platform(
1257 struct snd_kcontrol *kcontrol)
1258{
1259 return snd_kcontrol_chip(kcontrol);
1260}
1261
1231int snd_soc_util_init(void); 1262int snd_soc_util_init(void);
1232void snd_soc_util_exit(void); 1263void snd_soc_util_exit(void);
1233 1264