aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/soc-dapm.c
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2008-08-28 07:46:24 -0400
committerJaroslav Kysela <perex@perex.cz>2008-08-29 04:06:14 -0400
commitf0062a92c330cf5a45fe6c8bf30a9ee82e88f530 (patch)
treee94ad00bd76c7cdf4c9dd2c0063cf35a1e9deece /sound/soc/soc-dapm.c
parent2922c9aff22ea65f33a891af894331f0f883d127 (diff)
ALSA: ASoC: Convert DAPM pop time configuration to debugfs
Pop time configuration is a debugging feature which shouldn't be used in normal operation so move it to debugfs where it is clearer. This also simplifies the code since debugfs provides standard facilities for exposing simple integer values to user space. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Diffstat (limited to 'sound/soc/soc-dapm.c')
-rw-r--r--sound/soc/soc-dapm.c53
1 files changed, 20 insertions, 33 deletions
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 7a88f764daf8..c016426fb896 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -38,6 +38,7 @@
38#include <linux/bitops.h> 38#include <linux/bitops.h>
39#include <linux/platform_device.h> 39#include <linux/platform_device.h>
40#include <linux/jiffies.h> 40#include <linux/jiffies.h>
41#include <linux/debugfs.h>
41#include <sound/core.h> 42#include <sound/core.h>
42#include <sound/pcm.h> 43#include <sound/pcm.h>
43#include <sound/pcm_params.h> 44#include <sound/pcm_params.h>
@@ -67,7 +68,9 @@ static int dapm_status = 1;
67module_param(dapm_status, int, 0); 68module_param(dapm_status, int, 0);
68MODULE_PARM_DESC(dapm_status, "enable DPM sysfs entries"); 69MODULE_PARM_DESC(dapm_status, "enable DPM sysfs entries");
69 70
70static unsigned int pop_time; 71static struct dentry *asoc_debugfs;
72
73static u32 pop_time;
71 74
72static void pop_wait(void) 75static void pop_wait(void)
73{ 76{
@@ -817,51 +820,35 @@ static ssize_t dapm_widget_show(struct device *dev,
817 820
818static DEVICE_ATTR(dapm_widget, 0444, dapm_widget_show, NULL); 821static DEVICE_ATTR(dapm_widget, 0444, dapm_widget_show, NULL);
819 822
820/* pop/click delay times */
821static ssize_t dapm_pop_time_show(struct device *dev,
822 struct device_attribute *attr, char *buf)
823{
824 return sprintf(buf, "%d\n", pop_time);
825}
826
827static ssize_t dapm_pop_time_store(struct device *dev,
828 struct device_attribute *attr,
829 const char *buf, size_t count)
830
831{
832 unsigned long val;
833
834 if (strict_strtoul(buf, 10, &val) >= 0)
835 pop_time = val;
836 else
837 printk(KERN_ERR "Unable to parse pop_time setting\n");
838
839 return count;
840}
841
842static DEVICE_ATTR(dapm_pop_time, 0744, dapm_pop_time_show,
843 dapm_pop_time_store);
844
845int snd_soc_dapm_sys_add(struct device *dev) 823int snd_soc_dapm_sys_add(struct device *dev)
846{ 824{
847 int ret = 0; 825 int ret = 0;
848 826
849 if (dapm_status) { 827 if (!dapm_status)
850 ret = device_create_file(dev, &dev_attr_dapm_widget); 828 return 0;
851 829
852 if (ret == 0) 830 ret = device_create_file(dev, &dev_attr_dapm_widget);
853 ret = device_create_file(dev, &dev_attr_dapm_pop_time); 831 if (ret != 0)
854 } 832 return ret;
855 833
856 return ret; 834 asoc_debugfs = debugfs_create_dir("asoc", NULL);
835 if (!IS_ERR(asoc_debugfs))
836 debugfs_create_u32("dapm_pop_time", 0744, asoc_debugfs,
837 &pop_time);
838 else
839 asoc_debugfs = NULL;
840
841 return 0;
857} 842}
858 843
859static void snd_soc_dapm_sys_remove(struct device *dev) 844static void snd_soc_dapm_sys_remove(struct device *dev)
860{ 845{
861 if (dapm_status) { 846 if (dapm_status) {
862 device_remove_file(dev, &dev_attr_dapm_pop_time);
863 device_remove_file(dev, &dev_attr_dapm_widget); 847 device_remove_file(dev, &dev_attr_dapm_widget);
864 } 848 }
849
850 if (asoc_debugfs)
851 debugfs_remove_recursive(asoc_debugfs);
865} 852}
866 853
867/* free all dapm widgets and resources */ 854/* free all dapm widgets and resources */