diff options
author | Lars-Peter Clausen <lars@metafoo.de> | 2014-03-18 04:02:12 -0400 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2014-04-14 12:22:44 -0400 |
commit | b37f1d123c69c0d7730704d65b83eaac780c0e3b (patch) | |
tree | f7e175bec547275fa4785efaea33690df97d472f /sound/soc/soc-core.c | |
parent | 98e639fb8a3ed1bf2bd512626c3cfc2992a57113 (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 'sound/soc/soc-core.c')
-rw-r--r-- | sound/soc/soc-core.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 3314efb365e3..a95c7e524dfc 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c | |||
@@ -3921,6 +3921,8 @@ EXPORT_SYMBOL_GPL(snd_soc_unregister_component); | |||
3921 | int snd_soc_add_platform(struct device *dev, struct snd_soc_platform *platform, | 3921 | int snd_soc_add_platform(struct device *dev, struct snd_soc_platform *platform, |
3922 | const struct snd_soc_platform_driver *platform_drv) | 3922 | const struct snd_soc_platform_driver *platform_drv) |
3923 | { | 3923 | { |
3924 | int ret; | ||
3925 | |||
3924 | /* create platform component name */ | 3926 | /* create platform component name */ |
3925 | platform->name = fmt_single_name(dev, &platform->id); | 3927 | platform->name = fmt_single_name(dev, &platform->id); |
3926 | if (platform->name == NULL) | 3928 | if (platform->name == NULL) |
@@ -3933,6 +3935,16 @@ int snd_soc_add_platform(struct device *dev, struct snd_soc_platform *platform, | |||
3933 | platform->dapm.stream_event = platform_drv->stream_event; | 3935 | platform->dapm.stream_event = platform_drv->stream_event; |
3934 | mutex_init(&platform->mutex); | 3936 | mutex_init(&platform->mutex); |
3935 | 3937 | ||
3938 | /* register component */ | ||
3939 | ret = __snd_soc_register_component(dev, &platform->component, | ||
3940 | &platform_drv->component_driver, | ||
3941 | NULL, NULL, 0, false); | ||
3942 | if (ret < 0) { | ||
3943 | dev_err(platform->component.dev, | ||
3944 | "ASoC: Failed to register component: %d\n", ret); | ||
3945 | return ret; | ||
3946 | } | ||
3947 | |||
3936 | mutex_lock(&client_mutex); | 3948 | mutex_lock(&client_mutex); |
3937 | list_add(&platform->list, &platform_list); | 3949 | list_add(&platform->list, &platform_list); |
3938 | mutex_unlock(&client_mutex); | 3950 | mutex_unlock(&client_mutex); |
@@ -3974,6 +3986,8 @@ EXPORT_SYMBOL_GPL(snd_soc_register_platform); | |||
3974 | */ | 3986 | */ |
3975 | void snd_soc_remove_platform(struct snd_soc_platform *platform) | 3987 | void snd_soc_remove_platform(struct snd_soc_platform *platform) |
3976 | { | 3988 | { |
3989 | snd_soc_unregister_component(platform->dev); | ||
3990 | |||
3977 | mutex_lock(&client_mutex); | 3991 | mutex_lock(&client_mutex); |
3978 | list_del(&platform->list); | 3992 | list_del(&platform->list); |
3979 | mutex_unlock(&client_mutex); | 3993 | mutex_unlock(&client_mutex); |