From patchwork Wed Dec 6 16:03:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Rivera-Matos X-Patchwork-Id: 751101 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 7C6F8C10F05 for ; Wed, 6 Dec 2023 16:05:02 +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 7283AA4C; Wed, 6 Dec 2023 17:04:50 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 7283AA4C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1701878700; bh=K33RCRA0O4ArfJEfE2Ba+CL4H/aOJCU4U+9CXW27fm4=; 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=DP3zQkEvjOOOzDhU+LXfS/wtxf8lileTqFcFl2yqbVGt1P5QgWCEjG0gpqHbiNQFF DfU1X29yeiyUzF9BBQW8fI3Iz0hzBSVCLcUIfLGpMBGLV6mTSt8hZAxmVIwjnWv/Hc GxeMRYDi8tZwiMyIF6x4ASGup/pGVtIhYIUrnmao= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 980F4F805E2; Wed, 6 Dec 2023 17:03:58 +0100 (CET) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 6BB00F805D2; Wed, 6 Dec 2023 17:03:58 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 1DCAEF8024E; Wed, 6 Dec 2023 17:03:47 +0100 (CET) Received: from mx0b-001ae601.pphosted.com (mx0b-001ae601.pphosted.com [67.231.152.168]) (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 F23DCF80166 for ; Wed, 6 Dec 2023 17:03:25 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz F23DCF80166 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=Z/SsmbJS Received: from pps.filterd (m0077474.ppops.net [127.0.0.1]) by mx0b-001ae601.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 3B67KtYi002302; Wed, 6 Dec 2023 10:03:24 -0600 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=foiFmzUEqVJ/nGA5Ch+P7eFl69ST9qdDwFB3DwnmLsM=; b= Z/SsmbJSKBb8eM74KWZBiOcV9HXnb62a+W6K9v0FeQy1X0W0wpieinlPnoyqmKf0 9Bo0Xgo/DfDt+1heRifZEf4qknO1HyzA2mhJf69RJYLrKeH8Mnyxf+f0dudWCcmy XlacSTHAlj4EIgASTtJvCT7yRMPTqs6gbkuvuZYAmlLg/WzIbNyYPvuxmjrVt0S3 PGQp7j2wGP0IEKuTTFrxKHY4g5kDGjC0bBamMfQmu0VFoqHiJ/QpAiiwwfY7pyT3 11Ye8CdOQrGr0A71m5KJl+LMM+1dX5gEFzViapawS8C67K/5dTHru8ScJ5BpUeFk PG5UJ7IndaqgsyqBXu+0Uw== Received: from ediex01.ad.cirrus.com ([84.19.233.68]) by mx0b-001ae601.pphosted.com (PPS) with ESMTPS id 3utd1w8x5j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 06 Dec 2023 10:03:24 -0600 (CST) Received: from ediex01.ad.cirrus.com (198.61.84.80) by ediex01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Wed, 6 Dec 2023 16:03:22 +0000 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.40 via Frontend Transport; Wed, 6 Dec 2023 16:03:22 +0000 Received: from ricardo-lws.crystal.cirrus.com (ricardo-lws.ad.cirrus.com [141.131.145.40]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id AF91511AB; Wed, 6 Dec 2023 16:03:20 +0000 (UTC) From: Ricardo Rivera-Matos To: James Schulman , David Rhodes , Lucas Tanure , Richard Fitzgerald , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai CC: Ricardo Rivera-Matos , Charles Keepax , , , Subject: [PATCH 1/3] ASoC: cs35l45: Use modern pm_ops Date: Wed, 6 Dec 2023 10:03:16 -0600 Message-ID: <20231206160318.1255034-2-rriveram@opensource.cirrus.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231206160318.1255034-1-rriveram@opensource.cirrus.com> References: <20231206160318.1255034-1-rriveram@opensource.cirrus.com> MIME-Version: 1.0 X-Proofpoint-GUID: _Kgy0evTf8WtsM92-AuIIBWRghTlZrZZ X-Proofpoint-ORIG-GUID: _Kgy0evTf8WtsM92-AuIIBWRghTlZrZZ X-Proofpoint-Spam-Reason: safe Message-ID-Hash: KVLMQVWIUKZAX5R5E6JHRZTX32YAZSJ3 X-Message-ID-Hash: KVLMQVWIUKZAX5R5E6JHRZTX32YAZSJ3 X-MailFrom: prvs=77048296a8=rriveram@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.9 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: Make use of the recently introduced EXPORT_GPL_DEV_PM_OPS() macro, to conditionally export the runtime/system PM functions. Replace the old SET_{RUNTIME,SYSTEM_SLEEP,NOIRQ_SYSTEM_SLEEP}_PM_OPS() helpers with their modern alternatives and get rid of the now unnecessary '__maybe_unused' annotations on all PM functions. Additionally, use the pm_ptr() macro to fix the following errors when building with CONFIG_PM disabled: Signed-off-by: Ricardo Rivera-Matos Acked-by: Charles Keepax --- sound/soc/codecs/cs35l45-i2c.c | 2 +- sound/soc/codecs/cs35l45-spi.c | 2 +- sound/soc/codecs/cs35l45.c | 9 ++++----- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/sound/soc/codecs/cs35l45-i2c.c b/sound/soc/codecs/cs35l45-i2c.c index 77e0f8750f37..bc2af1ed0fe9 100644 --- a/sound/soc/codecs/cs35l45-i2c.c +++ b/sound/soc/codecs/cs35l45-i2c.c @@ -62,7 +62,7 @@ static struct i2c_driver cs35l45_i2c_driver = { .driver = { .name = "cs35l45", .of_match_table = cs35l45_of_match, - .pm = &cs35l45_pm_ops, + .pm = pm_ptr(&cs35l45_pm_ops), }, .id_table = cs35l45_id_i2c, .probe = cs35l45_i2c_probe, diff --git a/sound/soc/codecs/cs35l45-spi.c b/sound/soc/codecs/cs35l45-spi.c index 5efb77530cc3..39e203a5f060 100644 --- a/sound/soc/codecs/cs35l45-spi.c +++ b/sound/soc/codecs/cs35l45-spi.c @@ -64,7 +64,7 @@ static struct spi_driver cs35l45_spi_driver = { .driver = { .name = "cs35l45", .of_match_table = cs35l45_of_match, - .pm = &cs35l45_pm_ops, + .pm = pm_ptr(&cs35l45_pm_ops), }, .id_table = cs35l45_id_spi, .probe = cs35l45_spi_probe, diff --git a/sound/soc/codecs/cs35l45.c b/sound/soc/codecs/cs35l45.c index b68853e42fd1..4f4df166f5f0 100644 --- a/sound/soc/codecs/cs35l45.c +++ b/sound/soc/codecs/cs35l45.c @@ -982,7 +982,7 @@ static int cs35l45_exit_hibernate(struct cs35l45_private *cs35l45) return -ETIMEDOUT; } -static int __maybe_unused cs35l45_runtime_suspend(struct device *dev) +static int cs35l45_runtime_suspend(struct device *dev) { struct cs35l45_private *cs35l45 = dev_get_drvdata(dev); @@ -999,7 +999,7 @@ static int __maybe_unused cs35l45_runtime_suspend(struct device *dev) return 0; } -static int __maybe_unused cs35l45_runtime_resume(struct device *dev) +static int cs35l45_runtime_resume(struct device *dev) { struct cs35l45_private *cs35l45 = dev_get_drvdata(dev); int ret; @@ -1466,10 +1466,9 @@ void cs35l45_remove(struct cs35l45_private *cs35l45) } EXPORT_SYMBOL_NS_GPL(cs35l45_remove, SND_SOC_CS35L45); -const struct dev_pm_ops cs35l45_pm_ops = { - SET_RUNTIME_PM_OPS(cs35l45_runtime_suspend, cs35l45_runtime_resume, NULL) +EXPORT_GPL_DEV_PM_OPS(cs35l45_pm_ops) = { + RUNTIME_PM_OPS(cs35l45_runtime_suspend, cs35l45_runtime_resume, NULL) }; -EXPORT_SYMBOL_NS_GPL(cs35l45_pm_ops, SND_SOC_CS35L45); MODULE_DESCRIPTION("ASoC CS35L45 driver"); MODULE_AUTHOR("James Schulman, Cirrus Logic Inc, "); From patchwork Wed Dec 6 16:03:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Rivera-Matos X-Patchwork-Id: 750731 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 A9B79C4167B for ; Wed, 6 Dec 2023 16:04:40 +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 E6E54DE5; Wed, 6 Dec 2023 17:04:28 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz E6E54DE5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1701878678; bh=2XWukHCkV+U+w06AzXyV2DMLGv1kx3kqGbtNecu1mLk=; 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=EWtg01Vrc/n76v4neRhsHtkanmq9ztf1tJucfbykbKvGosiqUSE8ucaBgMIhrEtCq 6yUWIxDG48E7mHMcURVoyJpbVMmc9ysEDWwxruX9R5a66PCNelxmaP3gpYZGk6uu+w x0+jHnTE4eKhrQ2TQENWWRzEVOeUONogj8iPLeio= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 120AEF805CA; Wed, 6 Dec 2023 17:03:57 +0100 (CET) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 68C6BF805C5; Wed, 6 Dec 2023 17:03:56 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 2790AF8025A; Wed, 6 Dec 2023 17:03:45 +0100 (CET) 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 11D3DF800D2 for ; Wed, 6 Dec 2023 17:03:29 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 11D3DF800D2 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=Ik98qTrs Received: from pps.filterd (m0077473.ppops.net [127.0.0.1]) by mx0a-001ae601.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 3B6AvD2j025625; Wed, 6 Dec 2023 10:03:27 -0600 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=0fxSxG4+teDLsjntgKgN17KmimgUY2wX58MvQrY/vYo=; b= Ik98qTrsUihTasSXfYMET94Gk9cJqUSlwX2h1QIqWQg8kOTixbCOaymTUAh+h6vQ zPMc2tKfD4ZbFoVsMuikq00fMI8rXZ0RAie4z6hmj0bwCOzc4ZBNTq+DKLtjiSaq l9GdfpsnAj4uEkqSJYg3h7oiwDKk2OCs5c3cVlbvbR4riSx/7E0fzgnzuo/hxgNS iFJUP7Of5q8TB6YpJ4A7uuoMuGcgL84qUVkyaon8g1PZykYGsBTzMIgnUIS/1zyt ouokjDteX6/dYpGqEfdKLVz1/4DHzkN85KwlfwEcyC7rPraFWMjOi2Ld1/U6XIEz x+ITm72gJ1Iaxb7M6kluwA== Received: from ediex02.ad.cirrus.com ([84.19.233.68]) by mx0a-001ae601.pphosted.com (PPS) with ESMTPS id 3utd47rww7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 06 Dec 2023 10:03:26 -0600 (CST) 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.40; Wed, 6 Dec 2023 16:03:24 +0000 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.40 via Frontend Transport; Wed, 6 Dec 2023 16:03:24 +0000 Received: from ricardo-lws.crystal.cirrus.com (ricardo-lws.ad.cirrus.com [141.131.145.40]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id 009B611AB; Wed, 6 Dec 2023 16:03:22 +0000 (UTC) From: Ricardo Rivera-Matos To: James Schulman , David Rhodes , Lucas Tanure , Richard Fitzgerald , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai CC: Ricardo Rivera-Matos , Charles Keepax , , , Subject: [PATCH 2/3] ASoC: cs35l45: Prevent IRQ handling when suspending/resuming Date: Wed, 6 Dec 2023 10:03:17 -0600 Message-ID: <20231206160318.1255034-3-rriveram@opensource.cirrus.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231206160318.1255034-1-rriveram@opensource.cirrus.com> References: <20231206160318.1255034-1-rriveram@opensource.cirrus.com> MIME-Version: 1.0 X-Proofpoint-GUID: NbkZp4JFc9ISGo9U6WJCQgj5DOK-Ke2B X-Proofpoint-ORIG-GUID: NbkZp4JFc9ISGo9U6WJCQgj5DOK-Ke2B X-Proofpoint-Spam-Reason: safe Message-ID-Hash: 6MM4FIY5DQFD24XDT2RQYINOWBVKJR4Q X-Message-ID-Hash: 6MM4FIY5DQFD24XDT2RQYINOWBVKJR4Q X-MailFrom: prvs=77048296a8=rriveram@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.9 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: Use the SYSTEM_SLEEP_PM_OPS handlers to prevent handling an IRQ when the system is in the middle of suspending or resuming. Signed-off-by: Ricardo Rivera-Matos Acked-by: Charles Keepax --- sound/soc/codecs/cs35l45.c | 43 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/sound/soc/codecs/cs35l45.c b/sound/soc/codecs/cs35l45.c index 4f4df166f5f0..28f76fccf277 100644 --- a/sound/soc/codecs/cs35l45.c +++ b/sound/soc/codecs/cs35l45.c @@ -1026,6 +1026,46 @@ static int cs35l45_runtime_resume(struct device *dev) return ret; } +static int cs35l45_sys_suspend(struct device *dev) +{ + struct cs35l45_private *cs35l45 = dev_get_drvdata(dev); + + dev_dbg(cs35l45->dev, "System suspend, disabling IRQ\n"); + disable_irq(cs35l45->irq); + + return 0; +} + +static int cs35l45_sys_suspend_noirq(struct device *dev) +{ + struct cs35l45_private *cs35l45 = dev_get_drvdata(dev); + + dev_dbg(cs35l45->dev, "Late system suspend, reenabling IRQ\n"); + enable_irq(cs35l45->irq); + + return 0; +} + +static int cs35l45_sys_resume_noirq(struct device *dev) +{ + struct cs35l45_private *cs35l45 = dev_get_drvdata(dev); + + dev_dbg(cs35l45->dev, "Early system resume, disabling IRQ\n"); + disable_irq(cs35l45->irq); + + return 0; +} + +static int cs35l45_sys_resume(struct device *dev) +{ + struct cs35l45_private *cs35l45 = dev_get_drvdata(dev); + + dev_dbg(cs35l45->dev, "System resume, reenabling IRQ\n"); + enable_irq(cs35l45->irq); + + return 0; +} + static int cs35l45_apply_property_config(struct cs35l45_private *cs35l45) { struct device_node *node = cs35l45->dev->of_node; @@ -1468,6 +1508,9 @@ EXPORT_SYMBOL_NS_GPL(cs35l45_remove, SND_SOC_CS35L45); EXPORT_GPL_DEV_PM_OPS(cs35l45_pm_ops) = { RUNTIME_PM_OPS(cs35l45_runtime_suspend, cs35l45_runtime_resume, NULL) + + SYSTEM_SLEEP_PM_OPS(cs35l45_sys_suspend, cs35l45_sys_resume) + NOIRQ_SYSTEM_SLEEP_PM_OPS(cs35l45_sys_suspend_noirq, cs35l45_sys_resume_noirq) }; MODULE_DESCRIPTION("ASoC CS35L45 driver"); From patchwork Wed Dec 6 16:03:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Rivera-Matos X-Patchwork-Id: 751102 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 6AB01C4167B for ; Wed, 6 Dec 2023 16:04:30 +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 97E5B832; Wed, 6 Dec 2023 17:04:17 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 97E5B832 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1701878667; bh=jsI2AcF3wi0NGxAesBuQMumoo5fLXxaVd5yW6rfOEEI=; 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=uFjBxFLR4QzhMetgm9Lvh+kqSErJkIv7v508DutlNTZ7VA5UyFpMB8D9P9j8uf1Rv t6MwoK+Qi8EATgBCGBs4paOHOgK1oCHc8XkMnOpnYckVd1oq9R6WR615JSWiKker8L UZ1m+9Ng9uawM+R+3ZDRBEXGBTmtyuowqtNpISq4= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 86924F80568; Wed, 6 Dec 2023 17:03:54 +0100 (CET) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 1A07EF80579; Wed, 6 Dec 2023 17:03:54 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 66476F8025A; Wed, 6 Dec 2023 17:03:43 +0100 (CET) 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 81A2BF800F5 for ; Wed, 6 Dec 2023 17:03:31 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 81A2BF800F5 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=THDPlpRV Received: from pps.filterd (m0077473.ppops.net [127.0.0.1]) by mx0a-001ae601.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 3B65uLeA028385; Wed, 6 Dec 2023 10:03:30 -0600 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=CF5Y4M22mU0ASa7dzcDvmubXPzmRyzCTuOM4tyVQcZE=; b= THDPlpRVAwel25YuDshmjnnPKhnNpHMuzCUv6lAVyrToEmywcionIxQgSV6oSg9O qRKmiJExjknlxGFY9Z0mjb3IcppouRjKbpQiPbfAq7CNvvA6OkJghphiYMLMY9Dg v26YC7rojfi96hBlISJYpkeII9Q6aw5AWxDZkgSiSqnkn911DcLOkbKqjI8vsv5P Zz9v92VWduZRCNfMqhWh7eSK+f4Rq8NuDGUV+8WX0QEGLr3vzLe5m73jb0TN/mAP wvXsG5RaylOm8BH+ManaUvvO2W/k+mHG8ESavhi25UtrxZxq+wMVBLJdqKYLnWHD t81DW2MHxQ8TEBFUfiXN9Q== Received: from ediex01.ad.cirrus.com ([84.19.233.68]) by mx0a-001ae601.pphosted.com (PPS) with ESMTPS id 3utd47rww8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 06 Dec 2023 10:03:29 -0600 (CST) Received: from ediex02.ad.cirrus.com (198.61.84.81) by ediex01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Wed, 6 Dec 2023 16:03:27 +0000 Received: from ediswmail.ad.cirrus.com (198.61.86.93) by anon-ediex02.ad.cirrus.com (198.61.84.81) with Microsoft SMTP Server id 15.2.1118.40 via Frontend Transport; Wed, 6 Dec 2023 16:03:27 +0000 Received: from ricardo-lws.crystal.cirrus.com (ricardo-lws.ad.cirrus.com [141.131.145.40]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id 53A8E11D1; Wed, 6 Dec 2023 16:03:25 +0000 (UTC) From: Ricardo Rivera-Matos To: James Schulman , David Rhodes , Lucas Tanure , Richard Fitzgerald , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai CC: Ricardo Rivera-Matos , Charles Keepax , , , Subject: [PATCH 3/3] ASoC: cs35l45: Prevents spinning during runtime suspend Date: Wed, 6 Dec 2023 10:03:18 -0600 Message-ID: <20231206160318.1255034-4-rriveram@opensource.cirrus.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231206160318.1255034-1-rriveram@opensource.cirrus.com> References: <20231206160318.1255034-1-rriveram@opensource.cirrus.com> MIME-Version: 1.0 X-Proofpoint-GUID: HLP5MC39A_dcsXx0UFwisv0hie67bmM_ X-Proofpoint-ORIG-GUID: HLP5MC39A_dcsXx0UFwisv0hie67bmM_ X-Proofpoint-Spam-Reason: safe Message-ID-Hash: PHFULDLAM6FZRWKLAMO7NCHN7O4FYCTW X-Message-ID-Hash: PHFULDLAM6FZRWKLAMO7NCHN7O4FYCTW X-MailFrom: prvs=77048296a8=rriveram@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.9 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: Masks the "DSP Virtual Mailbox 2 write" interrupt when before issuing the hibernate command to the DSP. The interrupt is unmasked when exiting runtime suspend as it is required for DSP operation. Without this change the DSP fires an interrupt when hibernating causing the system spin between runtime suspend and runtime resume. Signed-off-by: Ricardo Rivera-Matos Acked-by: Charles Keepax --- sound/soc/codecs/cs35l45.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sound/soc/codecs/cs35l45.c b/sound/soc/codecs/cs35l45.c index 28f76fccf277..44c221745c3b 100644 --- a/sound/soc/codecs/cs35l45.c +++ b/sound/soc/codecs/cs35l45.c @@ -947,6 +947,8 @@ static int cs35l45_enter_hibernate(struct cs35l45_private *cs35l45) cs35l45_setup_hibernate(cs35l45); + regmap_set_bits(cs35l45->regmap, CS35L45_IRQ1_MASK_2, CS35L45_DSP_VIRT2_MBOX_MASK); + // Don't wait for ACK since bus activity would wake the device regmap_write(cs35l45->regmap, CS35L45_DSP_VIRT1_MBOX_1, CSPL_MBOX_CMD_HIBERNATE); @@ -967,6 +969,8 @@ static int cs35l45_exit_hibernate(struct cs35l45_private *cs35l45) CSPL_MBOX_CMD_OUT_OF_HIBERNATE); if (!ret) { dev_dbg(cs35l45->dev, "Wake success at cycle: %d\n", j); + regmap_clear_bits(cs35l45->regmap, CS35L45_IRQ1_MASK_2, + CS35L45_DSP_VIRT2_MBOX_MASK); return 0; } usleep_range(100, 200);