aboutsummaryrefslogtreecommitdiffstats
path: root/include/sound
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2014-08-19 09:51:19 -0400
committerMark Brown <broonie@linaro.org>2014-08-19 11:59:45 -0400
commitf1d45cc3ae96a6173129b2c164c216272faa5fc0 (patch)
treed59bf61023e1fe970639016909b1e1550b129d7a /include/sound
parent81c7cfd1b22a0ee5e40efef72ec2cd17dbf12e6d (diff)
ASoC: Consolidate platform and CODEC probe/remove
The platform and CODEC probe and remove code is now largely identical. This patch consolidates it at the component level. The resulting code is slightly larger due to all the boiler plate code setting up the indirection for the table based control and DAPM registration. Once all drivers have been update to no longer use the snd_soc_codec_driver and snd_soc_platform_driver specific fields for this the indirection can be removed again. This patch contains two noteworthy hacks that are only meant to be temporary to be able to update drivers and the core in separate incremental patches. The first hack is related to that some DPCM platforms expect that the DAPM widgets for the DAIs of a snd_soc_component are created in the DAPM context of the snd_soc_platform that has the same parent device. For handling this the steal_sibling_dai_widgets attribute is introduced. It gets set for snd_soc_platforms that register DAPM elements. When creating the DAI widgets for a component this flag is checked and if it is found on one of the siblings the component will not create any DAI widgets in its own DAPM context. If the attribute is set on a platform it will look for siblings components and create DAI widgets for them in its own context. The fix for this will be to update the offending drivers to only register a single component rather than two. The second hack deals with the fact that the ASoC card suspend and resume code still needs a list of CODECs that have been registered for the card. To handle this the generic probe and remove path have a check to see if the component is CODEC and if yes add/remove it to the card's CODEC list. While it is possible to clean up the suspend/resume code to not need the CODEC list anymore this is a bit of a chicken and egg problem since it will become easier to clean up the suspend/resume code once there is a unified component layer. 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.h27
1 files changed, 17 insertions, 10 deletions
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 0ab8b1e4a5d2..22543acfae4b 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -697,6 +697,10 @@ struct snd_soc_component_driver {
697 void (*seq_notifier)(struct snd_soc_component *, enum snd_soc_dapm_type, 697 void (*seq_notifier)(struct snd_soc_component *, enum snd_soc_dapm_type,
698 int subseq); 698 int subseq);
699 int (*stream_event)(struct snd_soc_component *, int event); 699 int (*stream_event)(struct snd_soc_component *, int event);
700
701 /* probe ordering - for components with runtime dependencies */
702 int probe_order;
703 int remove_order;
700}; 704};
701 705
702struct snd_soc_component { 706struct snd_soc_component {
@@ -710,6 +714,7 @@ struct snd_soc_component {
710 714
711 unsigned int ignore_pmdown_time:1; /* pmdown_time is ignored at stop */ 715 unsigned int ignore_pmdown_time:1; /* pmdown_time is ignored at stop */
712 unsigned int registered_as_component:1; 716 unsigned int registered_as_component:1;
717 unsigned int probed:1;
713 718
714 struct list_head list; 719 struct list_head list;
715 720
@@ -742,6 +747,18 @@ struct snd_soc_component {
742 struct snd_soc_dapm_context dapm; 747 struct snd_soc_dapm_context dapm;
743 struct snd_soc_dapm_context *dapm_ptr; 748 struct snd_soc_dapm_context *dapm_ptr;
744 749
750 const struct snd_kcontrol_new *controls;
751 unsigned int num_controls;
752 const struct snd_soc_dapm_widget *dapm_widgets;
753 unsigned int num_dapm_widgets;
754 const struct snd_soc_dapm_route *dapm_routes;
755 unsigned int num_dapm_routes;
756 bool steal_sibling_dai_widgets;
757 struct snd_soc_codec *codec;
758
759 int (*probe)(struct snd_soc_component *);
760 void (*remove)(struct snd_soc_component *);
761
745#ifdef CONFIG_DEBUG_FS 762#ifdef CONFIG_DEBUG_FS
746 void (*init_debugfs)(struct snd_soc_component *component); 763 void (*init_debugfs)(struct snd_soc_component *component);
747 const char *debugfs_prefix; 764 const char *debugfs_prefix;
@@ -761,7 +778,6 @@ struct snd_soc_codec {
761 struct snd_ac97 *ac97; /* for ad-hoc ac97 devices */ 778 struct snd_ac97 *ac97; /* for ad-hoc ac97 devices */
762 unsigned int cache_bypass:1; /* Suppress access to the cache */ 779 unsigned int cache_bypass:1; /* Suppress access to the cache */
763 unsigned int suspended:1; /* Codec is in suspend PM state */ 780 unsigned int suspended:1; /* Codec is in suspend PM state */
764 unsigned int probed:1; /* Codec has been probed */
765 unsigned int ac97_registered:1; /* Codec has been AC97 registered */ 781 unsigned int ac97_registered:1; /* Codec has been AC97 registered */
766 unsigned int ac97_created:1; /* Codec has been created by SoC */ 782 unsigned int ac97_created:1; /* Codec has been created by SoC */
767 unsigned int cache_init:1; /* codec cache has been initialized */ 783 unsigned int cache_init:1; /* codec cache has been initialized */
@@ -827,10 +843,6 @@ struct snd_soc_codec_driver {
827 enum snd_soc_dapm_type, int); 843 enum snd_soc_dapm_type, int);
828 844
829 bool ignore_pmdown_time; /* Doesn't benefit from pmdown delay */ 845 bool ignore_pmdown_time; /* Doesn't benefit from pmdown delay */
830
831 /* probe ordering - for components with runtime dependencies */
832 int probe_order;
833 int remove_order;
834}; 846};
835 847
836/* SoC platform interface */ 848/* SoC platform interface */
@@ -867,10 +879,6 @@ struct snd_soc_platform_driver {
867 /* platform stream compress ops */ 879 /* platform stream compress ops */
868 const struct snd_compr_ops *compr_ops; 880 const struct snd_compr_ops *compr_ops;
869 881
870 /* probe ordering - for components with runtime dependencies */
871 int probe_order;
872 int remove_order;
873
874 /* platform IO - used for platform DAPM */ 882 /* platform IO - used for platform DAPM */
875 unsigned int (*read)(struct snd_soc_platform *, unsigned int); 883 unsigned int (*read)(struct snd_soc_platform *, unsigned int);
876 int (*write)(struct snd_soc_platform *, unsigned int, unsigned int); 884 int (*write)(struct snd_soc_platform *, unsigned int, unsigned int);
@@ -888,7 +896,6 @@ struct snd_soc_platform {
888 const struct snd_soc_platform_driver *driver; 896 const struct snd_soc_platform_driver *driver;
889 897
890 unsigned int suspended:1; /* platform is suspended */ 898 unsigned int suspended:1; /* platform is suspended */
891 unsigned int probed:1;
892 899
893 struct list_head list; 900 struct list_head list;
894 901