diff options
author | Lars-Peter Clausen <lars@metafoo.de> | 2011-04-30 13:45:49 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-05-03 13:43:44 -0400 |
commit | d5d1e0bef4385a0cd726613c0fc1909cd23efd39 (patch) | |
tree | 13942d02a969bfe93a8c32f2449282a475c7ceef /sound | |
parent | 8eecaf62445e175572ffabaab090b471001c5a2c (diff) |
ASoC: Move DAPM widget debugfs entry creation to snd_soc_dapm_new_widgets
Currently debugfs entries for a DAPM widgets are only added in
snd_soc_dapm_debugfs_init. If a widget is added later (for example in the
dai_link's probe callback) it will not show up in debugfs.
This patch moves the creation of the widget debugfs entry to
snd_soc_dapm_new_widgets where it will be added after the widget has been
properly instantiated.
As a side-effect this will also reduce the number of times the DAPM widget list
is iterated during a card's instantiation.
Since it is possible that snd_soc_dapm_new_widgets is invoked form the codecs or
cards probe callbacks, the creation of the debugfs dapm directory has to be
moved before these are called.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/soc/soc-core.c | 13 | ||||
-rw-r--r-- | sound/soc/soc-dapm.c | 35 |
2 files changed, 30 insertions, 18 deletions
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 983ec640d4d..fbd011ebe19 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c | |||
@@ -1493,6 +1493,8 @@ static int soc_probe_codec(struct snd_soc_card *card, | |||
1493 | if (!try_module_get(codec->dev->driver->owner)) | 1493 | if (!try_module_get(codec->dev->driver->owner)) |
1494 | return -ENODEV; | 1494 | return -ENODEV; |
1495 | 1495 | ||
1496 | soc_init_codec_debugfs(codec); | ||
1497 | |||
1496 | if (driver->probe) { | 1498 | if (driver->probe) { |
1497 | ret = driver->probe(codec); | 1499 | ret = driver->probe(codec); |
1498 | if (ret < 0) { | 1500 | if (ret < 0) { |
@@ -1513,8 +1515,6 @@ static int soc_probe_codec(struct snd_soc_card *card, | |||
1513 | snd_soc_dapm_add_routes(&codec->dapm, driver->dapm_routes, | 1515 | snd_soc_dapm_add_routes(&codec->dapm, driver->dapm_routes, |
1514 | driver->num_dapm_routes); | 1516 | driver->num_dapm_routes); |
1515 | 1517 | ||
1516 | soc_init_codec_debugfs(codec); | ||
1517 | |||
1518 | /* mark codec as probed and add to card codec list */ | 1518 | /* mark codec as probed and add to card codec list */ |
1519 | codec->probed = 1; | 1519 | codec->probed = 1; |
1520 | list_add(&codec->card_list, &card->codec_dev_list); | 1520 | list_add(&codec->card_list, &card->codec_dev_list); |
@@ -1523,6 +1523,7 @@ static int soc_probe_codec(struct snd_soc_card *card, | |||
1523 | return 0; | 1523 | return 0; |
1524 | 1524 | ||
1525 | err_probe: | 1525 | err_probe: |
1526 | soc_cleanup_codec_debugfs(codec); | ||
1526 | module_put(codec->dev->driver->owner); | 1527 | module_put(codec->dev->driver->owner); |
1527 | 1528 | ||
1528 | return ret; | 1529 | return ret; |
@@ -1873,6 +1874,10 @@ static void snd_soc_instantiate_card(struct snd_soc_card *card) | |||
1873 | card->dapm.card = card; | 1874 | card->dapm.card = card; |
1874 | list_add(&card->dapm.list, &card->dapm_list); | 1875 | list_add(&card->dapm.list, &card->dapm_list); |
1875 | 1876 | ||
1877 | #ifdef CONFIG_DEBUG_FS | ||
1878 | snd_soc_dapm_debugfs_init(&card->dapm, card->debugfs_card_root); | ||
1879 | #endif | ||
1880 | |||
1876 | #ifdef CONFIG_PM_SLEEP | 1881 | #ifdef CONFIG_PM_SLEEP |
1877 | /* deferred resume work */ | 1882 | /* deferred resume work */ |
1878 | INIT_WORK(&card->deferred_resume_work, soc_resume_deferred); | 1883 | INIT_WORK(&card->deferred_resume_work, soc_resume_deferred); |
@@ -1919,10 +1924,6 @@ static void snd_soc_instantiate_card(struct snd_soc_card *card) | |||
1919 | snd_soc_dapm_add_routes(&card->dapm, card->dapm_routes, | 1924 | snd_soc_dapm_add_routes(&card->dapm, card->dapm_routes, |
1920 | card->num_dapm_routes); | 1925 | card->num_dapm_routes); |
1921 | 1926 | ||
1922 | #ifdef CONFIG_DEBUG_FS | ||
1923 | snd_soc_dapm_debugfs_init(&card->dapm, card->debugfs_card_root); | ||
1924 | #endif | ||
1925 | |||
1926 | snprintf(card->snd_card->shortname, sizeof(card->snd_card->shortname), | 1927 | snprintf(card->snd_card->shortname, sizeof(card->snd_card->shortname), |
1927 | "%s", card->name); | 1928 | "%s", card->name); |
1928 | snprintf(card->snd_card->longname, sizeof(card->snd_card->longname), | 1929 | snprintf(card->snd_card->longname, sizeof(card->snd_card->longname), |
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index ffed456b214..8454cc2967d 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c | |||
@@ -1257,7 +1257,6 @@ static const struct file_operations dapm_bias_fops = { | |||
1257 | void snd_soc_dapm_debugfs_init(struct snd_soc_dapm_context *dapm, | 1257 | void snd_soc_dapm_debugfs_init(struct snd_soc_dapm_context *dapm, |
1258 | struct dentry *parent) | 1258 | struct dentry *parent) |
1259 | { | 1259 | { |
1260 | struct snd_soc_dapm_widget *w; | ||
1261 | struct dentry *d; | 1260 | struct dentry *d; |
1262 | 1261 | ||
1263 | dapm->debugfs_dapm = debugfs_create_dir("dapm", parent); | 1262 | dapm->debugfs_dapm = debugfs_create_dir("dapm", parent); |
@@ -1274,25 +1273,35 @@ void snd_soc_dapm_debugfs_init(struct snd_soc_dapm_context *dapm, | |||
1274 | if (!d) | 1273 | if (!d) |
1275 | dev_warn(dapm->dev, | 1274 | dev_warn(dapm->dev, |
1276 | "ASoC: Failed to create bias level debugfs file\n"); | 1275 | "ASoC: Failed to create bias level debugfs file\n"); |
1276 | } | ||
1277 | 1277 | ||
1278 | list_for_each_entry(w, &dapm->card->widgets, list) { | 1278 | static void dapm_debugfs_add_widget(struct snd_soc_dapm_widget *w) |
1279 | if (!w->name || w->dapm != dapm) | 1279 | { |
1280 | continue; | 1280 | struct snd_soc_dapm_context *dapm = w->dapm; |
1281 | struct dentry *d; | ||
1281 | 1282 | ||
1282 | d = debugfs_create_file(w->name, 0444, | 1283 | if (!dapm->debugfs_dapm || !w->name) |
1283 | dapm->debugfs_dapm, w, | 1284 | return; |
1284 | &dapm_widget_power_fops); | 1285 | |
1285 | if (!d) | 1286 | d = debugfs_create_file(w->name, 0444, |
1286 | dev_warn(w->dapm->dev, | 1287 | dapm->debugfs_dapm, w, |
1287 | "ASoC: Failed to create %s debugfs file\n", | 1288 | &dapm_widget_power_fops); |
1288 | w->name); | 1289 | if (!d) |
1289 | } | 1290 | dev_warn(w->dapm->dev, |
1291 | "ASoC: Failed to create %s debugfs file\n", | ||
1292 | w->name); | ||
1290 | } | 1293 | } |
1294 | |||
1291 | #else | 1295 | #else |
1292 | void snd_soc_dapm_debugfs_init(struct snd_soc_dapm_context *dapm, | 1296 | void snd_soc_dapm_debugfs_init(struct snd_soc_dapm_context *dapm, |
1293 | struct dentry *parent) | 1297 | struct dentry *parent) |
1294 | { | 1298 | { |
1295 | } | 1299 | } |
1300 | |||
1301 | static inline void dapm_debugfs_add_widget(struct snd_soc_dapm_widget *w) | ||
1302 | { | ||
1303 | } | ||
1304 | |||
1296 | #endif | 1305 | #endif |
1297 | 1306 | ||
1298 | /* test and update the power status of a mux widget */ | 1307 | /* test and update the power status of a mux widget */ |
@@ -1765,6 +1774,8 @@ int snd_soc_dapm_new_widgets(struct snd_soc_dapm_context *dapm) | |||
1765 | } | 1774 | } |
1766 | 1775 | ||
1767 | w->new = 1; | 1776 | w->new = 1; |
1777 | |||
1778 | dapm_debugfs_add_widget(w); | ||
1768 | } | 1779 | } |
1769 | 1780 | ||
1770 | dapm_power_widgets(dapm, SND_SOC_DAPM_STREAM_NOP); | 1781 | dapm_power_widgets(dapm, SND_SOC_DAPM_STREAM_NOP); |