aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/hda_hwdep.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2009-03-02 11:09:25 -0500
committerTakashi Iwai <tiwai@suse.de>2009-03-02 11:29:53 -0500
commitab1726f920275b52991b2eff7538ac6d313bf9a2 (patch)
tree0ad588024d3742c77e85978e78d21e5e9ce1a2e6 /sound/pci/hda/hda_hwdep.c
parent43b62713f67d9f0655f3a61f5bd14d6297ddd3ce (diff)
ALSA: hda - Add show for init_verbs and hints sysfs entries
Added the show method for init_verbs and hints hwdep sysfs entries. They show the current values. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/hda_hwdep.c')
-rw-r--r--sound/pci/hda/hda_hwdep.c35
1 files changed, 33 insertions, 2 deletions
diff --git a/sound/pci/hda/hda_hwdep.c b/sound/pci/hda/hda_hwdep.c
index 5e554de9cd9b..1e3ccc740afc 100644
--- a/sound/pci/hda/hda_hwdep.c
+++ b/sound/pci/hda/hda_hwdep.c
@@ -290,6 +290,22 @@ static ssize_t type##_store(struct device *dev, \
290CODEC_ACTION_STORE(reconfig); 290CODEC_ACTION_STORE(reconfig);
291CODEC_ACTION_STORE(clear); 291CODEC_ACTION_STORE(clear);
292 292
293static ssize_t init_verbs_show(struct device *dev,
294 struct device_attribute *attr,
295 char *buf)
296{
297 struct snd_hwdep *hwdep = dev_get_drvdata(dev);
298 struct hda_codec *codec = hwdep->private_data;
299 int i, len = 0;
300 for (i = 0; i < codec->init_verbs.used; i++) {
301 struct hda_verb *v = snd_array_elem(&codec->init_verbs, i);
302 len += snprintf(buf + len, PAGE_SIZE - len,
303 "0x%02x 0x%03x 0x%04x\n",
304 v->nid, v->verb, v->param);
305 }
306 return len;
307}
308
293static ssize_t init_verbs_store(struct device *dev, 309static ssize_t init_verbs_store(struct device *dev,
294 struct device_attribute *attr, 310 struct device_attribute *attr,
295 const char *buf, size_t count) 311 const char *buf, size_t count)
@@ -312,6 +328,21 @@ static ssize_t init_verbs_store(struct device *dev,
312 return count; 328 return count;
313} 329}
314 330
331static ssize_t hints_show(struct device *dev,
332 struct device_attribute *attr,
333 char *buf)
334{
335 struct snd_hwdep *hwdep = dev_get_drvdata(dev);
336 struct hda_codec *codec = hwdep->private_data;
337 int i, len = 0;
338 for (i = 0; i < codec->hints.used; i++) {
339 struct hda_hint *hint = snd_array_elem(&codec->hints, i);
340 len += snprintf(buf + len, PAGE_SIZE - len,
341 "%s = %s\n", hint->key, hint->val);
342 }
343 return len;
344}
345
315static struct hda_hint *get_hint(struct hda_codec *codec, const char *key) 346static struct hda_hint *get_hint(struct hda_codec *codec, const char *key)
316{ 347{
317 int i; 348 int i;
@@ -466,8 +497,8 @@ static struct device_attribute codec_attrs[] = {
466 CODEC_ATTR_RO(mfg), 497 CODEC_ATTR_RO(mfg),
467 CODEC_ATTR_RW(name), 498 CODEC_ATTR_RW(name),
468 CODEC_ATTR_RW(modelname), 499 CODEC_ATTR_RW(modelname),
469 CODEC_ATTR_WO(init_verbs), 500 CODEC_ATTR_RW(init_verbs),
470 CODEC_ATTR_WO(hints), 501 CODEC_ATTR_RW(hints),
471 CODEC_ATTR_RO(init_pin_configs), 502 CODEC_ATTR_RO(init_pin_configs),
472 CODEC_ATTR_RW(user_pin_configs), 503 CODEC_ATTR_RW(user_pin_configs),
473 CODEC_ATTR_RO(driver_pin_configs), 504 CODEC_ATTR_RO(driver_pin_configs),