diff options
author | Lars-Peter Clausen <lars@metafoo.de> | 2014-06-16 12:13:07 -0400 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2014-06-21 16:34:15 -0400 |
commit | bc9af9fa9b89cb74eed020066d882abf238fad69 (patch) | |
tree | f3462c4aedb204a7a8789f3da35d7d63190b6111 | |
parent | ce0fc93ae56e2ba50ff8c220d69e4e860e889320 (diff) |
ASoC: Use component DAPM context for platforms
The snd_soc_platform dapm field is not accessed outside of the ASoC core. Switch
it over to using the snd_soc_component DAPM context.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@linaro.org>
-rw-r--r-- | include/sound/soc.h | 4 | ||||
-rw-r--r-- | sound/soc/soc-core.c | 25 |
2 files changed, 13 insertions, 16 deletions
diff --git a/include/sound/soc.h b/include/sound/soc.h index a21dfecba56b..84ebc079c92f 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h | |||
@@ -862,8 +862,6 @@ struct snd_soc_platform { | |||
862 | 862 | ||
863 | struct snd_soc_component component; | 863 | struct snd_soc_component component; |
864 | 864 | ||
865 | struct snd_soc_dapm_context dapm; | ||
866 | |||
867 | #ifdef CONFIG_DEBUG_FS | 865 | #ifdef CONFIG_DEBUG_FS |
868 | struct dentry *debugfs_platform_root; | 866 | struct dentry *debugfs_platform_root; |
869 | #endif | 867 | #endif |
@@ -1203,7 +1201,7 @@ static inline struct snd_soc_codec *snd_soc_dapm_to_codec( | |||
1203 | static inline struct snd_soc_platform *snd_soc_dapm_to_platform( | 1201 | static inline struct snd_soc_platform *snd_soc_dapm_to_platform( |
1204 | struct snd_soc_dapm_context *dapm) | 1202 | struct snd_soc_dapm_context *dapm) |
1205 | { | 1203 | { |
1206 | return container_of(dapm, struct snd_soc_platform, dapm); | 1204 | return snd_soc_component_to_platform(snd_soc_dapm_to_component(dapm)); |
1207 | } | 1205 | } |
1208 | 1206 | ||
1209 | /** | 1207 | /** |
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index f519a9f7571c..711e99c43be3 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c | |||
@@ -314,7 +314,7 @@ static void soc_init_platform_debugfs(struct snd_soc_platform *platform) | |||
314 | return; | 314 | return; |
315 | } | 315 | } |
316 | 316 | ||
317 | snd_soc_dapm_debugfs_init(&platform->dapm, | 317 | snd_soc_dapm_debugfs_init(&platform->component.dapm, |
318 | platform->debugfs_platform_root); | 318 | platform->debugfs_platform_root); |
319 | } | 319 | } |
320 | 320 | ||
@@ -974,7 +974,7 @@ static int soc_remove_platform(struct snd_soc_platform *platform) | |||
974 | } | 974 | } |
975 | 975 | ||
976 | /* Make sure all DAPM widgets are freed */ | 976 | /* Make sure all DAPM widgets are freed */ |
977 | snd_soc_dapm_free(&platform->dapm); | 977 | snd_soc_dapm_free(&platform->component.dapm); |
978 | 978 | ||
979 | soc_cleanup_platform_debugfs(platform); | 979 | soc_cleanup_platform_debugfs(platform); |
980 | platform->probed = 0; | 980 | platform->probed = 0; |
@@ -1210,7 +1210,7 @@ static int soc_probe_platform(struct snd_soc_card *card, | |||
1210 | struct snd_soc_dai *dai; | 1210 | struct snd_soc_dai *dai; |
1211 | 1211 | ||
1212 | platform->card = card; | 1212 | platform->card = card; |
1213 | platform->dapm.card = card; | 1213 | platform->component.dapm.card = card; |
1214 | 1214 | ||
1215 | if (!try_module_get(platform->dev->driver->owner)) | 1215 | if (!try_module_get(platform->dev->driver->owner)) |
1216 | return -ENODEV; | 1216 | return -ENODEV; |
@@ -1218,7 +1218,7 @@ static int soc_probe_platform(struct snd_soc_card *card, | |||
1218 | soc_init_platform_debugfs(platform); | 1218 | soc_init_platform_debugfs(platform); |
1219 | 1219 | ||
1220 | if (driver->dapm_widgets) | 1220 | if (driver->dapm_widgets) |
1221 | snd_soc_dapm_new_controls(&platform->dapm, | 1221 | snd_soc_dapm_new_controls(&platform->component.dapm, |
1222 | driver->dapm_widgets, driver->num_dapm_widgets); | 1222 | driver->dapm_widgets, driver->num_dapm_widgets); |
1223 | 1223 | ||
1224 | /* Create DAPM widgets for each DAI stream */ | 1224 | /* Create DAPM widgets for each DAI stream */ |
@@ -1226,10 +1226,11 @@ static int soc_probe_platform(struct snd_soc_card *card, | |||
1226 | if (component->dev != platform->dev) | 1226 | if (component->dev != platform->dev) |
1227 | continue; | 1227 | continue; |
1228 | list_for_each_entry(dai, &component->dai_list, list) | 1228 | list_for_each_entry(dai, &component->dai_list, list) |
1229 | snd_soc_dapm_new_dai_widgets(&platform->dapm, dai); | 1229 | snd_soc_dapm_new_dai_widgets(&platform->component.dapm, |
1230 | dai); | ||
1230 | } | 1231 | } |
1231 | 1232 | ||
1232 | platform->dapm.idle_bias_off = 1; | 1233 | platform->component.dapm.idle_bias_off = 1; |
1233 | 1234 | ||
1234 | if (driver->probe) { | 1235 | if (driver->probe) { |
1235 | ret = driver->probe(platform); | 1236 | ret = driver->probe(platform); |
@@ -1244,13 +1245,13 @@ static int soc_probe_platform(struct snd_soc_card *card, | |||
1244 | snd_soc_add_platform_controls(platform, driver->controls, | 1245 | snd_soc_add_platform_controls(platform, driver->controls, |
1245 | driver->num_controls); | 1246 | driver->num_controls); |
1246 | if (driver->dapm_routes) | 1247 | if (driver->dapm_routes) |
1247 | snd_soc_dapm_add_routes(&platform->dapm, driver->dapm_routes, | 1248 | snd_soc_dapm_add_routes(&platform->component.dapm, |
1248 | driver->num_dapm_routes); | 1249 | driver->dapm_routes, driver->num_dapm_routes); |
1249 | 1250 | ||
1250 | /* mark platform as probed and add to card platform list */ | 1251 | /* mark platform as probed and add to card platform list */ |
1251 | platform->probed = 1; | 1252 | platform->probed = 1; |
1252 | list_add(&platform->card_list, &card->platform_dev_list); | 1253 | list_add(&platform->card_list, &card->platform_dev_list); |
1253 | list_add(&platform->dapm.list, &card->dapm_list); | 1254 | list_add(&platform->component.dapm.list, &card->dapm_list); |
1254 | 1255 | ||
1255 | return 0; | 1256 | return 0; |
1256 | 1257 | ||
@@ -4141,8 +4142,6 @@ int snd_soc_add_platform(struct device *dev, struct snd_soc_platform *platform, | |||
4141 | { | 4142 | { |
4142 | int ret; | 4143 | int ret; |
4143 | 4144 | ||
4144 | platform->component.dapm_ptr = &platform->dapm; | ||
4145 | |||
4146 | ret = snd_soc_component_initialize(&platform->component, | 4145 | ret = snd_soc_component_initialize(&platform->component, |
4147 | &platform_drv->component_driver, dev); | 4146 | &platform_drv->component_driver, dev); |
4148 | if (ret) | 4147 | if (ret) |
@@ -4150,8 +4149,8 @@ int snd_soc_add_platform(struct device *dev, struct snd_soc_platform *platform, | |||
4150 | 4149 | ||
4151 | platform->dev = dev; | 4150 | platform->dev = dev; |
4152 | platform->driver = platform_drv; | 4151 | platform->driver = platform_drv; |
4153 | platform->dapm.platform = platform; | 4152 | platform->component.dapm.platform = platform; |
4154 | platform->dapm.stream_event = platform_drv->stream_event; | 4153 | platform->component.dapm.stream_event = platform_drv->stream_event; |
4155 | if (platform_drv->write) | 4154 | if (platform_drv->write) |
4156 | platform->component.write = snd_soc_platform_drv_write; | 4155 | platform->component.write = snd_soc_platform_drv_write; |
4157 | if (platform_drv->read) | 4156 | if (platform_drv->read) |