diff options
-rw-r--r-- | sound/pci/hda/hda_codec.c | 41 | ||||
-rw-r--r-- | sound/pci/hda/hda_codec.h | 8 |
2 files changed, 24 insertions, 25 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 679fba44bdb5..503869aad7f9 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c | |||
@@ -185,20 +185,19 @@ EXPORT_SYMBOL_HDA(snd_hda_get_jack_type); | |||
185 | * Compose a 32bit command word to be sent to the HD-audio controller | 185 | * Compose a 32bit command word to be sent to the HD-audio controller |
186 | */ | 186 | */ |
187 | static inline unsigned int | 187 | static inline unsigned int |
188 | make_codec_cmd(struct hda_codec *codec, hda_nid_t nid, int direct, | 188 | make_codec_cmd(struct hda_codec *codec, hda_nid_t nid, int flags, |
189 | unsigned int verb, unsigned int parm) | 189 | unsigned int verb, unsigned int parm) |
190 | { | 190 | { |
191 | u32 val; | 191 | u32 val; |
192 | 192 | ||
193 | if ((codec->addr & ~0xf) || (direct & ~1) || (nid & ~0x7f) || | 193 | if ((codec->addr & ~0xf) || (nid & ~0x7f) || |
194 | (verb & ~0xfff) || (parm & ~0xffff)) { | 194 | (verb & ~0xfff) || (parm & ~0xffff)) { |
195 | printk(KERN_ERR "hda-codec: out of range cmd %x:%x:%x:%x:%x\n", | 195 | printk(KERN_ERR "hda-codec: out of range cmd %x:%x:%x:%x\n", |
196 | codec->addr, direct, nid, verb, parm); | 196 | codec->addr, nid, verb, parm); |
197 | return ~0; | 197 | return ~0; |
198 | } | 198 | } |
199 | 199 | ||
200 | val = (u32)codec->addr << 28; | 200 | val = (u32)codec->addr << 28; |
201 | val |= (u32)direct << 27; | ||
202 | val |= (u32)nid << 20; | 201 | val |= (u32)nid << 20; |
203 | val |= verb << 8; | 202 | val |= verb << 8; |
204 | val |= parm; | 203 | val |= parm; |
@@ -209,7 +208,7 @@ make_codec_cmd(struct hda_codec *codec, hda_nid_t nid, int direct, | |||
209 | * Send and receive a verb | 208 | * Send and receive a verb |
210 | */ | 209 | */ |
211 | static int codec_exec_verb(struct hda_codec *codec, unsigned int cmd, | 210 | static int codec_exec_verb(struct hda_codec *codec, unsigned int cmd, |
212 | unsigned int *res) | 211 | int flags, unsigned int *res) |
213 | { | 212 | { |
214 | struct hda_bus *bus = codec->bus; | 213 | struct hda_bus *bus = codec->bus; |
215 | int err; | 214 | int err; |
@@ -255,7 +254,7 @@ static int codec_exec_verb(struct hda_codec *codec, unsigned int cmd, | |||
255 | * snd_hda_codec_read - send a command and get the response | 254 | * snd_hda_codec_read - send a command and get the response |
256 | * @codec: the HDA codec | 255 | * @codec: the HDA codec |
257 | * @nid: NID to send the command | 256 | * @nid: NID to send the command |
258 | * @direct: direct flag | 257 | * @flags: optional bit flags |
259 | * @verb: the verb to send | 258 | * @verb: the verb to send |
260 | * @parm: the parameter for the verb | 259 | * @parm: the parameter for the verb |
261 | * | 260 | * |
@@ -264,12 +263,12 @@ static int codec_exec_verb(struct hda_codec *codec, unsigned int cmd, | |||
264 | * Returns the obtained response value, or -1 for an error. | 263 | * Returns the obtained response value, or -1 for an error. |
265 | */ | 264 | */ |
266 | unsigned int snd_hda_codec_read(struct hda_codec *codec, hda_nid_t nid, | 265 | unsigned int snd_hda_codec_read(struct hda_codec *codec, hda_nid_t nid, |
267 | int direct, | 266 | int flags, |
268 | unsigned int verb, unsigned int parm) | 267 | unsigned int verb, unsigned int parm) |
269 | { | 268 | { |
270 | unsigned cmd = make_codec_cmd(codec, nid, direct, verb, parm); | 269 | unsigned cmd = make_codec_cmd(codec, nid, flags, verb, parm); |
271 | unsigned int res; | 270 | unsigned int res; |
272 | if (codec_exec_verb(codec, cmd, &res)) | 271 | if (codec_exec_verb(codec, cmd, flags, &res)) |
273 | return -1; | 272 | return -1; |
274 | return res; | 273 | return res; |
275 | } | 274 | } |
@@ -279,7 +278,7 @@ EXPORT_SYMBOL_HDA(snd_hda_codec_read); | |||
279 | * snd_hda_codec_write - send a single command without waiting for response | 278 | * snd_hda_codec_write - send a single command without waiting for response |
280 | * @codec: the HDA codec | 279 | * @codec: the HDA codec |
281 | * @nid: NID to send the command | 280 | * @nid: NID to send the command |
282 | * @direct: direct flag | 281 | * @flags: optional bit flags |
283 | * @verb: the verb to send | 282 | * @verb: the verb to send |
284 | * @parm: the parameter for the verb | 283 | * @parm: the parameter for the verb |
285 | * | 284 | * |
@@ -287,12 +286,12 @@ EXPORT_SYMBOL_HDA(snd_hda_codec_read); | |||
287 | * | 286 | * |
288 | * Returns 0 if successful, or a negative error code. | 287 | * Returns 0 if successful, or a negative error code. |
289 | */ | 288 | */ |
290 | int snd_hda_codec_write(struct hda_codec *codec, hda_nid_t nid, int direct, | 289 | int snd_hda_codec_write(struct hda_codec *codec, hda_nid_t nid, int flags, |
291 | unsigned int verb, unsigned int parm) | 290 | unsigned int verb, unsigned int parm) |
292 | { | 291 | { |
293 | unsigned int cmd = make_codec_cmd(codec, nid, direct, verb, parm); | 292 | unsigned int cmd = make_codec_cmd(codec, nid, flags, verb, parm); |
294 | unsigned int res; | 293 | unsigned int res; |
295 | return codec_exec_verb(codec, cmd, | 294 | return codec_exec_verb(codec, cmd, flags, |
296 | codec->bus->sync_write ? &res : NULL); | 295 | codec->bus->sync_write ? &res : NULL); |
297 | } | 296 | } |
298 | EXPORT_SYMBOL_HDA(snd_hda_codec_write); | 297 | EXPORT_SYMBOL_HDA(snd_hda_codec_write); |
@@ -3582,7 +3581,7 @@ EXPORT_SYMBOL_HDA(snd_hda_create_spdif_in_ctls); | |||
3582 | * snd_hda_codec_write_cache - send a single command with caching | 3581 | * snd_hda_codec_write_cache - send a single command with caching |
3583 | * @codec: the HDA codec | 3582 | * @codec: the HDA codec |
3584 | * @nid: NID to send the command | 3583 | * @nid: NID to send the command |
3585 | * @direct: direct flag | 3584 | * @flags: optional bit flags |
3586 | * @verb: the verb to send | 3585 | * @verb: the verb to send |
3587 | * @parm: the parameter for the verb | 3586 | * @parm: the parameter for the verb |
3588 | * | 3587 | * |
@@ -3591,7 +3590,7 @@ EXPORT_SYMBOL_HDA(snd_hda_create_spdif_in_ctls); | |||
3591 | * Returns 0 if successful, or a negative error code. | 3590 | * Returns 0 if successful, or a negative error code. |
3592 | */ | 3591 | */ |
3593 | int snd_hda_codec_write_cache(struct hda_codec *codec, hda_nid_t nid, | 3592 | int snd_hda_codec_write_cache(struct hda_codec *codec, hda_nid_t nid, |
3594 | int direct, unsigned int verb, unsigned int parm) | 3593 | int flags, unsigned int verb, unsigned int parm) |
3595 | { | 3594 | { |
3596 | int err; | 3595 | int err; |
3597 | struct hda_cache_head *c; | 3596 | struct hda_cache_head *c; |
@@ -3600,7 +3599,7 @@ int snd_hda_codec_write_cache(struct hda_codec *codec, hda_nid_t nid, | |||
3600 | 3599 | ||
3601 | cache_only = codec->cached_write; | 3600 | cache_only = codec->cached_write; |
3602 | if (!cache_only) { | 3601 | if (!cache_only) { |
3603 | err = snd_hda_codec_write(codec, nid, direct, verb, parm); | 3602 | err = snd_hda_codec_write(codec, nid, flags, verb, parm); |
3604 | if (err < 0) | 3603 | if (err < 0) |
3605 | return err; | 3604 | return err; |
3606 | } | 3605 | } |
@@ -3624,7 +3623,7 @@ EXPORT_SYMBOL_HDA(snd_hda_codec_write_cache); | |||
3624 | * snd_hda_codec_update_cache - check cache and write the cmd only when needed | 3623 | * snd_hda_codec_update_cache - check cache and write the cmd only when needed |
3625 | * @codec: the HDA codec | 3624 | * @codec: the HDA codec |
3626 | * @nid: NID to send the command | 3625 | * @nid: NID to send the command |
3627 | * @direct: direct flag | 3626 | * @flags: optional bit flags |
3628 | * @verb: the verb to send | 3627 | * @verb: the verb to send |
3629 | * @parm: the parameter for the verb | 3628 | * @parm: the parameter for the verb |
3630 | * | 3629 | * |
@@ -3635,7 +3634,7 @@ EXPORT_SYMBOL_HDA(snd_hda_codec_write_cache); | |||
3635 | * Returns 0 if successful, or a negative error code. | 3634 | * Returns 0 if successful, or a negative error code. |
3636 | */ | 3635 | */ |
3637 | int snd_hda_codec_update_cache(struct hda_codec *codec, hda_nid_t nid, | 3636 | int snd_hda_codec_update_cache(struct hda_codec *codec, hda_nid_t nid, |
3638 | int direct, unsigned int verb, unsigned int parm) | 3637 | int flags, unsigned int verb, unsigned int parm) |
3639 | { | 3638 | { |
3640 | struct hda_cache_head *c; | 3639 | struct hda_cache_head *c; |
3641 | u32 key; | 3640 | u32 key; |
@@ -3651,7 +3650,7 @@ int snd_hda_codec_update_cache(struct hda_codec *codec, hda_nid_t nid, | |||
3651 | return 0; | 3650 | return 0; |
3652 | } | 3651 | } |
3653 | mutex_unlock(&codec->bus->cmd_mutex); | 3652 | mutex_unlock(&codec->bus->cmd_mutex); |
3654 | return snd_hda_codec_write_cache(codec, nid, direct, verb, parm); | 3653 | return snd_hda_codec_write_cache(codec, nid, flags, verb, parm); |
3655 | } | 3654 | } |
3656 | EXPORT_SYMBOL_HDA(snd_hda_codec_update_cache); | 3655 | EXPORT_SYMBOL_HDA(snd_hda_codec_update_cache); |
3657 | 3656 | ||
diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h index c93f9021f452..39a658e02988 100644 --- a/sound/pci/hda/hda_codec.h +++ b/sound/pci/hda/hda_codec.h | |||
@@ -945,9 +945,9 @@ int snd_hda_codec_update_widgets(struct hda_codec *codec); | |||
945 | * low level functions | 945 | * low level functions |
946 | */ | 946 | */ |
947 | unsigned int snd_hda_codec_read(struct hda_codec *codec, hda_nid_t nid, | 947 | unsigned int snd_hda_codec_read(struct hda_codec *codec, hda_nid_t nid, |
948 | int direct, | 948 | int flags, |
949 | unsigned int verb, unsigned int parm); | 949 | unsigned int verb, unsigned int parm); |
950 | int snd_hda_codec_write(struct hda_codec *codec, hda_nid_t nid, int direct, | 950 | int snd_hda_codec_write(struct hda_codec *codec, hda_nid_t nid, int flags, |
951 | unsigned int verb, unsigned int parm); | 951 | unsigned int verb, unsigned int parm); |
952 | #define snd_hda_param_read(codec, nid, param) \ | 952 | #define snd_hda_param_read(codec, nid, param) \ |
953 | snd_hda_codec_read(codec, nid, 0, AC_VERB_PARAMETERS, param) | 953 | snd_hda_codec_read(codec, nid, 0, AC_VERB_PARAMETERS, param) |
@@ -986,11 +986,11 @@ int snd_hda_queue_unsol_event(struct hda_bus *bus, u32 res, u32 res_ex); | |||
986 | 986 | ||
987 | /* cached write */ | 987 | /* cached write */ |
988 | int snd_hda_codec_write_cache(struct hda_codec *codec, hda_nid_t nid, | 988 | int snd_hda_codec_write_cache(struct hda_codec *codec, hda_nid_t nid, |
989 | int direct, unsigned int verb, unsigned int parm); | 989 | int flags, unsigned int verb, unsigned int parm); |
990 | void snd_hda_sequence_write_cache(struct hda_codec *codec, | 990 | void snd_hda_sequence_write_cache(struct hda_codec *codec, |
991 | const struct hda_verb *seq); | 991 | const struct hda_verb *seq); |
992 | int snd_hda_codec_update_cache(struct hda_codec *codec, hda_nid_t nid, | 992 | int snd_hda_codec_update_cache(struct hda_codec *codec, hda_nid_t nid, |
993 | int direct, unsigned int verb, unsigned int parm); | 993 | int flags, unsigned int verb, unsigned int parm); |
994 | void snd_hda_codec_resume_cache(struct hda_codec *codec); | 994 | void snd_hda_codec_resume_cache(struct hda_codec *codec); |
995 | /* both for cmd & amp caches */ | 995 | /* both for cmd & amp caches */ |
996 | void snd_hda_codec_flush_cache(struct hda_codec *codec); | 996 | void snd_hda_codec_flush_cache(struct hda_codec *codec); |