summaryrefslogtreecommitdiff
path: root/sound/hda/hdac_device.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2015-03-03 15:40:08 +0100
committerTakashi Iwai <tiwai@suse.de>2015-03-23 13:17:37 +0100
commit05852448690d7d810175f8ceccefba083525aa89 (patch)
tree32e68c37fca1c6ab3cbba4e0cc4a04debc4f7913 /sound/hda/hdac_device.c
parent3256be6537751f65c76b3ecfbb4e667f87525a2f (diff)
ALSA: hda - Support indirect execution of verbs
Add an overriding exec_verb op to struct hdac_device so that the call via snd_hdac_exec_verb() can switch to a different route depending on the setup. The codec driver sets this field so that it can handle the errors or applying quirks appropriately. Furthermore, this mechanism will be used for smooth transition for the regmap support in later patches. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/hda/hdac_device.c')
-rw-r--r--sound/hda/hdac_device.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/sound/hda/hdac_device.c b/sound/hda/hdac_device.c
index 1470ecc354db..aaece36247e7 100644
--- a/sound/hda/hdac_device.c
+++ b/sound/hda/hdac_device.c
@@ -194,6 +194,28 @@ unsigned int snd_hdac_make_cmd(struct hdac_device *codec, hda_nid_t nid,
EXPORT_SYMBOL_GPL(snd_hdac_make_cmd);
/**
+ * snd_hdac_exec_verb - execute an encoded verb
+ * @codec: the codec object
+ * @cmd: encoded verb to execute
+ * @flags: optional flags, pass zero for default
+ * @res: the pointer to store the result, NULL if running async
+ *
+ * Returns zero if successful, or a negative error code.
+ *
+ * This calls the exec_verb op when set in hdac_codec. If not,
+ * call the default snd_hdac_bus_exec_verb().
+ */
+int snd_hdac_exec_verb(struct hdac_device *codec, unsigned int cmd,
+ unsigned int flags, unsigned int *res)
+{
+ if (codec->exec_verb)
+ return codec->exec_verb(codec, cmd, flags, res);
+ return snd_hdac_bus_exec_verb(codec->bus, codec->addr, cmd, res);
+}
+EXPORT_SYMBOL_GPL(snd_hdac_exec_verb);
+
+
+/**
* snd_hdac_read - execute a verb
* @codec: the codec object
* @nid: NID to execute a verb
@@ -208,7 +230,7 @@ int snd_hdac_read(struct hdac_device *codec, hda_nid_t nid,
{
unsigned int cmd = snd_hdac_make_cmd(codec, nid, verb, parm);
- return snd_hdac_bus_exec_verb(codec->bus, codec->addr, cmd, res);
+ return snd_hdac_exec_verb(codec, cmd, 0, res);
}
EXPORT_SYMBOL_GPL(snd_hdac_read);