From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 439B1EB64D8 for ; Wed, 14 Jun 2023 05:56:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242997AbjFNF4Z (ORCPT ); Wed, 14 Jun 2023 01:56:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242969AbjFNF4W (ORCPT ); Wed, 14 Jun 2023 01:56:22 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 960B41BD3 for ; Tue, 13 Jun 2023 22:56:21 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 427172250C; Wed, 14 Jun 2023 05:56:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1686722180; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=geObxz8Ir0kENPOmj8FusLWNQEZG6IM3PHxh2vZfFwk=; b=bzBloQLAA5gr4c9KZLeJMWlrHR1ueIHUvCkOe2+nYJVfOG5XgWkaagskPklRz6RARLmyjg eAGnvSmNSpZm6FxcphK3zDRWb5ZSJmWhi8pzFGLmOalr3IvnhTnFnNWiznBaF/Wv0sPmhw 3qTzUPiWqMfj6miCxxrue37jPCwtA9M= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1686722180; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=geObxz8Ir0kENPOmj8FusLWNQEZG6IM3PHxh2vZfFwk=; b=Ha8E1ZTmNnM2le8dwe9okwlYwHEngT2eWKPRKt6n2yi5uEVbyTm0vY63sd25GmsIdgzF57 LwRn3O+PnBwOY1Dg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 164D01391E; Wed, 14 Jun 2023 05:56:20 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id ltN1BIRWiWTwcAAAMHmgww (envelope-from ); Wed, 14 Jun 2023 05:56:20 +0000 Date: Wed, 14 Jun 2023 07:56:19 +0200 Message-ID: <87zg52bn98.wl-tiwai@suse.de> From: Takashi Iwai To: Mark Brown Cc: Jaroslav Kysela , Takashi Iwai , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] ALSA: hda: Use maple tree register cache In-Reply-To: <34b7d114-af69-459e-8a22-2a93a1e43e94@sirena.org.uk> References: <20230609-alsa-hda-maple-v1-1-a2b725c8b8f5@kernel.org> <87v8fua1qm.wl-tiwai@suse.de> <877cs7g6f1.wl-tiwai@suse.de> <87v8frcueb.wl-tiwai@suse.de> <60f70667-16b0-4071-aa0f-a83e43bbf2a0@sirena.org.uk> <87a5x3cp9r.wl-tiwai@suse.de> <18bcfcba-a6ce-4595-bd2b-4d4ba761fd58@sirena.org.uk> <874jnbcmy6.wl-tiwai@suse.de> <34b7d114-af69-459e-8a22-2a93a1e43e94@sirena.org.uk> User-Agent: Wanderlust/2.15.9 (Almost Unreal) Emacs/27.2 Mule/6.0 MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 13 Jun 2023 19:29:19 +0200, Mark Brown wrote: > > On Tue, Jun 13, 2023 at 07:05:21PM +0200, Takashi Iwai wrote: > > Mark Brown wrote: > > > > > Oh, I'm afraid that we're seeing different things. The code there is > > > > rather to *set* some initial value for each amp register (but only > > > > once), and it's not about optimization for writing a same value > > > > again. > > > > > That is, the function helps to set an initial (mute) value on each amp > > > > when the driver parses the topology and finds an amp. But if the > > > > driver already has parsed this amp beforehand by other paths, it skips > > > > the initialization, as the other path may have already unmuted the > > > > amp. > > > > So it is possible that we might set two distinct values during setup > > > then and we're doing this intentionally? It's not obvious that this > > > might happen. A comment wouldn't hurt, and a big part of this is > > > confusing is that in the non-regmap case all we're doing is suppressing > > > duplicate writes, in that path it's just checking for changes in the > > > register value. > > > > None of this is what the non-regmap path does, it just suppresses noop > > > writes to the hardware. > > > Actually, many of HD-audio codec driver code heavily relies on the > > regmap, more or less mandatory. The snd_hda_codec_amp_init() is one > > of such. You may write a codec driver without the regmap, but some > > helpers won't work as expected. > > Sounds like it might be so thinly used it's becoming mandatory to have a > regmap in order to avoid gotchas like there might be with things getting > muted? It's rather historical reasons. The caching mechanism was already present and mandatory from the beginning, but it was implemented in a different way. Later on, it was translated to the regmap. Meanwhile, we generalized the HD-audio codec driver to be on a generic HD-audio bus, and this allowed the use without regmap. So some basic helpers are designed to work without regmap but some are still tightly tied with regmap. Takashi