Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp10905242rwp; Fri, 21 Jul 2023 06:43:33 -0700 (PDT) X-Google-Smtp-Source: APBJJlFJ5B8JCZs57r9MC4G0zpeBywej1SB1967K0svS+3Ns/Qj48YbqG1rtAphzOOz/VU4oJgaP X-Received: by 2002:a25:ac90:0:b0:cad:8d36:2a10 with SMTP id x16-20020a25ac90000000b00cad8d362a10mr1614553ybi.55.1689947013584; Fri, 21 Jul 2023 06:43:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689947013; cv=none; d=google.com; s=arc-20160816; b=fk1hFhtKkxZVuQk4LYvVnGhAXcE/SV6O8e3C0F2j7i7iivkg0gAO4Pw/ccMZlBqnzs rEsFBaigYTWUqFDLhBdkbShELLa5876CnfXFD3Z+i9jQ+UPGWC6+Ao7YiHjmCVYBu+fI msrhePqN3W+qp4hRIQagj8RsvaAK5LuPIeWQ2Jctfunjb+bardfxJ4XQ6HxXvDL49/v0 Rr5Jl9vCM4y3yZurcxDmBuQ/LmEvuHaKmX3jK+DZO+vBCGVDwfTdTI5sncUXSLsYNGBs Dj5G3QTU9+qV803Js2uMfOEZAQSs06/BOfWq/H7P6kDLngVBuaVPerkd6SxT4sgc9XB8 sFbQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=72jaUi8LQGupqb0rDYD3gpQ7cU92GTLGM5/DEejZRHs=; fh=QvXx5lDpQknB9PDD6mOm+E8djX72AmxBQwiVxLDXEAM=; b=MhfD4uNmT5TOv9n7xB1MxX1g6BhUSkYRAt4V11m7cVwAU9c6VzOYc7YNl58xVuB5oh PVzWOOhLaxvdSX0fW93XXXH9rxNXMm+WjMD/gVgWIRBxHydBqHRycns05JbsiKWZ3PM9 8l+XrdH8gJFqbihfM/MF+LX9uWLBfvAyJTps6Rgrznxr208MZsK8tY9+aBcxqxiTmnAy NOffs5ytyZZ7HqjHfecw6kDgrXWdaRxysRAJkCyWs3Ox7XDW0F93+Ici+pdmQCwTflJi 5+GsivxfP4v8+7QbtiaR3yjECGnzf8QbWd3q/AxJJwD7dQjj85Q4mpVoi8r4xfXkARH2 JUkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=NPgaERWH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=cirrus.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id me3-20020a17090b17c300b002632bfd62b9si3456565pjb.185.2023.07.21.06.43.20; Fri, 21 Jul 2023 06:43:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=NPgaERWH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=cirrus.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231318AbjGUNWV (ORCPT + 99 others); Fri, 21 Jul 2023 09:22:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231315AbjGUNWO (ORCPT ); Fri, 21 Jul 2023 09:22:14 -0400 Received: from mx0b-001ae601.pphosted.com (mx0b-001ae601.pphosted.com [67.231.152.168]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9744135AC for ; Fri, 21 Jul 2023 06:21:41 -0700 (PDT) Received: from pps.filterd (m0077474.ppops.net [127.0.0.1]) by mx0b-001ae601.pphosted.com (8.17.1.22/8.17.1.22) with ESMTP id 36L7lwWm024208; Fri, 21 Jul 2023 08:21:27 -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=72jaUi8LQGupqb0rDYD3gpQ7cU92GTLGM5/DEejZRHs=; b= NPgaERWHxJgo65xs+vpCWC45ykbGBwhYuWix2A1caSC2JMMYSLZbKFmLaoD9rQcA 7bDpdYBCqd3RY3s54UIqgpqqHLWSmo7Njtf2OUxz2q0qSRoYJOzuTUfD9PoZTflT H1bhptr+qtiP0Rk7PP+vK+rXF4AGMZS/jFji2o6a9R3uN0sVGVgFi/sMjjIHtg7S 7VbC2toKJdjXQYBzABCDxAM0McjCE1C1qFaL50/0RbD77cNoNXM5HXOPAALH0yhH ASTtaL2dcEg8uzuFd1XZ3U96LZAMeCpfBcz4t2kyzCZcYsusbJTG61iP/YMeZgRM Qa4MDPV10g9aYbXSzxFzYQ== Received: from ediex02.ad.cirrus.com ([84.19.233.68]) by mx0b-001ae601.pphosted.com (PPS) with ESMTPS id 3rus6gyj2u-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jul 2023 08:21:26 -0500 (CDT) Received: from ediex02.ad.cirrus.com (198.61.84.81) 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.30; Fri, 21 Jul 2023 14:21:24 +0100 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.30 via Frontend Transport; Fri, 21 Jul 2023 14:21:24 +0100 Received: from work-debian.ad.cirrus.com (unknown [198.61.64.172]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id 79EB515B6; Fri, 21 Jul 2023 13:21:24 +0000 (UTC) From: Richard Fitzgerald To: , CC: , , , , Simon Trimmer , Richard Fitzgerald Subject: [PATCH v5 03/11] ASoC: cs35l56: Convert utility functions to use common data structure Date: Fri, 21 Jul 2023 14:21:12 +0100 Message-ID: <20230721132120.5523-4-rf@opensource.cirrus.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230721132120.5523-1-rf@opensource.cirrus.com> References: <20230721132120.5523-1-rf@opensource.cirrus.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-ORIG-GUID: jxbwaBapaFciCsqhqApgJW-vJr5Z41Ry X-Proofpoint-GUID: jxbwaBapaFciCsqhqApgJW-vJr5Z41Ry X-Proofpoint-Spam-Reason: safe X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 7a83e388e869..87e2f618850b 100644 --- a/sound/soc/codecs/cs35l56.c +++ b/sound/soc/codecs/cs35l56.c @@ -802,14 +802,14 @@ static const struct reg_sequence cs35l56_system_reset_seq[] = { REG_SEQ0(CS35L56_DSP_VIRTUAL1_MBOX_1, CS35L56_MBOX_CMD_SYSTEM_RESET), }; -static void cs35l56_system_reset(struct cs35l56_private *cs35l56, bool is_soundwire) +static void cs35l56_system_reset(struct cs35l56_base *cs35l56_base, bool is_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)); @@ -818,7 +818,7 @@ static void cs35l56_system_reset(struct cs35l56_private *cs35l56, bool is_soundw return; 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); } static void cs35l56_secure_patch(struct cs35l56_private *cs35l56) @@ -882,7 +882,7 @@ static void cs35l56_patch(struct cs35l56_private *cs35l56) init_completion(&cs35l56->init_completion); cs35l56->soft_resetting = true; - cs35l56_system_reset(cs35l56, !!cs35l56->sdw_peripheral); + cs35l56_system_reset(&cs35l56->base, !!cs35l56->sdw_peripheral); if (cs35l56->sdw_peripheral) { /* @@ -1137,20 +1137,20 @@ int cs35l56_runtime_resume_common(struct cs35l56_private *cs35l56) } EXPORT_SYMBOL_NS_GPL(cs35l56_runtime_resume_common, SND_SOC_CS35L56_CORE); -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; /* Nothing to re-patch if we haven't done any patching yet. */ - if (!cs35l56->base.fw_patched) + if (!cs35l56_base->fw_patched) return false; /* * 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; /* @@ -1158,22 +1158,22 @@ static int cs35l56_is_fw_reload_needed(struct cs35l56_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; - ret = pm_runtime_resume_and_get(cs35l56->base.dev); + ret = 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; } - ret = regmap_read(cs35l56->base.regmap, CS35L56_PROTECTION_STATUS, &val); + ret = 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 = !!(val & CS35L56_FIRMWARE_MISSING); - pm_runtime_put_autosuspend(cs35l56->base.dev); + pm_runtime_put_autosuspend(cs35l56_base->dev); return ret; } @@ -1302,7 +1302,7 @@ int cs35l56_system_resume(struct device *dev) if (!cs35l56->component) return 0; - ret = cs35l56_is_fw_reload_needed(cs35l56); + ret = cs35l56_is_fw_reload_needed(&cs35l56->base); dev_dbg(cs35l56->base.dev, "fw_reload_needed: %d\n", ret); if (ret < 1) return ret; @@ -1547,7 +1547,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 = 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); -- 2.30.2