diff options
Diffstat (limited to 'sound/hda/hdac_device.c')
-rw-r--r-- | sound/hda/hdac_device.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/sound/hda/hdac_device.c b/sound/hda/hdac_device.c index ba9c1fc..0dac746 100644 --- a/sound/hda/hdac_device.c +++ b/sound/hda/hdac_device.c @@ -250,19 +250,43 @@ int _snd_hdac_read_parm(struct hdac_device *codec, hda_nid_t nid, int parm, EXPORT_SYMBOL_GPL(_snd_hdac_read_parm); /** + * snd_hdac_read_parm_uncached - read a codec parameter without caching + * @codec: the codec object + * @nid: NID to read a parameter + * @parm: parameter to read + * + * Returns -1 for error. If you need to distinguish the error more + * strictly, use snd_hdac_read() directly. + */ +int snd_hdac_read_parm_uncached(struct hdac_device *codec, hda_nid_t nid, + int parm) +{ + int val; + + if (codec->regmap) + regcache_cache_bypass(codec->regmap, true); + val = snd_hdac_read_parm(codec, nid, parm); + if (codec->regmap) + regcache_cache_bypass(codec->regmap, false); + return val; +} +EXPORT_SYMBOL_GPL(snd_hdac_read_parm_uncached); + +/** * snd_hdac_get_sub_nodes - get start NID and number of subtree nodes * @codec: the codec object * @nid: NID to inspect * @start_id: the pointer to store the starting NID * * Returns the number of subtree nodes or zero if not found. + * This function reads parameters always without caching. */ int snd_hdac_get_sub_nodes(struct hdac_device *codec, hda_nid_t nid, hda_nid_t *start_id) { unsigned int parm; - parm = snd_hdac_read_parm(codec, nid, AC_PAR_NODE_COUNT); + parm = snd_hdac_read_parm_uncached(codec, nid, AC_PAR_NODE_COUNT); if (parm == -1) { *start_id = 0; return 0; |