Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp1916651rdb; Thu, 7 Dec 2023 12:19:54 -0800 (PST) X-Google-Smtp-Source: AGHT+IE7VMY4T2bXgL3QclEIsaaEDff49hVnrh6OI0jeQTSDjiObVsNWy2GuEsQzjKv+detjdw0x X-Received: by 2002:a17:90b:46c1:b0:286:ce9e:5032 with SMTP id jx1-20020a17090b46c100b00286ce9e5032mr2685958pjb.16.1701980394396; Thu, 07 Dec 2023 12:19:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701980394; cv=none; d=google.com; s=arc-20160816; b=isOcJ4ensbwP/a74M8rqvHM7tdlpPdZ+Z/5xiXbFfJIv72SxLHstZj6a/KW9Qd5q9b gBmPEYkZnZ8+rVPKzfa2sn7Wr4v69/7/AT5/LRaipQxkg4eIXtukm4dqh8BXUgSacsfS qmj2Swk9cszimF5HpZ5Y8QwRSjnHJJWjWW5CCBu7ZVP4TBGY4QsFBV1PAz0XEmy1dGB+ rgjZ6n12kYwmI6r6QOR3x4nlFvtTCcRuScHTrEHRC4QyQ9pf3d6nDQlyaJdtUB6Mc5KC 3YZ96LIei6zLcx1eSFObPaMZPZnYAlzNp1qmiAIVtjiGMQJtLv85D66SYQxy9O/ByGsr Sbbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent :content-transfer-encoding:references:in-reply-to:date:cc:to:from :subject:message-id; bh=ycsKnwXu+F0F7/JZQeAymVV/SureyTRD4Q3KStQ89/Q=; fh=ZR6V6D2WU0zyIjfQPX7YfmWZmlvbVzl0m0Qi5vpsgvY=; b=DuTUkDzf33kZJKyJiOi97g1rBtdrQvclO+H2OciRPXevdHRz9kT0QbR1DIudHGII9P HgAxks8ynTQGhaCCtqDj0Clb9Mk9Z+UzDMaDM6PotRQ3yqlK9gY280b5EKztCJ4PLJ4+ OegCMqczLZm+WoqT6GM0gfwR4Tqr62yAlfisUS4EOD8si4dH8hmMKJ+2VOPKdnPRftra MPg2x3HzhCHgyPAZ7gVtORtjcONgdQYZvmTCxOlNMcTECqLE2xAlrWCbeMUXvVn/GXJU 1qmX+/J1mY6BhwVNWSOySkp5ND9isLOJtzjr/qQS8yrK33I7AzjjZBYxdW5sB+U0LTsh uRng== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=irl.hu Return-Path: Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id gx6-20020a17090b124600b0028a1ee84596si487618pjb.186.2023.12.07.12.19.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Dec 2023 12:19:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=irl.hu Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 3930383294D4; Thu, 7 Dec 2023 12:19:52 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233115AbjLGUTe convert rfc822-to-8bit (ORCPT + 99 others); Thu, 7 Dec 2023 15:19:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55486 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229541AbjLGUTd (ORCPT ); Thu, 7 Dec 2023 15:19:33 -0500 Received: from irl.hu (irl.hu [95.85.9.111]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B8FD41717 for ; Thu, 7 Dec 2023 12:19:39 -0800 (PST) Received: from [192.168.2.4] (51b690cd.dsl.pool.telekom.hu [::ffff:81.182.144.205]) (AUTH: CRAM-MD5 soyer@irl.hu, ) by irl.hu with ESMTPSA id 0000000000070A5A.00000000657228D7.0011AE34; Thu, 07 Dec 2023 21:19:35 +0100 Message-ID: <47097f19398808b64f4cc87c2a3c7cc462fb2416.camel@irl.hu> Subject: Re: [PATCH 03/16] ASoC: tas2781: disable regmap regcache From: Gergo Koteles To: Mark Brown Cc: Shenghao Ding , Kevin Lu , Baojun Xu , Jaroslav Kysela , Takashi Iwai , Liam Girdwood , linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org Date: Thu, 07 Dec 2023 21:19:34 +0100 In-Reply-To: <0b836c10-b21b-4275-8dd0-254dd5467497@sirena.org.uk> References: <21a183b5a08cb23b193af78d4b1114cc59419272.1701906455.git.soyer@irl.hu> <0b836c10-b21b-4275-8dd0-254dd5467497@sirena.org.uk> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT User-Agent: Evolution 3.50.1 (3.50.1-1.fc39) MIME-Version: 1.0 X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, 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 morse.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 (morse.vger.email [0.0.0.0]); Thu, 07 Dec 2023 12:19:52 -0800 (PST) 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. > > static int tas2781_system_suspend(struct device *dev) > > @@ -770,10 +758,7 @@ static int tas2781_system_suspend(struct device *dev) > > return ret; > > > > /* 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); > > > > /* > > * Reset GPIO may be shared, so cannot reset here. > > 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. 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. system_restore doesn't work at all, because regcache_cache_only stays true since system_suspend. It works without the regcache functions.