aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/hda_hwdep.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/hda/hda_hwdep.c')
-rw-r--r--sound/pci/hda/hda_hwdep.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/sound/pci/hda/hda_hwdep.c b/sound/pci/hda/hda_hwdep.c
index cc24e6721d74..d24328661c6a 100644
--- a/sound/pci/hda/hda_hwdep.c
+++ b/sound/pci/hda/hda_hwdep.c
@@ -154,6 +154,44 @@ int /*__devinit*/ snd_hda_create_hwdep(struct hda_codec *codec)
154 return 0; 154 return 0;
155} 155}
156 156
157#ifdef CONFIG_SND_HDA_POWER_SAVE
158static ssize_t power_on_acct_show(struct device *dev,
159 struct device_attribute *attr,
160 char *buf)
161{
162 struct snd_hwdep *hwdep = dev_get_drvdata(dev);
163 struct hda_codec *codec = hwdep->private_data;
164 snd_hda_update_power_acct(codec);
165 return sprintf(buf, "%u\n", jiffies_to_msecs(codec->power_on_acct));
166}
167
168static ssize_t power_off_acct_show(struct device *dev,
169 struct device_attribute *attr,
170 char *buf)
171{
172 struct snd_hwdep *hwdep = dev_get_drvdata(dev);
173 struct hda_codec *codec = hwdep->private_data;
174 snd_hda_update_power_acct(codec);
175 return sprintf(buf, "%u\n", jiffies_to_msecs(codec->power_off_acct));
176}
177
178static struct device_attribute power_attrs[] = {
179 __ATTR_RO(power_on_acct),
180 __ATTR_RO(power_off_acct),
181};
182
183int snd_hda_hwdep_add_power_sysfs(struct hda_codec *codec)
184{
185 struct snd_hwdep *hwdep = codec->hwdep;
186 int i;
187
188 for (i = 0; i < ARRAY_SIZE(power_attrs); i++)
189 snd_add_device_sysfs_file(SNDRV_DEVICE_TYPE_HWDEP, hwdep->card,
190 hwdep->device, &power_attrs[i]);
191 return 0;
192}
193#endif /* CONFIG_SND_HDA_POWER_SAVE */
194
157#ifdef CONFIG_SND_HDA_RECONFIG 195#ifdef CONFIG_SND_HDA_RECONFIG
158 196
159/* 197/*