aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/hda_codec.h
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2012-12-13 12:30:04 -0500
committerTakashi Iwai <tiwai@suse.de>2013-01-12 02:29:17 -0500
commitc370dd6e9faae4b2e699a1f210827aceaa0c3399 (patch)
tree8b80d63a3c3f7f42161e653acd71a1e27dd4284a /sound/pci/hda/hda_codec.h
parent8092e6065435d75a68873fa66cd003a1b829e0fe (diff)
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>
Diffstat (limited to 'sound/pci/hda/hda_codec.h')
-rw-r--r--sound/pci/hda/hda_codec.h12
1 files changed, 4 insertions, 8 deletions
diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h
index 8665540e55aa..cab39b23d37c 100644
--- a/sound/pci/hda/hda_codec.h
+++ b/sound/pci/hda/hda_codec.h
@@ -719,9 +719,10 @@ struct hda_codec_ops {
719 719
720/* record for amp information cache */ 720/* record for amp information cache */
721struct hda_cache_head { 721struct hda_cache_head {
722 u32 key; /* hash key */ 722 u32 key:31; /* hash key */
723 u32 dirty:1;
723 u16 val; /* assigned value */ 724 u16 val; /* assigned value */
724 u16 next; /* next link; -1 = terminal */ 725 u16 next;
725}; 726};
726 727
727struct hda_amp_info { 728struct hda_amp_info {
@@ -867,6 +868,7 @@ struct hda_codec {
867 unsigned int no_jack_detect:1; /* Machine has no jack-detection */ 868 unsigned int no_jack_detect:1; /* Machine has no jack-detection */
868 unsigned int pcm_format_first:1; /* PCM format must be set first */ 869 unsigned int pcm_format_first:1; /* PCM format must be set first */
869 unsigned int epss:1; /* supporting EPSS? */ 870 unsigned int epss:1; /* supporting EPSS? */
871 unsigned int cached_write:1; /* write only to caches */
870#ifdef CONFIG_PM 872#ifdef CONFIG_PM
871 unsigned int power_on :1; /* current (global) power-state */ 873 unsigned int power_on :1; /* current (global) power-state */
872 unsigned int d3_stop_clk:1; /* support D3 operation without BCLK */ 874 unsigned int d3_stop_clk:1; /* support D3 operation without BCLK */
@@ -952,7 +954,6 @@ void snd_hda_sequence_write(struct hda_codec *codec,
952int snd_hda_queue_unsol_event(struct hda_bus *bus, u32 res, u32 res_ex); 954int snd_hda_queue_unsol_event(struct hda_bus *bus, u32 res, u32 res_ex);
953 955
954/* cached write */ 956/* cached write */
955#ifdef CONFIG_PM
956int snd_hda_codec_write_cache(struct hda_codec *codec, hda_nid_t nid, 957int snd_hda_codec_write_cache(struct hda_codec *codec, hda_nid_t nid,
957 int direct, unsigned int verb, unsigned int parm); 958 int direct, unsigned int verb, unsigned int parm);
958void snd_hda_sequence_write_cache(struct hda_codec *codec, 959void snd_hda_sequence_write_cache(struct hda_codec *codec,
@@ -960,11 +961,6 @@ void snd_hda_sequence_write_cache(struct hda_codec *codec,
960int snd_hda_codec_update_cache(struct hda_codec *codec, hda_nid_t nid, 961int snd_hda_codec_update_cache(struct hda_codec *codec, hda_nid_t nid,
961 int direct, unsigned int verb, unsigned int parm); 962 int direct, unsigned int verb, unsigned int parm);
962void snd_hda_codec_resume_cache(struct hda_codec *codec); 963void snd_hda_codec_resume_cache(struct hda_codec *codec);
963#else
964#define snd_hda_codec_write_cache snd_hda_codec_write
965#define snd_hda_codec_update_cache snd_hda_codec_write
966#define snd_hda_sequence_write_cache snd_hda_sequence_write
967#endif
968 964
969/* the struct for codec->pin_configs */ 965/* the struct for codec->pin_configs */
970struct hda_pincfg { 966struct hda_pincfg {