OSDN Git Service

ALSA: hda - Introduce cache & flush cmd / amp writes
authorTakashi Iwai <tiwai@suse.de>
Thu, 13 Dec 2012 17:30:04 +0000 (18:30 +0100)
committerTakashi Iwai <tiwai@suse.de>
Sat, 12 Jan 2013 07:29:17 +0000 (08:29 +0100)
commitc370dd6e9faae4b2e699a1f210827aceaa0c3399
tree8b80d63a3c3f7f42161e653acd71a1e27dd4284a
parent8092e6065435d75a68873fa66cd003a1b829e0fe
ALSA: hda - Introduce cache & flush cmd / amp writes

For optimizing the verb executions, a new mechanism to cache the verbs
and amp update commands is introduced.  With the new "write to cache
and flush" way, you can reduce the same verbs that have been written
multiple times.

When codec->cached_write flag is set, the further
snd_hda_codec_write_cache() and snd_hda_codec_amp_stereo() calls will
be performed only on the command or amp cache table, but not sent to
the hardware yet.  Once after you call all commands and update amps,
call snd_hda_codec_resume_amp() and snd_hda_codec_resume_cache().
Then all cached writes and amp updates will be written to the
hardware, and the dirty flags are cleared.

In this implementation, the existing cache table is reused, so
actually no big code change is seen here.  Each cache entry has a new
dirty flag now (so the cache key is now reduced to 31bit).

As a good side-effect by this change, snd_hda_codec_resume_*() will no
longer execute verbs that have been already issued during the resume
phase by checking the dirty flags.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/hda/hda_codec.c
sound/pci/hda/hda_codec.h
sound/pci/hda/hda_local.h