Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp10914665rwp; Fri, 21 Jul 2023 06:50:51 -0700 (PDT) X-Google-Smtp-Source: APBJJlFxXhqiKj6IcxUuDD9HF0QwryVc/ZqrmpFmxockg9MEdhl+dmfbsKShgyP2i7opDbTxkUkI X-Received: by 2002:a05:6358:709:b0:135:47e8:76e2 with SMTP id e9-20020a056358070900b0013547e876e2mr27399rwj.4.1689947450873; Fri, 21 Jul 2023 06:50:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689947450; cv=none; d=google.com; s=arc-20160816; b=dySMdPXicNXk6vs4GbInI2muINBUrQP7vsw/If59nlmI0nyRbvmAW0VJ+rRlyFvKmL 8MA7v65igQ47uaR/LpiwVwhzMoAuqAu7GiaOIdfW1jBPuXxiREnqj32UuajEPfFpirms R6z3FAmONZkOc2F1yCckH+44i9yUtROJcmqr1a/Yeis3aJv+9eMAfelda+Pfjk8pp0N0 YpGfCKjPICyxTsoVGBKSlcJRkGaArVQy564AlaCPeRJ5atw4wDEIs13KWn0Gq6DwuuEK DzRcQJIDsN9MqgdSLpvRKWzca2kv5IbkR8Q5r4MLy1JerAOQPSEgBjy5jiAKN3r2U2BV PwCg== 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=/GR8Vtk59byP9wmS57RBzSvQgsvYoSeDrSmoMD6yAyg=; fh=QvXx5lDpQknB9PDD6mOm+E8djX72AmxBQwiVxLDXEAM=; b=aNpa5dBR+i0ed5ZAO1OipsFbs2303vF3EhCv1Sd05UXCk1ugXiO2Aj2SmJ2L4gDn3X gQiDgzVKn82dldCrL2xb2d4vFL+HUlDiGn5pvrvrcBzWPOeNMxJKmLCdxbrY0QKPQRxJ TjW41hAoiOQGWxZp0bWVUR13VzcelsWSmQkkLk1egrQb6m+EIU9fBbSRj15RGvUXXCjb 2IQ6qbjVwLPu6Za9h5Udo65byLUEyW+FrTSCHHS8NfoMgtl1PBlGqKeUtl1d0XP+yFSL VqvQPONXZMPu1Owi3suNYsb6OXXhlvhdCTl6TngeWwB73S+anENh4C5SkbV9oHeEn5HU AaMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=TDYllQvB; 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 k184-20020a636fc1000000b005638355e990si1563022pgc.410.2023.07.21.06.50.34; Fri, 21 Jul 2023 06:50:50 -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=TDYllQvB; 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 S231432AbjGUNWz (ORCPT + 99 others); Fri, 21 Jul 2023 09:22:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60202 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231169AbjGUNW0 (ORCPT ); Fri, 21 Jul 2023 09:22:26 -0400 Received: from mx0b-001ae601.pphosted.com (mx0a-001ae601.pphosted.com [67.231.149.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E84763C05 for ; Fri, 21 Jul 2023 06:21:50 -0700 (PDT) Received: from pps.filterd (m0077473.ppops.net [127.0.0.1]) by mx0a-001ae601.pphosted.com (8.17.1.22/8.17.1.22) with ESMTP id 36LBeOqL003184; Fri, 21 Jul 2023 08:21:29 -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=/GR8Vtk59byP9wmS57RBzSvQgsvYoSeDrSmoMD6yAyg=; b= TDYllQvBA7zFTKeNcNFyxM7PHmQo7d5ZUfiN+vY1E1H6LjK6isyWVdgfn+52qGfU wy/e6F2AQ0u0feRbCwazXPMShAVnX6gtf3MNdT6UY5zyslvnULxcT6nh9fM176wW xmqmQh26XN5YycfW0ptj1GxFi6lZsI9G+qVe/0aSeLePFZ9CXgSVDXMkQOVOKigh pdbbtMT1t1n9VTyQetJrO63Naf3ufBGsy3H/eYog8zCDdLl26ImjAQhyAX02Y7Yq DLf3KSXK9dMlL3iB0gNw+UZqw6mt7HcVLvKqO/Xc+GzhaqIR25BNngXrCddKcumv iLB8IYpyeO0MHPgDx6ZlKA== Received: from ediex01.ad.cirrus.com ([84.19.233.68]) by mx0a-001ae601.pphosted.com (PPS) with ESMTPS id 3rus62y4hx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 21 Jul 2023 08:21:29 -0500 (CDT) 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.30; Fri, 21 Jul 2023 14:21:27 +0100 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.30 via Frontend Transport; Fri, 21 Jul 2023 14:21:27 +0100 Received: from work-debian.ad.cirrus.com (unknown [198.61.64.172]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id BBB6D15B6; Fri, 21 Jul 2023 13:21:26 +0000 (UTC) From: Richard Fitzgerald To: , CC: , , , , Simon Trimmer , Richard Fitzgerald Subject: [PATCH v5 08/11] ASoC: cs35l56: Make common function for control port wait Date: Fri, 21 Jul 2023 14:21:17 +0100 Message-ID: <20230721132120.5523-9-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-GUID: gpEXFCACL11W3ufuZboS1PXaSEyF-jjJ X-Proofpoint-ORIG-GUID: gpEXFCACL11W3ufuZboS1PXaSEyF-jjJ 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 Move the waits for CS35L56_CONTROL_PORT_READY_US into a common function, and also allow a wider range of allowed wait times. Signed-off-by: Simon Trimmer Signed-off-by: Richard Fitzgerald Acked-by: Mark Brown --- include/sound/cs35l56.h | 1 + sound/soc/codecs/cs35l56-shared.c | 16 ++++++++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/include/sound/cs35l56.h b/include/sound/cs35l56.h index 0d6cdfb6107b..79e117abee06 100644 --- a/include/sound/cs35l56.h +++ b/include/sound/cs35l56.h @@ -275,6 +275,7 @@ extern const unsigned int cs35l56_tx_input_values[CS35L56_NUM_INPUT_SRC]; int cs35l56_set_patch(struct cs35l56_base *cs35l56_base); int cs35l56_mbox_send(struct cs35l56_base *cs35l56_base, unsigned int command); int cs35l56_wait_for_firmware_boot(struct cs35l56_base *cs35l56_base); +void cs35l56_wait_control_port_ready(void); void cs35l56_wait_min_reset_pulse(void); void cs35l56_system_reset(struct cs35l56_base *cs35l56_base, bool is_soundwire); int cs35l56_irq_request(struct cs35l56_base *cs35l56_base, int irq); diff --git a/sound/soc/codecs/cs35l56-shared.c b/sound/soc/codecs/cs35l56-shared.c index 8a98070ece5e..4e3becb9581d 100644 --- a/sound/soc/codecs/cs35l56-shared.c +++ b/sound/soc/codecs/cs35l56-shared.c @@ -244,6 +244,13 @@ int cs35l56_wait_for_firmware_boot(struct cs35l56_base *cs35l56_base) } EXPORT_SYMBOL_NS_GPL(cs35l56_wait_for_firmware_boot, SND_SOC_CS35L56_SHARED); +void cs35l56_wait_control_port_ready(void) +{ + /* Wait for control port to be ready (datasheet tIRS). */ + usleep_range(CS35L56_CONTROL_PORT_READY_US, 2 * CS35L56_CONTROL_PORT_READY_US); +} +EXPORT_SYMBOL_NS_GPL(cs35l56_wait_control_port_ready, SND_SOC_CS35L56_SHARED); + void cs35l56_wait_min_reset_pulse(void) { /* Satisfy minimum reset pulse width spec */ @@ -270,7 +277,7 @@ void cs35l56_system_reset(struct cs35l56_base *cs35l56_base, bool is_soundwire) if (is_soundwire) return; - usleep_range(CS35L56_CONTROL_PORT_READY_US, CS35L56_CONTROL_PORT_READY_US + 400); + cs35l56_wait_control_port_ready(); regcache_cache_only(cs35l56_base->regmap, false); } EXPORT_SYMBOL_NS_GPL(cs35l56_system_reset, SND_SOC_CS35L56_SHARED); @@ -481,8 +488,7 @@ int cs35l56_runtime_resume_common(struct cs35l56_base *cs35l56_base, bool is_sou cs35l56_hibernate_wake_seq, ARRAY_SIZE(cs35l56_hibernate_wake_seq)); - usleep_range(CS35L56_CONTROL_PORT_READY_US, - CS35L56_CONTROL_PORT_READY_US + 400); + cs35l56_wait_control_port_ready(); } out_sync: @@ -556,9 +562,7 @@ int cs35l56_hw_init(struct cs35l56_base *cs35l56_base) if (!cs35l56_base->reset_gpio) regmap_read(cs35l56_base->regmap, CS35L56_DSP_VIRTUAL1_MBOX_1, &devid); - /* Wait for control port to be ready (datasheet tIRS). */ - usleep_range(CS35L56_CONTROL_PORT_READY_US, - CS35L56_CONTROL_PORT_READY_US + 400); + cs35l56_wait_control_port_ready(); /* * The HALO_STATE register is in different locations on Ax and B0 -- 2.30.2