From: Maarten Lankhorst maarten.lankhorst@linux.intel.com
commit 2e8c90386db48e425997ca644fa40876b2058b30 upstream.
Selecting CONFIG_DRM selects CONFIG_VIDEO_NOMODESET, which exports video_firmware_drivers_only(). This can be used as a first approximation on whether i915 will be available. It's safe to use as this is only built when CONFIG_SND_HDA_I915 is selected by CONFIG_I915.
It's not completely fool proof, as you can boot with "nomodeset i915.modeset=1" to make i915 load regardless, or use "i915.force_probe=!*" to never load i915, but the common case of booting with nomodeset to disable all GPU drivers this will work as intended.
Because of this, we add an extra module parameter, snd_hda_core.gpu_bind that can be used to signal users intent. -1 follows nomodeset, 0 disables binding, 1 forces wait/-EPROBE_DEFER on binding.
Signed-off-by: Maarten Lankhorst maarten.lankhorst@linux.intel.com Reviewed-by: Peter Ujfalusi peter.ujfalusi@linux.intel.com Reviewed-by: Kai Vehmanen kai.vehmanen@linux.intel.com Reviewed-by: Pierre-Louis Bossart pierre-louis.bossart@linux.intel.com Link: https://lore.kernel.org/r/20231009115437.99976-7-maarten.lankhorst@linux.int... Signed-off-by: Takashi Iwai tiwai@suse.de Signed-off-by: Vasiliy Kovalev kovalev@altlinux.org --- sound/hda/hdac_i915.c | 9 +++++++++ 1 file changed, 9 insertions(+)
diff --git a/sound/hda/hdac_i915.c b/sound/hda/hdac_i915.c index b428537f284c7..a4a712c795c3d 100644 --- a/sound/hda/hdac_i915.c +++ b/sound/hda/hdac_i915.c @@ -10,6 +10,12 @@ #include <sound/hdaudio.h> #include <sound/hda_i915.h> #include <sound/hda_register.h> +#include <video/nomodeset.h> + +static int gpu_bind = -1; +module_param(gpu_bind, int, 0644); +MODULE_PARM_DESC(gpu_bind, "Whether to bind sound component to GPU " + "(1=always, 0=never, -1=on nomodeset(default))");
/** * snd_hdac_i915_set_bclk - Reprogram BCLK for HSW/BDW @@ -122,6 +128,9 @@ static int i915_gfx_present(struct pci_dev *hdac_pci) { struct pci_dev *display_dev = NULL;
+ if (!gpu_bind || (gpu_bind < 0 && video_firmware_drivers_only())) + return false; + for_each_pci_dev(display_dev) { if (display_dev->vendor == PCI_VENDOR_ID_INTEL && (display_dev->class >> 16) == PCI_BASE_CLASS_DISPLAY &&
Hi,
04.07.2024 16:27, kovalev@altlinux.org wrote:
From: Maarten Lankhorst maarten.lankhorst@linux.intel.com
commit 2e8c90386db48e425997ca644fa40876b2058b30 upstream.
This patch does not fix anything, but it allows you to have a working sound with a normal initialization time on newer chips. On machines whose video chips are not fully supported by the i915 driver, running with KMS disabled, a binding error occurs for future hdmi codec settings:
snd_hda_intel: couldn't find with audio component
This leads either to a long delay in initializing the rest of the audio (codec 0), or to an error and a complete lack of sound. There are no such problems with this patch if you add the "nomodeset" kernel parameter.
linux-stable-mirror@lists.linaro.org