Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp10938360rwp; Fri, 21 Jul 2023 07:07:47 -0700 (PDT) X-Google-Smtp-Source: APBJJlFgEVkMfuyREWGE02oKXn3gTl9uaXrXlXYmIq8nw6CnnR4LXvFd/160WxtoNH/BbaJacFoX X-Received: by 2002:a17:902:ec83:b0:1b8:ae12:5628 with SMTP id x3-20020a170902ec8300b001b8ae125628mr4043861plg.2.1689948467486; Fri, 21 Jul 2023 07:07:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689948467; cv=none; d=google.com; s=arc-20160816; b=e3ryIF9KNc3t2oqLHJZ+zARtyP5f64A503gVY1WBlXUtEnFA7yOIBz4ahJ7nBnDmKH JQonnkmyNElNIpppgs5iezQ+z4mZGzydjqyG1NffuF2NdfqovDki0fxbRpoJ8i81Rn8G 9LK0mWfYcMBaXhbLMROOnGdO6hv5PdCNaSgKjCo6o2WkZCJP5/Pv5Ep6OK4ivEr6tpAx cynJ0oqjZ6mbJZShrw940jDyZDpMNSzBhs9J1G7bYKRlgr36dGVa18aKlTBGZJT5J7uh Cq0x1/HfUMU1l+SE+Ydm7uZm5QafuE7AnBpsoihWj6gTbCyrhlZvJhAiFO2xtYOHm80l dhvg== 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=29De29CfgxtaslEDXEZsN6HJ5nTQb8h4NcfQQ6+My7w=; fh=QvXx5lDpQknB9PDD6mOm+E8djX72AmxBQwiVxLDXEAM=; b=UEjiFpmrSe7mgW65AwynkX2B+RRuvnnNXQ56neXjjc0gDZrbQuu/ST02/2rdj1hoMy M9VSGyvKH1ddJptjrEb01LWicMR5BlRpC1T7X6BwrlNZuFDMbKaygdofwV5kDR2z+b64 SJQe2hZOOd6VHzGKZOKQFE4JZK5NJ2F9MFB9HidoJrPPXDYq0+lB8n1leu9makSoNgWk 69JbdFvSHYh5TZaybxYwXb24yaXPOfM2NgZPLFV6w7WzJ8gyitmjGZ6ELiFB6Wy3nx7j vFz02/q9deTnZPHfRAqWi3X8j5IfBVIyRLR0EsuT1BMnbZOfTYrrvkCaGrZ9HhGfJ0Cc lHXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=hLTsQSaH; 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 iw9-20020a170903044900b001b880f88093si3052435plb.8.2023.07.21.07.07.33; Fri, 21 Jul 2023 07:07:47 -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=hLTsQSaH; 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 S231330AbjGUNWR (ORCPT + 99 others); Fri, 21 Jul 2023 09:22:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60378 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231228AbjGUNWL (ORCPT ); Fri, 21 Jul 2023 09:22:11 -0400 Received: from mx0b-001ae601.pphosted.com (mx0b-001ae601.pphosted.com [67.231.152.168]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AA0A5358E for ; Fri, 21 Jul 2023 06:21:40 -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 36L7lwWl024208; Fri, 21 Jul 2023 08:21:26 -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=29De29CfgxtaslEDXEZsN6HJ5nTQb8h4NcfQQ6+My7w=; b= hLTsQSaHDqEoLwbNFZD23xejc04aA/0kflqR1pV0+Zv/ON8o+7h0OmGJw+yVWwzP SaDF7k3TWC7AYyoOFQQy/0jLj13c7Ka7UvzaLSLC060E7LAK504OjAwld6tKCVtw nag9Bu7IwyREnu6RmP8pX8tv9pAlt3fXku60oBcf8o3X04DHy+dDff8U9ZKLeZtb EZq6AD9ypvxqM9qdE3wjPsAoCARSVh2oDhUbu03bVMssLqgVcTEge2uE27dF/5HA grPMOJaGQbJbBjc5OO+lKtLfxduayrELlderNDqlQfjQTjRw58X2PnpJtGvCdkE1 R0lrz9rdkG2OQ9khKTiacQ== Received: from ediex02.ad.cirrus.com ([84.19.233.68]) by mx0b-001ae601.pphosted.com (PPS) with ESMTPS id 3rus6gyj2u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jul 2023 08:21:25 -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 F176346B; Fri, 21 Jul 2023 13:21:23 +0000 (UTC) From: Richard Fitzgerald To: , CC: , , , , Simon Trimmer , Richard Fitzgerald Subject: [PATCH v5 02/11] ASoC: cs35l56: Make cs35l56_system_reset() code more generic Date: Fri, 21 Jul 2023 14:21:11 +0100 Message-ID: <20230721132120.5523-3-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: abVUIvMO1chmM1eHGKjqZGXK-Y_dSGZL X-Proofpoint-GUID: abVUIvMO1chmM1eHGKjqZGXK-Y_dSGZL 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 The function can be more easily reused in HDA if the tracking of whether a soft reset is being performed and whether the device is connected to a SoundWire bus is moved out of the function. Signed-off-by: Simon Trimmer Signed-off-by: Richard Fitzgerald Acked-by: Mark Brown --- sound/soc/codecs/cs35l56.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sound/soc/codecs/cs35l56.c b/sound/soc/codecs/cs35l56.c index 4eb8e5b09bfd..7a83e388e869 100644 --- a/sound/soc/codecs/cs35l56.c +++ b/sound/soc/codecs/cs35l56.c @@ -802,10 +802,8 @@ 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) +static void cs35l56_system_reset(struct cs35l56_private *cs35l56, bool is_soundwire) { - cs35l56->soft_resetting = true; - /* * Must enter cache-only first so there can't be any more register * accesses other than the controlled system reset sequence below. @@ -816,7 +814,7 @@ static void cs35l56_system_reset(struct cs35l56_private *cs35l56) ARRAY_SIZE(cs35l56_system_reset_seq)); /* On SoundWire the registers won't be accessible until it re-enumerates. */ - if (cs35l56->sdw_peripheral) + if (is_soundwire) return; usleep_range(CS35L56_CONTROL_PORT_READY_US, CS35L56_CONTROL_PORT_READY_US + 400); @@ -883,7 +881,8 @@ static void cs35l56_patch(struct cs35l56_private *cs35l56) init_completion(&cs35l56->init_completion); - cs35l56_system_reset(cs35l56); + cs35l56->soft_resetting = true; + cs35l56_system_reset(cs35l56, !!cs35l56->sdw_peripheral); if (cs35l56->sdw_peripheral) { /* @@ -1547,7 +1546,8 @@ 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_system_reset(cs35l56); + cs35l56->soft_resetting = true; + cs35l56_system_reset(cs35l56, !!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