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 EB0B0EB64D0 for ; Tue, 13 Jun 2023 16:15:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240478AbjFMQP2 (ORCPT ); Tue, 13 Jun 2023 12:15:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239096AbjFMQPX (ORCPT ); Tue, 13 Jun 2023 12:15:23 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 10FDD137 for ; Tue, 13 Jun 2023 09:15:19 -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 B33C222509; Tue, 13 Jun 2023 16:15:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1686672912; 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=fVqYdpZ9HtvtVy/54sJHHRor7pEOHvMaLqDV/HaUw1A=; b=0G5jX+9UYczBF+s6QA38vytr4oilg44y+74CkIkuzUm1nQM8k8MKzGCxBlJNwC/JL129mX 9YbdCOql6vXbEMATY3MvLA9ZKzjHueeaIknwzGuyOc9Jo3v6KrYC602Ive1hFO2nE9Ywvi fZMm/Avt8bAkV3hihqihi/y55vhS0OY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1686672912; 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=fVqYdpZ9HtvtVy/54sJHHRor7pEOHvMaLqDV/HaUw1A=; b=aElo1Jkk7a3gk/PrHe8ck2pi5hl6MJjw+G1A6kr1VcZ9nHk7AHYwNgFMU4kdLHal5ChdZh agcjayAmo2xQr+DA== 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 8D66F13345; Tue, 13 Jun 2023 16:15:12 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id o4JrIRCWiGSzOAAAMHmgww (envelope-from ); Tue, 13 Jun 2023 16:15:12 +0000 Date: Tue, 13 Jun 2023 18:15:12 +0200 Message-ID: <87a5x3cp9r.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: <60f70667-16b0-4071-aa0f-a83e43bbf2a0@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> 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 17:49:41 +0200, Mark Brown wrote: > > On Tue, Jun 13, 2023 at 04:24:28PM +0200, Takashi Iwai wrote: > > Mark Brown wrote: > > > > BTW I was just looking at reg_raw_update_once() and I can't figure out > > > why it's trying to do what it's doing - it does a read to check if it's > > > seen the register before and then does an _update_bits() if the register > > > hasn't been cached yet, apparently trying suppress duplicate writes but > > > possibly deliberately discarding changes to multiple bitfields in the > > > same register. That's not what the non-regmap path does, it'll only > > > discard noop changes to the same bitfield. > > > Yes, it's a quite hackish way of optimization of the initialization. > > > 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()... thanks, Takashi