From nobody Sat Dec 21 13:18:13 2024 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 79C8BC77B7A for ; Fri, 26 May 2023 12:29:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243490AbjEZM3c (ORCPT ); Fri, 26 May 2023 08:29:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237222AbjEZM3R (ORCPT ); Fri, 26 May 2023 08:29:17 -0400 Received: from mx0b-001ae601.pphosted.com (mx0a-001ae601.pphosted.com [67.231.149.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 828AB19A for ; Fri, 26 May 2023 05:29:13 -0700 (PDT) Received: from pps.filterd (m0077473.ppops.net [127.0.0.1]) by mx0a-001ae601.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 34QC7FGv007721; Fri, 26 May 2023 07:28:58 -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=5JHSTn8HhfaguMfczWYlhmKIp98Y8mr035TZOnR3y5A=; b=aj7zSqK2VMXMOFi4565HXyXLtqyJeSYAbJNOTRIiBfCfI40S+iD1Ee2xufWSRud5xwBp 2K07S6sk0196F6eNbnQdvnJTPRcAOSPgPGNQPa3dSqn0nxkfm5yNn4m7FCvKKxb3EImN x49hShQWtym8b7E7yPjm3pEZITzE+yYgcRvGU2O74xdtuAgyyMtCgHe1Xc87VM449NAM EJesPy0VHSYEVFLmcdzkXY+/XOvei+maxVVlxxNlAXcW3J3qvi72Z90UeKz+qlRFP8YZ 0i5ew1oj+FyfSxMf7G41FvisrDwwFfjzzVMJvhAEADNgBTLMIfgYj7FetOcSDp4lodgy gQ== Received: from ediex01.ad.cirrus.com ([84.19.233.68]) by mx0a-001ae601.pphosted.com (PPS) with ESMTPS id 3qsde8k66v-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 26 May 2023 07:28:58 -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.26; Fri, 26 May 2023 07:28:55 -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.26 via Frontend Transport; Fri, 26 May 2023 07:28:55 -0500 Received: from EDIN4L06LR3.ad.cirrus.com (EDIN4L06LR3.ad.cirrus.com [198.61.65.166]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id 9A511B38; Fri, 26 May 2023 12:28:55 +0000 (UTC) From: Richard Fitzgerald To: , , CC: , , , Simon Trimmer , Richard Fitzgerald Subject: [PATCH v3 03/12] ASoC: cs35l56: Convert utility functions to use common data structure Date: Fri, 26 May 2023 13:28:43 +0100 Message-ID: <20230526122852.4552-4-rf@opensource.cirrus.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230526122852.4552-1-rf@opensource.cirrus.com> References: <20230526122852.4552-1-rf@opensource.cirrus.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-ORIG-GUID: pAr_NR0Hv0XjjnS91RPvrFF4Ap5yTNoX X-Proofpoint-GUID: pAr_NR0Hv0XjjnS91RPvrFF4Ap5yTNoX X-Proofpoint-Spam-Reason: safe Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Simon Trimmer Use the new cs35l56_base struct for utility functions. Signed-off-by: Simon Trimmer Signed-off-by: Richard Fitzgerald Acked-by: Mark Brown --- sound/soc/codecs/cs35l56.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/sound/soc/codecs/cs35l56.c b/sound/soc/codecs/cs35l56.c index 76cc9110d4e0..48e856583477 100644 --- a/sound/soc/codecs/cs35l56.c +++ b/sound/soc/codecs/cs35l56.c @@ -805,14 +805,14 @@ static const struct reg_sequence cs35l56_system_reset= _seq[] =3D { REG_SEQ0(CS35L56_DSP_VIRTUAL1_MBOX_1, CS35L56_MBOX_CMD_SYSTEM_RESET), }; =20 -static void cs35l56_system_reset(struct cs35l56_private *cs35l56, bool is_= soundwire) +static void cs35l56_system_reset(struct cs35l56_base *cs35l56_base, bool i= s_soundwire) { /* * Must enter cache-only first so there can't be any more register * accesses other than the controlled system reset sequence below. */ - regcache_cache_only(cs35l56->base.regmap, true); - regmap_multi_reg_write_bypassed(cs35l56->base.regmap, + regcache_cache_only(cs35l56_base->regmap, true); + regmap_multi_reg_write_bypassed(cs35l56_base->regmap, cs35l56_system_reset_seq, ARRAY_SIZE(cs35l56_system_reset_seq)); =20 @@ -821,7 +821,7 @@ static void cs35l56_system_reset(struct cs35l56_private= *cs35l56, bool is_soundw return; =20 usleep_range(CS35L56_CONTROL_PORT_READY_US, CS35L56_CONTROL_PORT_READY_US= + 400); - regcache_cache_only(cs35l56->base.regmap, false); + regcache_cache_only(cs35l56_base->regmap, false); } =20 static void cs35l56_secure_patch(struct cs35l56_private *cs35l56) @@ -885,7 +885,7 @@ static void cs35l56_patch(struct cs35l56_private *cs35l= 56) init_completion(&cs35l56->init_completion); =20 cs35l56->soft_resetting =3D true; - cs35l56_system_reset(cs35l56, !!cs35l56->sdw_peripheral); + cs35l56_system_reset(&cs35l56->base, !!cs35l56->sdw_peripheral); =20 if (cs35l56->sdw_peripheral) { /* @@ -1140,20 +1140,20 @@ int cs35l56_runtime_resume_common(struct cs35l56_pr= ivate *cs35l56) } EXPORT_SYMBOL_NS_GPL(cs35l56_runtime_resume_common, SND_SOC_CS35L56_CORE); =20 -static int cs35l56_is_fw_reload_needed(struct cs35l56_private *cs35l56) +static int cs35l56_is_fw_reload_needed(struct cs35l56_base *cs35l56_base) { unsigned int val; int ret; =20 /* Nothing to re-patch if we haven't done any patching yet. */ - if (!cs35l56->base.fw_patched) + if (!cs35l56_base->fw_patched) return false; =20 /* * If we have control of RESET we will have asserted it so the firmware * will need re-patching. */ - if (cs35l56->base.reset_gpio) + if (cs35l56_base->reset_gpio) return true; =20 /* @@ -1161,22 +1161,22 @@ static int cs35l56_is_fw_reload_needed(struct cs35l= 56_private *cs35l56) * can't be used here to test for memory retention. * Assume that tuning must be re-loaded. */ - if (cs35l56->base.secured) + if (cs35l56_base->secured) return true; =20 - ret =3D pm_runtime_resume_and_get(cs35l56->base.dev); + ret =3D pm_runtime_resume_and_get(cs35l56_base->dev); if (ret) { - dev_err(cs35l56->base.dev, "Failed to runtime_get: %d\n", ret); + dev_err(cs35l56_base->dev, "Failed to runtime_get: %d\n", ret); return ret; } =20 - ret =3D regmap_read(cs35l56->base.regmap, CS35L56_PROTECTION_STATUS, &val= ); + ret =3D regmap_read(cs35l56_base->regmap, CS35L56_PROTECTION_STATUS, &val= ); if (ret) - dev_err(cs35l56->base.dev, "Failed to read PROTECTION_STATUS: %d\n", ret= ); + dev_err(cs35l56_base->dev, "Failed to read PROTECTION_STATUS: %d\n", ret= ); else ret =3D !!(val & CS35L56_FIRMWARE_MISSING); =20 - pm_runtime_put_autosuspend(cs35l56->base.dev); + pm_runtime_put_autosuspend(cs35l56_base->dev); =20 return ret; } @@ -1305,7 +1305,7 @@ int cs35l56_system_resume(struct device *dev) if (!cs35l56->component) return 0; =20 - ret =3D cs35l56_is_fw_reload_needed(cs35l56); + ret =3D cs35l56_is_fw_reload_needed(&cs35l56->base); dev_dbg(cs35l56->base.dev, "fw_reload_needed: %d\n", ret); if (ret < 1) return ret; @@ -1550,7 +1550,7 @@ int cs35l56_init(struct cs35l56_private *cs35l56) if (!cs35l56->base.reset_gpio) { dev_dbg(cs35l56->base.dev, "No reset gpio: using soft reset\n"); cs35l56->soft_resetting =3D true; - cs35l56_system_reset(cs35l56, !!cs35l56->sdw_peripheral); + cs35l56_system_reset(&cs35l56->base, !!cs35l56->sdw_peripheral); if (cs35l56->sdw_peripheral) { /* Keep alive while we wait for re-enumeration */ pm_runtime_get_noresume(cs35l56->base.dev); --=20 2.30.2