summaryrefslogtreecommitdiffstats
path: root/sound/hda/hdac_device.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2015-03-03 23:29:47 +0100
committerTakashi Iwai <tiwai@suse.de>2015-03-23 13:19:38 +0100
commit9ba17b4d132f56a680fa1ba0bc2a8f98b6263d93 (patch)
treebc30e4c61923f45eab27f9fc0f5d96d4c5132554 /sound/hda/hdac_device.c
parent01ed3c06c6d5e7e861650ae76117dd4194d87316 (diff)
downloadlinux-9ba17b4d132f56a680fa1ba0bc2a8f98b6263d93.tar.gz
linux-9ba17b4d132f56a680fa1ba0bc2a8f98b6263d93.tar.bz2
linux-9ba17b4d132f56a680fa1ba0bc2a8f98b6263d93.zip
ALSA: hda - Implement uncached version of parameter reads
Sometimes we need the uncached reads, e.g. for refreshing the tree. This patch provides the helper function for that and uses it for refreshing widgets, reading subtrees and the whole proc reads. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/hda/hdac_device.c')
-rw-r--r--sound/hda/hdac_device.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/sound/hda/hdac_device.c b/sound/hda/hdac_device.c
index ba9c1fc6e3ea..0dac746df7da 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;