diff options
author | Takashi Iwai <tiwai@suse.de> | 2009-03-23 08:07:47 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2009-03-23 08:08:33 -0400 |
commit | 1327a32b878b5ed2113c63557b6f4f949f821857 (patch) | |
tree | 25b47d63e8cc68840134120fc49e4fa499f54569 /sound/pci/hda/hda_codec.c | |
parent | 52ca15b7c0c711eb37f5e4b769e8488e5c516d43 (diff) |
ALSA: hda - Cache pin-cap values
Added snd_hda_query_pin_caps() to read and cache pin-cap values
to avoid too frequently issuing the same verbs.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/hda_codec.c')
-rw-r--r-- | sound/pci/hda/hda_codec.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 1b5575ecb0a4..0f70d2d102e0 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c | |||
@@ -1052,6 +1052,7 @@ EXPORT_SYMBOL_HDA(snd_hda_codec_cleanup_stream); | |||
1052 | 1052 | ||
1053 | /* FIXME: more better hash key? */ | 1053 | /* FIXME: more better hash key? */ |
1054 | #define HDA_HASH_KEY(nid,dir,idx) (u32)((nid) + ((idx) << 16) + ((dir) << 24)) | 1054 | #define HDA_HASH_KEY(nid,dir,idx) (u32)((nid) + ((idx) << 16) + ((dir) << 24)) |
1055 | #define HDA_HASH_PINCAP_KEY(nid) (u32)((nid) + (0x02 << 24)) | ||
1055 | #define INFO_AMP_CAPS (1<<0) | 1056 | #define INFO_AMP_CAPS (1<<0) |
1056 | #define INFO_AMP_VOL(ch) (1 << (1 + (ch))) | 1057 | #define INFO_AMP_VOL(ch) (1 << (1 + (ch))) |
1057 | 1058 | ||
@@ -1142,6 +1143,21 @@ int snd_hda_override_amp_caps(struct hda_codec *codec, hda_nid_t nid, int dir, | |||
1142 | } | 1143 | } |
1143 | EXPORT_SYMBOL_HDA(snd_hda_override_amp_caps); | 1144 | EXPORT_SYMBOL_HDA(snd_hda_override_amp_caps); |
1144 | 1145 | ||
1146 | u32 snd_hda_query_pin_caps(struct hda_codec *codec, hda_nid_t nid) | ||
1147 | { | ||
1148 | struct hda_amp_info *info; | ||
1149 | |||
1150 | info = get_alloc_amp_hash(codec, HDA_HASH_PINCAP_KEY(nid)); | ||
1151 | if (!info) | ||
1152 | return 0; | ||
1153 | if (!info->head.val) { | ||
1154 | info->amp_caps = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP); | ||
1155 | info->head.val |= INFO_AMP_CAPS; | ||
1156 | } | ||
1157 | return info->amp_caps; | ||
1158 | } | ||
1159 | EXPORT_SYMBOL_HDA(snd_hda_query_pin_caps); | ||
1160 | |||
1145 | /* | 1161 | /* |
1146 | * read the current volume to info | 1162 | * read the current volume to info |
1147 | * if the cache exists, read the cache value. | 1163 | * if the cache exists, read the cache value. |