From: Takashi Iwai <tiwai@suse.de>
To: Mark Brown <broonie@kernel.org>
Cc: Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ALSA: hda: Use maple tree register cache
Date: Tue, 13 Jun 2023 19:05:21 +0200 [thread overview]
Message-ID: <874jnbcmy6.wl-tiwai@suse.de> (raw)
In-Reply-To: <18bcfcba-a6ce-4595-bd2b-4d4ba761fd58@sirena.org.uk>
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
next prev parent reply other threads:[~2023-06-13 17:06 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-10 14:26 [PATCH] ALSA: hda: Use maple tree register cache Mark Brown
2023-06-11 7:37 ` Takashi Iwai
2023-06-13 7:36 ` Takashi Iwai
2023-06-13 13:59 ` Mark Brown
2023-06-13 14:24 ` Takashi Iwai
2023-06-13 15:49 ` Mark Brown
2023-06-13 16:15 ` Takashi Iwai
2023-06-13 16:41 ` Mark Brown
2023-06-13 17:05 ` Takashi Iwai [this message]
2023-06-13 17:29 ` Mark Brown
2023-06-14 5:56 ` Takashi Iwai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=874jnbcmy6.wl-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=perex@perex.cz \
--cc=tiwai@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.