Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp2511825rwb; Mon, 3 Oct 2022 01:39:24 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6GC9EJaFMnfhxOWeeRYJfl4ojEgAjPa4vWaG83nXQnmq578Gjs5fCErR2gcHNCVGBDObe3 X-Received: by 2002:a05:6a00:1a44:b0:52a:ecd5:bbef with SMTP id h4-20020a056a001a4400b0052aecd5bbefmr21169333pfv.28.1664786364546; Mon, 03 Oct 2022 01:39:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664786364; cv=none; d=google.com; s=arc-20160816; b=ym7wmZgKZxBNxe8d5WrBWMgUs/f2pTiH65KHgoLv1THjw+71THJEcAJeVtppKBRuU9 aNV9tPPJ45yMOQwLXagcLjIEZFp/IuyKpvh/zjfJsuYeoIALsllUUG4BoaSXfrJ83MNn v7fzaE/VpkDWkIV5LoMtzCrxZZ2YxDtNPzzUCVcbU10KfFMpix8i6COsr35np6itDSUU IiX514DUzmkTNf8lbM1L3cUVF0SsTgSjBtO5wcAeF5JcgOYYysBO6MvzyqQMn1fiaofg 7iER5Ev1kpLshCyJhb5ePdKUyXDEqxgW2OWUd1RPeJBkSPnmoLV5cd1gBYE+YobbE0pj VJUg== 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=KB5AMQOfqzP7c/uvW6j/zjZB+2rgpqs5iY6UgiB7eVM=; b=WhIr91aMPEi3bGKyM4ZZYpCI8j2lsrmE2KVAboHvf9JFedA5uZIIz3hWhMdxJX7kr4 7WZCGisLUy3X0Wz72kDrOx1j1dznCJQl8WWS/95ijANhW1yB4Mh4hNO2MzYn5AN323GE OYE3RLWTSEAbNOkK/oJmrXZOWUIlDMY7PZGXxcWcwu+MDD9XDqCrUD/h/vxUbfL8T9WS S1lEU43uwcCMeQ+4qgsIQmtJzHpAOYPxw23SfnoEwj4sYSxt/Ki2GkuWhmvjgHlZL8TR dc4mCqsvod9rYe08Pzv6NQRFTIRQWoadzFCuxFlzyH1b15Rrm2wb4RfRQUyUjAhgqsVX iIpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=pwCxtDZX; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c4-20020a056a00248400b00558991a667esi10496938pfv.359.2022.10.03.01.39.13; Mon, 03 Oct 2022 01:39:24 -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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=pwCxtDZX; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231605AbiJCHfv (ORCPT + 99 others); Mon, 3 Oct 2022 03:35:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34794 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231811AbiJCHec (ORCPT ); Mon, 3 Oct 2022 03:34:32 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D48251A10; Mon, 3 Oct 2022 00:21:39 -0700 (PDT) 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 ams.source.kernel.org (Postfix) with ESMTPS id B45F9B80E90; Mon, 3 Oct 2022 07:21:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3194DC433D6; Mon, 3 Oct 2022 07:21:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664781691; bh=62Pl46htK72DjfHHFb8qdc35jiu2sPDKD2CkDTpVmUU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pwCxtDZXtYSg5VviYyd1boeSbbc/vLyaw30d8NFZA4yp2N4pLwrWOvG6p0/f/WzdV g3vK3hO4+2hQEsn3HpY7d/Js99N+XT60QNdTtvW0tZOuxmmoq7bPN1TcLmz52q9S+X mp1jSNLP0SY8LI4X4YbrTNeNsxH+WoFBpcQ4W2es= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dmitry Osipenko , Takashi Iwai , Sasha Levin , Peter Geis , Matt Merhar , Nicolas Chauvet Subject: [PATCH 5.10 04/52] ALSA: hda/tegra: Reset hardware Date: Mon, 3 Oct 2022 09:11:11 +0200 Message-Id: <20221003070718.834758818@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221003070718.687440096@linuxfoundation.org> References: <20221003070718.687440096@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 From: Dmitry Osipenko [ Upstream commit 87f0e46e7559beb6f1d1ff99f8f48b1b9d86db52 ] Reset hardware on RPM-resume in order to bring it into a predictable state. Tested-by: Peter Geis # Ouya T30 audio works Tested-by: Matt Merhar # Ouya T30 boot-tested Tested-by: Nicolas Chauvet # TK1 boot-tested Signed-off-by: Dmitry Osipenko Link: https://lore.kernel.org/r/20210120003154.26749-3-digetx@gmail.com Signed-off-by: Takashi Iwai Stable-dep-of: f89e409402e2 ("ALSA: hda: Fix Nvidia dp infoframe") Signed-off-by: Sasha Levin --- sound/pci/hda/hda_tegra.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/sound/pci/hda/hda_tegra.c b/sound/pci/hda/hda_tegra.c index 957a7a9aaab0..17b06f7b69ee 100644 --- a/sound/pci/hda/hda_tegra.c +++ b/sound/pci/hda/hda_tegra.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -70,6 +71,7 @@ struct hda_tegra { struct azx chip; struct device *dev; + struct reset_control *reset; struct clk_bulk_data clocks[3]; unsigned int nclocks; void __iomem *regs; @@ -167,6 +169,12 @@ static int __maybe_unused hda_tegra_runtime_resume(struct device *dev) struct hda_tegra *hda = container_of(chip, struct hda_tegra, chip); int rc; + if (!chip->running) { + rc = reset_control_assert(hda->reset); + if (rc) + return rc; + } + rc = clk_bulk_prepare_enable(hda->nclocks, hda->clocks); if (rc != 0) return rc; @@ -176,6 +184,12 @@ static int __maybe_unused hda_tegra_runtime_resume(struct device *dev) /* disable controller wake up event*/ azx_writew(chip, WAKEEN, azx_readw(chip, WAKEEN) & ~STATESTS_INT_MASK); + } else { + usleep_range(10, 100); + + rc = reset_control_deassert(hda->reset); + if (rc) + return rc; } return 0; @@ -445,6 +459,12 @@ static int hda_tegra_probe(struct platform_device *pdev) return err; } + hda->reset = devm_reset_control_array_get_exclusive(&pdev->dev); + if (IS_ERR(hda->reset)) { + err = PTR_ERR(hda->reset); + goto out_free; + } + hda->clocks[hda->nclocks++].id = "hda"; hda->clocks[hda->nclocks++].id = "hda2hdmi"; hda->clocks[hda->nclocks++].id = "hda2codec_2x"; -- 2.35.1