From 4ceec8e98a24e067fbe036f2621b9d5af783f80e Mon Sep 17 00:00:00 2001 From: Peter Ujfalusi Date: Fri, 30 May 2025 09:29:26 +0300 Subject: [PATCH 1/4] drm/i915/audio: Add flag to skip device link creation for audio component When there is no direct dependency between audio and display there is no reason to add device link, which forces indirect PM dependency between the independent (in power and clock sense) subsystems. The audio stack takes care of powering up the display codec when needed, but during suspend and resume there is really no need to serialize the two devices. There are still cases when the dependency is valid, like on discrete gfx cards. The default behavior remains the same: device link is added, which can be revised if desired. Signed-off-by: Peter Ujfalusi --- drivers/gpu/drm/i915/display/intel_audio.c | 13 ++++++++----- include/drm/intel/i915_component.h | 6 ++++++ 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_audio.c b/drivers/gpu/drm/i915/display/intel_audio.c index ea935a5d94c872..60439a00969183 100644 --- a/drivers/gpu/drm/i915/display/intel_audio.c +++ b/drivers/gpu/drm/i915/display/intel_audio.c @@ -1260,10 +1260,12 @@ static int intel_audio_component_bind(struct device *drv_kdev, if (drm_WARN_ON(display->drm, acomp->base.ops || acomp->base.dev)) return -EEXIST; - if (drm_WARN_ON(display->drm, - !device_link_add(hda_kdev, drv_kdev, - DL_FLAG_STATELESS))) - return -ENOMEM; + if (!acomp->no_device_link) { + if (drm_WARN_ON(display->drm, + !device_link_add(hda_kdev, drv_kdev, + DL_FLAG_STATELESS))) + return -ENOMEM; + } drm_modeset_lock_all(display->drm); acomp->base.ops = &intel_audio_component_ops; @@ -1289,7 +1291,8 @@ static void intel_audio_component_unbind(struct device *drv_kdev, display->audio.component = NULL; drm_modeset_unlock_all(display->drm); - device_link_remove(hda_kdev, drv_kdev); + if (!acomp->no_device_link) + device_link_remove(hda_kdev, drv_kdev); if (display->audio.power_refcount) drm_err(display->drm, diff --git a/include/drm/intel/i915_component.h b/include/drm/intel/i915_component.h index 4ea3b17aa14396..ed87eb09f768e7 100644 --- a/include/drm/intel/i915_component.h +++ b/include/drm/intel/i915_component.h @@ -51,6 +51,12 @@ struct i915_audio_component { * @aud_sample_rate: the array of audio sample rate per port */ int aud_sample_rate[MAX_PORTS]; + + /** + * @no_device_link: Do not add device link for HDMI audio + */ + bool no_device_link:1; + }; #endif /* _I915_COMPONENT_H_ */ From f98aad252ceb3f8d6c06131353cc6d2c00e612f8 Mon Sep 17 00:00:00 2001 From: Peter Ujfalusi Date: Fri, 13 Jun 2025 16:18:23 +0300 Subject: [PATCH 2/4] ALSA: hda: convert audio_component member of hdac_bus to void pointer The hdac_bus->audio_component is used as a pointer to a 'struct drm_audio_component' or to 'struct i915_audio_component' while it's type is 'struct drm_audio_component'. Convert it to void* to avoid this abuse. Signed-off-by: Peter Ujfalusi --- include/sound/hdaudio.h | 2 +- sound/hda/hdac_component.c | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/include/sound/hdaudio.h b/include/sound/hdaudio.h index 25668eee65cf3e..4e4317d06ac548 100644 --- a/include/sound/hdaudio.h +++ b/include/sound/hdaudio.h @@ -366,7 +366,7 @@ struct hdac_bus { struct mutex lock; /* DRM component interface */ - struct drm_audio_component *audio_component; + void *audio_component; long display_power_status; unsigned long display_power_active; diff --git a/sound/hda/hdac_component.c b/sound/hda/hdac_component.c index 9c82a2864a2fbe..4842ae0df06359 100644 --- a/sound/hda/hdac_component.c +++ b/sound/hda/hdac_component.c @@ -252,10 +252,12 @@ static const struct component_master_ops hdac_component_master_ops = { int snd_hdac_acomp_register_notifier(struct hdac_bus *bus, const struct drm_audio_component_audio_ops *aops) { - if (!bus->audio_component) + struct drm_audio_component *acomp = bus->audio_component; + + if (!acomp) return -ENODEV; - bus->audio_component->audio_ops = aops; + acomp->audio_ops = aops; return 0; } EXPORT_SYMBOL_GPL(snd_hdac_acomp_register_notifier); From 93b739838654072e6864d047f7538e5f8f605930 Mon Sep 17 00:00:00 2001 From: Peter Ujfalusi Date: Fri, 13 Jun 2025 16:22:08 +0300 Subject: [PATCH 3/4] ALSA: hda/i915: Add flag to hdac_bus to disable device link for display audio i915_no_device_link can be set by audio stacks where there is no direct hardware dependency exist between display and HDA. The flag will be passed to acomp->no_device_link for the display stack to skip the creation of the display link if it is set. By default the link creation will remain to ensure that it is skipped only when it is possible by the architecture. Signed-off-by: Peter Ujfalusi --- include/sound/hdaudio.h | 1 + sound/hda/hdac_i915.c | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/include/sound/hdaudio.h b/include/sound/hdaudio.h index 4e4317d06ac548..9e1234be3ea781 100644 --- a/include/sound/hdaudio.h +++ b/include/sound/hdaudio.h @@ -352,6 +352,7 @@ struct hdac_bus { bool not_use_interrupts:1; /* prohibiting the RIRB IRQ */ bool access_sdnctl_in_dword:1; /* accessing the sdnctl register by dword */ bool use_pio_for_commands:1; /* Use PIO instead of CORB for commands */ + bool i915_no_device_link:1; /* Do not add device link for i915 HDMI audio */ int poll_count; diff --git a/sound/hda/hdac_i915.c b/sound/hda/hdac_i915.c index e9425213320eae..b86dd31b67f859 100644 --- a/sound/hda/hdac_i915.c +++ b/sound/hda/hdac_i915.c @@ -118,8 +118,13 @@ static int i915_component_master_match(struct device *dev, int subcomponent, if ((!strcmp(dev->driver->name, "i915") || !strcmp(dev->driver->name, "xe")) && subcomponent == I915_COMPONENT_AUDIO && - connectivity_check(i915_pci, hdac_pci)) + connectivity_check(i915_pci, hdac_pci)) { + struct i915_audio_component *acomp = bus->audio_component; + + acomp->no_device_link = bus->i915_no_device_link; + return 1; + } return 0; } From fec95324dd8f18f4e83216900e68dae4bb266759 Mon Sep 17 00:00:00 2001 From: Peter Ujfalusi Date: Fri, 13 Jun 2025 16:24:23 +0300 Subject: [PATCH 4/4] ASoC: SOF: Intel: hda-codec: Disable display audio device link creation In systems where SOF is used there is no direct dependency between HDA controller and the display stack, there is no need to create the device link. Without the device link it will be allowed to suspend and resume the display and audio hardware in parallel. Signed-off-by: Peter Ujfalusi --- sound/soc/sof/intel/hda-codec.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sound/soc/sof/intel/hda-codec.c b/sound/soc/sof/intel/hda-codec.c index 2f9925830d1d53..1742ffc886c16e 100644 --- a/sound/soc/sof/intel/hda-codec.c +++ b/sound/soc/sof/intel/hda-codec.c @@ -425,6 +425,7 @@ int hda_codec_i915_init(struct snd_sof_dev *sdev) return 0; /* i915 exposes a HDA codec for HDMI audio */ + bus->i915_no_device_link = true; ret = snd_hdac_i915_init(bus); if (ret < 0) return ret;