aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2015-02-24 08:59:42 -0500
committerTakashi Iwai <tiwai@suse.de>2015-03-23 08:17:27 -0400
commit3256be6537751f65c76b3ecfbb4e667f87525a2f (patch)
tree8dc85bb89fa5c5c23ebf815e0d4a825a0b9d4367 /sound/pci/hda
parent7639a06c23c7d4cda34c2546bd7290d8753849ca (diff)
ALSA: hda - Add widget sysfs tree
This patch changes the sysfs files assigned to the codec device on the bus which were formerly identical with hwdep sysfs files. Now it shows only a few core parameter, vendor_id, subsystem_id, revision_id, afg, mfg, vendor_name and chip_name. In addition, now a widget tree is added to the bus device sysfs directory for showing the widget topology and attributes. It's just a flat tree consisting of subdirectories named as the widget NID including various attributes like widget capability bits. The AFG (usually NID 0x01) is always found there, and it contains always amp_in_caps, amp_out_caps and power_caps files. Each of these attributes show a single value. The rest are the widget nodes belonging to that AFG. Note that the child node might not start from 0x02 but from another value like 0x0a. Each child node may contain caps, pin_caps, amp_in_caps, amp_out_caps, power_caps and connections files. The caps (representing the widget capability bits) always contain a value. The rest may contain value(s) if the attribute exists on the node. Only connections file show multiple values while other attributes have zero or one single value. An example of ls -R output is like below: % ls -R /sys/bus/hdaudio/devices/hdaudioC0D0/ /sys/bus/hdaudio/devices/hdaudioC0D0/widgets/: 01/ 04/ 07/ 0a/ 0d/ 10/ 13/ 16/ 19/ 1c/ 1f/ 22/ 02/ 05/ 08/ 0b/ 0e/ 11/ 14/ 17/ 1a/ 1d/ 20/ 23/ 03/ 06/ 09/ 0c/ 0f/ 12/ 15/ 18/ 1b/ 1e/ 21/ /sys/bus/hdaudio/devices/hdaudioC0D0/widgets/01: amp_in_caps amp_out_caps power_caps /sys/bus/hdaudio/devices/hdaudioC0D0/widgets/02: amp_in_caps amp_out_caps caps connections pin_caps pin_cfg power_caps /sys/bus/hdaudio/devices/hdaudioC0D0/widgets/03: ..... Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda')
-rw-r--r--sound/pci/hda/hda_bind.c4
-rw-r--r--sound/pci/hda/hda_codec.c6
2 files changed, 4 insertions, 6 deletions
diff --git a/sound/pci/hda/hda_bind.c b/sound/pci/hda/hda_bind.c
index ad276a9771db..130f672e6f37 100644
--- a/sound/pci/hda/hda_bind.c
+++ b/sound/pci/hda/hda_bind.c
@@ -240,7 +240,7 @@ int snd_hda_codec_configure(struct hda_codec *codec)
240 else 240 else
241 codec->probe_id = 0; 241 codec->probe_id = 0;
242 242
243 err = device_add(hda_codec_dev(codec)); 243 err = snd_hdac_device_register(&codec->core);
244 if (err < 0) 244 if (err < 0)
245 return err; 245 return err;
246 246
@@ -262,7 +262,7 @@ int snd_hda_codec_configure(struct hda_codec *codec)
262 return 0; 262 return 0;
263 263
264 error: 264 error:
265 device_del(hda_codec_dev(codec)); 265 snd_hdac_device_unregister(&codec->core);
266 return err; 266 return err;
267} 267}
268EXPORT_SYMBOL_GPL(snd_hda_codec_configure); 268EXPORT_SYMBOL_GPL(snd_hda_codec_configure);
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index ddfc0fbbee23..b162fc40348f 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -967,8 +967,7 @@ static int snd_hda_codec_dev_free(struct snd_device *device)
967 struct hda_codec *codec = device->device_data; 967 struct hda_codec *codec = device->device_data;
968 968
969 codec->in_freeing = 1; 969 codec->in_freeing = 1;
970 if (device_is_registered(hda_codec_dev(codec))) 970 snd_hdac_device_unregister(&codec->core);
971 device_del(hda_codec_dev(codec));
972 put_device(hda_codec_dev(codec)); 971 put_device(hda_codec_dev(codec));
973 return 0; 972 return 0;
974} 973}
@@ -2182,8 +2181,7 @@ int snd_hda_codec_reset(struct hda_codec *codec)
2182 return -EBUSY; 2181 return -EBUSY;
2183 2182
2184 /* OK, let it free */ 2183 /* OK, let it free */
2185 if (device_is_registered(hda_codec_dev(codec))) 2184 snd_hdac_device_unregister(&codec->core);
2186 device_del(hda_codec_dev(codec));
2187 2185
2188 /* allow device access again */ 2186 /* allow device access again */
2189 snd_hda_unlock_devices(bus); 2187 snd_hda_unlock_devices(bus);