Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp94164pxb; Thu, 20 Jan 2022 09:31:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJyij2nFNAA8QIA4rw8H8cg6TuMnDcTfZjxv3cgERr3u9n6T5fGft6p2Mh1cfS9DqB6PNddJ X-Received: by 2002:a05:6a00:998:b0:4c4:455:cebc with SMTP id u24-20020a056a00099800b004c40455cebcmr21787551pfg.67.1642699866686; Thu, 20 Jan 2022 09:31:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642699866; cv=none; d=google.com; s=arc-20160816; b=x/kYbtmFEGVCa8jyGROyGl8fPXtPk6ieZc46/aWTtk4SLnw3Ieq//V3Xc//lzeXU5P XZqe2/2AP7cLQGqQ7Kv12nSdxos2i39piAkYk7oJFwU54oeoTfK3VPvHLTwID0DP8IIU ijYcF2/22abvVLlx6PUIAKgUQWH5QhzdwuFBxpX42PqPB+da6Gt+AsXrXMjOWH8RineJ uQkbXZUSWwvsL/4RRcIxxB6Jef2DIbPAJiXPkBN1LFcE/qYmVAnp73Ft3l3mju3op/3i dGpeoFpdZoto426vx0g8R/olM4IJl60FRMuI+Xa/a9+fZgeNreW+2U8HvmoH/viDZ0SN ZVeg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ta9ZQBiaqwCJHJ7hDD3zMJiJ6HVAhAUkKU+pRjROT30=; b=DuqtqJwqNR4VuaKOzueqq6ZYsWYeutOMscQKsCVVrJJCqgxRvJ6SXCCs/pK6qNscy1 C+vjPsQJywWMvsF/bd7Mut1u7VwgL8duE7dXwNdRuFlwxjdXc0g7MbXSE55tJa6zooBd z57acFttNNbAm7TdmnvHmBHviZmVsAEB7N3MnXNDPXRV+XkM99510Fa1oQJG8Zvawdx2 iDTi3aLoX/Rjgl+IJJEb9hp+Tr7laco4hPeApvAJarH/GYE+P9OvoCNWhSyplaVM6zZ3 g+kOx29tbHGIEa61ljaHU2DiPcR7awsufNKMXcWu/36mLZYOxTotLK7hlDdHQYg/jiVS HSxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xhX2CtB3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j184si3911076pge.347.2022.01.20.09.30.44; Thu, 20 Jan 2022 09:31:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xhX2CtB3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347188AbiARQOg (ORCPT + 99 others); Tue, 18 Jan 2022 11:14:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51616 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347560AbiARQMv (ORCPT ); Tue, 18 Jan 2022 11:12:51 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 00E3CC061343; Tue, 18 Jan 2022 08:11:51 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 945FD6128A; Tue, 18 Jan 2022 16:11:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 737AEC00446; Tue, 18 Jan 2022 16:11:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1642522310; bh=hTRDEN/X1rHYkMuWknx8N7RQeDUfodJ/6qtI+kqvAZE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xhX2CtB3PvA+IIz0ha4z3ZfjN8RMJR5SuRYzTUP1WjSlq7KLORD/pqeH0CHnEKrIE zcC2YQp+9u4fFkdlU2VvYV6mKEpALYfY/aYvmX4ior9jv4yvMEtxIn9fD352D3K19T Bc2NpaiAk5QJ4dNAsO5/G+vhdssyGQ7GMD/nfyjE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sameer Pujar , Dmitry Osipenko , Takashi Iwai Subject: [PATCH 5.16 26/28] ALSA: hda/tegra: Fix Tegra194 HDA reset failure Date: Tue, 18 Jan 2022 17:06:21 +0100 Message-Id: <20220118160453.263982133@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220118160452.384322748@linuxfoundation.org> References: <20220118160452.384322748@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sameer Pujar commit d278dc9151a034674b31ffeda24cdfb0073570f3 upstream. HDA regression is recently reported on Tegra194 based platforms. This happens because "hda2codec_2x" reset does not really exist in Tegra194 and it causes probe failure. All the HDA based audio tests fail at the moment. This underlying issue is exposed by commit c045ceb5a145 ("reset: tegra-bpmp: Handle errors in BPMP response") which now checks return code of BPMP command response. Fix this issue by skipping unavailable reset on Tegra194. Cc: stable@vger.kernel.org Signed-off-by: Sameer Pujar Reviewed-by: Dmitry Osipenko Link: https://lore.kernel.org/r/1640260431-11613-2-git-send-email-spujar@nvidia.com Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman --- sound/pci/hda/hda_tegra.c | 43 ++++++++++++++++++++++++++++++++++--------- 1 file changed, 34 insertions(+), 9 deletions(-) --- a/sound/pci/hda/hda_tegra.c +++ b/sound/pci/hda/hda_tegra.c @@ -68,14 +68,20 @@ */ #define TEGRA194_NUM_SDO_LINES 4 +struct hda_tegra_soc { + bool has_hda2codec_2x_reset; +}; + struct hda_tegra { struct azx chip; struct device *dev; - struct reset_control *reset; + struct reset_control_bulk_data resets[3]; struct clk_bulk_data clocks[3]; + unsigned int nresets; unsigned int nclocks; void __iomem *regs; struct work_struct probe_work; + const struct hda_tegra_soc *soc; }; #ifdef CONFIG_PM @@ -170,7 +176,7 @@ static int __maybe_unused hda_tegra_runt int rc; if (!chip->running) { - rc = reset_control_assert(hda->reset); + rc = reset_control_bulk_assert(hda->nresets, hda->resets); if (rc) return rc; } @@ -187,7 +193,7 @@ static int __maybe_unused hda_tegra_runt } else { usleep_range(10, 100); - rc = reset_control_deassert(hda->reset); + rc = reset_control_bulk_deassert(hda->nresets, hda->resets); if (rc) return rc; } @@ -427,9 +433,17 @@ static int hda_tegra_create(struct snd_c return 0; } +static const struct hda_tegra_soc tegra30_data = { + .has_hda2codec_2x_reset = true, +}; + +static const struct hda_tegra_soc tegra194_data = { + .has_hda2codec_2x_reset = false, +}; + static const struct of_device_id hda_tegra_match[] = { - { .compatible = "nvidia,tegra30-hda" }, - { .compatible = "nvidia,tegra194-hda" }, + { .compatible = "nvidia,tegra30-hda", .data = &tegra30_data }, + { .compatible = "nvidia,tegra194-hda", .data = &tegra194_data }, {}, }; MODULE_DEVICE_TABLE(of, hda_tegra_match); @@ -449,6 +463,8 @@ static int hda_tegra_probe(struct platfo hda->dev = &pdev->dev; chip = &hda->chip; + hda->soc = of_device_get_match_data(&pdev->dev); + err = snd_card_new(&pdev->dev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1, THIS_MODULE, 0, &card); if (err < 0) { @@ -456,11 +472,20 @@ static int hda_tegra_probe(struct platfo return err; } - hda->reset = devm_reset_control_array_get_exclusive(&pdev->dev); - if (IS_ERR(hda->reset)) { - err = PTR_ERR(hda->reset); + hda->resets[hda->nresets++].id = "hda"; + hda->resets[hda->nresets++].id = "hda2hdmi"; + /* + * "hda2codec_2x" reset is not present on Tegra194. Though DT would + * be updated to reflect this, but to have backward compatibility + * below is necessary. + */ + if (hda->soc->has_hda2codec_2x_reset) + hda->resets[hda->nresets++].id = "hda2codec_2x"; + + err = devm_reset_control_bulk_get_exclusive(&pdev->dev, hda->nresets, + hda->resets); + if (err) goto out_free; - } hda->clocks[hda->nclocks++].id = "hda"; hda->clocks[hda->nclocks++].id = "hda2hdmi";