Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2353460rwd; Fri, 26 May 2023 05:37:20 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4llyWi3M9NLzRgLmFlwlewmWMfWwFjQH0wGRIYdTqr58yHx3yFwBNMD4Nb5FesmifSJmyu X-Received: by 2002:a17:902:b705:b0:1af:e116:4b42 with SMTP id d5-20020a170902b70500b001afe1164b42mr4782752pls.34.1685104640316; Fri, 26 May 2023 05:37:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685104640; cv=none; d=google.com; s=arc-20160816; b=jbGlWAQioAzF6yIq1r81PgoI3hbAjqjSTTTTYwo4qUOk0ZqDJQ4DcH42TLbAHiGALX B96xFnyTKK4k/33efhbkWD0B3Z6gxqdSP6/Lxxzcrpde4IdZjAKdwCG/yartGEGc3HFt SfRBlnuv74JJwbowOAMzG/pVfX9YDRIEbCinnFPAU43R77lEmrsmJGAxy9rEHDzoe0/P lSgUm2m8CWi32jh/2LmMy8u1BDKAzClIZYEilbIOovbOwh8Yk3LDC6TtnmX+6BQxfzVk ayys41q6qiMP3uaggQBSb77js1Sm5ggUF9AnMWS2Fg3QMVbSBz28xy1RM7aPkDdZZ6fl bJ3w== 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=gjvF9y3c82RzHTgs5t2qAQVubD+R1HPBW6x2ID+7JwQ=; b=ZzaIw5U9X/0Iu/wpcJyAb0bYgFr3Axe7boMErUQsCK48HzmDfQjFj8f/NPRMtjMBmQ wYSgLBuELhsp7HfrPmNPRdgSGd7Y+InkxohAIW/i6XXk1bbCoq9rkuD7tvq8kpsIxn0M sRvIqSpKykXwKYOldcu4otOk6NE+nFVQIecTHVwmWN9a9rRaxI6L4aBQWnB/9cN4Tfo8 XgjfLzO8XPz9+2t8F0AdJLkt+vp+PBHfpZL7Vj6HMStTjszal/G/ECR49kTk6ZJSW0ET /cw0tfWr3oiUEtXFBs4rQHmacXnIa4zWDEjZ11+w62t3OXEnGoKrK7P1STYWWEQBxdrM 7c6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=eqt5WJIJ; 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 jc11-20020a17090325cb00b001a94b91f428si3623754plb.319.2023.05.26.05.37.08; Fri, 26 May 2023 05:37:20 -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=eqt5WJIJ; 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 S243252AbjEZM3S (ORCPT + 99 others); Fri, 26 May 2023 08:29:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59178 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229766AbjEZM3R (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 AB50A194 for ; Fri, 26 May 2023 05:29:12 -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 34QC7FGt007721; Fri, 26 May 2023 07:28:57 -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=gjvF9y3c82RzHTgs5t2qAQVubD+R1HPBW6x2ID+7JwQ=; b=eqt5WJIJjV6uOmIoS+tpPbLNSegqSGlhzqoB2ID8kU7U/H7n8NYpUPeoVocqolQbiVZa uYHMWUFxG3s8lVLXNBw3URyJwM5UK0cnecJ0WMu7oZTIGb3W/qX7HNzIQJI4A9rzfpKu 9aHmhcjmxLeryHB26muVTkxV6kUFBoR1JsG/SMJ1TPvL4N5uNFlP3YmeRBLxYZRs6gnX kZLSe/k+hGKpZddU5TW1g5Pr+Io/Ag4gOkSvHHJ0h4Hk0UJWxgZ6z5dP32Cpl2Bu0duK bxDRaN3UXzFS7wwkH59yEXEc6OQ4Crpd8Ii2/lLzT7/EvAEK7Rk3ai4fscenzMsuSl+s vQ== Received: from ediex01.ad.cirrus.com ([84.19.233.68]) by mx0a-001ae601.pphosted.com (PPS) with ESMTPS id 3qsde8k66v-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 26 May 2023 07:28:57 -0500 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.26; Fri, 26 May 2023 07:28:55 -0500 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.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 3A52611A8; Fri, 26 May 2023 12:28:55 +0000 (UTC) From: Richard Fitzgerald To: , , CC: , , , Simon Trimmer , Richard Fitzgerald Subject: [PATCH v3 02/12] ASoC: cs35l56: Make cs35l56_system_reset() code more generic Date: Fri, 26 May 2023 13:28:42 +0100 Message-ID: <20230526122852.4552-3-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: 8bit Content-Type: text/plain X-Proofpoint-ORIG-GUID: qIVzziWqmjJFw00D4UuMtyws15xD_hoS X-Proofpoint-GUID: qIVzziWqmjJFw00D4UuMtyws15xD_hoS X-Proofpoint-Spam-Reason: safe X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,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 4d41c4b040a4..76cc9110d4e0 100644 --- a/sound/soc/codecs/cs35l56.c +++ b/sound/soc/codecs/cs35l56.c @@ -805,10 +805,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. @@ -819,7 +817,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); @@ -886,7 +884,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) { /* @@ -1550,7 +1549,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