From patchwork Thu Apr 30 13:17:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hui Wang X-Patchwork-Id: 1280402 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49CbY61BK0z9sSw; Thu, 30 Apr 2020 23:18:18 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1jU94w-0000hE-A8; Thu, 30 Apr 2020 13:18:14 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1jU94u-0000ga-DU for kernel-team@lists.ubuntu.com; Thu, 30 Apr 2020 13:18:12 +0000 Received: from [123.114.59.112] (helo=localhost.localdomain) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1jU94t-0002Cg-D5 for kernel-team@lists.ubuntu.com; Thu, 30 Apr 2020 13:18:12 +0000 From: Hui Wang To: kernel-team@lists.ubuntu.com Subject: [SRU][E/F/unstable][PATCH RESEND 1/1] UBUNTU: SAUCE: ASoC: intel/skl/hda - fix oops on systems without i915 audio codec Date: Thu, 30 Apr 2020 21:17:53 +0800 Message-Id: <20200430131753.7381-2-hui.wang@canonical.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200430131753.7381-1-hui.wang@canonical.com> References: <20200430131753.7381-1-hui.wang@canonical.com> X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Kai Vehmanen BugLink: https://bugs.launchpad.net/bugs/1874359 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: 3a24f135e6cc ("ASoC: intel/skl/hda - set autosuspend timeout for hda codecs") Signed-off-by: Kai Vehmanen Reviewed-by: Pierre-Louis Bossart Reviewed-by: Ranjani Sridharan Link: https://lore.kernel.org/r/20200420205431.13070-1-kai.vehmanen@linux.intel.com Signed-off-by: Mark Brown (backported from commit 5bf73b1b1deca46c7459cb4d732ba8bad6da93c5 git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git) Signed-off-by: Hui Wang Acked-by: Kleber Sacilotto de Souza --- sound/soc/intel/boards/skl_hda_dsp_generic.c | 34 +++++++++++--------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/sound/soc/intel/boards/skl_hda_dsp_generic.c b/sound/soc/intel/boards/skl_hda_dsp_generic.c index ab2bec029768..122f4017babf 100644 --- a/sound/soc/intel/boards/skl_hda_dsp_generic.c +++ b/sound/soc/intel/boards/skl_hda_dsp_generic.c @@ -151,23 +151,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) { - struct snd_soc_pcm_runtime *rtd = - list_first_entry(&card->rtd_list, - struct snd_soc_pcm_runtime, list); - struct snd_soc_dai *codec_dai = rtd->codec_dai; + struct snd_soc_pcm_runtime *rtd; struct hdac_hda_priv *hda_pvt; - - if (!codec_dai) - return; - - /* - * all codecs are on the same bus, so it's sufficient - * to lookup the first runtime and its codec, and set - * 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, - HDA_CODEC_AUTOSUSPEND_DELAY_MS); + struct snd_soc_dai *dai; + + for_each_card_rtds(card, rtd) { + if (!strstr(rtd->dai_link->codecs->name, "ehdaudio")) + continue; + dai = rtd->codec_dai; + hda_pvt = snd_soc_component_get_drvdata(dai->component); + if (hda_pvt) { + /* + * all codecs are on the same bus, so it's sufficient + * to look up only the first one + */ + snd_hda_set_power_save(hda_pvt->codec.bus, + HDA_CODEC_AUTOSUSPEND_DELAY_MS); + break; + } + } } static int skl_hda_audio_probe(struct platform_device *pdev)