Received: by 2002:a05:6358:701b:b0:131:369:b2a3 with SMTP id 27csp4283686rwo; Tue, 25 Jul 2023 03:52:33 -0700 (PDT) X-Google-Smtp-Source: APBJJlGg70TsyYTc1v//Txtmy+e4a4Vkrzqn8UrD+p+4GBGEZXBmADn0H96MgShMUWZ7hYa+FzU9 X-Received: by 2002:a05:6512:3b0b:b0:4fd:fecf:5d57 with SMTP id f11-20020a0565123b0b00b004fdfecf5d57mr2279597lfv.39.1690282353096; Tue, 25 Jul 2023 03:52:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690282353; cv=none; d=google.com; s=arc-20160816; b=Rp2VgT8Kwj4iua2plkRlVl21MLzmNoEhsskOGQq8W6lfChjw3HB8PKW+yH6Y9uYn0c XhqLMJpXzBo7JkIT1uMNpMxk3A+x2dIqRv3UiPELCSZRHOU4Dh1qC5racGnOhC4NkRNT 8MEcLGFVk00VOeZyBt3pRYf36PzQVhG4JiP8Kclnxu7Mg+sJ9eGWzf91XVLKkUSE8gjS CSPlR+HVZtZK1tDjOVeVwaKCVL01XFWlPLQlTzmTeMOv/mSVjeyHpOihOca7iagr9qWp PurJP1txUymKdJRnZypDh/OuFuVBUFgV6YyDfZBReVsewnIcicZpFJRGAnClUP2YWqND J42w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=D7NkZVkNERf7GE73BfSO6JkemZd7uUcmG+Q/dioiOGg=; fh=pQOFpwebVXpjafJEFIqJCppAbPPr6UGQUjLQC8pdxVc=; b=GB2H0ZV650ZtzecAPDaw6/1wLyNlZp9/QbO8mMx50HUK6W948E2AOBhyJMwKda2eAe Q1Hnfiv9Fp4/cuG+roQCMfx2QZI8XoZppj0zmbQ9T3GOGSVG3tbc2rFEnEPmW+LDYS+P BYpCHszX7zkFkCxtW6P2x5CKg6M/v2DUVLqrrvKa/yiuTxH1anywr65FSaP0b6yQnJLA AZOTYbb5iV/IaK+Hrdk2Q7lCco1p7z9BjhcI0fLUu6y9ogTyu7loJux+Hlzx0Viq7vMt smie5B13OCFvbu+CfkiJ3fuN9qGr1Ge2m8EVazsVBHEusYEeqUVCv/HCnPQyABBUM9Nl 9WZA== 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 c22-20020aa7c996000000b00521820ef030si8246497edt.214.2023.07.25.03.52.08; Tue, 25 Jul 2023 03:52:33 -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 S232070AbjGYKN0 (ORCPT + 99 others); Tue, 25 Jul 2023 06:13:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39426 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229713AbjGYKNY (ORCPT ); Tue, 25 Jul 2023 06:13:24 -0400 Received: from mblankhorst.nl (lankhorst.se [141.105.120.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B69AB10C9 for ; Tue, 25 Jul 2023 03:13:23 -0700 (PDT) Message-ID: <35720f76-e8b0-578b-e326-ebfce536be04@linux.intel.com> Date: Tue, 25 Jul 2023 12:13:20 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: [PATCH v2 7/9] ALSA: hda/intel: Move snd_hdac_i915_init to before probe_work. Content-Language: en-US To: Pierre-Louis Bossart , alsa-devel@alsa-project.org Cc: sound-open-firmware@alsa-project.org, linux-kernel@vger.kernel.org, Jaroslav Kysela , Takashi Iwai , Cezary Rojewski , Liam Girdwood , Peter Ujfalusi , Bard Liao , Ranjani Sridharan , Kai Vehmanen , Mark Brown , Daniel Baluta References: <20230719164141.228073-1-maarten.lankhorst@linux.intel.com> <20230719164141.228073-8-maarten.lankhorst@linux.intel.com> From: Maarten Lankhorst In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,NICE_REPLY_A, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham 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 Hey, On 2023-07-24 12:58, Pierre-Louis Bossart wrote: > > > On 7/19/23 18:41, Maarten Lankhorst wrote: >> 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 >> --- >> 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 11cf9907f039f..e3128d7d742e7 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 > > Is it intentional that the display_power() is left in the probe workqueue? > > this piece of code follows the stuff above in the existing code? > > /* 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 > * display codec needs the power and it can be released after probe. > */ > display_power(chip, true); I think for the binding itself, there isn't any harm. We are not poking any hardware when binding, only software. This appears to be true on the i915 side as well. Cheers, ~Maarten