diff options
author | Takashi Iwai <tiwai@suse.de> | 2015-02-26 10:54:56 +0300 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2015-03-23 15:19:40 +0300 |
commit | faa75f8a2edf005a5caf43be4875ffeeb9bcb498 (patch) | |
tree | 5158cb6255a448080b16c376b1006e8e29f946aa /sound/hda/hdac_device.c | |
parent | eeecd9d10d3da0b9efd6f58fad55c4355dcc246a (diff) | |
download | linux-faa75f8a2edf005a5caf43be4875ffeeb9bcb498.tar.xz |
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/hda/hdac_device.c')
-rw-r--r-- | sound/hda/hdac_device.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/sound/hda/hdac_device.c b/sound/hda/hdac_device.c index 0dac746df7da..72c584eb011b 100644 --- a/sound/hda/hdac_device.c +++ b/sound/hda/hdac_device.c @@ -273,6 +273,29 @@ int snd_hdac_read_parm_uncached(struct hdac_device *codec, hda_nid_t nid, EXPORT_SYMBOL_GPL(snd_hdac_read_parm_uncached); /** + * snd_hdac_override_parm - override read-only parameters + * @codec: the codec object + * @nid: NID for the parameter + * @parm: the parameter to change + * @val: the parameter value to overwrite + */ +int snd_hdac_override_parm(struct hdac_device *codec, hda_nid_t nid, + unsigned int parm, unsigned int val) +{ + unsigned int verb = (AC_VERB_PARAMETERS << 8) | (nid << 20) | parm; + int err; + + if (!codec->regmap) + return -EINVAL; + + codec->caps_overwriting = true; + err = snd_hdac_regmap_write_raw(codec, verb, val); + codec->caps_overwriting = false; + return err; +} +EXPORT_SYMBOL_GPL(snd_hdac_override_parm); + +/** * snd_hdac_get_sub_nodes - get start NID and number of subtree nodes * @codec: the codec object * @nid: NID to inspect |