Commit dbe21408 authored by Mark Brown's avatar Mark Brown

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: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: default avatarLiam Girdwood <lrg@slimlogic.co.uk>
parent 96dd3622
...@@ -130,6 +130,29 @@ static ssize_t codec_reg_show(struct device *dev, ...@@ -130,6 +130,29 @@ static ssize_t codec_reg_show(struct device *dev,
static DEVICE_ATTR(codec_reg, 0444, codec_reg_show, NULL); static DEVICE_ATTR(codec_reg, 0444, codec_reg_show, NULL);
static ssize_t pmdown_time_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct snd_soc_device *socdev = dev_get_drvdata(dev);
struct snd_soc_card *card = socdev->card;
return sprintf(buf, "%d\n", card->pmdown_time);
}
static ssize_t pmdown_time_set(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{
struct snd_soc_device *socdev = dev_get_drvdata(dev);
struct snd_soc_card *card = socdev->card;
strict_strtol(buf, 10, &card->pmdown_time);
return count;
}
static DEVICE_ATTR(pmdown_time, 0644, pmdown_time_show, pmdown_time_set);
#ifdef CONFIG_DEBUG_FS #ifdef CONFIG_DEBUG_FS
static int codec_reg_open_file(struct inode *inode, struct file *file) static int codec_reg_open_file(struct inode *inode, struct file *file)
{ {
...@@ -1124,6 +1147,10 @@ static void snd_soc_instantiate_card(struct snd_soc_card *card) ...@@ -1124,6 +1147,10 @@ static void snd_soc_instantiate_card(struct snd_soc_card *card)
if (ret < 0) if (ret < 0)
printk(KERN_WARNING "asoc: failed to add dapm sysfs entries\n"); printk(KERN_WARNING "asoc: failed to add dapm sysfs entries\n");
ret = device_create_file(card->socdev->dev, &dev_attr_pmdown_time);
if (ret < 0)
printk(KERN_WARNING "asoc: failed to add pmdown_time sysfs\n");
ret = device_create_file(card->socdev->dev, &dev_attr_codec_reg); ret = device_create_file(card->socdev->dev, &dev_attr_codec_reg);
if (ret < 0) if (ret < 0)
printk(KERN_WARNING "asoc: failed to add codec sysfs files\n"); printk(KERN_WARNING "asoc: failed to add codec sysfs files\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment