2022-04-29 07:08:31

by Mauro Carvalho Chehab

[permalink] [raw]
Subject: [PATCH 2/2] ALSA: hda - identify when audio is provided by a video driver

On some devices, the hda driver needs to hook into a video driver,
in order to be able to properly access the audio hardware and/or
the power management function.

That's the case of several snd_hda_intel devices that depends on
i915 driver.

Currently, this dependency is hidden from /proc/modules and
from lsmod, making harder to identify the need to unbind the
audio driver before being able to unbind the i915 driver.

Add a reference for it at the module dependency, in order to
allow userspace to identify it, and print a message on such
cases.

Signed-off-by: Mauro Carvalho Chehab <[email protected]>
---

See [PATCH 0/2] at: https://lore.kernel.org/all/[email protected]/

sound/hda/hdac_component.c | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/sound/hda/hdac_component.c b/sound/hda/hdac_component.c
index bb37e7e0bd79..103c6be8be1e 100644
--- a/sound/hda/hdac_component.c
+++ b/sound/hda/hdac_component.c
@@ -211,6 +211,14 @@ static int hdac_component_master_bind(struct device *dev)
}

complete_all(&acomp->master_bind_complete);
+
+ if (acomp->ops->owner && acomp->ops->owner->name) {
+ dev_info(dev, "audio component provided by %s driver\n",
+ acomp->ops->owner->name);
+ module_add_named_dependency(acomp->ops->owner->name,
+ dev->driver->owner);
+ }
+
return 0;

module_put:
--
2.35.1