diff options
Diffstat (limited to 'sound/soc')
-rw-r--r-- | sound/soc/soc-core.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 42542e0da2a3..94a2edf9cfd5 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c | |||
@@ -270,6 +270,33 @@ static void soc_cleanup_codec_debugfs(struct snd_soc_codec *codec) | |||
270 | debugfs_remove_recursive(codec->debugfs_codec_root); | 270 | debugfs_remove_recursive(codec->debugfs_codec_root); |
271 | } | 271 | } |
272 | 272 | ||
273 | static ssize_t codec_list_read_file(struct file *file, char __user *user_buf, | ||
274 | size_t count, loff_t *ppos) | ||
275 | { | ||
276 | char *buf = kmalloc(PAGE_SIZE, GFP_KERNEL); | ||
277 | ssize_t ret = 0; | ||
278 | struct snd_soc_codec *codec; | ||
279 | |||
280 | if (!buf) | ||
281 | return -ENOMEM; | ||
282 | |||
283 | list_for_each_entry(codec, &codec_list, list) | ||
284 | ret += snprintf(buf + ret, PAGE_SIZE - ret, "%s\n", | ||
285 | codec->name); | ||
286 | |||
287 | if (ret >= 0) | ||
288 | ret = simple_read_from_buffer(user_buf, count, ppos, buf, ret); | ||
289 | |||
290 | kfree(buf); | ||
291 | |||
292 | return ret; | ||
293 | } | ||
294 | |||
295 | static const struct file_operations codec_list_fops = { | ||
296 | .read = codec_list_read_file, | ||
297 | .llseek = default_llseek,/* read accesses f_pos */ | ||
298 | }; | ||
299 | |||
273 | #else | 300 | #else |
274 | 301 | ||
275 | static inline void soc_init_codec_debugfs(struct snd_soc_codec *codec) | 302 | static inline void soc_init_codec_debugfs(struct snd_soc_codec *codec) |
@@ -3191,6 +3218,11 @@ static int __init snd_soc_init(void) | |||
3191 | "ASoC: Failed to create debugfs directory\n"); | 3218 | "ASoC: Failed to create debugfs directory\n"); |
3192 | debugfs_root = NULL; | 3219 | debugfs_root = NULL; |
3193 | } | 3220 | } |
3221 | |||
3222 | if (!debugfs_create_file("codecs", 0444, debugfs_root, NULL, | ||
3223 | &codec_list_fops)) | ||
3224 | pr_warn("ASoC: Failed to create CODEC list debugfs file\n"); | ||
3225 | |||
3194 | #endif | 3226 | #endif |
3195 | 3227 | ||
3196 | return platform_driver_register(&soc_driver); | 3228 | return platform_driver_register(&soc_driver); |