Commit Graph

6 Commits

Author SHA1 Message Date
Subhransu S. Prusty 78abb2afaf ALSA: hda - Add hdaudio bus modalias support
This patch just adds modalias sysfs entry to each hdaudio bus entry.

[rewritten to call the common helper function by tiwai]

Signed-off-by: Subhransu S. Prusty <subhransu.s.prusty@intel.com>
Reviewed-by: Vinod Koul <vinod.koul@intel.com>
Tested-by: Subhransu S Prusty <subhransu.s.prusty@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-10-20 10:15:09 +02:00
Takashi Iwai a92d5ee866 ALSA: hda - Fix widget sysfs tree corruption after refresh
When snd_hdac_refresh_widget_sysfs() is called before the first
hda_widget_sysfs_init(), the next call overrides and eventually
fails.  This results in unexpected Oops, something like:
  BUG: unable to handle kernel NULL pointer dereference at 00000000000000c8
  IP: [<ffffffff8180e2a3>] hdmi_chmap_ctl_info+0x23/0x40

The fix is to add a check of the existing sysfs tree.  Also, for more
safety, this patch adds the checks of device_is_registered() in
snd-hdac_refresh_wdiget_sysfs(), too.

Fixes: fa4f18b4f4 ('ALSA: hda - Refresh widgets sysfs at probing Haswell+ HDMI codecs')
Bugizlla: https://bugzilla.kernel.org/show_bug.cgi?id=103431
Reported-by: Andreas Reis <andreas.reis@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-08-26 07:43:47 +02:00
Markus Elfring 24d9b755ab ALSA: hda: Delete an unnecessary check before the function call "kobject_put"
The kobject_put() function tests whether its argument is NULL and then
returns immediately. Thus the test around the call is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-07-09 14:20:27 +02:00
Takashi Iwai eacf6e0a23 ALSA: hda - Expose codec type sysfs
The type field of HD-audio codec object should be exposed to
user-space so that it can identify which driver type to bind (legacy /
asoc).

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-13 10:43:54 +02:00
Takashi Iwai 142267c9e0 ALSA: hda - Create AFG sysfs node at last
... so that user-space can know that the whole nodes have been
created.  Unfortunately, this can't be implemented easily in race-free
way, so it's a kind of compromise.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2015-04-08 11:41:59 +02:00
Takashi Iwai 3256be6537 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>
2015-03-23 13:17:27 +01:00