aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2010-02-12 06:37:24 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2010-02-16 14:14:52 -0500
commitdbe21408b15f04da4f80fb89a27b7cb067d6103e (patch)
tree1ed935aa9d45b62cc49c302ee22e647e464c816d /sound/soc
parent96dd362284ddcb546d2783035ae7eeda73692eda (diff)
ASoC: Make pmdown_time runtime configurable
Provide a sysfs file allowing userspace to inspect and change the pmdown_time setting at runtime. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Diffstat (limited to 'sound/soc')
-rw-r--r--sound/soc/soc-core.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 94b9cde26139..c2008bc9c64a 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -130,6 +130,29 @@ static ssize_t codec_reg_show(struct device *dev,
130 130
131static DEVICE_ATTR(codec_reg, 0444, codec_reg_show, NULL); 131static DEVICE_ATTR(codec_reg, 0444, codec_reg_show, NULL);
132 132
133static ssize_t pmdown_time_show(struct device *dev,
134 struct device_attribute *attr, char *buf)
135{
136 struct snd_soc_device *socdev = dev_get_drvdata(dev);
137 struct snd_soc_card *card = socdev->card;
138
139 return sprintf(buf, "%d\n", card->pmdown_time);
140}
141
142static ssize_t pmdown_time_set(struct device *dev,
143 struct device_attribute *attr,
144 const char *buf, size_t count)
145{
146 struct snd_soc_device *socdev = dev_get_drvdata(dev);
147 struct snd_soc_card *card = socdev->card;
148
149 strict_strtol(buf, 10, &card->pmdown_time);
150
151 return count;
152}
153
154static DEVICE_ATTR(pmdown_time, 0644, pmdown_time_show, pmdown_time_set);
155
133#ifdef CONFIG_DEBUG_FS 156#ifdef CONFIG_DEBUG_FS
134static int codec_reg_open_file(struct inode *inode, struct file *file) 157static int codec_reg_open_file(struct inode *inode, struct file *file)
135{ 158{
@@ -1124,6 +1147,10 @@ static void snd_soc_instantiate_card(struct snd_soc_card *card)
1124 if (ret < 0) 1147 if (ret < 0)
1125 printk(KERN_WARNING "asoc: failed to add dapm sysfs entries\n"); 1148 printk(KERN_WARNING "asoc: failed to add dapm sysfs entries\n");
1126 1149
1150 ret = device_create_file(card->socdev->dev, &dev_attr_pmdown_time);
1151 if (ret < 0)
1152 printk(KERN_WARNING "asoc: failed to add pmdown_time sysfs\n");
1153
1127 ret = device_create_file(card->socdev->dev, &dev_attr_codec_reg); 1154 ret = device_create_file(card->socdev->dev, &dev_attr_codec_reg);
1128 if (ret < 0) 1155 if (ret < 0)
1129 printk(KERN_WARNING "asoc: failed to add codec sysfs files\n"); 1156 printk(KERN_WARNING "asoc: failed to add codec sysfs files\n");