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>
此提交包含在:
@@ -1052,6 +1052,7 @@ EXPORT_SYMBOL_HDA(snd_hda_codec_cleanup_stream);
|
||||
|
||||
/* FIXME: more better hash key? */
|
||||
#define HDA_HASH_KEY(nid,dir,idx) (u32)((nid) + ((idx) << 16) + ((dir) << 24))
|
||||
#define HDA_HASH_PINCAP_KEY(nid) (u32)((nid) + (0x02 << 24))
|
||||
#define INFO_AMP_CAPS (1<<0)
|
||||
#define INFO_AMP_VOL(ch) (1 << (1 + (ch)))
|
||||
|
||||
@@ -1142,6 +1143,21 @@ int snd_hda_override_amp_caps(struct hda_codec *codec, hda_nid_t nid, int dir,
|
||||
}
|
||||
EXPORT_SYMBOL_HDA(snd_hda_override_amp_caps);
|
||||
|
||||
u32 snd_hda_query_pin_caps(struct hda_codec *codec, hda_nid_t nid)
|
||||
{
|
||||
struct hda_amp_info *info;
|
||||
|
||||
info = get_alloc_amp_hash(codec, HDA_HASH_PINCAP_KEY(nid));
|
||||
if (!info)
|
||||
return 0;
|
||||
if (!info->head.val) {
|
||||
info->amp_caps = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP);
|
||||
info->head.val |= INFO_AMP_CAPS;
|
||||
}
|
||||
return info->amp_caps;
|
||||
}
|
||||
EXPORT_SYMBOL_HDA(snd_hda_query_pin_caps);
|
||||
|
||||
/*
|
||||
* read the current volume to info
|
||||
* if the cache exists, read the cache value.
|
||||
|
新增問題並參考
封鎖使用者