From patchwork Wed Nov 22 06:35:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Chiu X-Patchwork-Id: 1867169 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=185.125.189.65; helo=lists.ubuntu.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=patchwork.ozlabs.org) Received: from lists.ubuntu.com (lists.ubuntu.com [185.125.189.65]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4SZs5r6037z1yRg for ; Wed, 22 Nov 2023 17:38:56 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=lists.ubuntu.com) by lists.ubuntu.com with esmtp (Exim 4.86_2) (envelope-from ) id 1r5gsj-0003GS-TN; Wed, 22 Nov 2023 06:38:42 +0000 Received: from smtp-relay-internal-0.internal ([10.131.114.225] helo=smtp-relay-internal-0.canonical.com) by lists.ubuntu.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1r5gq4-0001z8-J5 for kernel-team@lists.ubuntu.com; Wed, 22 Nov 2023 06:35:56 +0000 Received: from mail-oa1-f69.google.com (mail-oa1-f69.google.com [209.85.160.69]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id 0A7C13F179 for ; Wed, 22 Nov 2023 06:35:56 +0000 (UTC) Received: by mail-oa1-f69.google.com with SMTP id 586e51a60fabf-1f5d366b498so4822522fac.1 for ; Tue, 21 Nov 2023 22:35:55 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700634955; x=1701239755; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+VmukcGVnOm76Q/JUpTlUXh0pUufqPBYkI5bZkYuKB8=; b=eb5gcYSyZeCEg87pC7s+L2FQ743QtOx8mXpjt7hVcSSh0950SODdS3giEAaOJ0ZF+0 fKO9lF7PQrRn1+/6+xTbENJH9wHDX6+LgG8TM/hA0HP0r90cKkpMgGhq81s9j5qjzTep MR9RFYMVu0PoBY4ilS0qxYsPlr0S3w2mw6dfACKth+PocfSudp67NfK86OpR4eXDNIyI oqTUHFTYC3fjh1dvGubuMEj5z4JXQW3TAsWyofYeiRrvzgYyAN9wPwbIHRQn+DuCxAx/ 4+7T9o3lBCSz2TZhAs0fcFN9EBNPQA/pCUiadqlqlo1H7OMlb3SBMZWNnHaXviQomwh5 qkRA== X-Gm-Message-State: AOJu0Yxm1bBSP9K60BpMBVRNQ1b787xzum8iJkFwqwrZ1PGskJBO7FxW VYrjBA/ckYYLe6QBnLkBQn0E28m2ZHKZ9Vv/PV8ogP1EOfjuOFcy3gi2vtg0nn/TeOgkwTlyUew uCKfkDfsmD4xir8eyloGU0UgMcy5iQu+3j9trsRHquk82JvB2ZA== X-Received: by 2002:a05:6870:7ec9:b0:1e9:96c6:e04c with SMTP id wz9-20020a0568707ec900b001e996c6e04cmr1789079oab.32.1700634954601; Tue, 21 Nov 2023 22:35:54 -0800 (PST) X-Google-Smtp-Source: AGHT+IGKsipXTiSEV4OeJLqidgAN1tqVnhEOS/KM86uA9Jnkojsj+NBZ36aVsudozjof+Aqcv4b9uA== X-Received: by 2002:a05:6870:7ec9:b0:1e9:96c6:e04c with SMTP id wz9-20020a0568707ec900b001e996c6e04cmr1789063oab.32.1700634954236; Tue, 21 Nov 2023 22:35:54 -0800 (PST) Received: from localhost.localdomain (114-36-219-155.dynamic-ip.hinet.net. [114.36.219.155]) by smtp.gmail.com with ESMTPSA id z10-20020a056a00240a00b006c31c0dfb69sm8966360pfh.188.2023.11.21.22.35.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Nov 2023 22:35:53 -0800 (PST) From: Chris Chiu To: kernel-team@lists.ubuntu.com Subject: [PATCH 08/10][SRU][M] ALSA: hda: cs35l41: Do not unload firmware before reset in system suspend Date: Wed, 22 Nov 2023 14:35:39 +0800 Message-Id: <20231122063541.11346-9-chris.chiu@canonical.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231122063541.11346-1-chris.chiu@canonical.com> References: <20231122063541.11346-1-chris.chiu@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Stefan Binding BugLink: https://bugs.launchpad.net/bugs/2042060 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 Link: https://lore.kernel.org/r/20231026150558.2105827-7-sbinding@opensource.cirrus.com Signed-off-by: Takashi Iwai (cherry picked from commit 33790d1f039114a829433b89fc55a0d781d38d62) Signed-off-by: Chris Chiu --- 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 be74b3c5547b..3c88f71d97f4 100644 --- a/sound/pci/hda/cs35l41_hda.c +++ b/sound/pci/hda/cs35l41_hda.c @@ -695,41 +695,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)