Skip to content
  • Takashi Iwai's avatar
    ALSA: hda - Introduce cache & flush cmd / amp writes · c370dd6e
    Takashi Iwai authored
    
    
    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: default avatarTakashi Iwai <tiwai@suse.de>
    c370dd6e