By setting the MODALIAS variable in uevents, userspace helpers will be
enabled to load modules via the module alias associated with a device.
This information is required to automatically load HDA codec drivers
instead of having to explicitly request the various modules in the HDA
core code.
[Note that currently the legacy HDA controller driver tries to bind
codec modules manually. It's for supporting the fallback generic
drivers. This new udev modalias support was added rather for ASoC
HDA ext drivers, since this addition itself won't hurt the legacy HDA
-- tiwai]
[Use the common helper function to generate the modalias -- tiwai]
Signed-off-by: Thierry Reding <treding@nvidia.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>
return 1;
}
+static int hda_uevent(struct device *dev, struct kobj_uevent_env *env)
+{
+ char modalias[32];
+
+ snd_hdac_codec_modalias(dev_to_hdac_dev(dev), modalias,
+ sizeof(modalias));
+ if (add_uevent_var(env, "MODALIAS=%s", modalias))
+ return -ENOMEM;
+ return 0;
+}
+
struct bus_type snd_hda_bus_type = {
.name = "hdaudio",
.match = hda_bus_match,
+ .uevent = hda_uevent,
};
EXPORT_SYMBOL_GPL(snd_hda_bus_type);