Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp977932rwd; Thu, 1 Jun 2023 08:55:55 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7bN9OKDVQ/y6kN5B0DgGVx5BGPoQeg4Do0544osaj41CBa3BPPXdAr52BgXKfZ1n8dx9ln X-Received: by 2002:a05:6a00:1ca4:b0:64f:d4a8:8fa9 with SMTP id y36-20020a056a001ca400b0064fd4a88fa9mr2220071pfw.9.1685634954962; Thu, 01 Jun 2023 08:55:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685634954; cv=none; d=google.com; s=arc-20160816; b=mhuQpYz7xtPSQt6znLJ++m4VuMJIUo4GmBc/sYOiGJ5nEKv/jd7f2ONQgIGM9BaVZZ Qs/qx+pGW5WIcqfUUuXe9ZsmlsapP7FxUyCPYS2jAD4w47yoMZOoUbuTsdKB1zoiXpQN BSmUHMaEMBU+14gpT6+5VW8PNgsbLjqjZUWGdgRoo6v1In7Re9VrkMB3DfECn6h+dA2u 5GVyLWJ1akGO/WYRmaUACrITqYhzC3kM9NT1lRt1y0BUpT3ia5rMnsHLnig994fW7MyP yJ9bnm1OoMS/6XbOh/tquGo+fcU2AQMoSS3vl6TYq5QTQU32HPFt8m89zVkAO8NSEH37 uKiA== 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=ZtRVanoa2UL9fx2mOjgnx7Kor2SKPiAisybX4sOubCs=; b=i4IRuOCPcOwDws/xW2jnHKoK4WKj8WjjFCK2l9gdEBKNgSA6727IughgZFjIghgNr+ WHIYe8z9SCD3AJ62vnQ5HAwaNT5qb6PuhaKYH3V4l2gEGUVAR8bXCJeivjMzulRrWHOH h/atUNOER88NpWxyOamazPuFfF1pmJcAO+RH96CFKszzbcGY/4I+n9GPOcuUpk9igOg0 MIFDyLqLGlN+J4t9E4oKpHF5T3UHmVDZZlNShah1ahY5DajsKbR+AFdKt/M+l1Llss1M rQodGY8Xd7GWBMNU1JsL2mKXmnHMnmgsyF4/OiIhDHXw9IRuwaqWemv3jqE6nzpjrNRB tDDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=S0YdhEIN; 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 o25-20020a637319000000b0053b8c964128si3145046pgc.708.2023.06.01.08.55.37; Thu, 01 Jun 2023 08:55:54 -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=S0YdhEIN; 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 S235050AbjFAPsW (ORCPT + 99 others); Thu, 1 Jun 2023 11:48:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48758 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233753AbjFAPr4 (ORCPT ); Thu, 1 Jun 2023 11:47:56 -0400 Received: from mx0b-001ae601.pphosted.com (mx0a-001ae601.pphosted.com [67.231.149.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED282180 for ; Thu, 1 Jun 2023 08:47:54 -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 351CPISZ014930; Thu, 1 Jun 2023 10:47:37 -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=ZtRVanoa2UL9fx2mOjgnx7Kor2SKPiAisybX4sOubCs=; b=S0YdhEINQttRsPR0Nq/Ygs4gC6mlo5XSRL/wzAPPlHqFSwv0UVQA0RCXLUPgRwIWGMF/ OeZBV5crmUSx2/SHWSXFdpsW2CPZGHloxV7UBbiVZwW7SBMlh+yVmbC59HXOPPh7d8fB u62+R8Uz5+LP4eNOAhdAl+Iz11V5pWYmrc6XhUPIdxwIP+2GmXRQ0ZP0EBih29aMWqkh kptjGvkdr8c2b2txofK/iwpb75184ai8j6m9EgfI5J0LjQj1QAv/iH4NOB+oSGzpMtEs FqhQ9aIO5rc/9mIaMDRh9TPc4bFxyazxwnff/mezOoLv4F1SohQ70if+6X9syNyP0+su JA== Received: from ediex01.ad.cirrus.com ([84.19.233.68]) by mx0a-001ae601.pphosted.com (PPS) with ESMTPS id 3quf90x42d-5 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 01 Jun 2023 10:47:37 -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; Thu, 1 Jun 2023 16:47:31 +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.26 via Frontend Transport; Thu, 1 Jun 2023 16:47:31 +0100 Received: from edi-sw-dsktp-006.ad.cirrus.com (edi-sw-dsktp-006.ad.cirrus.com [198.90.251.127]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id BC87E15A4; Thu, 1 Jun 2023 15:47:31 +0000 (UTC) From: Richard Fitzgerald To: , , CC: , , , Simon Trimmer , Richard Fitzgerald Subject: [PATCH v4 08/12] ASoC: cs35l56: Make common function for control port wait Date: Thu, 1 Jun 2023 16:47:27 +0100 Message-ID: <20230601154731.3210572-9-rf@opensource.cirrus.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230601154731.3210572-1-rf@opensource.cirrus.com> References: <20230601154731.3210572-1-rf@opensource.cirrus.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: ZVmxJV_NsmlLJqlBjs1oeVwctAu3N39e X-Proofpoint-ORIG-GUID: ZVmxJV_NsmlLJqlBjs1oeVwctAu3N39e 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 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 489a61f84325..ae9e8f55962a 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]; void cs35l56_reread_firmware_registers(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 e3b935bd9037..7e02d023338c 100644 --- a/sound/soc/codecs/cs35l56-shared.c +++ b/sound/soc/codecs/cs35l56-shared.c @@ -249,6 +249,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 */ @@ -275,7 +282,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); @@ -486,8 +493,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: @@ -561,9 +567,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