From f5e86ff2c7ccf60b3788d3d9c23a8e7f0ea3b186 Mon Sep 17 00:00:00 2001 From: Liam Girdwood Date: Mon, 4 Jul 2011 22:10:53 +0100 Subject: [PATCH] --- yaml --- r: 257572 b: refs/heads/master c: cb2cf612fbdf457291b6e47064fed24f0dfdd9a5 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/include/sound/soc.h | 8 ++++++++ trunk/sound/soc/soc-core.c | 11 +++++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index c2af3b8e07e6..c9232f22e41d 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: b7950641374ddb41e9a03ff61b43f9ab3fcf763d +refs/heads/master: cb2cf612fbdf457291b6e47064fed24f0dfdd9a5 diff --git a/trunk/include/sound/soc.h b/trunk/include/sound/soc.h index 6ce8dc32a3db..aa19f5a32ba8 100644 --- a/trunk/include/sound/soc.h +++ b/trunk/include/sound/soc.h @@ -651,6 +651,14 @@ struct snd_soc_platform_driver { int (*pcm_new)(struct snd_soc_pcm_runtime *); void (*pcm_free)(struct snd_pcm *); + /* Default control and setup, added after probe() is run */ + const struct snd_kcontrol_new *controls; + int num_controls; + const struct snd_soc_dapm_widget *dapm_widgets; + int num_dapm_widgets; + const struct snd_soc_dapm_route *dapm_routes; + int num_dapm_routes; + /* * For platform caused delay reporting. * Optional. diff --git a/trunk/sound/soc/soc-core.c b/trunk/sound/soc/soc-core.c index 38f954af7bb5..3049c37b14e0 100644 --- a/trunk/sound/soc/soc-core.c +++ b/trunk/sound/soc/soc-core.c @@ -998,6 +998,10 @@ static int soc_probe_platform(struct snd_soc_card *card, if (!try_module_get(platform->dev->driver->owner)) return -ENODEV; + if (driver->dapm_widgets) + snd_soc_dapm_new_controls(&platform->dapm, + driver->dapm_widgets, driver->num_dapm_widgets); + if (driver->probe) { ret = driver->probe(platform); if (ret < 0) { @@ -1008,6 +1012,13 @@ static int soc_probe_platform(struct snd_soc_card *card, } } + if (driver->controls) + snd_soc_add_platform_controls(platform, driver->controls, + driver->num_controls); + if (driver->dapm_routes) + snd_soc_dapm_add_routes(&platform->dapm, driver->dapm_routes, + driver->num_dapm_routes); + /* mark platform as probed and add to card platform list */ platform->probed = 1; list_add(&platform->card_list, &card->platform_dev_list);