Received: by 2002:a05:6359:6284:b0:131:369:b2a3 with SMTP id se4csp2742320rwb; Mon, 7 Aug 2023 02:43:45 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGz/UTuqQ8ky9bViVgbtmEJdgfoQgQAClE7iOdHkJKqKDhWynJnzYzZ1jT8nwEngBvc7JZd X-Received: by 2002:a17:906:156:b0:99b:5ba6:f2cf with SMTP id 22-20020a170906015600b0099b5ba6f2cfmr6623941ejh.26.1691401425421; Mon, 07 Aug 2023 02:43:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691401425; cv=none; d=google.com; s=arc-20160816; b=UddaDQvEJJUs83U8fYWbHsgolh1va/m4TE1kZg4PKvW1jQlqjfTibaZSge5wJh4OaH 3zW+bbWZOQ6Xzi+KMdZQ7Ve26ZmUeAA9I7w7QDhyHQtz5bpzDz1zPTraAZhg/5s83YyY V0Xy5CRTe4pRLG4QFqgdwBUOZZ9pswnBl4XW0oo0sVPcgvuxYQ05PFM8hC7vlgjHxAKS L06OH/qX6Dz6HOVjwMW9yTlfn/hnsEKkq0eJi171MGhJEM+AoOWuxO2rCDkaYwNWacbT gsBmoRxCAQx6JYDrVp2l6eiwjPOAIOnsCioDh+XmmAeyuacWzkv53inkLq4mtHmg3UWC s7lw== 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=gdNOwqkjUyEVqFGCpsaX5r8PQXCk4kooVBAUK1fmwJc=; fh=BXAiiC6ODviiKux+ApVm3yEF4jvtq/D5DoYh0OgxZlk=; b=CZzGfSqPTFLzetkIDjQgiauKys/6xYha4yMFGRqrgIVU2zLzJSUH8mk3eYQmX8IIID OJxzg1HUZYzv/Dezl/SD8K92+aKkuiyryLOGBXSdY69aYiDXqjntiWh82jFZtL40OmRW IkrP+FK+oIOCQnx/ycS/rO1wZAtAS1zfCmIK3XyD4os26iaT/yZcwpufc1ESJzUMJuZ8 V3xHuA6kPQfiH2lA59LfD2oI5zQKByM/FAzcLLFIExHTFabD3ixzTGy8fZn88vgBDAWc wYYbguA2sVok3Bm+BqIzleUOovH+vZWf1SDziVn8HZAI/oFjua5kihnvk1nmNLWIHlt3 Lvyw== 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 j1-20020a1709064b4100b0099cbccaed7dsi2957687ejv.905.2023.08.07.02.43.20; Mon, 07 Aug 2023 02:43:45 -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 S231461AbjHGJCS (ORCPT + 99 others); Mon, 7 Aug 2023 05:02:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43632 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231241AbjHGJBs (ORCPT ); Mon, 7 Aug 2023 05:01:48 -0400 Received: from mblankhorst.nl (lankhorst.se [IPv6:2a02:2308:0:7ec:e79c:4e97:b6c4:f0ae]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 465221991 for ; Mon, 7 Aug 2023 02:01:38 -0700 (PDT) From: Maarten Lankhorst To: alsa-devel@alsa-project.org Cc: 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 , linux-kernel@vger.kernel.org, sound-open-firmware@alsa-project.org, Maarten Lankhorst Subject: [PATCH v3 7/9] ALSA: hda/intel: Move snd_hdac_i915_init to before probe_work. Date: Mon, 7 Aug 2023 11:00:43 +0200 Message-Id: <20230807090045.198993-8-maarten.lankhorst@linux.intel.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230807090045.198993-1-maarten.lankhorst@linux.intel.com> References: <20230807090045.198993-1-maarten.lankhorst@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,SPF_HELO_NONE,SPF_NONE 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. Changes since v1: - Use dev_err_probe() - Don't move probed_devs bitmap unnecessarily. (tiwai) - Move snd_hdac_i915_init slightly upward, to ensure it's always initialised before vga-switcheroo is called. Signed-off-by: Maarten Lankhorst Reviewed-by: Kai Vehmanen --- sound/pci/hda/hda_intel.c | 59 ++++++++++++++++++++------------------- 1 file changed, 30 insertions(+), 29 deletions(-) diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index 11cf9907f039..e3128d7d742e 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c @@ -2147,6 +2147,36 @@ static int azx_probe(struct pci_dev *pci, pci_set_drvdata(pci, card); +#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)) { + dev_err_probe(card->dev, err, + "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; + } +#else + if (CONTROLLER_IN_GPU(pci)) + dev_err(card->dev, "Haswell/Broadwell HDMI/DP must build in CONFIG_SND_HDA_I915\n"); +#endif + err = register_vga_switcheroo(chip); if (err < 0) { dev_err(card->dev, "Error registering vga_switcheroo client\n"); @@ -2174,11 +2204,6 @@ static int azx_probe(struct pci_dev *pci, } #endif /* CONFIG_SND_HDA_PATCH_LOADER */ -#ifndef CONFIG_SND_HDA_I915 - if (CONTROLLER_IN_GPU(pci)) - dev_err(card->dev, "Haswell/Broadwell HDMI/DP must build in CONFIG_SND_HDA_I915\n"); -#endif - if (schedule_probe) schedule_delayed_work(&hda->probe_work, 0); @@ -2275,30 +2300,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