aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2015-03-03 09:40:08 -0500
committerTakashi Iwai <tiwai@suse.de>2015-03-23 08:17:37 -0400
commit05852448690d7d810175f8ceccefba083525aa89 (patch)
tree32e68c37fca1c6ab3cbba4e0cc4a04debc4f7913 /sound/pci
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/pci')
-rw-r--r--sound/pci/hda/hda_codec.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index b162fc40348f..36483f7dd3ce 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -124,11 +124,12 @@ const char *snd_hda_get_jack_type(u32 cfg)
124EXPORT_SYMBOL_GPL(snd_hda_get_jack_type); 124EXPORT_SYMBOL_GPL(snd_hda_get_jack_type);
125 125
126/* 126/*
127 * Send and receive a verb 127 * Send and receive a verb - passed to exec_verb override for hdac_device
128 */ 128 */
129static int codec_exec_verb(struct hda_codec *codec, unsigned int cmd, 129static int codec_exec_verb(struct hdac_device *dev, unsigned int cmd,
130 int flags, unsigned int *res) 130 unsigned int flags, unsigned int *res)
131{ 131{
132 struct hda_codec *codec = container_of(dev, struct hda_codec, core);
132 struct hda_bus *bus = codec->bus; 133 struct hda_bus *bus = codec->bus;
133 int err; 134 int err;
134 135
@@ -177,7 +178,7 @@ unsigned int snd_hda_codec_read(struct hda_codec *codec, hda_nid_t nid,
177{ 178{
178 unsigned int cmd = snd_hdac_make_cmd(&codec->core, nid, verb, parm); 179 unsigned int cmd = snd_hdac_make_cmd(&codec->core, nid, verb, parm);
179 unsigned int res; 180 unsigned int res;
180 if (codec_exec_verb(codec, cmd, flags, &res)) 181 if (snd_hdac_exec_verb(&codec->core, cmd, flags, &res))
181 return -1; 182 return -1;
182 return res; 183 return res;
183} 184}
@@ -199,7 +200,7 @@ int snd_hda_codec_write(struct hda_codec *codec, hda_nid_t nid, int flags,
199 unsigned int verb, unsigned int parm) 200 unsigned int verb, unsigned int parm)
200{ 201{
201 unsigned int cmd = snd_hdac_make_cmd(&codec->core, nid, verb, parm); 202 unsigned int cmd = snd_hdac_make_cmd(&codec->core, nid, verb, parm);
202 return codec_exec_verb(codec, cmd, flags, NULL); 203 return snd_hdac_exec_verb(&codec->core, cmd, flags, NULL);
203} 204}
204EXPORT_SYMBOL_GPL(snd_hda_codec_write); 205EXPORT_SYMBOL_GPL(snd_hda_codec_write);
205 206
@@ -1026,6 +1027,7 @@ int snd_hda_codec_new(struct hda_bus *bus, struct snd_card *card,
1026 1027
1027 codec->core.dev.release = snd_hda_codec_dev_release; 1028 codec->core.dev.release = snd_hda_codec_dev_release;
1028 codec->core.type = HDA_DEV_LEGACY; 1029 codec->core.type = HDA_DEV_LEGACY;
1030 codec->core.exec_verb = codec_exec_verb;
1029 1031
1030 codec->bus = bus; 1032 codec->bus = bus;
1031 codec->card = card; 1033 codec->card = card;