summaryrefslogtreecommitdiff
path: root/sound/hda
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2015-02-26 15:57:47 +0300
committerTakashi Iwai <tiwai@suse.de>2015-03-23 15:19:37 +0300
commit01ed3c06c6d5e7e861650ae76117dd4194d87316 (patch)
treed75e171cd46b58c985848cfc46a3e0d3492c2496 /sound/hda
parent4d75faa0448a6bb2fd6d56051a3675a3937cbada (diff)
downloadlinux-01ed3c06c6d5e7e861650ae76117dd4194d87316.tar.xz
ALSA: hda - Use regmap for codec parameter reads
Let's start converting the access functions to regmap. The first one is the simplest, just converting the codec parameter read helper function snd_hda_param_read(). Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/hda')
-rw-r--r--sound/hda/hdac_device.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/sound/hda/hdac_device.c b/sound/hda/hdac_device.c
index 6e8ee1d6974a..ba9c1fc6e3ea 100644
--- a/sound/hda/hdac_device.c
+++ b/sound/hda/hdac_device.c
@@ -9,6 +9,7 @@
#include <linux/export.h>
#include <linux/pm_runtime.h>
#include <sound/hdaudio.h>
+#include <sound/hda_regmap.h>
#include "local.h"
static void setup_fg_nodes(struct hdac_device *codec);
@@ -234,23 +235,19 @@ int snd_hdac_read(struct hdac_device *codec, hda_nid_t nid,
EXPORT_SYMBOL_GPL(snd_hdac_read);
/**
- * snd_hdac_read_parm - read a codec parameter
- * @codec: the codec object
- * @nid: NID to read a parameter
- * @parm: parameter to read
+ * _snd_hdac_read_parm - read a parmeter
*
- * Returns -1 for error. If you need to distinguish the error more
- * strictly, use snd_hdac_read() directly.
+ * This function returns zero or an error unlike snd_hdac_read_parm().
*/
-int snd_hdac_read_parm(struct hdac_device *codec, hda_nid_t nid, int parm)
+int _snd_hdac_read_parm(struct hdac_device *codec, hda_nid_t nid, int parm,
+ unsigned int *res)
{
- int val;
+ unsigned int cmd;
- if (snd_hdac_read(codec, nid, AC_VERB_PARAMETERS, parm, &val))
- return -1;
- return val;
+ cmd = snd_hdac_regmap_encode_verb(nid, AC_VERB_PARAMETERS) | parm;
+ return snd_hdac_regmap_read_raw(codec, cmd, res);
}
-EXPORT_SYMBOL_GPL(snd_hdac_read_parm);
+EXPORT_SYMBOL_GPL(_snd_hdac_read_parm);
/**
* snd_hdac_get_sub_nodes - get start NID and number of subtree nodes