All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lars-Peter Clausen <lars@metafoo.de>
To: Takashi Iwai <tiwai@suse.de>
Cc: alsa-devel@alsa-project.org
Subject: Re: [PATCH 7/7] ALSA: hda - Reduce verbs during generic parser initialization
Date: Sat, 28 Feb 2015 11:27:42 +0100	[thread overview]
Message-ID: <54F1981E.7070103@metafoo.de> (raw)
In-Reply-To: <s5hwq32gxrf.wl-tiwai@suse.de>

On 02/28/2015 11:01 AM, Takashi Iwai wrote:
> At Sat, 28 Feb 2015 10:51:29 +0100,
> Lars-Peter Clausen wrote:
>>
>> On 02/27/2015 10:28 PM, Takashi Iwai wrote:
>>> For reducing the number of verbs performed during the initialization
>>> and the resume of the generic parser, this patch (re-)introduces the
>>> mechanism to cache everything in init and sync later.
>>>
>>> However, it became a bit tricky in the end: we can't use regcache's
>>> cache_only flag straightforwardly here because we do want the actual
>>> hardware access for reads if needed, but forbids only the writes.
>>> So, instead, the regmap reg_write callback checks the own flag
>>> (reusing the existing codec->cached_write) and skips the actual
>>> access.  This works by assumption of regmap dumping the whole
>>> registers via regcache_sync() at a later point.
>>>
>>> Signed-off-by: Takashi Iwai <tiwai@suse.de>
>>> ---
>>>    sound/pci/hda/hda_generic.c | 4 ++++
>>>    sound/pci/hda/hda_regmap.c  | 6 ++++++
>>>    2 files changed, 10 insertions(+)
>>>
>>> diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c
>>> index 33de31c83d6e..bcaed93f8795 100644
>>> --- a/sound/pci/hda/hda_generic.c
>>> +++ b/sound/pci/hda/hda_generic.c
>>> @@ -5411,6 +5411,8 @@ int snd_hda_gen_init(struct hda_codec *codec)
>>>
>>>    	snd_hda_apply_verbs(codec);
>>>
>>> +	codec->cached_write = 1;
>>> +
>>
>> How about using regcache_cache_only(), this handles this internally in
>> regmap and will also make sure that the cache gets marked as dirty so that a
>> regcache_sync() will properly write out the dirty registers.
>
> I tried this as a first option, too, but it doesn't work because we
> still want reading the value from hardware if not read beforehand.
> regcache_cache_only() prevents also from reading a h/w value.  It's
> the point I mentioned this being tricky.

Hm, right, I skipped right past that. But I think it will still be better to 
implement this write-only caching in the regmap layer.

- Lars

  reply	other threads:[~2015-02-28 10:27 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-27 21:28 [PATCH 0/7] HD-audio regmap support Takashi Iwai
2015-02-27 21:28 ` [PATCH 1/7] ALSA: hda - Add " Takashi Iwai
2015-02-27 21:28 ` [PATCH 2/7] ALSA: hda - Use regmap for codec parameter reads Takashi Iwai
2015-02-27 21:28 ` [PATCH 3/7] ALSA: hda - Use regmap for amp accesses Takashi Iwai
2015-02-27 21:28 ` [PATCH 4/7] ALSA: hda - Use regmap for parameter caches, too Takashi Iwai
2015-02-27 21:28 ` [PATCH 5/7] ALSA: hda - Allow driver to add vendor-specific verbs for regmap Takashi Iwai
2015-02-27 21:28 ` [PATCH 6/7] ALSA: hda - Use regmap for command verb caches, too Takashi Iwai
2015-02-27 21:28 ` [PATCH 7/7] ALSA: hda - Reduce verbs during generic parser initialization Takashi Iwai
2015-02-28  9:51   ` Lars-Peter Clausen
2015-02-28 10:01     ` Takashi Iwai
2015-02-28 10:27       ` Lars-Peter Clausen [this message]
2015-02-28 15:11         ` 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=54F1981E.7070103@metafoo.de \
    --to=lars@metafoo.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=tiwai@suse.de \
    /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.