aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorPeter Ujfalusi <peter.ujfalusi@nokia.com>2009-10-01 03:32:47 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2009-10-01 07:13:04 -0400
commit88439ac793934a47f47ad285656b63d09f5937c8 (patch)
treef2292568c573bc063f198fe62ce7e8bb72f73711 /sound
parent17c86a32076f0119437a017de70a583431f4bf51 (diff)
ASoC: add support for multiple cards/codecs in debugfs
In order to support multiple codecs on the same system in the debugfs the directory hierarchy need to be changed by adding directory per codec under the asoc direcorty: debugfs/asoc/{dev_name(socdev->dev)}-{codec->name}/codec_reg /dapm_pop_time /dapm/{widgets} With the original implementation only the debugfs files are only created for the first codec, other codecs loaded later would fail to create the debugfs files (since they are already exist). Furthermore in this situation any of the codecs has been removed, would cause the debugfs entries to disappear, regardless if the codec, which created them are still loaded (the one which loaded first). Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/soc-core.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index f5b356f8acfb..e4ab36daf3f7 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1254,21 +1254,35 @@ static const struct file_operations codec_reg_fops = {
1254 1254
1255static void soc_init_codec_debugfs(struct snd_soc_codec *codec) 1255static void soc_init_codec_debugfs(struct snd_soc_codec *codec)
1256{ 1256{
1257 char codec_root[128];
1258
1259 snprintf(codec_root, sizeof(codec_root),
1260 "%s-%s", dev_name(codec->socdev->dev), codec->name);
1261
1262 codec->debugfs_codec_root = debugfs_create_dir(codec_root,
1263 debugfs_root);
1264 if (!codec->debugfs_codec_root) {
1265 printk(KERN_WARNING
1266 "ASoC: Failed to create codec debugfs directory\n");
1267 return;
1268 }
1269
1257 codec->debugfs_reg = debugfs_create_file("codec_reg", 0644, 1270 codec->debugfs_reg = debugfs_create_file("codec_reg", 0644,
1258 debugfs_root, codec, 1271 codec->debugfs_codec_root,
1259 &codec_reg_fops); 1272 codec, &codec_reg_fops);
1260 if (!codec->debugfs_reg) 1273 if (!codec->debugfs_reg)
1261 printk(KERN_WARNING 1274 printk(KERN_WARNING
1262 "ASoC: Failed to create codec register debugfs file\n"); 1275 "ASoC: Failed to create codec register debugfs file\n");
1263 1276
1264 codec->debugfs_pop_time = debugfs_create_u32("dapm_pop_time", 0744, 1277 codec->debugfs_pop_time = debugfs_create_u32("dapm_pop_time", 0744,
1265 debugfs_root, 1278 codec->debugfs_codec_root,
1266 &codec->pop_time); 1279 &codec->pop_time);
1267 if (!codec->debugfs_pop_time) 1280 if (!codec->debugfs_pop_time)
1268 printk(KERN_WARNING 1281 printk(KERN_WARNING
1269 "Failed to create pop time debugfs file\n"); 1282 "Failed to create pop time debugfs file\n");
1270 1283
1271 codec->debugfs_dapm = debugfs_create_dir("dapm", debugfs_root); 1284 codec->debugfs_dapm = debugfs_create_dir("dapm",
1285 codec->debugfs_codec_root);
1272 if (!codec->debugfs_dapm) 1286 if (!codec->debugfs_dapm)
1273 printk(KERN_WARNING 1287 printk(KERN_WARNING
1274 "Failed to create DAPM debugfs directory\n"); 1288 "Failed to create DAPM debugfs directory\n");
@@ -1278,9 +1292,7 @@ static void soc_init_codec_debugfs(struct snd_soc_codec *codec)
1278 1292
1279static void soc_cleanup_codec_debugfs(struct snd_soc_codec *codec) 1293static void soc_cleanup_codec_debugfs(struct snd_soc_codec *codec)
1280{ 1294{
1281 debugfs_remove_recursive(codec->debugfs_dapm); 1295 debugfs_remove_recursive(codec->debugfs_codec_root);
1282 debugfs_remove(codec->debugfs_pop_time);
1283 debugfs_remove(codec->debugfs_reg);
1284} 1296}
1285 1297
1286#else 1298#else