Commit 5bf73b1b authored by Kai Vehmanen's avatar Kai Vehmanen Committed by Mark Brown

ASoC: intel/skl/hda - fix oops on systems without i915 audio codec

Recent fix for jack detection caused a regression on systems with HDA
audio codec but no HDMI/DP audio via i915 graphics, leading to a kernel
oops at device probe. On these systems, HDA bus instance lookup fails,
as the first ASoC runtime of the card is connected to a dummy codec
(as no HDMI codec is present).

Fixes: 3a24f135 ("ASoC: intel/skl/hda - set autosuspend timeout for hda codecs")
Signed-off-by: default avatarKai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: default avatarRanjani Sridharan <ranjani.sridharan@linux.intel.com>
Link: https://lore.kernel.org/r/20200420205431.13070-1-kai.vehmanen@linux.intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 787a46c0
...@@ -172,23 +172,25 @@ static int skl_hda_fill_card_info(struct snd_soc_acpi_mach_params *mach_params) ...@@ -172,23 +172,25 @@ static int skl_hda_fill_card_info(struct snd_soc_acpi_mach_params *mach_params)
static void skl_set_hda_codec_autosuspend_delay(struct snd_soc_card *card) static void skl_set_hda_codec_autosuspend_delay(struct snd_soc_card *card)
{ {
struct snd_soc_pcm_runtime *rtd = struct snd_soc_pcm_runtime *rtd;
list_first_entry(&card->rtd_list,
struct snd_soc_pcm_runtime, list);
struct snd_soc_dai *codec_dai = asoc_rtd_to_codec(rtd, 0);
struct hdac_hda_priv *hda_pvt; struct hdac_hda_priv *hda_pvt;
struct snd_soc_dai *dai;
if (!codec_dai)
return; for_each_card_rtds(card, rtd) {
if (!strstr(rtd->dai_link->codecs->name, "ehdaudio"))
continue;
dai = asoc_rtd_to_codec(rtd, 0);
hda_pvt = snd_soc_component_get_drvdata(dai->component);
if (hda_pvt) {
/* /*
* all codecs are on the same bus, so it's sufficient * all codecs are on the same bus, so it's sufficient
* to lookup the first runtime and its codec, and set * to look up only the first one
* power save defaults for all codecs on the bus
*/ */
hda_pvt = snd_soc_component_get_drvdata(codec_dai->component);
snd_hda_set_power_save(hda_pvt->codec.bus, snd_hda_set_power_save(hda_pvt->codec.bus,
HDA_CODEC_AUTOSUSPEND_DELAY_MS); HDA_CODEC_AUTOSUSPEND_DELAY_MS);
break;
}
}
} }
static int skl_hda_audio_probe(struct platform_device *pdev) static int skl_hda_audio_probe(struct platform_device *pdev)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment