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>
此提交包含在:
Takashi Iwai
2009-03-23 13:07:47 +01:00
父節點 52ca15b7c0
當前提交 1327a32b87
共有 5 個檔案被更改,包括 24 行新增8 行删除

查看文件

@@ -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.