aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/hda_local.h
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2015-02-26 02:54:56 -0500
committerTakashi Iwai <tiwai@suse.de>2015-03-23 08:19:40 -0400
commitfaa75f8a2edf005a5caf43be4875ffeeb9bcb498 (patch)
tree5158cb6255a448080b16c376b1006e8e29f946aa /sound/pci/hda/hda_local.h
parenteeecd9d10d3da0b9efd6f58fad55c4355dcc246a (diff)
ALSA: hda - Use regmap for parameter caches, too
The amp hash table was used for recording the cached reads of some capability values like pin caps or amp caps. Now all these are moved to regmap as well. One addition to the regmap helper is codec->caps_overwriting flag. This is set in snd_hdac_override_parm(), and the regmap helper accepts any register while this flag is set, so that it can overwrite even the read-only verb like AC_VERB_PARAMETERS. The flag is cleared immediately in snd_hdac_override_parm(), as it's a once-off flag. Along with these changes, the no longer needed amp hash and relevant fields are removed from hda_codec struct now. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/hda_local.h')
-rw-r--r--sound/pci/hda/hda_local.h38
1 files changed, 35 insertions, 3 deletions
diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h
index 7023eeee8b9d..3b567f42296b 100644
--- a/sound/pci/hda/hda_local.h
+++ b/sound/pci/hda/hda_local.h
@@ -557,9 +557,41 @@ static inline void snd_hda_override_wcaps(struct hda_codec *codec,
557u32 query_amp_caps(struct hda_codec *codec, hda_nid_t nid, int direction); 557u32 query_amp_caps(struct hda_codec *codec, hda_nid_t nid, int direction);
558int snd_hda_override_amp_caps(struct hda_codec *codec, hda_nid_t nid, int dir, 558int snd_hda_override_amp_caps(struct hda_codec *codec, hda_nid_t nid, int dir,
559 unsigned int caps); 559 unsigned int caps);
560u32 snd_hda_query_pin_caps(struct hda_codec *codec, hda_nid_t nid); 560/**
561int snd_hda_override_pin_caps(struct hda_codec *codec, hda_nid_t nid, 561 * snd_hda_query_pin_caps - Query PIN capabilities
562 unsigned int caps); 562 * @codec: the HD-auio codec
563 * @nid: the NID to query
564 *
565 * Query PIN capabilities for the given widget.
566 * Returns the obtained capability bits.
567 *
568 * When cap bits have been already read, this doesn't read again but
569 * returns the cached value.
570 */
571static inline u32
572snd_hda_query_pin_caps(struct hda_codec *codec, hda_nid_t nid)
573{
574 return snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP);
575
576}
577
578/**
579 * snd_hda_override_pin_caps - Override the pin capabilities
580 * @codec: the CODEC
581 * @nid: the NID to override
582 * @caps: the capability bits to set
583 *
584 * Override the cached PIN capabilitiy bits value by the given one.
585 *
586 * Returns zero if successful or a negative error code.
587 */
588static inline int
589snd_hda_override_pin_caps(struct hda_codec *codec, hda_nid_t nid,
590 unsigned int caps)
591{
592 return snd_hdac_override_parm(&codec->core, nid, AC_PAR_PIN_CAP, caps);
593}
594
563bool snd_hda_check_amp_caps(struct hda_codec *codec, hda_nid_t nid, 595bool snd_hda_check_amp_caps(struct hda_codec *codec, hda_nid_t nid,
564 int dir, unsigned int bits); 596 int dir, unsigned int bits);
565 597