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 32155EB64D8 for ; Tue, 13 Jun 2023 17:05:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235545AbjFMRFa (ORCPT ); Tue, 13 Jun 2023 13:05:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41494 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235159AbjFMRF2 (ORCPT ); Tue, 13 Jun 2023 13:05:28 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B610819B7 for ; Tue, 13 Jun 2023 10:05:23 -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-out2.suse.de (Postfix) with ESMTPS id 655D11FDB2; Tue, 13 Jun 2023 17:05:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1686675922; 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=4SwZHho/BwJapf6iwS9Bcg+rbEfSrGjWbdyyOWiF71c=; b=zBWcqGYuX2Gb6xG21jmzaJYvhuDC8TRvkie8TrULLNbf4pKIgxTooxoc517dsvmTjUT8Ti N4v7kVNn4/+cRjh5p+4MLR1wpPYg+zPRM8BdpcLdPkwj3l7Qctwb0Yjfr/Jc5HOf2nG8xX MbreelxpxDEchzAW65ioKmo689Lj4GU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1686675922; 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=4SwZHho/BwJapf6iwS9Bcg+rbEfSrGjWbdyyOWiF71c=; b=WfqJKZv6uf12q8a1vlSPL9Hj/Ne1M4NlY+ERSPpBgncY1pMZHI06FTM+SKJ9yyP49grZnS wZZyOhU3+nW857Bw== 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 3AAE113345; Tue, 13 Jun 2023 17:05:22 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 2HlMDdKhiGTHTwAAMHmgww (envelope-from ); Tue, 13 Jun 2023 17:05:22 +0000 Date: Tue, 13 Jun 2023 19:05:21 +0200 Message-ID: <874jnbcmy6.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: <18bcfcba-a6ce-4595-bd2b-4d4ba761fd58@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> 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 18:41:15 +0200, Mark Brown wrote: > > On Tue, Jun 13, 2023 at 06:15:12PM +0200, Takashi Iwai wrote: > > Mark Brown wrote: > > > On Tue, Jun 13, 2023 at 04:24:28PM +0200, Takashi Iwai wrote: > > > > > Since HD-audio codec has no known default values unlike normal codecs, > > > > it needs to initialize itself only at the first access, and this > > > > helper does it. > > > > Ah, if it's just suppressing the write the code should just be removed. > > > regmap_update_bits() already suppresses noop writes so unless we might > > > write a different value to the register later the effect will be the > > > same. I can send a patch. > > > 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. > > > Or I might have misunderstood what you mean about _update_bits()... > > 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. Takashi