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>

+27
+27
sound/soc/soc-core.c
··· 130 130 131 131 static DEVICE_ATTR(codec_reg, 0444, codec_reg_show, NULL); 132 132 133 + static 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 + 142 + static 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 + 154 + static DEVICE_ATTR(pmdown_time, 0644, pmdown_time_show, pmdown_time_set); 155 + 133 156 #ifdef CONFIG_DEBUG_FS 134 157 static int codec_reg_open_file(struct inode *inode, struct file *file) 135 158 { ··· 1146 1123 ret = snd_soc_dapm_sys_add(card->socdev->dev); 1147 1124 if (ret < 0) 1148 1125 printk(KERN_WARNING "asoc: failed to add dapm sysfs entries\n"); 1126 + 1127 + ret = device_create_file(card->socdev->dev, &dev_attr_pmdown_time); 1128 + if (ret < 0) 1129 + printk(KERN_WARNING "asoc: failed to add pmdown_time sysfs\n"); 1149 1130 1150 1131 ret = device_create_file(card->socdev->dev, &dev_attr_codec_reg); 1151 1132 if (ret < 0)