diff options
author | Troy Kisky <troy.kisky@boundarydevices.com> | 2008-10-13 20:42:14 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2008-10-30 10:34:02 -0400 |
commit | 12ef193d5817504621e503e78d641265f6a86ac4 (patch) | |
tree | a86c1cc9d7297561b0912f0b2c0332bf2ab993ca /sound/soc/soc-dapm.c | |
parent | 15ad9a531a64d46af54839ab13542a81ad4c82a5 (diff) |
ASoC: Allow setting codec register with debugfs filesystem
i.e. echo 6 59 >/sys/kernel/debug/soc-audio.0/codec_reg
will set register 0x06 to a value of 0x59.
Also, pop_time debugfs interface setup is moved so that it
is setup in the same function as codec_reg
Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/soc-dapm.c')
-rw-r--r-- | sound/soc/soc-dapm.c | 33 |
1 files changed, 8 insertions, 25 deletions
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index 7e9f423f5b09..b51d82285be4 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c | |||
@@ -37,7 +37,6 @@ | |||
37 | #include <linux/bitops.h> | 37 | #include <linux/bitops.h> |
38 | #include <linux/platform_device.h> | 38 | #include <linux/platform_device.h> |
39 | #include <linux/jiffies.h> | 39 | #include <linux/jiffies.h> |
40 | #include <linux/debugfs.h> | ||
41 | #include <sound/core.h> | 40 | #include <sound/core.h> |
42 | #include <sound/pcm.h> | 41 | #include <sound/pcm.h> |
43 | #include <sound/pcm_params.h> | 42 | #include <sound/pcm_params.h> |
@@ -67,17 +66,13 @@ static int dapm_status = 1; | |||
67 | module_param(dapm_status, int, 0); | 66 | module_param(dapm_status, int, 0); |
68 | MODULE_PARM_DESC(dapm_status, "enable DPM sysfs entries"); | 67 | MODULE_PARM_DESC(dapm_status, "enable DPM sysfs entries"); |
69 | 68 | ||
70 | static struct dentry *asoc_debugfs; | 69 | static void pop_wait(u32 pop_time) |
71 | |||
72 | static u32 pop_time; | ||
73 | |||
74 | static void pop_wait(void) | ||
75 | { | 70 | { |
76 | if (pop_time) | 71 | if (pop_time) |
77 | schedule_timeout_uninterruptible(msecs_to_jiffies(pop_time)); | 72 | schedule_timeout_uninterruptible(msecs_to_jiffies(pop_time)); |
78 | } | 73 | } |
79 | 74 | ||
80 | static void pop_dbg(const char *fmt, ...) | 75 | static void pop_dbg(u32 pop_time, const char *fmt, ...) |
81 | { | 76 | { |
82 | va_list args; | 77 | va_list args; |
83 | 78 | ||
@@ -85,7 +80,7 @@ static void pop_dbg(const char *fmt, ...) | |||
85 | 80 | ||
86 | if (pop_time) { | 81 | if (pop_time) { |
87 | vprintk(fmt, args); | 82 | vprintk(fmt, args); |
88 | pop_wait(); | 83 | pop_wait(pop_time); |
89 | } | 84 | } |
90 | 85 | ||
91 | va_end(args); | 86 | va_end(args); |
@@ -230,10 +225,11 @@ static int dapm_update_bits(struct snd_soc_dapm_widget *widget) | |||
230 | 225 | ||
231 | change = old != new; | 226 | change = old != new; |
232 | if (change) { | 227 | if (change) { |
233 | pop_dbg("pop test %s : %s in %d ms\n", widget->name, | 228 | pop_dbg(codec->pop_time, "pop test %s : %s in %d ms\n", |
234 | widget->power ? "on" : "off", pop_time); | 229 | widget->name, widget->power ? "on" : "off", |
230 | codec->pop_time); | ||
235 | snd_soc_write(codec, widget->reg, new); | 231 | snd_soc_write(codec, widget->reg, new); |
236 | pop_wait(); | 232 | pop_wait(codec->pop_time); |
237 | } | 233 | } |
238 | pr_debug("reg %x old %x new %x change %d\n", widget->reg, | 234 | pr_debug("reg %x old %x new %x change %d\n", widget->reg, |
239 | old, new, change); | 235 | old, new, change); |
@@ -821,23 +817,13 @@ static DEVICE_ATTR(dapm_widget, 0444, dapm_widget_show, NULL); | |||
821 | 817 | ||
822 | int snd_soc_dapm_sys_add(struct device *dev) | 818 | int snd_soc_dapm_sys_add(struct device *dev) |
823 | { | 819 | { |
824 | int ret = 0; | ||
825 | |||
826 | if (!dapm_status) | 820 | if (!dapm_status) |
827 | return 0; | 821 | return 0; |
828 | 822 | ||
829 | ret = device_create_file(dev, &dev_attr_dapm_widget); | 823 | ret = device_create_file(dev, &dev_attr_dapm_widget); |
830 | if (ret != 0) | 824 | if (ret != 0) |
831 | return ret; | 825 | return ret; |
832 | 826 | return device_create_file(dev, &dev_attr_dapm_widget); | |
833 | asoc_debugfs = debugfs_create_dir("asoc", NULL); | ||
834 | if (!IS_ERR(asoc_debugfs) && asoc_debugfs) | ||
835 | debugfs_create_u32("dapm_pop_time", 0744, asoc_debugfs, | ||
836 | &pop_time); | ||
837 | else | ||
838 | asoc_debugfs = NULL; | ||
839 | |||
840 | return 0; | ||
841 | } | 827 | } |
842 | 828 | ||
843 | static void snd_soc_dapm_sys_remove(struct device *dev) | 829 | static void snd_soc_dapm_sys_remove(struct device *dev) |
@@ -845,9 +831,6 @@ static void snd_soc_dapm_sys_remove(struct device *dev) | |||
845 | if (dapm_status) { | 831 | if (dapm_status) { |
846 | device_remove_file(dev, &dev_attr_dapm_widget); | 832 | device_remove_file(dev, &dev_attr_dapm_widget); |
847 | } | 833 | } |
848 | |||
849 | if (asoc_debugfs) | ||
850 | debugfs_remove_recursive(asoc_debugfs); | ||
851 | } | 834 | } |
852 | 835 | ||
853 | /* free all dapm widgets and resources */ | 836 | /* free all dapm widgets and resources */ |