aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/soc-dapm.c
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2011-04-04 07:48:13 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2011-04-04 19:31:02 -0400
commitef49e4fae3f364af8da041dcc1bb4931c749b3da (patch)
treecde35edcd9fddbfd84518d6562da6504b432c313 /sound/soc/soc-dapm.c
parent34bad69cf63efc761b05f603d99e121b83635c08 (diff)
ASoC: Add bias level data to DAPM context debugfs
This is also in the old sysfs diagnostics but it's nice to have everything in one place. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/soc-dapm.c')
-rw-r--r--sound/soc/soc-dapm.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 81c4052c127c..05da8a8f0aef 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -1304,6 +1304,47 @@ static const struct file_operations dapm_widget_power_fops = {
1304 .llseek = default_llseek, 1304 .llseek = default_llseek,
1305}; 1305};
1306 1306
1307static int dapm_bias_open_file(struct inode *inode, struct file *file)
1308{
1309 file->private_data = inode->i_private;
1310 return 0;
1311}
1312
1313static ssize_t dapm_bias_read_file(struct file *file, char __user *user_buf,
1314 size_t count, loff_t *ppos)
1315{
1316 struct snd_soc_dapm_context *dapm = file->private_data;
1317 char *level;
1318
1319 switch (dapm->bias_level) {
1320 case SND_SOC_BIAS_ON:
1321 level = "On\n";
1322 break;
1323 case SND_SOC_BIAS_PREPARE:
1324 level = "Prepare\n";
1325 break;
1326 case SND_SOC_BIAS_STANDBY:
1327 level = "Standby\n";
1328 break;
1329 case SND_SOC_BIAS_OFF:
1330 level = "Off\n";
1331 break;
1332 default:
1333 BUG();
1334 level = "Unknown\n";
1335 break;
1336 }
1337
1338 return simple_read_from_buffer(user_buf, count, ppos, level,
1339 strlen(level));
1340}
1341
1342static const struct file_operations dapm_bias_fops = {
1343 .open = dapm_bias_open_file,
1344 .read = dapm_bias_read_file,
1345 .llseek = default_llseek,
1346};
1347
1307void snd_soc_dapm_debugfs_init(struct snd_soc_dapm_context *dapm) 1348void snd_soc_dapm_debugfs_init(struct snd_soc_dapm_context *dapm)
1308{ 1349{
1309 struct snd_soc_dapm_widget *w; 1350 struct snd_soc_dapm_widget *w;
@@ -1312,6 +1353,13 @@ void snd_soc_dapm_debugfs_init(struct snd_soc_dapm_context *dapm)
1312 if (!dapm->debugfs_dapm) 1353 if (!dapm->debugfs_dapm)
1313 return; 1354 return;
1314 1355
1356 d = debugfs_create_file("bias_level", 0444,
1357 dapm->debugfs_dapm, dapm,
1358 &dapm_bias_fops);
1359 if (!d)
1360 dev_warn(dapm->dev,
1361 "ASoC: Failed to create bias level debugfs file\n");
1362
1315 list_for_each_entry(w, &dapm->card->widgets, list) { 1363 list_for_each_entry(w, &dapm->card->widgets, list) {
1316 if (!w->name || w->dapm != dapm) 1364 if (!w->name || w->dapm != dapm)
1317 continue; 1365 continue;