From patchwork Thu Oct 26 15:05:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Binding X-Patchwork-Id: 739095 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B9338C25B6B for ; Thu, 26 Oct 2023 15:10:13 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id BE801E11; Thu, 26 Oct 2023 17:09:21 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz BE801E11 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1698333011; bh=tfhftKsoLRYrjE2h6VK/g5frPbfbK/BcuYyMVN4Z+8Q=; h=From:To:CC:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=CflJsvixgiPjhEpU2faSucnllZzkYlXc+1D5+uB8akdob5GBNVTSfKIr4D1nW0LBP T3s7KXxbBk7VrbLXux/+pVlmg6vV7ns8krPukKHThNlFrBumfhMZ8y2TqvKhj/BuE1 Q+7oRC2fXMhaooqfrgo9AhW1Br7HwyyRJy/tp3Y0= Received: by alsa1.perex.cz (Postfix, from userid 50401) id A01F1F80580; Thu, 26 Oct 2023 17:09:07 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id DD672F80580; Thu, 26 Oct 2023 17:09:06 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 4E49FF8055A; Thu, 26 Oct 2023 17:09:00 +0200 (CEST) Received: from mx0b-001ae601.pphosted.com (mx0a-001ae601.pphosted.com [67.231.149.25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 72C7EF8019B for ; Thu, 26 Oct 2023 17:06:19 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 72C7EF8019B Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=cirrus.com header.i=@cirrus.com header.a=rsa-sha256 header.s=PODMain02222019 header.b=CqmUOW1Q Received: from pps.filterd (m0077473.ppops.net [127.0.0.1]) by mx0a-001ae601.pphosted.com (8.17.1.22/8.17.1.22) with ESMTP id 39Q5GUrk011654; Thu, 26 Oct 2023 10:06:17 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cirrus.com; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s= PODMain02222019; bh=aVS/k/o9GgQrl9MbNJJRmT2pCbqgdTBbMvRC49HEs3I=; b= CqmUOW1QFN+R8yYC1KTnwLmwDmYXbhma6M7+oX2skXH2fwCrvPIXlp3yvJtd8hZ9 A0pyADUxlmRqQiz9aygmctQXY6waCu8g0FNnwQFU+gAZVIeIRMUAzoiJ2WfHruqp 0mLSxpUtVWItzUQoH/8/hsuzkIUpWF0wFZctGjL7Q0la8LAsGiWjJGwIVMw8coHW sBhFsVpz6whzm2AKTm50X09iU1xO2fyqql3XKAbSQcgAUs084kL2LFrRZDcrJh4j 0qAqxMeLSQOB6Xu+DRs1YlJBDuwvkhitVJ/5Y3tXQ99qaSvwWO1SvrepEPJBQM0g Tx5/QLdHn2MyLy3T2pqH0w== Received: from ediex02.ad.cirrus.com ([84.19.233.68]) by mx0a-001ae601.pphosted.com (PPS) with ESMTPS id 3tvc1x94k9-7 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 26 Oct 2023 10:06:17 -0500 (CDT) Received: from ediex01.ad.cirrus.com (198.61.84.80) by ediex02.ad.cirrus.com (198.61.84.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.37; Thu, 26 Oct 2023 16:06:09 +0100 Received: from ediswmail.ad.cirrus.com (198.61.86.93) by ediex01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server id 15.2.1118.37 via Frontend Transport; Thu, 26 Oct 2023 16:06:09 +0100 Received: from sbinding-cirrus-dsktp2.ad.cirrus.com (unknown [198.90.238.177]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id CD6D7357D; Thu, 26 Oct 2023 15:06:08 +0000 (UTC) From: Stefan Binding To: Jaroslav Kysela , Takashi Iwai , "Mark Brown" CC: , , , , "Stefan Binding" Subject: [PATCH v1 6/8] ALSA: hda: cs35l41: Do not unload firmware before reset in system suspend Date: Thu, 26 Oct 2023 16:05:56 +0100 Message-ID: <20231026150558.2105827-7-sbinding@opensource.cirrus.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231026150558.2105827-1-sbinding@opensource.cirrus.com> References: <20231026150558.2105827-1-sbinding@opensource.cirrus.com> MIME-Version: 1.0 X-Proofpoint-GUID: 77tcB9QBMrf3J9m3UWL9pZxdtnLaMN5E X-Proofpoint-ORIG-GUID: 77tcB9QBMrf3J9m3UWL9pZxdtnLaMN5E X-Proofpoint-Spam-Reason: safe Message-ID-Hash: 35DGQPEGQRJNKARZMRTJKUAAPSIXE5DX X-Message-ID-Hash: 35DGQPEGQRJNKARZMRTJKUAAPSIXE5DX X-MailFrom: prvs=56633e4941=sbinding@opensource.cirrus.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Given the part is about to reset due to system suspend, and we are already in hibernate, there is no need to wake up the amp, just to get it ready to be reset. We just need to ensure cs_dsp is ready for reset by resetting the states. Signed-off-by: Stefan Binding --- sound/pci/hda/cs35l41_hda.c | 33 ++++----------------------------- 1 file changed, 4 insertions(+), 29 deletions(-) diff --git a/sound/pci/hda/cs35l41_hda.c b/sound/pci/hda/cs35l41_hda.c index 9746c64ff0dd..69303888be1a 100644 --- a/sound/pci/hda/cs35l41_hda.c +++ b/sound/pci/hda/cs35l41_hda.c @@ -760,41 +760,16 @@ int cs35l41_verify_id(struct cs35l41_hda *cs35l41, unsigned int *regid, unsigned static int cs35l41_ready_for_reset(struct cs35l41_hda *cs35l41) { - int ret = 0; - mutex_lock(&cs35l41->fw_mutex); if (cs35l41->firmware_running) { - - regcache_cache_only(cs35l41->regmap, false); - - ret = cs35l41_exit_hibernate(cs35l41->dev, cs35l41->regmap); - if (ret) { - dev_warn(cs35l41->dev, "Unable to exit Hibernate."); - goto err; - } - - /* Test key needs to be unlocked to allow the OTP settings to re-apply */ - cs35l41_test_key_unlock(cs35l41->dev, cs35l41->regmap); - ret = regcache_sync(cs35l41->regmap); - cs35l41_test_key_lock(cs35l41->dev, cs35l41->regmap); - if (ret) { - dev_err(cs35l41->dev, "Failed to restore register cache: %d\n", ret); - goto err; - } - - if (cs35l41->hw_cfg.bst_type == CS35L41_EXT_BOOST) - cs35l41_init_boost(cs35l41->dev, cs35l41->regmap, &cs35l41->hw_cfg); - - cs35l41_shutdown_dsp(cs35l41); - cs35l41_safe_reset(cs35l41->regmap, cs35l41->hw_cfg.bst_type); + cs35l41->cs_dsp.running = false; + cs35l41->cs_dsp.booted = false; + cs35l41->firmware_running = false; } -err: - regcache_cache_only(cs35l41->regmap, true); regcache_mark_dirty(cs35l41->regmap); - mutex_unlock(&cs35l41->fw_mutex); - return ret; + return 0; } static int cs35l41_system_suspend_prep(struct device *dev)