From: Takashi Iwai tiwai@suse.de
[ Upstream commit 161a0c617ab172bbcda7ce61803addeb2124dbff ]
When config table entries don't match with the device to be probed, currently we fall back to SND_INTEL_DSP_DRIVER_ANY, which means to allow any drivers to bind with it.
This was set so with the assumption (or hope) that all controller drivers should cover the devices generally, but in practice, this caused a problem as reported recently. Namely, when a specific kconfig for SOF isn't set for the modern Intel chips like Alderlake, a wrong driver (AVS) got probed and failed. This is because we have entries like:
#if IS_ENABLED(CONFIG_SND_SOC_SOF_ALDERLAKE) /* Alder Lake / Raptor Lake */ { .flags = FLAG_SOF | FLAG_SOF_ONLY_IF_DMIC_OR_SOUNDWIRE, .device = PCI_DEVICE_ID_INTEL_HDA_ADL_S, }, .... #endif
so this entry is effective only when CONFIG_SND_SOC_SOF_ALDERLAKE is set. If not set, there is no matching entry, hence it returns SND_INTEL_DSP_DRIVER_ANY as fallback. OTOH, if the kconfig is set, it explicitly falls back to SND_INTEL_DSP_DRIVER_LEGACY when no DMIC or SoundWire is found -- that was the working scenario. That being said, the current setup may be broken for modern Intel chips that are supposed to work with either SOF or legacy driver when the corresponding kconfig were missing.
For addressing the problem above, this patch changes the fallback driver to the legacy driver, i.e. return SND_INTEL_DSP_DRIVER_LEGACY type as much as possible. When CONFIG_SND_HDA_INTEL is also disabled, the fallback is set to SND_INTEL_DSP_DRIVER_ANY type, just to be sure.
Reported-by: Askar Safin safinaskar@gmail.com Closes: https://lore.kernel.org/all/20251014034156.4480-1-safinaskar@gmail.com/ Tested-by: Askar Safin safinaskar@gmail.com Reviewed-by: Peter Ujfalusi peter.ujfalusi@linux.intel.com Signed-off-by: Takashi Iwai tiwai@suse.de Link: https://patch.msgid.link/20251210131553.184404-1-tiwai@suse.de Signed-off-by: Sasha Levin sashal@kernel.org ---
LLM Generated explanations, may be completely bogus:
## Comprehensive Analysis
### 1. Commit Message Analysis
**Keywords**: "problem", "wrong driver", "failed", "broken"
**Strong positive indicators**: - `Reported-by: Askar Safin` - Real user encountered this bug - `Closes:` link - References actual bug report - `Tested-by: Askar Safin` - Reporter verified the fix works - `Reviewed-by: Peter Ujfalusi` - Intel audio engineer review - `Signed-off-by: Takashi Iwai` - ALSA maintainer
### 2. Code Change Analysis
The change is minimal - only 2-3 lines:
```c // Before: if (!cfg) return SND_INTEL_DSP_DRIVER_ANY;
// After: if (!cfg) return IS_ENABLED(CONFIG_SND_HDA_INTEL) ? SND_INTEL_DSP_DRIVER_LEGACY : SND_INTEL_DSP_DRIVER_ANY; ```
**Technical mechanism of the bug**: 1. Config table entries for Alderlake chips are wrapped in `#if IS_ENABLED(CONFIG_SND_SOC_SOF_ALDERLAKE)` 2. When that Kconfig is not set, entries are compiled out 3. `snd_intel_dsp_find_config()` returns NULL (no match) 4. Code returns `SND_INTEL_DSP_DRIVER_ANY` - letting any driver bind 5. AVS driver may bind first and fail, leaving no working audio
**Why the fix works**: - Returns `SND_INTEL_DSP_DRIVER_LEGACY` when `CONFIG_SND_HDA_INTEL` is enabled - The legacy HDA Intel driver then probes successfully - This matches the behavior at the end of the function (line 742) when config entries exist but don't match conditions
### 3. Classification
This is clearly a **bug fix**: - Fixes wrong driver selection leading to broken audio - Does not add new features or APIs - Uses compile-time conditional - zero runtime overhead
### 4. Scope and Risk Assessment
- **Lines changed**: 2-3 lines - **Files affected**: 1 file - **Complexity**: Very low - single compile-time conditional - **Risk**: Very low - Uses `IS_ENABLED()` which is compile-time evaluation - Preserves original behavior when `CONFIG_SND_HDA_INTEL` is disabled - The legacy driver is the conservative/safe fallback
### 5. User Impact
- **Severity**: High - audio completely broken - **Who is affected**: Users with modern Intel chips (Alderlake, Raptor Lake, etc.) without `CONFIG_SND_SOC_SOF_ALDERLAKE` enabled - **Real-world**: This is a realistic scenario for distribution kernels
### 6. Stability Indicators
- ✓ `Tested-by:` from reporter - ✓ `Reviewed-by:` from Intel engineer - ✓ Author is Takashi Iwai (ALSA maintainer - highly experienced)
### 7. Dependency Check
**Stable tree compatibility verified**: - File exists at `sound/hda/intel-dsp-config.c` in v6.6 and v6.12 stable - The exact code being modified (`if (!cfg) return SND_INTEL_DSP_DRIVER_ANY;`) exists in all active stable kernels - File was recently moved to `sound/hda/core/intel-dsp-config.c` in mainline - stable backport needs path adjustment - No dependencies on other commits
### Conclusion
This commit meets all stable kernel criteria: - ✓ Fixes a real, user-reported bug (broken audio) - ✓ Obviously correct (uses same logic already present elsewhere in the function) - ✓ Small and contained (2-3 lines in one file) - ✓ No new features or APIs - ✓ Well-tested (reporter verified) - ✓ Properly reviewed (Intel engineer + ALSA maintainer) - ✓ Applies to stable trees (with path adjustment for file location)
The bug causes complete audio failure on modern Intel systems with certain kernel configurations. The fix is minimal, low-risk, and uses a compile-time conditional that preserves old behavior as a fallback.
**YES**
sound/hda/core/intel-dsp-config.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/sound/hda/core/intel-dsp-config.c b/sound/hda/core/intel-dsp-config.c index 2a9e35cddcf7c..ddb349bc46bbd 100644 --- a/sound/hda/core/intel-dsp-config.c +++ b/sound/hda/core/intel-dsp-config.c @@ -710,7 +710,8 @@ int snd_intel_dsp_driver_probe(struct pci_dev *pci) /* find the configuration for the specific device */ cfg = snd_intel_dsp_find_config(pci, config_table, ARRAY_SIZE(config_table)); if (!cfg) - return SND_INTEL_DSP_DRIVER_ANY; + return IS_ENABLED(CONFIG_SND_HDA_INTEL) ? + SND_INTEL_DSP_DRIVER_LEGACY : SND_INTEL_DSP_DRIVER_ANY;
if (cfg->flags & FLAG_SOF) { if (cfg->flags & FLAG_SOF_ONLY_IF_SOUNDWIRE &&