From patchwork Fri Feb 8 10:50:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guennadi Liakhovetski X-Patchwork-Id: 10802743 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B99D6922 for ; Fri, 8 Feb 2019 10:51:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A64A02DA64 for ; Fri, 8 Feb 2019 10:51:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9AD252DC80; Fri, 8 Feb 2019 10:51:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,FREEMAIL_FROM, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D59602DA64 for ; Fri, 8 Feb 2019 10:51:05 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id A4A71267492; Fri, 8 Feb 2019 11:51:04 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id B8EF62679D8; Fri, 8 Feb 2019 11:51:02 +0100 (CET) Received: from mout.gmx.net (mout.gmx.net [212.227.15.19]) by alsa0.perex.cz (Postfix) with ESMTP id 19AB1267437 for ; Fri, 8 Feb 2019 11:50:50 +0100 (CET) Received: from axis700.grange ([87.78.226.14]) by mail.gmx.com (mrgmx001 [212.227.17.190]) with ESMTPSA (Nemesis) id 0Lu7a2-1hI0Gr1gww-011REE; Fri, 08 Feb 2019 11:50:27 +0100 Received: by axis700.grange (Postfix, from userid 1000) id D069F61CC2; Fri, 8 Feb 2019 11:50:25 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by axis700.grange (Postfix) with ESMTP id B96BA60824; Fri, 8 Feb 2019 11:50:25 +0100 (CET) Date: Fri, 8 Feb 2019 11:50:25 +0100 (CET) From: Guennadi Liakhovetski X-X-Sender: lyakh@axis700.grange To: alsa-devel@alsa-project.org Message-ID: User-Agent: Alpine 2.20 (DEB 67 2015-01-07) MIME-Version: 1.0 X-Provags-ID: V03:K1:UmFsnp1bTKFxmPySTLw/4vIJLeRqyoIaRe4anoVq8nwG5KcDanY 5766O8vpam7u1YCiTbefnpZixulkDlU/6+W9NLI//Xl5f7qWs5VyEXRyKO2MGIBEEhs5e/q C3eSw2Wwh26IS96uFwsUSIh3KCky8eVFWxDqnfiLJtGFa2BNHSWoO2ZDsZnmZCjTIaFCrf3 Oh60dwQ4DJiV/AqzV8IFw== X-UI-Out-Filterresults: notjunk:1;V03:K0:eYcCIP26q0w=:2Jc4GbHtuUnYxAXEjyDa/W 2yLimt/QyFRWokGhnFssMntyalp3Beimn+XpcvvLo4phq0BsTqG1rEUqYr+jASxtYDGuW4ZEe du8Dh1qqQUqK2zedGvPrx5+PtJj+nhGCBxNadiPLFgSk0tynevMAvgKF9SDyCQsAzhwj/KXM7 PaMI6wYcuBkGhKN8A8+41uODfQN2kh6Aq/9z4LW2mYd1vwQXq3y+X6XduaWSr3xqydwWwPOxE rRIzIBCWTJ6lXo8WM3axKC/kZ7sInB15QZdxSZ8G3/diYGvuzH9SHJQd1u3/skALXqW22GsJ/ DoH9gQSaSkck2/R2ESsidGWvWHRrcyvB4SYI2PCY6VQkd8y4HknoO5HT9AT/c7HvIqltUr2u1 E50JVA/B4vywg6g276dbt1yS61tBGzfhHUi8DcwD3GWMK9YoVo+jniTVSonwuXhvJUZyaA86E oilvbjKRfxQqv1JhqBlIA5kFQ7QfAaEPJIHXbRJO+rs8WKNmQyocFHJsKJ97doXro5Rua+oTe z2/zRsqP92TZG3iNiTyiaxz9r0aCICE5ln51p/VZ2v+cmXG2x+uesg7wlsdWgJ9XXhNUvv3bc PrlArqyUO8nP6QIfE6b6ydCBaz+EDLzk7HwbOGR2eVoP+PoRT1xjVu7gbsWAvPleELiEV9YHz uGP3m9ex476v4A9iXb7BGIYFjWlhnVTU29yiDMO+pwrORqcdoS/bfPB6zMT7QW6Hk+siY4lWO +QwHwQuMGny/oB4/NeqvSAqH9OEDu6myvgOMWQMlbTWSrGUJIBG2IsFMKuDcX2gLxbRLL+2Q5 ppcg2JO9/kTQPl/bwlK0ZbneojHdpqkUqWqZajYHimxwL5Ka8SZdI4Zi7awISZmoNEbtvhbbG v72TN88c8Sm5XCXezCdtnju1KfTd3pKSBj3LoePfq1Ta7dZGg+BcxypPdPak2CwpBlKdvk6XQ rDrn+qLA6bQ== Cc: Hans de Goede , Takashi Iwai , Pierre-Louis Bossart Subject: [alsa-devel] [PATCH RFC/untested] hda-intel: suspend HDA codecs and the PCI device in error cases X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP From: Guennadi Liakhovetski If HDA probing on Intel platforms fails, all the devices, that have previously been powered up, have to be suspended again. Signed-off-by: Guennadi Liakhovetski --- I came across HDA not suspending when no codec driver has successfully probed while working on SOF. Then I decided to look how this is handled in the mainline Intel HDA code and I think something like this patch is needed, however, I don't have a set up to test it. I haven't looked at the tegra HDA implementation, possibly they need something similar. Please, comment. sound/pci/hda/hda_intel.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c index e784130..d3caa37 100644 --- a/sound/pci/hda/hda_intel.c +++ b/sound/pci/hda/hda_intel.c @@ -2229,14 +2229,14 @@ static int azx_probe_continue(struct azx *chip) /* create codec instances */ err = azx_probe_codecs(chip, azx_max_codecs[chip->driver_type]); if (err < 0) - goto out_free; + goto out_power_down; #ifdef CONFIG_SND_HDA_PATCH_LOADER if (chip->fw) { err = snd_hda_load_patch(&chip->bus, chip->fw->size, chip->fw->data); if (err < 0) - goto out_free; + goto out_power_down; #ifndef CONFIG_PM release_firmware(chip->fw); /* no longer needed */ chip->fw = NULL; @@ -2246,12 +2246,12 @@ static int azx_probe_continue(struct azx *chip) if ((probe_only[dev] & 1) == 0) { err = azx_codec_configure(chip); if (err < 0) - goto out_free; + goto out_power_down; } err = snd_card_register(chip->card); if (err < 0) - goto out_free; + goto out_power_down; setup_vga_switcheroo_runtime_pm(chip); @@ -2260,6 +2260,7 @@ static int azx_probe_continue(struct azx *chip) set_default_power_save(chip); +out_power_down: if (azx_has_pm_runtime(chip)) pm_runtime_put_autosuspend(&pci->dev);