Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp6565494rwp; Tue, 18 Jul 2023 02:21:06 -0700 (PDT) X-Google-Smtp-Source: APBJJlEDStuhzkP2FeKxEzdAA2AaLsN4AeTIs8EzTdMFPaUaT1WpWGdaaOxZQKNpyQL/ZGANfANn X-Received: by 2002:a05:6a00:21d2:b0:681:142f:e8e3 with SMTP id t18-20020a056a0021d200b00681142fe8e3mr19034962pfj.14.1689672066701; Tue, 18 Jul 2023 02:21:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689672066; cv=none; d=google.com; s=arc-20160816; b=aibBIFCBiPYZKxE4b5Bnzl+zymRJrOsZHa5zo4H+7NhrpASXRocKgx4QjfzrRGhXO4 hwcNJ3a3cqHBtHtRCkt242FLscjcAVZMOzDenIZHzZ5UApZrCFlcOdLcemu3h2pLQA8n sdHn4Pus82SHh6hPrukxsmHeuu2VBGyKW216R9iHrFk1pzYn6L8w0baCrvdeiG1qYtKo 72ojDUBGR2JVZtxdFbSrr5sulYqEGjlRDQL3O2kUd1LZWajE/6FwT1PG1xIEi0zfzh4I W0H7kamywmkzhR6YuAh44Lr8ccR8EOHvb3fsvV86uXznyxPq4YCaCPRkRCkNmQAep9RM XhyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=T1m9uUADQYHrDo6p2qdzULxYJ2ki+mNetnR6h7OmpVc=; fh=dxIo+wp2Pw2j7LKHXvog8zBrh2HlBFjJ3CkiHF3U0aM=; b=FmXxgA+3jq0wPeOyxgFejDqNQPu2VhlL0fhJ64THuGl/fgqG2PpNIwbo0cAZlFgsVt rSx3sQcIANa7W7PiS/UXAOS8YYNxxDjxGU4MLeG6Nam2dxcsYtWg6rJc3QMUn5z70M7t doFk/8Vrz5qPOhQ+phVChTM/KgKuhxwUz+yEnOyNDFVsjB//Eg1pjgnQcbFYV48r+G3h Qgnd/FHBYPyZsLwvMMGQ/7O1bnCbGYTYjAE5DQ182zByMF4LqtyQsXTfZYVVFS5QIaH0 pzkweAcNbOKxUjoyGHoBKJztVkks5SbG1DpAZFMHXlJdVZZmZLLD34OLyQwiTpRj9ZLv Y2yw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a9-20020a056a000c8900b0067e18c6d2d2si1330700pfv.14.2023.07.18.02.20.54; Tue, 18 Jul 2023 02:21:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231438AbjGRJLb (ORCPT + 99 others); Tue, 18 Jul 2023 05:11:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50862 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229573AbjGRJL3 (ORCPT ); Tue, 18 Jul 2023 05:11:29 -0400 Received: from mblankhorst.nl (lankhorst.se [IPv6:2a02:2308:0:7ec:e79c:4e97:b6c4:f0ae]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC47C10C2 for ; Tue, 18 Jul 2023 02:11:26 -0700 (PDT) From: Maarten Lankhorst To: alsa-devel@alsa-project.org Cc: sound-open-firmware@alsa-project.org, linux-kernel@vger.kernel.org, Maarten Lankhorst , Jaroslav Kysela , Takashi Iwai , Cezary Rojewski , Pierre-Louis Bossart , Liam Girdwood , Peter Ujfalusi , Bard Liao , Ranjani Sridharan , Kai Vehmanen , Mark Brown , Daniel Baluta Subject: [PATCH 5/7] ALSA: hda/intel: Move snd_hdac_i915_init to before probe_work. Date: Tue, 18 Jul 2023 10:45:20 +0200 Message-Id: <20230718084522.116952-6-maarten.lankhorst@linux.intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230718084522.116952-1-maarten.lankhorst@linux.intel.com> References: <20230718084522.116952-1-maarten.lankhorst@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Now that we can use -EPROBE_DEFER, it's no longer required to spin off the snd_hdac_i915_init into a workqueue. Use the -EPROBE_DEFER mechanism instead, which must be returned in the probe function. Signed-off-by: Maarten Lankhorst --- sound/pci/hda/hda_intel.c | 58 +++++++++++++++++++++------------------ 1 file changed, 31 insertions(+), 27 deletions(-) diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index 5af1138e745bc..d40345a0088d8 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c @@ -213,6 +213,7 @@ MODULE_DESCRIPTION("Intel HDA driver"); #endif #endif +static DECLARE_BITMAP(probed_devs, SNDRV_CARDS); /* */ @@ -2094,8 +2095,6 @@ static const struct hda_controller_ops pci_hda_ops = { .position_check = azx_position_check, }; -static DECLARE_BITMAP(probed_devs, SNDRV_CARDS); - static int azx_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) { @@ -2174,7 +2173,36 @@ static int azx_probe(struct pci_dev *pci, } #endif /* CONFIG_SND_HDA_PATCH_LOADER */ -#ifndef CONFIG_SND_HDA_I915 +#ifdef CONFIG_SND_HDA_I915 + /* bind with i915 if needed */ + if (chip->driver_caps & AZX_DCAPS_I915_COMPONENT) { + err = snd_hdac_i915_init(azx_bus(chip), false); + if (err < 0) { + /* if the controller is bound only with HDMI/DP + * (for HSW and BDW), we need to abort the probe; + * for other chips, still continue probing as other + * codecs can be on the same link. + */ + if (CONTROLLER_IN_GPU(pci)) { + if (err != -EPROBE_DEFER) + dev_err(card->dev, + "HSW/BDW HD-audio HDMI/DP requires binding with gfx driver\n"); + + clear_bit(chip->dev_index, probed_devs); + pci_set_drvdata(pci, NULL); + snd_device_free(card, chip); + return err; + } else { + /* don't bother any longer */ + chip->driver_caps &= ~AZX_DCAPS_I915_COMPONENT; + } + } + + /* HSW/BDW controllers need this power */ + if (CONTROLLER_IN_GPU(pci)) + hda->need_i915_power = true; + } +#else if (CONTROLLER_IN_GPU(pci)) dev_err(card->dev, "Haswell/Broadwell HDMI/DP must build in CONFIG_SND_HDA_I915\n"); #endif @@ -2274,30 +2302,6 @@ static int azx_probe_continue(struct azx *chip) to_hda_bus(bus)->bus_probing = 1; hda->probe_continued = 1; - /* bind with i915 if needed */ - if (chip->driver_caps & AZX_DCAPS_I915_COMPONENT) { - err = snd_hdac_i915_init(bus, true); - if (err < 0) { - /* if the controller is bound only with HDMI/DP - * (for HSW and BDW), we need to abort the probe; - * for other chips, still continue probing as other - * codecs can be on the same link. - */ - if (CONTROLLER_IN_GPU(pci)) { - dev_err(chip->card->dev, - "HSW/BDW HD-audio HDMI/DP requires binding with gfx driver\n"); - goto out_free; - } else { - /* don't bother any longer */ - chip->driver_caps &= ~AZX_DCAPS_I915_COMPONENT; - } - } - - /* HSW/BDW controllers need this power */ - if (CONTROLLER_IN_GPU(pci)) - hda->need_i915_power = true; - } - /* Request display power well for the HDA controller or codec. For * Haswell/Broadwell, both the display HDA controller and codec need * this power. For other platforms, like Baytrail/Braswell, only the -- 2.39.2