From nobody Fri Apr 10 21:54:47 2026 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 22775C32773 for ; Fri, 19 Aug 2022 12:53:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349150AbiHSMxO (ORCPT ); Fri, 19 Aug 2022 08:53:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36796 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349105AbiHSMwu (ORCPT ); Fri, 19 Aug 2022 08:52:50 -0400 Received: from mx0b-001ae601.pphosted.com (mx0a-001ae601.pphosted.com [67.231.149.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B31EDDABAE for ; Fri, 19 Aug 2022 05:52:49 -0700 (PDT) Received: from pps.filterd (m0077473.ppops.net [127.0.0.1]) by mx0a-001ae601.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 27J5opPq018534; Fri, 19 Aug 2022 07:52:39 -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=+gFYFK2eJJEQkMu7BpUm9DSh8dHugunj12u4pVcE2IU=; b=q1RjZTQ0Aj4+EjAcAmUALLbzXX90u9GIl0PJHfGOFyOVsY1x3avmgAmKQSb3tm1blv+1 87eZdoh5gDN1/q7hvHJhdRl55Mcc9IukYNFloeGcMlKV5oY1RDUFIx+8G9WFvFiPD0Fl cIxL5ruScTpCWo7515dAyUxWyHZAIZvwzNTPqxfN0ZW4xyXUhdBf1VgPcz5nlFtN7U7P e/0ZQtoI4xNHLuFVq9voRB+vtDeo9BLvdHcShrg6aiFpoRpTxl/zaaMUAL6DIU8H0Vum upEOiwoUnLLQifGYKj3UgGKz3eABAEiOMyF6LumJw6NBVev6bAtL0WsFlLNRwiRh7o3X UA== Received: from ediex01.ad.cirrus.com ([84.19.233.68]) by mx0a-001ae601.pphosted.com (PPS) with ESMTPS id 3hx9c1yrtp-4 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 19 Aug 2022 07:52:38 -0500 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.9; Fri, 19 Aug 2022 07:52:34 -0500 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.9 via Frontend Transport; Fri, 19 Aug 2022 07:52:34 -0500 Received: from edi-sw-dsktp-006.ad.cirrus.com (edi-sw-dsktp-006.ad.cirrus.com [198.90.251.95]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id D1AB57C; Fri, 19 Aug 2022 12:52:34 +0000 (UTC) From: Richard Fitzgerald To: CC: , , , Richard Fitzgerald Subject: [PATCH 07/12] ASoC: cs42l42: Split cs42l42_resume into two functions Date: Fri, 19 Aug 2022 13:52:25 +0100 Message-ID: <20220819125230.42731-8-rf@opensource.cirrus.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220819125230.42731-1-rf@opensource.cirrus.com> References: <20220819125230.42731-1-rf@opensource.cirrus.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-ORIG-GUID: JJqG-086Y1AL889Nmp1m-P6S33t_WIV- X-Proofpoint-GUID: JJqG-086Y1AL889Nmp1m-P6S33t_WIV- X-Proofpoint-Spam-Reason: safe Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" On Soundwire the system resume cannot restore registers until the host controller has re-enumerated the peripheral. This patch splits cs42l42_resume() into two functions, one to power up and the other to restore registers, ready for adding Soundwire support. Signed-off-by: Richard Fitzgerald --- sound/soc/codecs/cs42l42.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/sound/soc/codecs/cs42l42.c b/sound/soc/codecs/cs42l42.c index 8c5909a43df6..54fe92b3d4da 100644 --- a/sound/soc/codecs/cs42l42.c +++ b/sound/soc/codecs/cs42l42.c @@ -2199,6 +2199,15 @@ static int __maybe_unused cs42l42_resume(struct devi= ce *dev) gpiod_set_value_cansleep(cs42l42->reset_gpio, 1); usleep_range(CS42L42_BOOT_TIME_US, CS42L42_BOOT_TIME_US * 2); =20 + dev_dbg(dev, "System resume powered up\n"); + + return 0; +} + +static void __maybe_unused cs42l42_resume_restore(struct device *dev) +{ + struct cs42l42_private *cs42l42 =3D dev_get_drvdata(dev); + regcache_cache_only(cs42l42->regmap, false); regcache_mark_dirty(cs42l42->regmap); =20 @@ -2211,6 +2220,17 @@ static int __maybe_unused cs42l42_resume(struct devi= ce *dev) mutex_unlock(&cs42l42->irq_lock); =20 dev_dbg(dev, "System resumed\n"); +} + +static int __maybe_unused cs42l42_i2c_resume(struct device *dev) +{ + int ret; + + ret =3D cs42l42_resume(dev); + if (ret) + return ret; + + cs42l42_resume_restore(dev); =20 return 0; } @@ -2428,7 +2448,7 @@ static int cs42l42_i2c_remove(struct i2c_client *i2c_= client) } =20 static const struct dev_pm_ops cs42l42_pm_ops =3D { - SET_SYSTEM_SLEEP_PM_OPS(cs42l42_suspend, cs42l42_resume) + SET_SYSTEM_SLEEP_PM_OPS(cs42l42_suspend, cs42l42_i2c_resume) }; =20 #ifdef CONFIG_OF --=20 2.30.2