Message ID | 20230127165111.3010960-9-sbinding@opensource.cirrus.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp934509wrn; Fri, 27 Jan 2023 08:54:51 -0800 (PST) X-Google-Smtp-Source: AK7set87RPVvoWH4p2cHCjFgTzrYIQzM8ksKS3zcha1VlCI1eBg9FqPuR9Gr0m4RxMHD2UoW7vr+ X-Received: by 2002:a17:902:f2d2:b0:196:49a8:225c with SMTP id h18-20020a170902f2d200b0019649a8225cmr4185144plc.0.1674838491368; Fri, 27 Jan 2023 08:54:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674838491; cv=none; d=google.com; s=arc-20160816; b=YgLdeknsYX5JNkPoLrC7RWCl+Gj+vIg2r2PQ6VThn9k+MJQRK2W1QPKp2uU3VncZvv B7oJkT44WLFEM7CVTEPqnSmaU+ACyDXrPhHgf/C3F663lqjhWQCxR9TVXyVEFUd/rKj8 sdEJU/6GNdeg3m7qYBm0GTnPEs71K7o2oH2LVhCgpZOWG8islJmoUQ11218dkkOc8zUS OYfRMz+Fk/trFIvXjDvqCFjOAlqTzz89G8zk1sMp9YdnmoShvBx3ON+6b9uLkILlzr+X CMRuSMHDrPXlWQeLU8UPM4+HUTDbhYRagmR8OIa9goZ00FrKVmmX4Sw8WKqiOqCMWlCW lLaQ== 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=U/maz5mq7SDVzaMNMiD4HWoXA0LOACVlnq93oey3UBM=; b=s8Jptj26Y7PIkEa7K0K+1fpmapdKff7CuOTXu/pP0QlpE6ZAcg+JD4aWGEuMFuOV43 I1oCMVGoNKv56iM8F5IlFRs4HuNCYtKT4vwhAPuXgI0Lrx6NmGGVyGKAh+uHNrleSxsi S0vjNVnf31ru5ckxcH0DcS2YsgJRTvK9iapyTTjvy6joRpx07kL+aTCcsVmG5PxzdRIH N9vtlc8MJzvSBrD06TofKB3MNVUiI4XAKOlNbng72iXjW61mvDxuPHZAWZKu0NbIUnGF xFB60nA8PR/EvVGvxOqlXkzefXa1h+Hy59XWgSmx8KvBXiNDKeUCWGj7iF1faoxwixrJ K87g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=jFZbsW3f; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x8-20020a170902ec8800b00189cbf6953dsi5583728plg.300.2023.01.27.08.54.39; Fri, 27 Jan 2023 08:54:51 -0800 (PST) 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=jFZbsW3f; 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 S234534AbjA0Qv7 (ORCPT <rfc822;lekhanya01809@gmail.com> + 99 others); Fri, 27 Jan 2023 11:51:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44596 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233569AbjA0Qvl (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 27 Jan 2023 11:51:41 -0500 Received: from mx0b-001ae601.pphosted.com (mx0b-001ae601.pphosted.com [67.231.152.168]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7FE7C7E04E for <linux-kernel@vger.kernel.org>; Fri, 27 Jan 2023 08:51:40 -0800 (PST) Received: from pps.filterd (m0077474.ppops.net [127.0.0.1]) by mx0b-001ae601.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 30R9k8LV030633; Fri, 27 Jan 2023 10:51:33 -0600 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=U/maz5mq7SDVzaMNMiD4HWoXA0LOACVlnq93oey3UBM=; b=jFZbsW3fNWzSXVtTVtqLfUylJ9G7+7ANLZnP8Fy7QfjqoytQ3y4dVLbB2b66TPRQkPCW f1vjkw8ho825Slg7jsN0yqcyBu6Pr2Hbe93V+aIFFD+u2xfYgvx9+tKKD7kf4k+n7etV k795p3z8r7Ihi2lbJArz/vrKvgaVdp6Kpfi9lE2fexx4+dueuFknxR5rMWPOARPflOdR clMQMg9eezpXoYafE+9Q+afJ7KuQP586gVnFgaBkKBxp0JTpvCMhxfszGNNGs7+3zC3G VK9WNWEUkAeIJNcAXzyoF2zDwxgyQyummbKogQMUKq9sGp8QvZ3SU8W2uDAUN2o5ZLGr oA== Received: from ediex02.ad.cirrus.com ([84.19.233.68]) by mx0b-001ae601.pphosted.com (PPS) with ESMTPS id 3n8dbsvrd1-7 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 27 Jan 2023 10:51:33 -0600 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.21; Fri, 27 Jan 2023 10:51:29 -0600 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.7 via Frontend Transport; Fri, 27 Jan 2023 10:51:29 -0600 Received: from sbinding-cirrus-dsktp2.ad.cirrus.com (unknown [198.90.202.160]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id 7E92511DC; Fri, 27 Jan 2023 16:51:29 +0000 (UTC) From: Stefan Binding <sbinding@opensource.cirrus.com> To: Vinod Koul <vkoul@kernel.org>, Bard Liao <yung-chuan.liao@linux.intel.com>, Mark Brown <broonie@kernel.org>, Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> CC: <alsa-devel@alsa-project.org>, <linux-kernel@vger.kernel.org>, <patches@opensource.cirrus.com>, Stefan Binding <sbinding@opensource.cirrus.com> Subject: [PATCH v3 8/8] ASoC: cs42l42: Wait for debounce interval after resume Date: Fri, 27 Jan 2023 16:51:11 +0000 Message-ID: <20230127165111.3010960-9-sbinding@opensource.cirrus.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230127165111.3010960-1-sbinding@opensource.cirrus.com> References: <20230127165111.3010960-1-sbinding@opensource.cirrus.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-ORIG-GUID: aAvAmRBgvSBVNp_iapDEzhgWA-nkGonO X-Proofpoint-GUID: aAvAmRBgvSBVNp_iapDEzhgWA-nkGonO 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 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756195445767464529?= X-GMAIL-MSGID: =?utf-8?q?1756195445767464529?= |
Series |
ASoC: cs42l42: Add SoundWire support
|
|
Commit Message
Stefan Binding
Jan. 27, 2023, 4:51 p.m. UTC
Since clock stop causes bus reset on Intel controllers, we need
to wait for the debounce interval on resume, to ensure all the
interrupt status registers are set correctly.
Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
---
sound/soc/codecs/cs42l42-sdw.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
Comments
On 1/27/23 10:51, Stefan Binding wrote: > Since clock stop causes bus reset on Intel controllers, we need nit-pick: It's more that the Intel controller has a power optimization where the context is lost when stopping the clock, which requires a bus reset and full re-enumeration/initialization when the clock resumes. The rest of the patch is fine so Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> > to wait for the debounce interval on resume, to ensure all the > interrupt status registers are set correctly. > > Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
On 30/01/2023 16:45, Pierre-Louis Bossart wrote: > > > On 1/27/23 10:51, Stefan Binding wrote: >> Since clock stop causes bus reset on Intel controllers, we need > > nit-pick: It's more that the Intel controller has a power optimization > where the context is lost when stopping the clock, which requires a bus > reset and full re-enumeration/initialization when the clock resumes. > Ok, it's true that clock stop doesn't _cause_ bus reset, bus reset is necessary when exiting clock stop. We can re-word if you want us to describe that accurately. But from the codec driver's point of view, a clock stop causes a bus reset. > The rest of the patch is fine so > > Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> > >> to wait for the debounce interval on resume, to ensure all the >> interrupt status registers are set correctly. >> >> Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
On 1/31/23 05:03, Richard Fitzgerald wrote: > On 30/01/2023 16:45, Pierre-Louis Bossart wrote: >> >> >> On 1/27/23 10:51, Stefan Binding wrote: >>> Since clock stop causes bus reset on Intel controllers, we need >> >> nit-pick: It's more that the Intel controller has a power optimization >> where the context is lost when stopping the clock, which requires a bus >> reset and full re-enumeration/initialization when the clock resumes. >> > > Ok, it's true that clock stop doesn't _cause_ bus reset, bus reset is > necessary when exiting clock stop. We can re-word if you want us to > describe that accurately. > > But from the codec driver's point of view, a clock stop causes a bus > reset. it's fine, we all agree here. >> The rest of the patch is fine so >> >> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> >> >>> to wait for the debounce interval on resume, to ensure all the >>> interrupt status registers are set correctly. >>> >>> Signed-off-by: Stefan Binding <sbinding@opensource.cirrus.com>
diff --git a/sound/soc/codecs/cs42l42-sdw.c b/sound/soc/codecs/cs42l42-sdw.c index 0de370b40eaf0..79023268d4c1b 100644 --- a/sound/soc/codecs/cs42l42-sdw.c +++ b/sound/soc/codecs/cs42l42-sdw.c @@ -447,7 +447,9 @@ static int __maybe_unused cs42l42_sdw_handle_unattach(struct cs42l42_private *cs static int __maybe_unused cs42l42_sdw_runtime_resume(struct device *dev) { + static const unsigned int ts_dbnce_ms[] = { 0, 125, 250, 500, 750, 1000, 1250, 1500}; struct cs42l42_private *cs42l42 = dev_get_drvdata(dev); + unsigned int dbnce; int ret; dev_dbg(dev, "Runtime resume\n"); @@ -456,8 +458,14 @@ static int __maybe_unused cs42l42_sdw_runtime_resume(struct device *dev) return 0; ret = cs42l42_sdw_handle_unattach(cs42l42); - if (ret < 0) + if (ret < 0) { return ret; + } else if (ret > 0) { + dbnce = max(cs42l42->ts_dbnc_rise, cs42l42->ts_dbnc_fall); + + if (dbnce > 0) + msleep(ts_dbnce_ms[dbnce]); + } regcache_cache_only(cs42l42->regmap, false);