aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/soc-core.c
diff options
context:
space:
mode:
authorLiam Girdwood <lrg@ti.com>2011-07-01 11:54:08 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2011-07-02 14:50:16 -0400
commit956245e9cd229138ad26521c326650eed8b88333 (patch)
treeaf3d16059a020d7decf29bdb7d0d7abd51175bd4 /sound/soc/soc-core.c
parent67d0c479d9392a89dd9ecf9d7b92148cc2251b00 (diff)
ASoC: core - Make platform probe more like codec probe.
In preparation for ASoC dynamic PCM support (AKA ASoC DSP) Platform will also support DAPM so separate out the probe function to simplify the code (just like the codec probe). Signed-off-by: Liam Girdwood <lrg@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/soc-core.c')
-rw-r--r--sound/soc/soc-core.c51
1 files changed, 36 insertions, 15 deletions
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 32bc50387f61..d49f0ed56f9c 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -986,6 +986,39 @@ err_probe:
986 return ret; 986 return ret;
987} 987}
988 988
989static int soc_probe_platform(struct snd_soc_card *card,
990 struct snd_soc_platform *platform)
991{
992 int ret = 0;
993 const struct snd_soc_platform_driver *driver = platform->driver;
994
995 platform->card = card;
996
997 if (!try_module_get(platform->dev->driver->owner))
998 return -ENODEV;
999
1000 if (driver->probe) {
1001 ret = driver->probe(platform);
1002 if (ret < 0) {
1003 dev_err(platform->dev,
1004 "asoc: failed to probe platform %s: %d\n",
1005 platform->name, ret);
1006 goto err_probe;
1007 }
1008 }
1009
1010 /* mark platform as probed and add to card platform list */
1011 platform->probed = 1;
1012 list_add(&platform->card_list, &card->platform_dev_list);
1013
1014 return 0;
1015
1016err_probe:
1017 module_put(platform->dev->driver->owner);
1018
1019 return ret;
1020}
1021
989static void rtd_release(struct device *dev) {} 1022static void rtd_release(struct device *dev) {}
990 1023
991static int soc_post_component_init(struct snd_soc_card *card, 1024static int soc_post_component_init(struct snd_soc_card *card,
@@ -1109,21 +1142,9 @@ static int soc_probe_dai_link(struct snd_soc_card *card, int num, int order)
1109 /* probe the platform */ 1142 /* probe the platform */
1110 if (!platform->probed && 1143 if (!platform->probed &&
1111 platform->driver->probe_order == order) { 1144 platform->driver->probe_order == order) {
1112 if (!try_module_get(platform->dev->driver->owner)) 1145 ret = soc_probe_platform(card, platform);
1113 return -ENODEV; 1146 if (ret < 0)
1114 1147 return ret;
1115 if (platform->driver->probe) {
1116 ret = platform->driver->probe(platform);
1117 if (ret < 0) {
1118 printk(KERN_ERR "asoc: failed to probe platform %s\n",
1119 platform->name);
1120 module_put(platform->dev->driver->owner);
1121 return ret;
1122 }
1123 }
1124 /* mark platform as probed and add to card platform list */
1125 platform->probed = 1;
1126 list_add(&platform->card_list, &card->platform_dev_list);
1127 } 1148 }
1128 1149
1129 /* probe the CODEC DAI */ 1150 /* probe the CODEC DAI */