Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp1924460rdb; Thu, 7 Dec 2023 12:36:54 -0800 (PST) X-Google-Smtp-Source: AGHT+IHM13+DVKtZLPHdxJ8GNXF2Y0h/aIWKjVXPk2aactzhvTJmpHNHBhz5taT5u87rdeqo8nzX X-Received: by 2002:a17:90b:4b04:b0:286:6cc1:7801 with SMTP id lx4-20020a17090b4b0400b002866cc17801mr2957442pjb.68.1701981413902; Thu, 07 Dec 2023 12:36:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701981413; cv=none; d=google.com; s=arc-20160816; b=pzms0cdveLA8DPVuycT3UKprcvXADinKnteMe4KsTqmg76Tw+t5TRIjYzaU/7Hrg7S RQ0F8NjxuvCL3MfF68x2m7+aJamB50DVQe1lRI0S8GwOc6grZacTs/DoYQIPu9JGqyzx KGdzkAxlMYwM07XthEWe5X7znR+mB/TSmCFKD0frg2QQtoapAX9cGo0ex4F/HoAt0QT8 CKwK1fIje+DObgyUUQ9fnIdCJWPO/S7Lj5tQTA4DR9yrOjEASXHuzSXwS0hm/eIBSh9j W8I4bRe3ZDzjsJgBZuvS4YNv5oWDGXHUSPB8hx93QesJ4SUMq4+gfqWiHYQpsMYUrPTr 3G0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=JGRL7p0Q6rkC0DrqZWjMXpUs99Cto4uIHrknhxe+HHo=; fh=nmaIcstL9sV5Nq4RMhFU+6bYjxHdBWKpDsuXM6BleVE=; b=aD3s1WRIZhT9nxfYeVXgb3lrf9LhCyuqTFuizPwiLBzTXpcNrHRsJHVp5U2vfVUlur 4frYlrqciwbVDaA2WGEsplBoAa7i7imKSUvDiS8eYaUF3h0KVz/RnwytDmvpesPAzA0k 4SYX9kL7M1ICFZFptZUfmmGp56rN8clv5YvfA38u5A+qdb5lin6zmVKufEvFfN2o/EQe kTeZaxGs2sdo13R4RamfGOvaNIhgDNRj4PocEQrKbCF7VaXKBNEdmcGzNIiv3HpFgdyi WMtflmiPL1h042k1/HbZD7nhwg4trIbojdmJpc8G2ls/ti86jh+bKMFhCT8sVXETFOqC SCLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=AexSbexJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id u8-20020a63df08000000b005b8ebaa2937si268026pgg.47.2023.12.07.12.36.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Dec 2023 12:36:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=AexSbexJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 8CA3D80F549E; Thu, 7 Dec 2023 12:36:41 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235234AbjLGUgY (ORCPT + 99 others); Thu, 7 Dec 2023 15:36:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49478 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233115AbjLGUgW (ORCPT ); Thu, 7 Dec 2023 15:36:22 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 12BC3171A for ; Thu, 7 Dec 2023 12:36:28 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B3B75C433C8; Thu, 7 Dec 2023 20:36:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1701981387; bh=A/iJPAJZbCyqXwpvMP5DNRiXuMJzxGLIa64KiWx8Gas=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=AexSbexJDdMRswMqpmCdOlHy2crmiHPWy9KFikL1+b2b7eNj7Oo1EZ44VOWsy2U88 OeaRxbiJi00cyTUY4bziwCtpr+2QZpTl+4mEt2Ujx2M85ok0VyNA92hBtk4cmpMXWn UgQLxN5ZvcFy1gjkjc4ACN4HsjQZXjvXgGIwzNX20ufxaw7OuMt2nUtz1e7KMUJjKB pjVGdTpPgg45CON4WHIgBsgy5wlWiETvDuU1qx6v769g/T+B8McsVuYKCd4JaRVJB7 hx7y4vYIoJvK4DV7s2PusDCaRcAAjs3Yqxo6AGHFerphjZI6EGN6V8oGhcqZC6p4Ma bwIOLfPLxV2KQ== Date: Thu, 7 Dec 2023 20:36:22 +0000 From: Mark Brown To: Gergo Koteles Cc: Shenghao Ding , Kevin Lu , Baojun Xu , Jaroslav Kysela , Takashi Iwai , Liam Girdwood , linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org Subject: Re: [PATCH 03/16] ASoC: tas2781: disable regmap regcache Message-ID: <5f3f0306-799f-4f3b-9e05-fbd300c59d5d@sirena.org.uk> References: <21a183b5a08cb23b193af78d4b1114cc59419272.1701906455.git.soyer@irl.hu> <0b836c10-b21b-4275-8dd0-254dd5467497@sirena.org.uk> <47097f19398808b64f4cc87c2a3c7cc462fb2416.camel@irl.hu> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="Uj2TarlHLm2msvZq" Content-Disposition: inline In-Reply-To: <47097f19398808b64f4cc87c2a3c7cc462fb2416.camel@irl.hu> X-Cookie: Two is company, three is an orgy. X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Thu, 07 Dec 2023 12:36:41 -0800 (PST) --Uj2TarlHLm2msvZq Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Dec 07, 2023 at 09:19:34PM +0100, Gergo Koteles wrote: > On Thu, 2023-12-07 at 18:20 +0000, Mark Brown wrote: > > On Thu, Dec 07, 2023 at 12:59:44AM +0100, Gergo Koteles wrote: > > > The amp has 3 level addressing (BOOK, PAGE, REG). > > > The regcache couldn't handle it. > > So the books aren't currently used so the driver actually works? > It writes to the book 0 and 8c. The initialization works with regcache, > because it writes also the i2c devices. I can't see any references to 0x8c in the driver? > > > static int tas2781_system_suspend(struct device *dev) > > > @@ -770,10 +758,7 @@ static int tas2781_system_suspend(struct device = *dev) > > > return ret; > > > =20 > > > /* Shutdown chip before system suspend */ > > > - regcache_cache_only(tas_priv->regmap, false); > > > tasdevice_tuning_switch(tas_priv, 1); > > > - regcache_cache_only(tas_priv->regmap, true); > > > - regcache_mark_dirty(tas_priv->regmap); > > How can this work over system suspend? This just removes the cache with > > no replacement so if the device looses power over suspend (which seems > > likely) then all the register state will be lost. A similar issue may > > potentially exist over runtime suspend on an ACPI system with > > sufficiently heavily optimised power management. > In runtime_resume, only one of the two amplifiers goes back. > The runtime_suspend sets the current book/prog/conf to -1 on all > devices, and tas2781_hda_playback_hook will restore the > program/configuration/profile with tasdevice_tuning_switch. What does "go back" mean? =20 > And only one, because tasdevice_change_chn_book directly changes the > address of i2c_client, so the unlucky one gets invalid values in its > actual book from regcache_sync. The code creates the impression that writing to one tas2781 writes to all of them, is that not the case? > system_restore doesn't work at all, because regcache_cache_only stays > true since system_suspend. Presumably the next runtime resume would make the device writable again? > It works without the regcache functions. How would the devices get their configuration restored? This sounds very much like a case of something working for your specific system in your specific test through some external factor rather than working by design, whatever problems might exist it seems fairly obvious to inspection that this patch would make things worse for other systems. At a minimum this patch needs a much clearer changelog (all the patches I looked at could use clearer changelogs) which explains what's going on here, I would really expect to see something that replaces the use of the cache sync to restore the device state for example. --Uj2TarlHLm2msvZq Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmVyLMUACgkQJNaLcl1U h9A1fQf/Tlm20RKXzkcJxmQRhcBpwToF4r81+C/V1oU79kt+sva9XYW8cdM7zpJQ LRgZIL4PcwHJIFjlxILYMs7iUaYnGqYEcL9OTxorCkVKUA29gqpF0LJLLQhxuCje FVEHeQLgF1lPk2bu0WuJeyvOJuAjXQYRrmSdIFLIQZOS4r4T3HsjX4OIV6fiGaxR pZZp+/R9MMFRe5nnA3nIsKVeqA21rH7rGdN0eCZsMhbRF82Vy9N8MNoAPw8EwgVU d1DQ9lsWKqnvZkRnEIca9VU5kfcswwqtvj4fQn4e3mv2mrQpKBMXvng7lGHM5Hn5 43hKhgOyvrEp9y/L+pdxWi/piD+Uog== =DLg/ -----END PGP SIGNATURE----- --Uj2TarlHLm2msvZq--