diff options
Diffstat (limited to 'sound/pci/hda/hda_codec.c')
-rw-r--r-- | sound/pci/hda/hda_codec.c | 411 |
1 files changed, 253 insertions, 158 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 69178c4f4113..ec4536c8d8d4 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/pci.h> | 26 | #include <linux/pci.h> |
27 | #include <linux/mutex.h> | 27 | #include <linux/mutex.h> |
28 | #include <linux/module.h> | 28 | #include <linux/module.h> |
29 | #include <linux/async.h> | ||
29 | #include <sound/core.h> | 30 | #include <sound/core.h> |
30 | #include "hda_codec.h" | 31 | #include "hda_codec.h" |
31 | #include <sound/asoundef.h> | 32 | #include <sound/asoundef.h> |
@@ -83,7 +84,7 @@ int snd_hda_add_codec_preset(struct hda_codec_preset_list *preset) | |||
83 | mutex_unlock(&preset_mutex); | 84 | mutex_unlock(&preset_mutex); |
84 | return 0; | 85 | return 0; |
85 | } | 86 | } |
86 | EXPORT_SYMBOL_HDA(snd_hda_add_codec_preset); | 87 | EXPORT_SYMBOL_GPL(snd_hda_add_codec_preset); |
87 | 88 | ||
88 | int snd_hda_delete_codec_preset(struct hda_codec_preset_list *preset) | 89 | int snd_hda_delete_codec_preset(struct hda_codec_preset_list *preset) |
89 | { | 90 | { |
@@ -92,23 +93,31 @@ int snd_hda_delete_codec_preset(struct hda_codec_preset_list *preset) | |||
92 | mutex_unlock(&preset_mutex); | 93 | mutex_unlock(&preset_mutex); |
93 | return 0; | 94 | return 0; |
94 | } | 95 | } |
95 | EXPORT_SYMBOL_HDA(snd_hda_delete_codec_preset); | 96 | EXPORT_SYMBOL_GPL(snd_hda_delete_codec_preset); |
96 | 97 | ||
97 | #ifdef CONFIG_PM | 98 | #ifdef CONFIG_PM |
98 | #define codec_in_pm(codec) ((codec)->in_pm) | 99 | #define codec_in_pm(codec) ((codec)->in_pm) |
99 | static void hda_power_work(struct work_struct *work); | 100 | static void hda_power_work(struct work_struct *work); |
100 | static void hda_keep_power_on(struct hda_codec *codec); | 101 | static void hda_keep_power_on(struct hda_codec *codec); |
101 | #define hda_codec_is_power_on(codec) ((codec)->power_on) | 102 | #define hda_codec_is_power_on(codec) ((codec)->power_on) |
102 | static inline void hda_call_pm_notify(struct hda_bus *bus, bool power_up) | 103 | |
104 | static void hda_call_pm_notify(struct hda_codec *codec, bool power_up) | ||
103 | { | 105 | { |
106 | struct hda_bus *bus = codec->bus; | ||
107 | |||
108 | if ((power_up && codec->pm_up_notified) || | ||
109 | (!power_up && !codec->pm_up_notified)) | ||
110 | return; | ||
104 | if (bus->ops.pm_notify) | 111 | if (bus->ops.pm_notify) |
105 | bus->ops.pm_notify(bus, power_up); | 112 | bus->ops.pm_notify(bus, power_up); |
113 | codec->pm_up_notified = power_up; | ||
106 | } | 114 | } |
115 | |||
107 | #else | 116 | #else |
108 | #define codec_in_pm(codec) 0 | 117 | #define codec_in_pm(codec) 0 |
109 | static inline void hda_keep_power_on(struct hda_codec *codec) {} | 118 | static inline void hda_keep_power_on(struct hda_codec *codec) {} |
110 | #define hda_codec_is_power_on(codec) 1 | 119 | #define hda_codec_is_power_on(codec) 1 |
111 | #define hda_call_pm_notify(bus, state) {} | 120 | #define hda_call_pm_notify(codec, state) {} |
112 | #endif | 121 | #endif |
113 | 122 | ||
114 | /** | 123 | /** |
@@ -143,7 +152,7 @@ const char *snd_hda_get_jack_location(u32 cfg) | |||
143 | } | 152 | } |
144 | return "UNKNOWN"; | 153 | return "UNKNOWN"; |
145 | } | 154 | } |
146 | EXPORT_SYMBOL_HDA(snd_hda_get_jack_location); | 155 | EXPORT_SYMBOL_GPL(snd_hda_get_jack_location); |
147 | 156 | ||
148 | /** | 157 | /** |
149 | * snd_hda_get_jack_connectivity - Give a connectivity string of the jack | 158 | * snd_hda_get_jack_connectivity - Give a connectivity string of the jack |
@@ -158,7 +167,7 @@ const char *snd_hda_get_jack_connectivity(u32 cfg) | |||
158 | 167 | ||
159 | return jack_locations[(cfg >> (AC_DEFCFG_LOCATION_SHIFT + 4)) & 3]; | 168 | return jack_locations[(cfg >> (AC_DEFCFG_LOCATION_SHIFT + 4)) & 3]; |
160 | } | 169 | } |
161 | EXPORT_SYMBOL_HDA(snd_hda_get_jack_connectivity); | 170 | EXPORT_SYMBOL_GPL(snd_hda_get_jack_connectivity); |
162 | 171 | ||
163 | /** | 172 | /** |
164 | * snd_hda_get_jack_type - Give a type string of the jack | 173 | * snd_hda_get_jack_type - Give a type string of the jack |
@@ -179,7 +188,7 @@ const char *snd_hda_get_jack_type(u32 cfg) | |||
179 | return jack_types[(cfg & AC_DEFCFG_DEVICE) | 188 | return jack_types[(cfg & AC_DEFCFG_DEVICE) |
180 | >> AC_DEFCFG_DEVICE_SHIFT]; | 189 | >> AC_DEFCFG_DEVICE_SHIFT]; |
181 | } | 190 | } |
182 | EXPORT_SYMBOL_HDA(snd_hda_get_jack_type); | 191 | EXPORT_SYMBOL_GPL(snd_hda_get_jack_type); |
183 | 192 | ||
184 | /* | 193 | /* |
185 | * Compose a 32bit command word to be sent to the HD-audio controller | 194 | * Compose a 32bit command word to be sent to the HD-audio controller |
@@ -275,7 +284,7 @@ unsigned int snd_hda_codec_read(struct hda_codec *codec, hda_nid_t nid, | |||
275 | return -1; | 284 | return -1; |
276 | return res; | 285 | return res; |
277 | } | 286 | } |
278 | EXPORT_SYMBOL_HDA(snd_hda_codec_read); | 287 | EXPORT_SYMBOL_GPL(snd_hda_codec_read); |
279 | 288 | ||
280 | /** | 289 | /** |
281 | * snd_hda_codec_write - send a single command without waiting for response | 290 | * snd_hda_codec_write - send a single command without waiting for response |
@@ -297,7 +306,7 @@ int snd_hda_codec_write(struct hda_codec *codec, hda_nid_t nid, int flags, | |||
297 | return codec_exec_verb(codec, cmd, flags, | 306 | return codec_exec_verb(codec, cmd, flags, |
298 | codec->bus->sync_write ? &res : NULL); | 307 | codec->bus->sync_write ? &res : NULL); |
299 | } | 308 | } |
300 | EXPORT_SYMBOL_HDA(snd_hda_codec_write); | 309 | EXPORT_SYMBOL_GPL(snd_hda_codec_write); |
301 | 310 | ||
302 | /** | 311 | /** |
303 | * snd_hda_sequence_write - sequence writes | 312 | * snd_hda_sequence_write - sequence writes |
@@ -312,7 +321,7 @@ void snd_hda_sequence_write(struct hda_codec *codec, const struct hda_verb *seq) | |||
312 | for (; seq->nid; seq++) | 321 | for (; seq->nid; seq++) |
313 | snd_hda_codec_write(codec, seq->nid, 0, seq->verb, seq->param); | 322 | snd_hda_codec_write(codec, seq->nid, 0, seq->verb, seq->param); |
314 | } | 323 | } |
315 | EXPORT_SYMBOL_HDA(snd_hda_sequence_write); | 324 | EXPORT_SYMBOL_GPL(snd_hda_sequence_write); |
316 | 325 | ||
317 | /** | 326 | /** |
318 | * snd_hda_get_sub_nodes - get the range of sub nodes | 327 | * snd_hda_get_sub_nodes - get the range of sub nodes |
@@ -334,7 +343,7 @@ int snd_hda_get_sub_nodes(struct hda_codec *codec, hda_nid_t nid, | |||
334 | *start_id = (parm >> 16) & 0x7fff; | 343 | *start_id = (parm >> 16) & 0x7fff; |
335 | return (int)(parm & 0x7fff); | 344 | return (int)(parm & 0x7fff); |
336 | } | 345 | } |
337 | EXPORT_SYMBOL_HDA(snd_hda_get_sub_nodes); | 346 | EXPORT_SYMBOL_GPL(snd_hda_get_sub_nodes); |
338 | 347 | ||
339 | /* connection list element */ | 348 | /* connection list element */ |
340 | struct hda_conn_list { | 349 | struct hda_conn_list { |
@@ -444,7 +453,7 @@ int snd_hda_get_conn_list(struct hda_codec *codec, hda_nid_t nid, | |||
444 | added = true; | 453 | added = true; |
445 | } | 454 | } |
446 | } | 455 | } |
447 | EXPORT_SYMBOL_HDA(snd_hda_get_conn_list); | 456 | EXPORT_SYMBOL_GPL(snd_hda_get_conn_list); |
448 | 457 | ||
449 | /** | 458 | /** |
450 | * snd_hda_get_connections - copy connection list | 459 | * snd_hda_get_connections - copy connection list |
@@ -476,7 +485,7 @@ int snd_hda_get_connections(struct hda_codec *codec, hda_nid_t nid, | |||
476 | 485 | ||
477 | return len; | 486 | return len; |
478 | } | 487 | } |
479 | EXPORT_SYMBOL_HDA(snd_hda_get_connections); | 488 | EXPORT_SYMBOL_GPL(snd_hda_get_connections); |
480 | 489 | ||
481 | /* return CONNLIST_LEN parameter of the given widget */ | 490 | /* return CONNLIST_LEN parameter of the given widget */ |
482 | static unsigned int get_num_conns(struct hda_codec *codec, hda_nid_t nid) | 491 | static unsigned int get_num_conns(struct hda_codec *codec, hda_nid_t nid) |
@@ -625,7 +634,7 @@ int snd_hda_override_conn_list(struct hda_codec *codec, hda_nid_t nid, int len, | |||
625 | 634 | ||
626 | return add_conn_list(codec, nid, len, list); | 635 | return add_conn_list(codec, nid, len, list); |
627 | } | 636 | } |
628 | EXPORT_SYMBOL_HDA(snd_hda_override_conn_list); | 637 | EXPORT_SYMBOL_GPL(snd_hda_override_conn_list); |
629 | 638 | ||
630 | /** | 639 | /** |
631 | * snd_hda_get_conn_index - get the connection index of the given NID | 640 | * snd_hda_get_conn_index - get the connection index of the given NID |
@@ -664,7 +673,7 @@ int snd_hda_get_conn_index(struct hda_codec *codec, hda_nid_t mux, | |||
664 | } | 673 | } |
665 | return -1; | 674 | return -1; |
666 | } | 675 | } |
667 | EXPORT_SYMBOL_HDA(snd_hda_get_conn_index); | 676 | EXPORT_SYMBOL_GPL(snd_hda_get_conn_index); |
668 | 677 | ||
669 | 678 | ||
670 | /* return DEVLIST_LEN parameter of the given widget */ | 679 | /* return DEVLIST_LEN parameter of the given widget */ |
@@ -760,7 +769,7 @@ int snd_hda_queue_unsol_event(struct hda_bus *bus, u32 res, u32 res_ex) | |||
760 | 769 | ||
761 | return 0; | 770 | return 0; |
762 | } | 771 | } |
763 | EXPORT_SYMBOL_HDA(snd_hda_queue_unsol_event); | 772 | EXPORT_SYMBOL_GPL(snd_hda_queue_unsol_event); |
764 | 773 | ||
765 | /* | 774 | /* |
766 | * process queued unsolicited events | 775 | * process queued unsolicited events |
@@ -831,6 +840,7 @@ static int snd_hda_bus_free(struct hda_bus *bus) | |||
831 | bus->ops.private_free(bus); | 840 | bus->ops.private_free(bus); |
832 | if (bus->workq) | 841 | if (bus->workq) |
833 | destroy_workqueue(bus->workq); | 842 | destroy_workqueue(bus->workq); |
843 | |||
834 | kfree(bus); | 844 | kfree(bus); |
835 | return 0; | 845 | return 0; |
836 | } | 846 | } |
@@ -920,7 +930,7 @@ int snd_hda_bus_new(struct snd_card *card, | |||
920 | *busp = bus; | 930 | *busp = bus; |
921 | return 0; | 931 | return 0; |
922 | } | 932 | } |
923 | EXPORT_SYMBOL_HDA(snd_hda_bus_new); | 933 | EXPORT_SYMBOL_GPL(snd_hda_bus_new); |
924 | 934 | ||
925 | #ifdef CONFIG_SND_HDA_GENERIC | 935 | #ifdef CONFIG_SND_HDA_GENERIC |
926 | #define is_generic_config(codec) \ | 936 | #define is_generic_config(codec) \ |
@@ -945,9 +955,6 @@ find_codec_preset(struct hda_codec *codec) | |||
945 | const struct hda_codec_preset *preset; | 955 | const struct hda_codec_preset *preset; |
946 | unsigned int mod_requested = 0; | 956 | unsigned int mod_requested = 0; |
947 | 957 | ||
948 | if (is_generic_config(codec)) | ||
949 | return NULL; /* use the generic parser */ | ||
950 | |||
951 | again: | 958 | again: |
952 | mutex_lock(&preset_mutex); | 959 | mutex_lock(&preset_mutex); |
953 | list_for_each_entry(tbl, &hda_preset_tables, list) { | 960 | list_for_each_entry(tbl, &hda_preset_tables, list) { |
@@ -1163,7 +1170,7 @@ int snd_hda_codec_set_pincfg(struct hda_codec *codec, | |||
1163 | { | 1170 | { |
1164 | return snd_hda_add_pincfg(codec, &codec->driver_pins, nid, cfg); | 1171 | return snd_hda_add_pincfg(codec, &codec->driver_pins, nid, cfg); |
1165 | } | 1172 | } |
1166 | EXPORT_SYMBOL_HDA(snd_hda_codec_set_pincfg); | 1173 | EXPORT_SYMBOL_GPL(snd_hda_codec_set_pincfg); |
1167 | 1174 | ||
1168 | /** | 1175 | /** |
1169 | * snd_hda_codec_get_pincfg - Obtain a pin-default configuration | 1176 | * snd_hda_codec_get_pincfg - Obtain a pin-default configuration |
@@ -1198,7 +1205,7 @@ unsigned int snd_hda_codec_get_pincfg(struct hda_codec *codec, hda_nid_t nid) | |||
1198 | return pin->cfg; | 1205 | return pin->cfg; |
1199 | return 0; | 1206 | return 0; |
1200 | } | 1207 | } |
1201 | EXPORT_SYMBOL_HDA(snd_hda_codec_get_pincfg); | 1208 | EXPORT_SYMBOL_GPL(snd_hda_codec_get_pincfg); |
1202 | 1209 | ||
1203 | /* remember the current pinctl target value */ | 1210 | /* remember the current pinctl target value */ |
1204 | int snd_hda_codec_set_pin_target(struct hda_codec *codec, hda_nid_t nid, | 1211 | int snd_hda_codec_set_pin_target(struct hda_codec *codec, hda_nid_t nid, |
@@ -1212,7 +1219,7 @@ int snd_hda_codec_set_pin_target(struct hda_codec *codec, hda_nid_t nid, | |||
1212 | pin->target = val; | 1219 | pin->target = val; |
1213 | return 0; | 1220 | return 0; |
1214 | } | 1221 | } |
1215 | EXPORT_SYMBOL_HDA(snd_hda_codec_set_pin_target); | 1222 | EXPORT_SYMBOL_GPL(snd_hda_codec_set_pin_target); |
1216 | 1223 | ||
1217 | /* return the current pinctl target value */ | 1224 | /* return the current pinctl target value */ |
1218 | int snd_hda_codec_get_pin_target(struct hda_codec *codec, hda_nid_t nid) | 1225 | int snd_hda_codec_get_pin_target(struct hda_codec *codec, hda_nid_t nid) |
@@ -1224,7 +1231,7 @@ int snd_hda_codec_get_pin_target(struct hda_codec *codec, hda_nid_t nid) | |||
1224 | return 0; | 1231 | return 0; |
1225 | return pin->target; | 1232 | return pin->target; |
1226 | } | 1233 | } |
1227 | EXPORT_SYMBOL_HDA(snd_hda_codec_get_pin_target); | 1234 | EXPORT_SYMBOL_GPL(snd_hda_codec_get_pin_target); |
1228 | 1235 | ||
1229 | /** | 1236 | /** |
1230 | * snd_hda_shutup_pins - Shut up all pins | 1237 | * snd_hda_shutup_pins - Shut up all pins |
@@ -1249,7 +1256,7 @@ void snd_hda_shutup_pins(struct hda_codec *codec) | |||
1249 | } | 1256 | } |
1250 | codec->pins_shutup = 1; | 1257 | codec->pins_shutup = 1; |
1251 | } | 1258 | } |
1252 | EXPORT_SYMBOL_HDA(snd_hda_shutup_pins); | 1259 | EXPORT_SYMBOL_GPL(snd_hda_shutup_pins); |
1253 | 1260 | ||
1254 | #ifdef CONFIG_PM | 1261 | #ifdef CONFIG_PM |
1255 | /* Restore the pin controls cleared previously via snd_hda_shutup_pins() */ | 1262 | /* Restore the pin controls cleared previously via snd_hda_shutup_pins() */ |
@@ -1330,6 +1337,28 @@ get_hda_cvt_setup(struct hda_codec *codec, hda_nid_t nid) | |||
1330 | } | 1337 | } |
1331 | 1338 | ||
1332 | /* | 1339 | /* |
1340 | * Dynamic symbol binding for the codec parsers | ||
1341 | */ | ||
1342 | #ifdef MODULE | ||
1343 | #define load_parser_sym(sym) ((int (*)(struct hda_codec *))symbol_request(sym)) | ||
1344 | #define unload_parser_addr(addr) symbol_put_addr(addr) | ||
1345 | #else | ||
1346 | #define load_parser_sym(sym) (sym) | ||
1347 | #define unload_parser_addr(addr) do {} while (0) | ||
1348 | #endif | ||
1349 | |||
1350 | #define load_parser(codec, sym) \ | ||
1351 | ((codec)->parser = load_parser_sym(sym)) | ||
1352 | |||
1353 | static void unload_parser(struct hda_codec *codec) | ||
1354 | { | ||
1355 | if (codec->parser) { | ||
1356 | unload_parser_addr(codec->parser); | ||
1357 | codec->parser = NULL; | ||
1358 | } | ||
1359 | } | ||
1360 | |||
1361 | /* | ||
1333 | * codec destructor | 1362 | * codec destructor |
1334 | */ | 1363 | */ |
1335 | static void snd_hda_codec_free(struct hda_codec *codec) | 1364 | static void snd_hda_codec_free(struct hda_codec *codec) |
@@ -1352,10 +1381,8 @@ static void snd_hda_codec_free(struct hda_codec *codec) | |||
1352 | codec->bus->caddr_tbl[codec->addr] = NULL; | 1381 | codec->bus->caddr_tbl[codec->addr] = NULL; |
1353 | if (codec->patch_ops.free) | 1382 | if (codec->patch_ops.free) |
1354 | codec->patch_ops.free(codec); | 1383 | codec->patch_ops.free(codec); |
1355 | #ifdef CONFIG_PM | 1384 | hda_call_pm_notify(codec, false); /* cancel leftover refcounts */ |
1356 | if (!codec->pm_down_notified) /* cancel leftover refcounts */ | 1385 | unload_parser(codec); |
1357 | hda_call_pm_notify(codec->bus, false); | ||
1358 | #endif | ||
1359 | module_put(codec->owner); | 1386 | module_put(codec->owner); |
1360 | free_hda_cache(&codec->amp_cache); | 1387 | free_hda_cache(&codec->amp_cache); |
1361 | free_hda_cache(&codec->cmd_cache); | 1388 | free_hda_cache(&codec->cmd_cache); |
@@ -1363,6 +1390,7 @@ static void snd_hda_codec_free(struct hda_codec *codec) | |||
1363 | kfree(codec->chip_name); | 1390 | kfree(codec->chip_name); |
1364 | kfree(codec->modelname); | 1391 | kfree(codec->modelname); |
1365 | kfree(codec->wcaps); | 1392 | kfree(codec->wcaps); |
1393 | codec->bus->num_codecs--; | ||
1366 | kfree(codec); | 1394 | kfree(codec); |
1367 | } | 1395 | } |
1368 | 1396 | ||
@@ -1424,6 +1452,7 @@ int snd_hda_codec_new(struct hda_bus *bus, | |||
1424 | INIT_LIST_HEAD(&codec->conn_list); | 1452 | INIT_LIST_HEAD(&codec->conn_list); |
1425 | 1453 | ||
1426 | INIT_DELAYED_WORK(&codec->jackpoll_work, hda_jackpoll_work); | 1454 | INIT_DELAYED_WORK(&codec->jackpoll_work, hda_jackpoll_work); |
1455 | codec->depop_delay = -1; | ||
1427 | 1456 | ||
1428 | #ifdef CONFIG_PM | 1457 | #ifdef CONFIG_PM |
1429 | spin_lock_init(&codec->power_lock); | 1458 | spin_lock_init(&codec->power_lock); |
@@ -1433,7 +1462,6 @@ int snd_hda_codec_new(struct hda_bus *bus, | |||
1433 | * phase. | 1462 | * phase. |
1434 | */ | 1463 | */ |
1435 | hda_keep_power_on(codec); | 1464 | hda_keep_power_on(codec); |
1436 | hda_call_pm_notify(bus, true); | ||
1437 | #endif | 1465 | #endif |
1438 | 1466 | ||
1439 | if (codec->bus->modelname) { | 1467 | if (codec->bus->modelname) { |
@@ -1445,6 +1473,8 @@ int snd_hda_codec_new(struct hda_bus *bus, | |||
1445 | } | 1473 | } |
1446 | 1474 | ||
1447 | list_add_tail(&codec->list, &bus->codec_list); | 1475 | list_add_tail(&codec->list, &bus->codec_list); |
1476 | bus->num_codecs++; | ||
1477 | |||
1448 | bus->caddr_tbl[codec_addr] = codec; | 1478 | bus->caddr_tbl[codec_addr] = codec; |
1449 | 1479 | ||
1450 | codec->vendor_id = snd_hda_param_read(codec, AC_NODE_ROOT, | 1480 | codec->vendor_id = snd_hda_param_read(codec, AC_NODE_ROOT, |
@@ -1486,11 +1516,14 @@ int snd_hda_codec_new(struct hda_bus *bus, | |||
1486 | #ifdef CONFIG_PM | 1516 | #ifdef CONFIG_PM |
1487 | codec->d3_stop_clk = snd_hda_codec_get_supported_ps(codec, fg, | 1517 | codec->d3_stop_clk = snd_hda_codec_get_supported_ps(codec, fg, |
1488 | AC_PWRST_CLKSTOP); | 1518 | AC_PWRST_CLKSTOP); |
1489 | if (!codec->d3_stop_clk) | ||
1490 | bus->power_keep_link_on = 1; | ||
1491 | #endif | 1519 | #endif |
1492 | codec->epss = snd_hda_codec_get_supported_ps(codec, fg, | 1520 | codec->epss = snd_hda_codec_get_supported_ps(codec, fg, |
1493 | AC_PWRST_EPSS); | 1521 | AC_PWRST_EPSS); |
1522 | #ifdef CONFIG_PM | ||
1523 | if (!codec->d3_stop_clk || !codec->epss) | ||
1524 | bus->power_keep_link_on = 1; | ||
1525 | #endif | ||
1526 | |||
1494 | 1527 | ||
1495 | /* power-up all before initialization */ | 1528 | /* power-up all before initialization */ |
1496 | hda_set_power_state(codec, AC_PWRST_D0); | 1529 | hda_set_power_state(codec, AC_PWRST_D0); |
@@ -1511,7 +1544,7 @@ int snd_hda_codec_new(struct hda_bus *bus, | |||
1511 | snd_hda_codec_free(codec); | 1544 | snd_hda_codec_free(codec); |
1512 | return err; | 1545 | return err; |
1513 | } | 1546 | } |
1514 | EXPORT_SYMBOL_HDA(snd_hda_codec_new); | 1547 | EXPORT_SYMBOL_GPL(snd_hda_codec_new); |
1515 | 1548 | ||
1516 | int snd_hda_codec_update_widgets(struct hda_codec *codec) | 1549 | int snd_hda_codec_update_widgets(struct hda_codec *codec) |
1517 | { | 1550 | { |
@@ -1534,8 +1567,33 @@ int snd_hda_codec_update_widgets(struct hda_codec *codec) | |||
1534 | 1567 | ||
1535 | return err; | 1568 | return err; |
1536 | } | 1569 | } |
1537 | EXPORT_SYMBOL_HDA(snd_hda_codec_update_widgets); | 1570 | EXPORT_SYMBOL_GPL(snd_hda_codec_update_widgets); |
1571 | |||
1538 | 1572 | ||
1573 | #ifdef CONFIG_SND_HDA_CODEC_HDMI | ||
1574 | /* if all audio out widgets are digital, let's assume the codec as a HDMI/DP */ | ||
1575 | static bool is_likely_hdmi_codec(struct hda_codec *codec) | ||
1576 | { | ||
1577 | hda_nid_t nid = codec->start_nid; | ||
1578 | int i; | ||
1579 | |||
1580 | for (i = 0; i < codec->num_nodes; i++, nid++) { | ||
1581 | unsigned int wcaps = get_wcaps(codec, nid); | ||
1582 | switch (get_wcaps_type(wcaps)) { | ||
1583 | case AC_WID_AUD_IN: | ||
1584 | return false; /* HDMI parser supports only HDMI out */ | ||
1585 | case AC_WID_AUD_OUT: | ||
1586 | if (!(wcaps & AC_WCAP_DIGITAL)) | ||
1587 | return false; | ||
1588 | break; | ||
1589 | } | ||
1590 | } | ||
1591 | return true; | ||
1592 | } | ||
1593 | #else | ||
1594 | /* no HDMI codec parser support */ | ||
1595 | #define is_likely_hdmi_codec(codec) false | ||
1596 | #endif /* CONFIG_SND_HDA_CODEC_HDMI */ | ||
1539 | 1597 | ||
1540 | /** | 1598 | /** |
1541 | * snd_hda_codec_configure - (Re-)configure the HD-audio codec | 1599 | * snd_hda_codec_configure - (Re-)configure the HD-audio codec |
@@ -1548,6 +1606,7 @@ EXPORT_SYMBOL_HDA(snd_hda_codec_update_widgets); | |||
1548 | */ | 1606 | */ |
1549 | int snd_hda_codec_configure(struct hda_codec *codec) | 1607 | int snd_hda_codec_configure(struct hda_codec *codec) |
1550 | { | 1608 | { |
1609 | int (*patch)(struct hda_codec *) = NULL; | ||
1551 | int err; | 1610 | int err; |
1552 | 1611 | ||
1553 | codec->preset = find_codec_preset(codec); | 1612 | codec->preset = find_codec_preset(codec); |
@@ -1557,31 +1616,42 @@ int snd_hda_codec_configure(struct hda_codec *codec) | |||
1557 | return err; | 1616 | return err; |
1558 | } | 1617 | } |
1559 | 1618 | ||
1560 | if (is_generic_config(codec)) { | 1619 | if (!is_generic_config(codec) && codec->preset) |
1561 | err = snd_hda_parse_generic_codec(codec); | 1620 | patch = codec->preset->patch; |
1562 | goto patched; | 1621 | if (!patch) { |
1563 | } | 1622 | unload_parser(codec); /* to be sure */ |
1564 | if (codec->preset && codec->preset->patch) { | 1623 | if (is_likely_hdmi_codec(codec)) |
1565 | err = codec->preset->patch(codec); | 1624 | patch = load_parser(codec, snd_hda_parse_hdmi_codec); |
1566 | goto patched; | 1625 | #ifdef CONFIG_SND_HDA_GENERIC |
1626 | if (!patch) | ||
1627 | patch = load_parser(codec, snd_hda_parse_generic_codec); | ||
1628 | #endif | ||
1629 | if (!patch) { | ||
1630 | printk(KERN_ERR "hda-codec: No codec parser is available\n"); | ||
1631 | return -ENODEV; | ||
1632 | } | ||
1567 | } | 1633 | } |
1568 | 1634 | ||
1569 | /* call the default parser */ | 1635 | err = patch(codec); |
1570 | err = snd_hda_parse_generic_codec(codec); | 1636 | if (err < 0) { |
1571 | if (err < 0) | 1637 | unload_parser(codec); |
1572 | printk(KERN_ERR "hda-codec: No codec parser is available\n"); | 1638 | return err; |
1639 | } | ||
1573 | 1640 | ||
1574 | patched: | 1641 | if (codec->patch_ops.unsol_event) { |
1575 | if (!err && codec->patch_ops.unsol_event) | ||
1576 | err = init_unsol_queue(codec->bus); | 1642 | err = init_unsol_queue(codec->bus); |
1643 | if (err < 0) | ||
1644 | return err; | ||
1645 | } | ||
1646 | |||
1577 | /* audio codec should override the mixer name */ | 1647 | /* audio codec should override the mixer name */ |
1578 | if (!err && (codec->afg || !*codec->bus->card->mixername)) | 1648 | if (codec->afg || !*codec->bus->card->mixername) |
1579 | snprintf(codec->bus->card->mixername, | 1649 | snprintf(codec->bus->card->mixername, |
1580 | sizeof(codec->bus->card->mixername), | 1650 | sizeof(codec->bus->card->mixername), |
1581 | "%s %s", codec->vendor_name, codec->chip_name); | 1651 | "%s %s", codec->vendor_name, codec->chip_name); |
1582 | return err; | 1652 | return 0; |
1583 | } | 1653 | } |
1584 | EXPORT_SYMBOL_HDA(snd_hda_codec_configure); | 1654 | EXPORT_SYMBOL_GPL(snd_hda_codec_configure); |
1585 | 1655 | ||
1586 | /* update the stream-id if changed */ | 1656 | /* update the stream-id if changed */ |
1587 | static void update_pcm_stream_id(struct hda_codec *codec, | 1657 | static void update_pcm_stream_id(struct hda_codec *codec, |
@@ -1668,7 +1738,7 @@ void snd_hda_codec_setup_stream(struct hda_codec *codec, hda_nid_t nid, | |||
1668 | } | 1738 | } |
1669 | } | 1739 | } |
1670 | } | 1740 | } |
1671 | EXPORT_SYMBOL_HDA(snd_hda_codec_setup_stream); | 1741 | EXPORT_SYMBOL_GPL(snd_hda_codec_setup_stream); |
1672 | 1742 | ||
1673 | static void really_cleanup_stream(struct hda_codec *codec, | 1743 | static void really_cleanup_stream(struct hda_codec *codec, |
1674 | struct hda_cvt_setup *q); | 1744 | struct hda_cvt_setup *q); |
@@ -1703,7 +1773,7 @@ void __snd_hda_codec_cleanup_stream(struct hda_codec *codec, hda_nid_t nid, | |||
1703 | p->active = 0; | 1773 | p->active = 0; |
1704 | } | 1774 | } |
1705 | } | 1775 | } |
1706 | EXPORT_SYMBOL_HDA(__snd_hda_codec_cleanup_stream); | 1776 | EXPORT_SYMBOL_GPL(__snd_hda_codec_cleanup_stream); |
1707 | 1777 | ||
1708 | static void really_cleanup_stream(struct hda_codec *codec, | 1778 | static void really_cleanup_stream(struct hda_codec *codec, |
1709 | struct hda_cvt_setup *q) | 1779 | struct hda_cvt_setup *q) |
@@ -1891,7 +1961,7 @@ u32 query_amp_caps(struct hda_codec *codec, hda_nid_t nid, int direction) | |||
1891 | HDA_HASH_KEY(nid, direction, 0), | 1961 | HDA_HASH_KEY(nid, direction, 0), |
1892 | read_amp_cap); | 1962 | read_amp_cap); |
1893 | } | 1963 | } |
1894 | EXPORT_SYMBOL_HDA(query_amp_caps); | 1964 | EXPORT_SYMBOL_GPL(query_amp_caps); |
1895 | 1965 | ||
1896 | /** | 1966 | /** |
1897 | * snd_hda_override_amp_caps - Override the AMP capabilities | 1967 | * snd_hda_override_amp_caps - Override the AMP capabilities |
@@ -1911,7 +1981,7 @@ int snd_hda_override_amp_caps(struct hda_codec *codec, hda_nid_t nid, int dir, | |||
1911 | { | 1981 | { |
1912 | return write_caps_hash(codec, HDA_HASH_KEY(nid, dir, 0), caps); | 1982 | return write_caps_hash(codec, HDA_HASH_KEY(nid, dir, 0), caps); |
1913 | } | 1983 | } |
1914 | EXPORT_SYMBOL_HDA(snd_hda_override_amp_caps); | 1984 | EXPORT_SYMBOL_GPL(snd_hda_override_amp_caps); |
1915 | 1985 | ||
1916 | static unsigned int read_pin_cap(struct hda_codec *codec, hda_nid_t nid, | 1986 | static unsigned int read_pin_cap(struct hda_codec *codec, hda_nid_t nid, |
1917 | int dir) | 1987 | int dir) |
@@ -1935,7 +2005,7 @@ u32 snd_hda_query_pin_caps(struct hda_codec *codec, hda_nid_t nid) | |||
1935 | return query_caps_hash(codec, nid, 0, HDA_HASH_PINCAP_KEY(nid), | 2005 | return query_caps_hash(codec, nid, 0, HDA_HASH_PINCAP_KEY(nid), |
1936 | read_pin_cap); | 2006 | read_pin_cap); |
1937 | } | 2007 | } |
1938 | EXPORT_SYMBOL_HDA(snd_hda_query_pin_caps); | 2008 | EXPORT_SYMBOL_GPL(snd_hda_query_pin_caps); |
1939 | 2009 | ||
1940 | /** | 2010 | /** |
1941 | * snd_hda_override_pin_caps - Override the pin capabilities | 2011 | * snd_hda_override_pin_caps - Override the pin capabilities |
@@ -1952,7 +2022,7 @@ int snd_hda_override_pin_caps(struct hda_codec *codec, hda_nid_t nid, | |||
1952 | { | 2022 | { |
1953 | return write_caps_hash(codec, HDA_HASH_PINCAP_KEY(nid), caps); | 2023 | return write_caps_hash(codec, HDA_HASH_PINCAP_KEY(nid), caps); |
1954 | } | 2024 | } |
1955 | EXPORT_SYMBOL_HDA(snd_hda_override_pin_caps); | 2025 | EXPORT_SYMBOL_GPL(snd_hda_override_pin_caps); |
1956 | 2026 | ||
1957 | /* read or sync the hash value with the current value; | 2027 | /* read or sync the hash value with the current value; |
1958 | * call within hash_mutex | 2028 | * call within hash_mutex |
@@ -2033,7 +2103,7 @@ int snd_hda_codec_amp_read(struct hda_codec *codec, hda_nid_t nid, int ch, | |||
2033 | mutex_unlock(&codec->hash_mutex); | 2103 | mutex_unlock(&codec->hash_mutex); |
2034 | return val; | 2104 | return val; |
2035 | } | 2105 | } |
2036 | EXPORT_SYMBOL_HDA(snd_hda_codec_amp_read); | 2106 | EXPORT_SYMBOL_GPL(snd_hda_codec_amp_read); |
2037 | 2107 | ||
2038 | static int codec_amp_update(struct hda_codec *codec, hda_nid_t nid, int ch, | 2108 | static int codec_amp_update(struct hda_codec *codec, hda_nid_t nid, int ch, |
2039 | int direction, int idx, int mask, int val, | 2109 | int direction, int idx, int mask, int val, |
@@ -2085,7 +2155,7 @@ int snd_hda_codec_amp_update(struct hda_codec *codec, hda_nid_t nid, int ch, | |||
2085 | { | 2155 | { |
2086 | return codec_amp_update(codec, nid, ch, direction, idx, mask, val, false); | 2156 | return codec_amp_update(codec, nid, ch, direction, idx, mask, val, false); |
2087 | } | 2157 | } |
2088 | EXPORT_SYMBOL_HDA(snd_hda_codec_amp_update); | 2158 | EXPORT_SYMBOL_GPL(snd_hda_codec_amp_update); |
2089 | 2159 | ||
2090 | /** | 2160 | /** |
2091 | * snd_hda_codec_amp_stereo - update the AMP stereo values | 2161 | * snd_hda_codec_amp_stereo - update the AMP stereo values |
@@ -2111,7 +2181,7 @@ int snd_hda_codec_amp_stereo(struct hda_codec *codec, hda_nid_t nid, | |||
2111 | idx, mask, val); | 2181 | idx, mask, val); |
2112 | return ret; | 2182 | return ret; |
2113 | } | 2183 | } |
2114 | EXPORT_SYMBOL_HDA(snd_hda_codec_amp_stereo); | 2184 | EXPORT_SYMBOL_GPL(snd_hda_codec_amp_stereo); |
2115 | 2185 | ||
2116 | /* Works like snd_hda_codec_amp_update() but it writes the value only at | 2186 | /* Works like snd_hda_codec_amp_update() but it writes the value only at |
2117 | * the first access. If the amp was already initialized / updated beforehand, | 2187 | * the first access. If the amp was already initialized / updated beforehand, |
@@ -2122,7 +2192,7 @@ int snd_hda_codec_amp_init(struct hda_codec *codec, hda_nid_t nid, int ch, | |||
2122 | { | 2192 | { |
2123 | return codec_amp_update(codec, nid, ch, dir, idx, mask, val, true); | 2193 | return codec_amp_update(codec, nid, ch, dir, idx, mask, val, true); |
2124 | } | 2194 | } |
2125 | EXPORT_SYMBOL_HDA(snd_hda_codec_amp_init); | 2195 | EXPORT_SYMBOL_GPL(snd_hda_codec_amp_init); |
2126 | 2196 | ||
2127 | int snd_hda_codec_amp_init_stereo(struct hda_codec *codec, hda_nid_t nid, | 2197 | int snd_hda_codec_amp_init_stereo(struct hda_codec *codec, hda_nid_t nid, |
2128 | int dir, int idx, int mask, int val) | 2198 | int dir, int idx, int mask, int val) |
@@ -2136,7 +2206,7 @@ int snd_hda_codec_amp_init_stereo(struct hda_codec *codec, hda_nid_t nid, | |||
2136 | idx, mask, val); | 2206 | idx, mask, val); |
2137 | return ret; | 2207 | return ret; |
2138 | } | 2208 | } |
2139 | EXPORT_SYMBOL_HDA(snd_hda_codec_amp_init_stereo); | 2209 | EXPORT_SYMBOL_GPL(snd_hda_codec_amp_init_stereo); |
2140 | 2210 | ||
2141 | /** | 2211 | /** |
2142 | * snd_hda_codec_resume_amp - Resume all AMP commands from the cache | 2212 | * snd_hda_codec_resume_amp - Resume all AMP commands from the cache |
@@ -2179,7 +2249,7 @@ void snd_hda_codec_resume_amp(struct hda_codec *codec) | |||
2179 | } | 2249 | } |
2180 | mutex_unlock(&codec->hash_mutex); | 2250 | mutex_unlock(&codec->hash_mutex); |
2181 | } | 2251 | } |
2182 | EXPORT_SYMBOL_HDA(snd_hda_codec_resume_amp); | 2252 | EXPORT_SYMBOL_GPL(snd_hda_codec_resume_amp); |
2183 | 2253 | ||
2184 | static u32 get_amp_max_value(struct hda_codec *codec, hda_nid_t nid, int dir, | 2254 | static u32 get_amp_max_value(struct hda_codec *codec, hda_nid_t nid, int dir, |
2185 | unsigned int ofs) | 2255 | unsigned int ofs) |
@@ -2219,7 +2289,7 @@ int snd_hda_mixer_amp_volume_info(struct snd_kcontrol *kcontrol, | |||
2219 | } | 2289 | } |
2220 | return 0; | 2290 | return 0; |
2221 | } | 2291 | } |
2222 | EXPORT_SYMBOL_HDA(snd_hda_mixer_amp_volume_info); | 2292 | EXPORT_SYMBOL_GPL(snd_hda_mixer_amp_volume_info); |
2223 | 2293 | ||
2224 | 2294 | ||
2225 | static inline unsigned int | 2295 | static inline unsigned int |
@@ -2276,7 +2346,7 @@ int snd_hda_mixer_amp_volume_get(struct snd_kcontrol *kcontrol, | |||
2276 | *valp = read_amp_value(codec, nid, 1, dir, idx, ofs); | 2346 | *valp = read_amp_value(codec, nid, 1, dir, idx, ofs); |
2277 | return 0; | 2347 | return 0; |
2278 | } | 2348 | } |
2279 | EXPORT_SYMBOL_HDA(snd_hda_mixer_amp_volume_get); | 2349 | EXPORT_SYMBOL_GPL(snd_hda_mixer_amp_volume_get); |
2280 | 2350 | ||
2281 | /** | 2351 | /** |
2282 | * snd_hda_mixer_amp_volume_put - Put callback for a standard AMP mixer volume | 2352 | * snd_hda_mixer_amp_volume_put - Put callback for a standard AMP mixer volume |
@@ -2306,7 +2376,7 @@ int snd_hda_mixer_amp_volume_put(struct snd_kcontrol *kcontrol, | |||
2306 | snd_hda_power_down(codec); | 2376 | snd_hda_power_down(codec); |
2307 | return change; | 2377 | return change; |
2308 | } | 2378 | } |
2309 | EXPORT_SYMBOL_HDA(snd_hda_mixer_amp_volume_put); | 2379 | EXPORT_SYMBOL_GPL(snd_hda_mixer_amp_volume_put); |
2310 | 2380 | ||
2311 | /** | 2381 | /** |
2312 | * snd_hda_mixer_amp_volume_put - TLV callback for a standard AMP mixer volume | 2382 | * snd_hda_mixer_amp_volume_put - TLV callback for a standard AMP mixer volume |
@@ -2344,7 +2414,7 @@ int snd_hda_mixer_amp_tlv(struct snd_kcontrol *kcontrol, int op_flag, | |||
2344 | return -EFAULT; | 2414 | return -EFAULT; |
2345 | return 0; | 2415 | return 0; |
2346 | } | 2416 | } |
2347 | EXPORT_SYMBOL_HDA(snd_hda_mixer_amp_tlv); | 2417 | EXPORT_SYMBOL_GPL(snd_hda_mixer_amp_tlv); |
2348 | 2418 | ||
2349 | /** | 2419 | /** |
2350 | * snd_hda_set_vmaster_tlv - Set TLV for a virtual master control | 2420 | * snd_hda_set_vmaster_tlv - Set TLV for a virtual master control |
@@ -2372,7 +2442,7 @@ void snd_hda_set_vmaster_tlv(struct hda_codec *codec, hda_nid_t nid, int dir, | |||
2372 | tlv[2] = -nums * step; | 2442 | tlv[2] = -nums * step; |
2373 | tlv[3] = step; | 2443 | tlv[3] = step; |
2374 | } | 2444 | } |
2375 | EXPORT_SYMBOL_HDA(snd_hda_set_vmaster_tlv); | 2445 | EXPORT_SYMBOL_GPL(snd_hda_set_vmaster_tlv); |
2376 | 2446 | ||
2377 | /* find a mixer control element with the given name */ | 2447 | /* find a mixer control element with the given name */ |
2378 | static struct snd_kcontrol * | 2448 | static struct snd_kcontrol * |
@@ -2401,7 +2471,7 @@ struct snd_kcontrol *snd_hda_find_mixer_ctl(struct hda_codec *codec, | |||
2401 | { | 2471 | { |
2402 | return find_mixer_ctl(codec, name, 0, 0); | 2472 | return find_mixer_ctl(codec, name, 0, 0); |
2403 | } | 2473 | } |
2404 | EXPORT_SYMBOL_HDA(snd_hda_find_mixer_ctl); | 2474 | EXPORT_SYMBOL_GPL(snd_hda_find_mixer_ctl); |
2405 | 2475 | ||
2406 | static int find_empty_mixer_ctl_idx(struct hda_codec *codec, const char *name, | 2476 | static int find_empty_mixer_ctl_idx(struct hda_codec *codec, const char *name, |
2407 | int start_idx) | 2477 | int start_idx) |
@@ -2461,7 +2531,7 @@ int snd_hda_ctl_add(struct hda_codec *codec, hda_nid_t nid, | |||
2461 | item->flags = flags; | 2531 | item->flags = flags; |
2462 | return 0; | 2532 | return 0; |
2463 | } | 2533 | } |
2464 | EXPORT_SYMBOL_HDA(snd_hda_ctl_add); | 2534 | EXPORT_SYMBOL_GPL(snd_hda_ctl_add); |
2465 | 2535 | ||
2466 | /** | 2536 | /** |
2467 | * snd_hda_add_nid - Assign a NID to a control element | 2537 | * snd_hda_add_nid - Assign a NID to a control element |
@@ -2492,7 +2562,7 @@ int snd_hda_add_nid(struct hda_codec *codec, struct snd_kcontrol *kctl, | |||
2492 | kctl->id.name, kctl->id.index, index); | 2562 | kctl->id.name, kctl->id.index, index); |
2493 | return -EINVAL; | 2563 | return -EINVAL; |
2494 | } | 2564 | } |
2495 | EXPORT_SYMBOL_HDA(snd_hda_add_nid); | 2565 | EXPORT_SYMBOL_GPL(snd_hda_add_nid); |
2496 | 2566 | ||
2497 | /** | 2567 | /** |
2498 | * snd_hda_ctls_clear - Clear all controls assigned to the given codec | 2568 | * snd_hda_ctls_clear - Clear all controls assigned to the given codec |
@@ -2543,7 +2613,7 @@ int snd_hda_lock_devices(struct hda_bus *bus) | |||
2543 | spin_unlock(&card->files_lock); | 2613 | spin_unlock(&card->files_lock); |
2544 | return -EINVAL; | 2614 | return -EINVAL; |
2545 | } | 2615 | } |
2546 | EXPORT_SYMBOL_HDA(snd_hda_lock_devices); | 2616 | EXPORT_SYMBOL_GPL(snd_hda_lock_devices); |
2547 | 2617 | ||
2548 | void snd_hda_unlock_devices(struct hda_bus *bus) | 2618 | void snd_hda_unlock_devices(struct hda_bus *bus) |
2549 | { | 2619 | { |
@@ -2554,7 +2624,7 @@ void snd_hda_unlock_devices(struct hda_bus *bus) | |||
2554 | card->shutdown = 0; | 2624 | card->shutdown = 0; |
2555 | spin_unlock(&card->files_lock); | 2625 | spin_unlock(&card->files_lock); |
2556 | } | 2626 | } |
2557 | EXPORT_SYMBOL_HDA(snd_hda_unlock_devices); | 2627 | EXPORT_SYMBOL_GPL(snd_hda_unlock_devices); |
2558 | 2628 | ||
2559 | /** | 2629 | /** |
2560 | * snd_hda_codec_reset - Clear all objects assigned to the codec | 2630 | * snd_hda_codec_reset - Clear all objects assigned to the codec |
@@ -2610,6 +2680,7 @@ int snd_hda_codec_reset(struct hda_codec *codec) | |||
2610 | codec->preset = NULL; | 2680 | codec->preset = NULL; |
2611 | codec->slave_dig_outs = NULL; | 2681 | codec->slave_dig_outs = NULL; |
2612 | codec->spdif_status_reset = 0; | 2682 | codec->spdif_status_reset = 0; |
2683 | unload_parser(codec); | ||
2613 | module_put(codec->owner); | 2684 | module_put(codec->owner); |
2614 | codec->owner = NULL; | 2685 | codec->owner = NULL; |
2615 | 2686 | ||
@@ -2777,7 +2848,7 @@ int __snd_hda_add_vmaster(struct hda_codec *codec, char *name, | |||
2777 | *ctl_ret = kctl; | 2848 | *ctl_ret = kctl; |
2778 | return 0; | 2849 | return 0; |
2779 | } | 2850 | } |
2780 | EXPORT_SYMBOL_HDA(__snd_hda_add_vmaster); | 2851 | EXPORT_SYMBOL_GPL(__snd_hda_add_vmaster); |
2781 | 2852 | ||
2782 | /* | 2853 | /* |
2783 | * mute-LED control using vmaster | 2854 | * mute-LED control using vmaster |
@@ -2854,7 +2925,7 @@ int snd_hda_add_vmaster_hook(struct hda_codec *codec, | |||
2854 | return -ENOMEM; | 2925 | return -ENOMEM; |
2855 | return snd_hda_ctl_add(codec, 0, kctl); | 2926 | return snd_hda_ctl_add(codec, 0, kctl); |
2856 | } | 2927 | } |
2857 | EXPORT_SYMBOL_HDA(snd_hda_add_vmaster_hook); | 2928 | EXPORT_SYMBOL_GPL(snd_hda_add_vmaster_hook); |
2858 | 2929 | ||
2859 | /* | 2930 | /* |
2860 | * Call the hook with the current value for synchronization | 2931 | * Call the hook with the current value for synchronization |
@@ -2878,7 +2949,7 @@ void snd_hda_sync_vmaster_hook(struct hda_vmaster_mute_hook *hook) | |||
2878 | break; | 2949 | break; |
2879 | } | 2950 | } |
2880 | } | 2951 | } |
2881 | EXPORT_SYMBOL_HDA(snd_hda_sync_vmaster_hook); | 2952 | EXPORT_SYMBOL_GPL(snd_hda_sync_vmaster_hook); |
2882 | 2953 | ||
2883 | 2954 | ||
2884 | /** | 2955 | /** |
@@ -2898,7 +2969,7 @@ int snd_hda_mixer_amp_switch_info(struct snd_kcontrol *kcontrol, | |||
2898 | uinfo->value.integer.max = 1; | 2969 | uinfo->value.integer.max = 1; |
2899 | return 0; | 2970 | return 0; |
2900 | } | 2971 | } |
2901 | EXPORT_SYMBOL_HDA(snd_hda_mixer_amp_switch_info); | 2972 | EXPORT_SYMBOL_GPL(snd_hda_mixer_amp_switch_info); |
2902 | 2973 | ||
2903 | /** | 2974 | /** |
2904 | * snd_hda_mixer_amp_switch_get - Get callback for a standard AMP mixer switch | 2975 | * snd_hda_mixer_amp_switch_get - Get callback for a standard AMP mixer switch |
@@ -2924,7 +2995,7 @@ int snd_hda_mixer_amp_switch_get(struct snd_kcontrol *kcontrol, | |||
2924 | HDA_AMP_MUTE) ? 0 : 1; | 2995 | HDA_AMP_MUTE) ? 0 : 1; |
2925 | return 0; | 2996 | return 0; |
2926 | } | 2997 | } |
2927 | EXPORT_SYMBOL_HDA(snd_hda_mixer_amp_switch_get); | 2998 | EXPORT_SYMBOL_GPL(snd_hda_mixer_amp_switch_get); |
2928 | 2999 | ||
2929 | /** | 3000 | /** |
2930 | * snd_hda_mixer_amp_switch_put - Put callback for a standard AMP mixer switch | 3001 | * snd_hda_mixer_amp_switch_put - Put callback for a standard AMP mixer switch |
@@ -2958,7 +3029,7 @@ int snd_hda_mixer_amp_switch_put(struct snd_kcontrol *kcontrol, | |||
2958 | snd_hda_power_down(codec); | 3029 | snd_hda_power_down(codec); |
2959 | return change; | 3030 | return change; |
2960 | } | 3031 | } |
2961 | EXPORT_SYMBOL_HDA(snd_hda_mixer_amp_switch_put); | 3032 | EXPORT_SYMBOL_GPL(snd_hda_mixer_amp_switch_put); |
2962 | 3033 | ||
2963 | /* | 3034 | /* |
2964 | * bound volume controls | 3035 | * bound volume controls |
@@ -2990,7 +3061,7 @@ int snd_hda_mixer_bind_switch_get(struct snd_kcontrol *kcontrol, | |||
2990 | mutex_unlock(&codec->control_mutex); | 3061 | mutex_unlock(&codec->control_mutex); |
2991 | return err; | 3062 | return err; |
2992 | } | 3063 | } |
2993 | EXPORT_SYMBOL_HDA(snd_hda_mixer_bind_switch_get); | 3064 | EXPORT_SYMBOL_GPL(snd_hda_mixer_bind_switch_get); |
2994 | 3065 | ||
2995 | /** | 3066 | /** |
2996 | * snd_hda_mixer_bind_switch_put - Put callback for a bound volume control | 3067 | * snd_hda_mixer_bind_switch_put - Put callback for a bound volume control |
@@ -3020,7 +3091,7 @@ int snd_hda_mixer_bind_switch_put(struct snd_kcontrol *kcontrol, | |||
3020 | mutex_unlock(&codec->control_mutex); | 3091 | mutex_unlock(&codec->control_mutex); |
3021 | return err < 0 ? err : change; | 3092 | return err < 0 ? err : change; |
3022 | } | 3093 | } |
3023 | EXPORT_SYMBOL_HDA(snd_hda_mixer_bind_switch_put); | 3094 | EXPORT_SYMBOL_GPL(snd_hda_mixer_bind_switch_put); |
3024 | 3095 | ||
3025 | /** | 3096 | /** |
3026 | * snd_hda_mixer_bind_ctls_info - Info callback for a generic bound control | 3097 | * snd_hda_mixer_bind_ctls_info - Info callback for a generic bound control |
@@ -3043,7 +3114,7 @@ int snd_hda_mixer_bind_ctls_info(struct snd_kcontrol *kcontrol, | |||
3043 | mutex_unlock(&codec->control_mutex); | 3114 | mutex_unlock(&codec->control_mutex); |
3044 | return err; | 3115 | return err; |
3045 | } | 3116 | } |
3046 | EXPORT_SYMBOL_HDA(snd_hda_mixer_bind_ctls_info); | 3117 | EXPORT_SYMBOL_GPL(snd_hda_mixer_bind_ctls_info); |
3047 | 3118 | ||
3048 | /** | 3119 | /** |
3049 | * snd_hda_mixer_bind_ctls_get - Get callback for a generic bound control | 3120 | * snd_hda_mixer_bind_ctls_get - Get callback for a generic bound control |
@@ -3066,7 +3137,7 @@ int snd_hda_mixer_bind_ctls_get(struct snd_kcontrol *kcontrol, | |||
3066 | mutex_unlock(&codec->control_mutex); | 3137 | mutex_unlock(&codec->control_mutex); |
3067 | return err; | 3138 | return err; |
3068 | } | 3139 | } |
3069 | EXPORT_SYMBOL_HDA(snd_hda_mixer_bind_ctls_get); | 3140 | EXPORT_SYMBOL_GPL(snd_hda_mixer_bind_ctls_get); |
3070 | 3141 | ||
3071 | /** | 3142 | /** |
3072 | * snd_hda_mixer_bind_ctls_put - Put callback for a generic bound control | 3143 | * snd_hda_mixer_bind_ctls_put - Put callback for a generic bound control |
@@ -3095,7 +3166,7 @@ int snd_hda_mixer_bind_ctls_put(struct snd_kcontrol *kcontrol, | |||
3095 | mutex_unlock(&codec->control_mutex); | 3166 | mutex_unlock(&codec->control_mutex); |
3096 | return err < 0 ? err : change; | 3167 | return err < 0 ? err : change; |
3097 | } | 3168 | } |
3098 | EXPORT_SYMBOL_HDA(snd_hda_mixer_bind_ctls_put); | 3169 | EXPORT_SYMBOL_GPL(snd_hda_mixer_bind_ctls_put); |
3099 | 3170 | ||
3100 | /** | 3171 | /** |
3101 | * snd_hda_mixer_bind_tlv - TLV callback for a generic bound control | 3172 | * snd_hda_mixer_bind_tlv - TLV callback for a generic bound control |
@@ -3118,7 +3189,7 @@ int snd_hda_mixer_bind_tlv(struct snd_kcontrol *kcontrol, int op_flag, | |||
3118 | mutex_unlock(&codec->control_mutex); | 3189 | mutex_unlock(&codec->control_mutex); |
3119 | return err; | 3190 | return err; |
3120 | } | 3191 | } |
3121 | EXPORT_SYMBOL_HDA(snd_hda_mixer_bind_tlv); | 3192 | EXPORT_SYMBOL_GPL(snd_hda_mixer_bind_tlv); |
3122 | 3193 | ||
3123 | struct hda_ctl_ops snd_hda_bind_vol = { | 3194 | struct hda_ctl_ops snd_hda_bind_vol = { |
3124 | .info = snd_hda_mixer_amp_volume_info, | 3195 | .info = snd_hda_mixer_amp_volume_info, |
@@ -3126,7 +3197,7 @@ struct hda_ctl_ops snd_hda_bind_vol = { | |||
3126 | .put = snd_hda_mixer_amp_volume_put, | 3197 | .put = snd_hda_mixer_amp_volume_put, |
3127 | .tlv = snd_hda_mixer_amp_tlv | 3198 | .tlv = snd_hda_mixer_amp_tlv |
3128 | }; | 3199 | }; |
3129 | EXPORT_SYMBOL_HDA(snd_hda_bind_vol); | 3200 | EXPORT_SYMBOL_GPL(snd_hda_bind_vol); |
3130 | 3201 | ||
3131 | struct hda_ctl_ops snd_hda_bind_sw = { | 3202 | struct hda_ctl_ops snd_hda_bind_sw = { |
3132 | .info = snd_hda_mixer_amp_switch_info, | 3203 | .info = snd_hda_mixer_amp_switch_info, |
@@ -3134,7 +3205,7 @@ struct hda_ctl_ops snd_hda_bind_sw = { | |||
3134 | .put = snd_hda_mixer_amp_switch_put, | 3205 | .put = snd_hda_mixer_amp_switch_put, |
3135 | .tlv = snd_hda_mixer_amp_tlv | 3206 | .tlv = snd_hda_mixer_amp_tlv |
3136 | }; | 3207 | }; |
3137 | EXPORT_SYMBOL_HDA(snd_hda_bind_sw); | 3208 | EXPORT_SYMBOL_GPL(snd_hda_bind_sw); |
3138 | 3209 | ||
3139 | /* | 3210 | /* |
3140 | * SPDIF out controls | 3211 | * SPDIF out controls |
@@ -3438,7 +3509,7 @@ int snd_hda_create_dig_out_ctls(struct hda_codec *codec, | |||
3438 | spdif->status = convert_to_spdif_status(spdif->ctls); | 3509 | spdif->status = convert_to_spdif_status(spdif->ctls); |
3439 | return 0; | 3510 | return 0; |
3440 | } | 3511 | } |
3441 | EXPORT_SYMBOL_HDA(snd_hda_create_dig_out_ctls); | 3512 | EXPORT_SYMBOL_GPL(snd_hda_create_dig_out_ctls); |
3442 | 3513 | ||
3443 | /* get the hda_spdif_out entry from the given NID | 3514 | /* get the hda_spdif_out entry from the given NID |
3444 | * call within spdif_mutex lock | 3515 | * call within spdif_mutex lock |
@@ -3455,7 +3526,7 @@ struct hda_spdif_out *snd_hda_spdif_out_of_nid(struct hda_codec *codec, | |||
3455 | } | 3526 | } |
3456 | return NULL; | 3527 | return NULL; |
3457 | } | 3528 | } |
3458 | EXPORT_SYMBOL_HDA(snd_hda_spdif_out_of_nid); | 3529 | EXPORT_SYMBOL_GPL(snd_hda_spdif_out_of_nid); |
3459 | 3530 | ||
3460 | void snd_hda_spdif_ctls_unassign(struct hda_codec *codec, int idx) | 3531 | void snd_hda_spdif_ctls_unassign(struct hda_codec *codec, int idx) |
3461 | { | 3532 | { |
@@ -3466,7 +3537,7 @@ void snd_hda_spdif_ctls_unassign(struct hda_codec *codec, int idx) | |||
3466 | spdif->nid = (u16)-1; | 3537 | spdif->nid = (u16)-1; |
3467 | mutex_unlock(&codec->spdif_mutex); | 3538 | mutex_unlock(&codec->spdif_mutex); |
3468 | } | 3539 | } |
3469 | EXPORT_SYMBOL_HDA(snd_hda_spdif_ctls_unassign); | 3540 | EXPORT_SYMBOL_GPL(snd_hda_spdif_ctls_unassign); |
3470 | 3541 | ||
3471 | void snd_hda_spdif_ctls_assign(struct hda_codec *codec, int idx, hda_nid_t nid) | 3542 | void snd_hda_spdif_ctls_assign(struct hda_codec *codec, int idx, hda_nid_t nid) |
3472 | { | 3543 | { |
@@ -3482,7 +3553,7 @@ void snd_hda_spdif_ctls_assign(struct hda_codec *codec, int idx, hda_nid_t nid) | |||
3482 | } | 3553 | } |
3483 | mutex_unlock(&codec->spdif_mutex); | 3554 | mutex_unlock(&codec->spdif_mutex); |
3484 | } | 3555 | } |
3485 | EXPORT_SYMBOL_HDA(snd_hda_spdif_ctls_assign); | 3556 | EXPORT_SYMBOL_GPL(snd_hda_spdif_ctls_assign); |
3486 | 3557 | ||
3487 | /* | 3558 | /* |
3488 | * SPDIF sharing with analog output | 3559 | * SPDIF sharing with analog output |
@@ -3530,7 +3601,7 @@ int snd_hda_create_spdif_share_sw(struct hda_codec *codec, | |||
3530 | /* ATTENTION: here mout is passed as private_data, instead of codec */ | 3601 | /* ATTENTION: here mout is passed as private_data, instead of codec */ |
3531 | return snd_hda_ctl_add(codec, mout->dig_out_nid, kctl); | 3602 | return snd_hda_ctl_add(codec, mout->dig_out_nid, kctl); |
3532 | } | 3603 | } |
3533 | EXPORT_SYMBOL_HDA(snd_hda_create_spdif_share_sw); | 3604 | EXPORT_SYMBOL_GPL(snd_hda_create_spdif_share_sw); |
3534 | 3605 | ||
3535 | /* | 3606 | /* |
3536 | * SPDIF input | 3607 | * SPDIF input |
@@ -3638,7 +3709,7 @@ int snd_hda_create_spdif_in_ctls(struct hda_codec *codec, hda_nid_t nid) | |||
3638 | AC_DIG1_ENABLE; | 3709 | AC_DIG1_ENABLE; |
3639 | return 0; | 3710 | return 0; |
3640 | } | 3711 | } |
3641 | EXPORT_SYMBOL_HDA(snd_hda_create_spdif_in_ctls); | 3712 | EXPORT_SYMBOL_GPL(snd_hda_create_spdif_in_ctls); |
3642 | 3713 | ||
3643 | /* | 3714 | /* |
3644 | * command cache | 3715 | * command cache |
@@ -3689,7 +3760,7 @@ int snd_hda_codec_write_cache(struct hda_codec *codec, hda_nid_t nid, | |||
3689 | mutex_unlock(&codec->bus->cmd_mutex); | 3760 | mutex_unlock(&codec->bus->cmd_mutex); |
3690 | return 0; | 3761 | return 0; |
3691 | } | 3762 | } |
3692 | EXPORT_SYMBOL_HDA(snd_hda_codec_write_cache); | 3763 | EXPORT_SYMBOL_GPL(snd_hda_codec_write_cache); |
3693 | 3764 | ||
3694 | /** | 3765 | /** |
3695 | * snd_hda_codec_update_cache - check cache and write the cmd only when needed | 3766 | * snd_hda_codec_update_cache - check cache and write the cmd only when needed |
@@ -3724,7 +3795,7 @@ int snd_hda_codec_update_cache(struct hda_codec *codec, hda_nid_t nid, | |||
3724 | mutex_unlock(&codec->bus->cmd_mutex); | 3795 | mutex_unlock(&codec->bus->cmd_mutex); |
3725 | return snd_hda_codec_write_cache(codec, nid, flags, verb, parm); | 3796 | return snd_hda_codec_write_cache(codec, nid, flags, verb, parm); |
3726 | } | 3797 | } |
3727 | EXPORT_SYMBOL_HDA(snd_hda_codec_update_cache); | 3798 | EXPORT_SYMBOL_GPL(snd_hda_codec_update_cache); |
3728 | 3799 | ||
3729 | /** | 3800 | /** |
3730 | * snd_hda_codec_resume_cache - Resume the all commands from the cache | 3801 | * snd_hda_codec_resume_cache - Resume the all commands from the cache |
@@ -3756,7 +3827,7 @@ void snd_hda_codec_resume_cache(struct hda_codec *codec) | |||
3756 | } | 3827 | } |
3757 | mutex_unlock(&codec->hash_mutex); | 3828 | mutex_unlock(&codec->hash_mutex); |
3758 | } | 3829 | } |
3759 | EXPORT_SYMBOL_HDA(snd_hda_codec_resume_cache); | 3830 | EXPORT_SYMBOL_GPL(snd_hda_codec_resume_cache); |
3760 | 3831 | ||
3761 | /** | 3832 | /** |
3762 | * snd_hda_sequence_write_cache - sequence writes with caching | 3833 | * snd_hda_sequence_write_cache - sequence writes with caching |
@@ -3774,7 +3845,7 @@ void snd_hda_sequence_write_cache(struct hda_codec *codec, | |||
3774 | snd_hda_codec_write_cache(codec, seq->nid, 0, seq->verb, | 3845 | snd_hda_codec_write_cache(codec, seq->nid, 0, seq->verb, |
3775 | seq->param); | 3846 | seq->param); |
3776 | } | 3847 | } |
3777 | EXPORT_SYMBOL_HDA(snd_hda_sequence_write_cache); | 3848 | EXPORT_SYMBOL_GPL(snd_hda_sequence_write_cache); |
3778 | 3849 | ||
3779 | /** | 3850 | /** |
3780 | * snd_hda_codec_flush_cache - Execute all pending (cached) amps / verbs | 3851 | * snd_hda_codec_flush_cache - Execute all pending (cached) amps / verbs |
@@ -3785,7 +3856,7 @@ void snd_hda_codec_flush_cache(struct hda_codec *codec) | |||
3785 | snd_hda_codec_resume_amp(codec); | 3856 | snd_hda_codec_resume_amp(codec); |
3786 | snd_hda_codec_resume_cache(codec); | 3857 | snd_hda_codec_resume_cache(codec); |
3787 | } | 3858 | } |
3788 | EXPORT_SYMBOL_HDA(snd_hda_codec_flush_cache); | 3859 | EXPORT_SYMBOL_GPL(snd_hda_codec_flush_cache); |
3789 | 3860 | ||
3790 | void snd_hda_codec_set_power_to_all(struct hda_codec *codec, hda_nid_t fg, | 3861 | void snd_hda_codec_set_power_to_all(struct hda_codec *codec, hda_nid_t fg, |
3791 | unsigned int power_state) | 3862 | unsigned int power_state) |
@@ -3807,7 +3878,7 @@ void snd_hda_codec_set_power_to_all(struct hda_codec *codec, hda_nid_t fg, | |||
3807 | state); | 3878 | state); |
3808 | } | 3879 | } |
3809 | } | 3880 | } |
3810 | EXPORT_SYMBOL_HDA(snd_hda_codec_set_power_to_all); | 3881 | EXPORT_SYMBOL_GPL(snd_hda_codec_set_power_to_all); |
3811 | 3882 | ||
3812 | /* | 3883 | /* |
3813 | * supported power states check | 3884 | * supported power states check |
@@ -3856,6 +3927,8 @@ unsigned int snd_hda_codec_eapd_power_filter(struct hda_codec *codec, | |||
3856 | hda_nid_t nid, | 3927 | hda_nid_t nid, |
3857 | unsigned int power_state) | 3928 | unsigned int power_state) |
3858 | { | 3929 | { |
3930 | if (nid == codec->afg || nid == codec->mfg) | ||
3931 | return power_state; | ||
3859 | if (power_state == AC_PWRST_D3 && | 3932 | if (power_state == AC_PWRST_D3 && |
3860 | get_wcaps_type(get_wcaps(codec, nid)) == AC_WID_PIN && | 3933 | get_wcaps_type(get_wcaps(codec, nid)) == AC_WID_PIN && |
3861 | (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)) { | 3934 | (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_EAPD)) { |
@@ -3866,7 +3939,7 @@ unsigned int snd_hda_codec_eapd_power_filter(struct hda_codec *codec, | |||
3866 | } | 3939 | } |
3867 | return power_state; | 3940 | return power_state; |
3868 | } | 3941 | } |
3869 | EXPORT_SYMBOL_HDA(snd_hda_codec_eapd_power_filter); | 3942 | EXPORT_SYMBOL_GPL(snd_hda_codec_eapd_power_filter); |
3870 | 3943 | ||
3871 | /* | 3944 | /* |
3872 | * set power state of the codec, and return the power state | 3945 | * set power state of the codec, and return the power state |
@@ -3881,8 +3954,10 @@ static unsigned int hda_set_power_state(struct hda_codec *codec, | |||
3881 | 3954 | ||
3882 | /* this delay seems necessary to avoid click noise at power-down */ | 3955 | /* this delay seems necessary to avoid click noise at power-down */ |
3883 | if (power_state == AC_PWRST_D3) { | 3956 | if (power_state == AC_PWRST_D3) { |
3884 | /* transition time less than 10ms for power down */ | 3957 | if (codec->depop_delay < 0) |
3885 | msleep(codec->epss ? 10 : 100); | 3958 | msleep(codec->epss ? 10 : 100); |
3959 | else if (codec->depop_delay > 0) | ||
3960 | msleep(codec->depop_delay); | ||
3886 | flags = HDA_RW_NO_RESPONSE_FALLBACK; | 3961 | flags = HDA_RW_NO_RESPONSE_FALLBACK; |
3887 | } | 3962 | } |
3888 | 3963 | ||
@@ -3892,9 +3967,13 @@ static unsigned int hda_set_power_state(struct hda_codec *codec, | |||
3892 | codec->patch_ops.set_power_state(codec, fg, | 3967 | codec->patch_ops.set_power_state(codec, fg, |
3893 | power_state); | 3968 | power_state); |
3894 | else { | 3969 | else { |
3895 | snd_hda_codec_read(codec, fg, flags, | 3970 | state = power_state; |
3896 | AC_VERB_SET_POWER_STATE, | 3971 | if (codec->power_filter) |
3897 | power_state); | 3972 | state = codec->power_filter(codec, fg, state); |
3973 | if (state == power_state || power_state != AC_PWRST_D3) | ||
3974 | snd_hda_codec_read(codec, fg, flags, | ||
3975 | AC_VERB_SET_POWER_STATE, | ||
3976 | state); | ||
3898 | snd_hda_codec_set_power_to_all(codec, fg, power_state); | 3977 | snd_hda_codec_set_power_to_all(codec, fg, power_state); |
3899 | } | 3978 | } |
3900 | state = hda_sync_power_state(codec, fg, power_state); | 3979 | state = hda_sync_power_state(codec, fg, power_state); |
@@ -4000,10 +4079,6 @@ static void hda_call_codec_resume(struct hda_codec *codec) | |||
4000 | * in the resume / power-save sequence | 4079 | * in the resume / power-save sequence |
4001 | */ | 4080 | */ |
4002 | hda_keep_power_on(codec); | 4081 | hda_keep_power_on(codec); |
4003 | if (codec->pm_down_notified) { | ||
4004 | codec->pm_down_notified = 0; | ||
4005 | hda_call_pm_notify(codec->bus, true); | ||
4006 | } | ||
4007 | hda_set_power_state(codec, AC_PWRST_D0); | 4082 | hda_set_power_state(codec, AC_PWRST_D0); |
4008 | restore_shutup_pins(codec); | 4083 | restore_shutup_pins(codec); |
4009 | hda_exec_init_verbs(codec); | 4084 | hda_exec_init_verbs(codec); |
@@ -4055,7 +4130,7 @@ int snd_hda_build_controls(struct hda_bus *bus) | |||
4055 | } | 4130 | } |
4056 | return 0; | 4131 | return 0; |
4057 | } | 4132 | } |
4058 | EXPORT_SYMBOL_HDA(snd_hda_build_controls); | 4133 | EXPORT_SYMBOL_GPL(snd_hda_build_controls); |
4059 | 4134 | ||
4060 | /* | 4135 | /* |
4061 | * add standard channel maps if not specified | 4136 | * add standard channel maps if not specified |
@@ -4228,7 +4303,7 @@ unsigned int snd_hda_calc_stream_format(unsigned int rate, | |||
4228 | 4303 | ||
4229 | return val; | 4304 | return val; |
4230 | } | 4305 | } |
4231 | EXPORT_SYMBOL_HDA(snd_hda_calc_stream_format); | 4306 | EXPORT_SYMBOL_GPL(snd_hda_calc_stream_format); |
4232 | 4307 | ||
4233 | static unsigned int get_pcm_param(struct hda_codec *codec, hda_nid_t nid, | 4308 | static unsigned int get_pcm_param(struct hda_codec *codec, hda_nid_t nid, |
4234 | int dir) | 4309 | int dir) |
@@ -4374,7 +4449,7 @@ int snd_hda_query_supported_pcm(struct hda_codec *codec, hda_nid_t nid, | |||
4374 | 4449 | ||
4375 | return 0; | 4450 | return 0; |
4376 | } | 4451 | } |
4377 | EXPORT_SYMBOL_HDA(snd_hda_query_supported_pcm); | 4452 | EXPORT_SYMBOL_GPL(snd_hda_query_supported_pcm); |
4378 | 4453 | ||
4379 | /** | 4454 | /** |
4380 | * snd_hda_is_supported_format - Check the validity of the format | 4455 | * snd_hda_is_supported_format - Check the validity of the format |
@@ -4441,7 +4516,7 @@ int snd_hda_is_supported_format(struct hda_codec *codec, hda_nid_t nid, | |||
4441 | 4516 | ||
4442 | return 1; | 4517 | return 1; |
4443 | } | 4518 | } |
4444 | EXPORT_SYMBOL_HDA(snd_hda_is_supported_format); | 4519 | EXPORT_SYMBOL_GPL(snd_hda_is_supported_format); |
4445 | 4520 | ||
4446 | /* | 4521 | /* |
4447 | * PCM stuff | 4522 | * PCM stuff |
@@ -4519,7 +4594,7 @@ int snd_hda_codec_prepare(struct hda_codec *codec, | |||
4519 | mutex_unlock(&codec->bus->prepare_mutex); | 4594 | mutex_unlock(&codec->bus->prepare_mutex); |
4520 | return ret; | 4595 | return ret; |
4521 | } | 4596 | } |
4522 | EXPORT_SYMBOL_HDA(snd_hda_codec_prepare); | 4597 | EXPORT_SYMBOL_GPL(snd_hda_codec_prepare); |
4523 | 4598 | ||
4524 | void snd_hda_codec_cleanup(struct hda_codec *codec, | 4599 | void snd_hda_codec_cleanup(struct hda_codec *codec, |
4525 | struct hda_pcm_stream *hinfo, | 4600 | struct hda_pcm_stream *hinfo, |
@@ -4529,7 +4604,7 @@ void snd_hda_codec_cleanup(struct hda_codec *codec, | |||
4529 | hinfo->ops.cleanup(hinfo, codec, substream); | 4604 | hinfo->ops.cleanup(hinfo, codec, substream); |
4530 | mutex_unlock(&codec->bus->prepare_mutex); | 4605 | mutex_unlock(&codec->bus->prepare_mutex); |
4531 | } | 4606 | } |
4532 | EXPORT_SYMBOL_HDA(snd_hda_codec_cleanup); | 4607 | EXPORT_SYMBOL_GPL(snd_hda_codec_cleanup); |
4533 | 4608 | ||
4534 | /* global */ | 4609 | /* global */ |
4535 | const char *snd_hda_pcm_type_name[HDA_PCM_NTYPES] = { | 4610 | const char *snd_hda_pcm_type_name[HDA_PCM_NTYPES] = { |
@@ -4687,7 +4762,7 @@ int snd_hda_build_pcms(struct hda_bus *bus) | |||
4687 | } | 4762 | } |
4688 | return 0; | 4763 | return 0; |
4689 | } | 4764 | } |
4690 | EXPORT_SYMBOL_HDA(snd_hda_build_pcms); | 4765 | EXPORT_SYMBOL_GPL(snd_hda_build_pcms); |
4691 | 4766 | ||
4692 | /** | 4767 | /** |
4693 | * snd_hda_check_board_config - compare the current codec with the config table | 4768 | * snd_hda_check_board_config - compare the current codec with the config table |
@@ -4743,7 +4818,7 @@ int snd_hda_check_board_config(struct hda_codec *codec, | |||
4743 | } | 4818 | } |
4744 | return -1; | 4819 | return -1; |
4745 | } | 4820 | } |
4746 | EXPORT_SYMBOL_HDA(snd_hda_check_board_config); | 4821 | EXPORT_SYMBOL_GPL(snd_hda_check_board_config); |
4747 | 4822 | ||
4748 | /** | 4823 | /** |
4749 | * snd_hda_check_board_codec_sid_config - compare the current codec | 4824 | * snd_hda_check_board_codec_sid_config - compare the current codec |
@@ -4804,7 +4879,7 @@ int snd_hda_check_board_codec_sid_config(struct hda_codec *codec, | |||
4804 | } | 4879 | } |
4805 | return -1; | 4880 | return -1; |
4806 | } | 4881 | } |
4807 | EXPORT_SYMBOL_HDA(snd_hda_check_board_codec_sid_config); | 4882 | EXPORT_SYMBOL_GPL(snd_hda_check_board_codec_sid_config); |
4808 | 4883 | ||
4809 | /** | 4884 | /** |
4810 | * snd_hda_add_new_ctls - create controls from the array | 4885 | * snd_hda_add_new_ctls - create controls from the array |
@@ -4854,7 +4929,7 @@ int snd_hda_add_new_ctls(struct hda_codec *codec, | |||
4854 | } | 4929 | } |
4855 | return 0; | 4930 | return 0; |
4856 | } | 4931 | } |
4857 | EXPORT_SYMBOL_HDA(snd_hda_add_new_ctls); | 4932 | EXPORT_SYMBOL_GPL(snd_hda_add_new_ctls); |
4858 | 4933 | ||
4859 | #ifdef CONFIG_PM | 4934 | #ifdef CONFIG_PM |
4860 | static void hda_power_work(struct work_struct *work) | 4935 | static void hda_power_work(struct work_struct *work) |
@@ -4877,11 +4952,8 @@ static void hda_power_work(struct work_struct *work) | |||
4877 | spin_unlock(&codec->power_lock); | 4952 | spin_unlock(&codec->power_lock); |
4878 | 4953 | ||
4879 | state = hda_call_codec_suspend(codec, true); | 4954 | state = hda_call_codec_suspend(codec, true); |
4880 | if (!codec->pm_down_notified && | 4955 | if (!bus->power_keep_link_on && (state & AC_PWRST_CLK_STOP_OK)) |
4881 | !bus->power_keep_link_on && (state & AC_PWRST_CLK_STOP_OK)) { | 4956 | hda_call_pm_notify(codec, false); |
4882 | codec->pm_down_notified = 1; | ||
4883 | hda_call_pm_notify(bus, false); | ||
4884 | } | ||
4885 | } | 4957 | } |
4886 | 4958 | ||
4887 | static void hda_keep_power_on(struct hda_codec *codec) | 4959 | static void hda_keep_power_on(struct hda_codec *codec) |
@@ -4891,6 +4963,7 @@ static void hda_keep_power_on(struct hda_codec *codec) | |||
4891 | codec->power_on = 1; | 4963 | codec->power_on = 1; |
4892 | codec->power_jiffies = jiffies; | 4964 | codec->power_jiffies = jiffies; |
4893 | spin_unlock(&codec->power_lock); | 4965 | spin_unlock(&codec->power_lock); |
4966 | hda_call_pm_notify(codec, true); | ||
4894 | } | 4967 | } |
4895 | 4968 | ||
4896 | /* update the power on/off account with the current jiffies */ | 4969 | /* update the power on/off account with the current jiffies */ |
@@ -4910,8 +4983,6 @@ void snd_hda_update_power_acct(struct hda_codec *codec) | |||
4910 | /* call this with codec->power_lock held! */ | 4983 | /* call this with codec->power_lock held! */ |
4911 | static void __snd_hda_power_up(struct hda_codec *codec, bool wait_power_down) | 4984 | static void __snd_hda_power_up(struct hda_codec *codec, bool wait_power_down) |
4912 | { | 4985 | { |
4913 | struct hda_bus *bus = codec->bus; | ||
4914 | |||
4915 | /* Return if power_on or transitioning to power_on, unless currently | 4986 | /* Return if power_on or transitioning to power_on, unless currently |
4916 | * powering down. */ | 4987 | * powering down. */ |
4917 | if ((codec->power_on || codec->power_transition > 0) && | 4988 | if ((codec->power_on || codec->power_transition > 0) && |
@@ -4938,11 +5009,6 @@ static void __snd_hda_power_up(struct hda_codec *codec, bool wait_power_down) | |||
4938 | codec->power_transition = 1; /* avoid reentrance */ | 5009 | codec->power_transition = 1; /* avoid reentrance */ |
4939 | spin_unlock(&codec->power_lock); | 5010 | spin_unlock(&codec->power_lock); |
4940 | 5011 | ||
4941 | if (codec->pm_down_notified) { | ||
4942 | codec->pm_down_notified = 0; | ||
4943 | hda_call_pm_notify(bus, true); | ||
4944 | } | ||
4945 | |||
4946 | hda_call_codec_resume(codec); | 5012 | hda_call_codec_resume(codec); |
4947 | 5013 | ||
4948 | spin_lock(&codec->power_lock); | 5014 | spin_lock(&codec->power_lock); |
@@ -4985,7 +5051,7 @@ void snd_hda_power_save(struct hda_codec *codec, int delta, bool d3wait) | |||
4985 | __snd_hda_power_down(codec); | 5051 | __snd_hda_power_down(codec); |
4986 | spin_unlock(&codec->power_lock); | 5052 | spin_unlock(&codec->power_lock); |
4987 | } | 5053 | } |
4988 | EXPORT_SYMBOL_HDA(snd_hda_power_save); | 5054 | EXPORT_SYMBOL_GPL(snd_hda_power_save); |
4989 | 5055 | ||
4990 | /** | 5056 | /** |
4991 | * snd_hda_check_amp_list_power - Check the amp list and update the power | 5057 | * snd_hda_check_amp_list_power - Check the amp list and update the power |
@@ -5035,7 +5101,7 @@ int snd_hda_check_amp_list_power(struct hda_codec *codec, | |||
5035 | } | 5101 | } |
5036 | return 0; | 5102 | return 0; |
5037 | } | 5103 | } |
5038 | EXPORT_SYMBOL_HDA(snd_hda_check_amp_list_power); | 5104 | EXPORT_SYMBOL_GPL(snd_hda_check_amp_list_power); |
5039 | #endif | 5105 | #endif |
5040 | 5106 | ||
5041 | /* | 5107 | /* |
@@ -5059,7 +5125,7 @@ int snd_hda_ch_mode_info(struct hda_codec *codec, | |||
5059 | chmode[uinfo->value.enumerated.item].channels); | 5125 | chmode[uinfo->value.enumerated.item].channels); |
5060 | return 0; | 5126 | return 0; |
5061 | } | 5127 | } |
5062 | EXPORT_SYMBOL_HDA(snd_hda_ch_mode_info); | 5128 | EXPORT_SYMBOL_GPL(snd_hda_ch_mode_info); |
5063 | 5129 | ||
5064 | /** | 5130 | /** |
5065 | * snd_hda_ch_mode_get - Get callback helper for the channel mode enum | 5131 | * snd_hda_ch_mode_get - Get callback helper for the channel mode enum |
@@ -5080,7 +5146,7 @@ int snd_hda_ch_mode_get(struct hda_codec *codec, | |||
5080 | } | 5146 | } |
5081 | return 0; | 5147 | return 0; |
5082 | } | 5148 | } |
5083 | EXPORT_SYMBOL_HDA(snd_hda_ch_mode_get); | 5149 | EXPORT_SYMBOL_GPL(snd_hda_ch_mode_get); |
5084 | 5150 | ||
5085 | /** | 5151 | /** |
5086 | * snd_hda_ch_mode_put - Put callback helper for the channel mode enum | 5152 | * snd_hda_ch_mode_put - Put callback helper for the channel mode enum |
@@ -5104,7 +5170,7 @@ int snd_hda_ch_mode_put(struct hda_codec *codec, | |||
5104 | snd_hda_sequence_write_cache(codec, chmode[mode].sequence); | 5170 | snd_hda_sequence_write_cache(codec, chmode[mode].sequence); |
5105 | return 1; | 5171 | return 1; |
5106 | } | 5172 | } |
5107 | EXPORT_SYMBOL_HDA(snd_hda_ch_mode_put); | 5173 | EXPORT_SYMBOL_GPL(snd_hda_ch_mode_put); |
5108 | 5174 | ||
5109 | /* | 5175 | /* |
5110 | * input MUX helper | 5176 | * input MUX helper |
@@ -5129,7 +5195,7 @@ int snd_hda_input_mux_info(const struct hda_input_mux *imux, | |||
5129 | strcpy(uinfo->value.enumerated.name, imux->items[index].label); | 5195 | strcpy(uinfo->value.enumerated.name, imux->items[index].label); |
5130 | return 0; | 5196 | return 0; |
5131 | } | 5197 | } |
5132 | EXPORT_SYMBOL_HDA(snd_hda_input_mux_info); | 5198 | EXPORT_SYMBOL_GPL(snd_hda_input_mux_info); |
5133 | 5199 | ||
5134 | /** | 5200 | /** |
5135 | * snd_hda_input_mux_info_put - Put callback helper for the input-mux enum | 5201 | * snd_hda_input_mux_info_put - Put callback helper for the input-mux enum |
@@ -5154,7 +5220,7 @@ int snd_hda_input_mux_put(struct hda_codec *codec, | |||
5154 | *cur_val = idx; | 5220 | *cur_val = idx; |
5155 | return 1; | 5221 | return 1; |
5156 | } | 5222 | } |
5157 | EXPORT_SYMBOL_HDA(snd_hda_input_mux_put); | 5223 | EXPORT_SYMBOL_GPL(snd_hda_input_mux_put); |
5158 | 5224 | ||
5159 | 5225 | ||
5160 | /* | 5226 | /* |
@@ -5183,7 +5249,7 @@ int snd_hda_enum_helper_info(struct snd_kcontrol *kcontrol, | |||
5183 | texts[uinfo->value.enumerated.item]); | 5249 | texts[uinfo->value.enumerated.item]); |
5184 | return 0; | 5250 | return 0; |
5185 | } | 5251 | } |
5186 | EXPORT_SYMBOL_HDA(snd_hda_enum_helper_info); | 5252 | EXPORT_SYMBOL_GPL(snd_hda_enum_helper_info); |
5187 | 5253 | ||
5188 | /* | 5254 | /* |
5189 | * Multi-channel / digital-out PCM helper functions | 5255 | * Multi-channel / digital-out PCM helper functions |
@@ -5249,7 +5315,7 @@ void snd_hda_bus_reboot_notify(struct hda_bus *bus) | |||
5249 | codec->patch_ops.reboot_notify(codec); | 5315 | codec->patch_ops.reboot_notify(codec); |
5250 | } | 5316 | } |
5251 | } | 5317 | } |
5252 | EXPORT_SYMBOL_HDA(snd_hda_bus_reboot_notify); | 5318 | EXPORT_SYMBOL_GPL(snd_hda_bus_reboot_notify); |
5253 | 5319 | ||
5254 | /** | 5320 | /** |
5255 | * snd_hda_multi_out_dig_open - open the digital out in the exclusive mode | 5321 | * snd_hda_multi_out_dig_open - open the digital out in the exclusive mode |
@@ -5265,7 +5331,7 @@ int snd_hda_multi_out_dig_open(struct hda_codec *codec, | |||
5265 | mutex_unlock(&codec->spdif_mutex); | 5331 | mutex_unlock(&codec->spdif_mutex); |
5266 | return 0; | 5332 | return 0; |
5267 | } | 5333 | } |
5268 | EXPORT_SYMBOL_HDA(snd_hda_multi_out_dig_open); | 5334 | EXPORT_SYMBOL_GPL(snd_hda_multi_out_dig_open); |
5269 | 5335 | ||
5270 | /** | 5336 | /** |
5271 | * snd_hda_multi_out_dig_prepare - prepare the digital out stream | 5337 | * snd_hda_multi_out_dig_prepare - prepare the digital out stream |
@@ -5281,7 +5347,7 @@ int snd_hda_multi_out_dig_prepare(struct hda_codec *codec, | |||
5281 | mutex_unlock(&codec->spdif_mutex); | 5347 | mutex_unlock(&codec->spdif_mutex); |
5282 | return 0; | 5348 | return 0; |
5283 | } | 5349 | } |
5284 | EXPORT_SYMBOL_HDA(snd_hda_multi_out_dig_prepare); | 5350 | EXPORT_SYMBOL_GPL(snd_hda_multi_out_dig_prepare); |
5285 | 5351 | ||
5286 | /** | 5352 | /** |
5287 | * snd_hda_multi_out_dig_cleanup - clean-up the digital out stream | 5353 | * snd_hda_multi_out_dig_cleanup - clean-up the digital out stream |
@@ -5294,7 +5360,7 @@ int snd_hda_multi_out_dig_cleanup(struct hda_codec *codec, | |||
5294 | mutex_unlock(&codec->spdif_mutex); | 5360 | mutex_unlock(&codec->spdif_mutex); |
5295 | return 0; | 5361 | return 0; |
5296 | } | 5362 | } |
5297 | EXPORT_SYMBOL_HDA(snd_hda_multi_out_dig_cleanup); | 5363 | EXPORT_SYMBOL_GPL(snd_hda_multi_out_dig_cleanup); |
5298 | 5364 | ||
5299 | /** | 5365 | /** |
5300 | * snd_hda_multi_out_dig_close - release the digital out stream | 5366 | * snd_hda_multi_out_dig_close - release the digital out stream |
@@ -5307,7 +5373,7 @@ int snd_hda_multi_out_dig_close(struct hda_codec *codec, | |||
5307 | mutex_unlock(&codec->spdif_mutex); | 5373 | mutex_unlock(&codec->spdif_mutex); |
5308 | return 0; | 5374 | return 0; |
5309 | } | 5375 | } |
5310 | EXPORT_SYMBOL_HDA(snd_hda_multi_out_dig_close); | 5376 | EXPORT_SYMBOL_GPL(snd_hda_multi_out_dig_close); |
5311 | 5377 | ||
5312 | /** | 5378 | /** |
5313 | * snd_hda_multi_out_analog_open - open analog outputs | 5379 | * snd_hda_multi_out_analog_open - open analog outputs |
@@ -5357,7 +5423,7 @@ int snd_hda_multi_out_analog_open(struct hda_codec *codec, | |||
5357 | return snd_pcm_hw_constraint_step(substream->runtime, 0, | 5423 | return snd_pcm_hw_constraint_step(substream->runtime, 0, |
5358 | SNDRV_PCM_HW_PARAM_CHANNELS, 2); | 5424 | SNDRV_PCM_HW_PARAM_CHANNELS, 2); |
5359 | } | 5425 | } |
5360 | EXPORT_SYMBOL_HDA(snd_hda_multi_out_analog_open); | 5426 | EXPORT_SYMBOL_GPL(snd_hda_multi_out_analog_open); |
5361 | 5427 | ||
5362 | /** | 5428 | /** |
5363 | * snd_hda_multi_out_analog_prepare - Preapre the analog outputs. | 5429 | * snd_hda_multi_out_analog_prepare - Preapre the analog outputs. |
@@ -5434,7 +5500,7 @@ int snd_hda_multi_out_analog_prepare(struct hda_codec *codec, | |||
5434 | 5500 | ||
5435 | return 0; | 5501 | return 0; |
5436 | } | 5502 | } |
5437 | EXPORT_SYMBOL_HDA(snd_hda_multi_out_analog_prepare); | 5503 | EXPORT_SYMBOL_GPL(snd_hda_multi_out_analog_prepare); |
5438 | 5504 | ||
5439 | /** | 5505 | /** |
5440 | * snd_hda_multi_out_analog_cleanup - clean up the setting for analog out | 5506 | * snd_hda_multi_out_analog_cleanup - clean up the setting for analog out |
@@ -5465,7 +5531,7 @@ int snd_hda_multi_out_analog_cleanup(struct hda_codec *codec, | |||
5465 | mutex_unlock(&codec->spdif_mutex); | 5531 | mutex_unlock(&codec->spdif_mutex); |
5466 | return 0; | 5532 | return 0; |
5467 | } | 5533 | } |
5468 | EXPORT_SYMBOL_HDA(snd_hda_multi_out_analog_cleanup); | 5534 | EXPORT_SYMBOL_GPL(snd_hda_multi_out_analog_cleanup); |
5469 | 5535 | ||
5470 | /** | 5536 | /** |
5471 | * snd_hda_get_default_vref - Get the default (mic) VREF pin bits | 5537 | * snd_hda_get_default_vref - Get the default (mic) VREF pin bits |
@@ -5492,7 +5558,7 @@ unsigned int snd_hda_get_default_vref(struct hda_codec *codec, hda_nid_t pin) | |||
5492 | return AC_PINCTL_VREF_GRD; | 5558 | return AC_PINCTL_VREF_GRD; |
5493 | return AC_PINCTL_VREF_HIZ; | 5559 | return AC_PINCTL_VREF_HIZ; |
5494 | } | 5560 | } |
5495 | EXPORT_SYMBOL_HDA(snd_hda_get_default_vref); | 5561 | EXPORT_SYMBOL_GPL(snd_hda_get_default_vref); |
5496 | 5562 | ||
5497 | /* correct the pin ctl value for matching with the pin cap */ | 5563 | /* correct the pin ctl value for matching with the pin cap */ |
5498 | unsigned int snd_hda_correct_pin_ctl(struct hda_codec *codec, | 5564 | unsigned int snd_hda_correct_pin_ctl(struct hda_codec *codec, |
@@ -5543,7 +5609,7 @@ unsigned int snd_hda_correct_pin_ctl(struct hda_codec *codec, | |||
5543 | 5609 | ||
5544 | return val; | 5610 | return val; |
5545 | } | 5611 | } |
5546 | EXPORT_SYMBOL_HDA(snd_hda_correct_pin_ctl); | 5612 | EXPORT_SYMBOL_GPL(snd_hda_correct_pin_ctl); |
5547 | 5613 | ||
5548 | int _snd_hda_set_pin_ctl(struct hda_codec *codec, hda_nid_t pin, | 5614 | int _snd_hda_set_pin_ctl(struct hda_codec *codec, hda_nid_t pin, |
5549 | unsigned int val, bool cached) | 5615 | unsigned int val, bool cached) |
@@ -5557,7 +5623,7 @@ int _snd_hda_set_pin_ctl(struct hda_codec *codec, hda_nid_t pin, | |||
5557 | return snd_hda_codec_write(codec, pin, 0, | 5623 | return snd_hda_codec_write(codec, pin, 0, |
5558 | AC_VERB_SET_PIN_WIDGET_CONTROL, val); | 5624 | AC_VERB_SET_PIN_WIDGET_CONTROL, val); |
5559 | } | 5625 | } |
5560 | EXPORT_SYMBOL_HDA(_snd_hda_set_pin_ctl); | 5626 | EXPORT_SYMBOL_GPL(_snd_hda_set_pin_ctl); |
5561 | 5627 | ||
5562 | /** | 5628 | /** |
5563 | * snd_hda_add_imux_item - Add an item to input_mux | 5629 | * snd_hda_add_imux_item - Add an item to input_mux |
@@ -5591,7 +5657,7 @@ int snd_hda_add_imux_item(struct hda_input_mux *imux, const char *label, | |||
5591 | imux->num_items++; | 5657 | imux->num_items++; |
5592 | return 0; | 5658 | return 0; |
5593 | } | 5659 | } |
5594 | EXPORT_SYMBOL_HDA(snd_hda_add_imux_item); | 5660 | EXPORT_SYMBOL_GPL(snd_hda_add_imux_item); |
5595 | 5661 | ||
5596 | 5662 | ||
5597 | #ifdef CONFIG_PM | 5663 | #ifdef CONFIG_PM |
@@ -5599,6 +5665,17 @@ EXPORT_SYMBOL_HDA(snd_hda_add_imux_item); | |||
5599 | * power management | 5665 | * power management |
5600 | */ | 5666 | */ |
5601 | 5667 | ||
5668 | |||
5669 | static void hda_async_suspend(void *data, async_cookie_t cookie) | ||
5670 | { | ||
5671 | hda_call_codec_suspend(data, false); | ||
5672 | } | ||
5673 | |||
5674 | static void hda_async_resume(void *data, async_cookie_t cookie) | ||
5675 | { | ||
5676 | hda_call_codec_resume(data); | ||
5677 | } | ||
5678 | |||
5602 | /** | 5679 | /** |
5603 | * snd_hda_suspend - suspend the codecs | 5680 | * snd_hda_suspend - suspend the codecs |
5604 | * @bus: the HDA bus | 5681 | * @bus: the HDA bus |
@@ -5608,15 +5685,25 @@ EXPORT_SYMBOL_HDA(snd_hda_add_imux_item); | |||
5608 | int snd_hda_suspend(struct hda_bus *bus) | 5685 | int snd_hda_suspend(struct hda_bus *bus) |
5609 | { | 5686 | { |
5610 | struct hda_codec *codec; | 5687 | struct hda_codec *codec; |
5688 | ASYNC_DOMAIN_EXCLUSIVE(domain); | ||
5611 | 5689 | ||
5612 | list_for_each_entry(codec, &bus->codec_list, list) { | 5690 | list_for_each_entry(codec, &bus->codec_list, list) { |
5613 | cancel_delayed_work_sync(&codec->jackpoll_work); | 5691 | cancel_delayed_work_sync(&codec->jackpoll_work); |
5614 | if (hda_codec_is_power_on(codec)) | 5692 | if (hda_codec_is_power_on(codec)) { |
5615 | hda_call_codec_suspend(codec, false); | 5693 | if (bus->num_codecs > 1) |
5694 | async_schedule_domain(hda_async_suspend, codec, | ||
5695 | &domain); | ||
5696 | else | ||
5697 | hda_call_codec_suspend(codec, false); | ||
5698 | } | ||
5616 | } | 5699 | } |
5700 | |||
5701 | if (bus->num_codecs > 1) | ||
5702 | async_synchronize_full_domain(&domain); | ||
5703 | |||
5617 | return 0; | 5704 | return 0; |
5618 | } | 5705 | } |
5619 | EXPORT_SYMBOL_HDA(snd_hda_suspend); | 5706 | EXPORT_SYMBOL_GPL(snd_hda_suspend); |
5620 | 5707 | ||
5621 | /** | 5708 | /** |
5622 | * snd_hda_resume - resume the codecs | 5709 | * snd_hda_resume - resume the codecs |
@@ -5627,13 +5714,21 @@ EXPORT_SYMBOL_HDA(snd_hda_suspend); | |||
5627 | int snd_hda_resume(struct hda_bus *bus) | 5714 | int snd_hda_resume(struct hda_bus *bus) |
5628 | { | 5715 | { |
5629 | struct hda_codec *codec; | 5716 | struct hda_codec *codec; |
5717 | ASYNC_DOMAIN_EXCLUSIVE(domain); | ||
5630 | 5718 | ||
5631 | list_for_each_entry(codec, &bus->codec_list, list) { | 5719 | list_for_each_entry(codec, &bus->codec_list, list) { |
5632 | hda_call_codec_resume(codec); | 5720 | if (bus->num_codecs > 1) |
5721 | async_schedule_domain(hda_async_resume, codec, &domain); | ||
5722 | else | ||
5723 | hda_call_codec_resume(codec); | ||
5633 | } | 5724 | } |
5725 | |||
5726 | if (bus->num_codecs > 1) | ||
5727 | async_synchronize_full_domain(&domain); | ||
5728 | |||
5634 | return 0; | 5729 | return 0; |
5635 | } | 5730 | } |
5636 | EXPORT_SYMBOL_HDA(snd_hda_resume); | 5731 | EXPORT_SYMBOL_GPL(snd_hda_resume); |
5637 | #endif /* CONFIG_PM */ | 5732 | #endif /* CONFIG_PM */ |
5638 | 5733 | ||
5639 | /* | 5734 | /* |
@@ -5667,7 +5762,7 @@ void *snd_array_new(struct snd_array *array) | |||
5667 | } | 5762 | } |
5668 | return snd_array_elem(array, array->used++); | 5763 | return snd_array_elem(array, array->used++); |
5669 | } | 5764 | } |
5670 | EXPORT_SYMBOL_HDA(snd_array_new); | 5765 | EXPORT_SYMBOL_GPL(snd_array_new); |
5671 | 5766 | ||
5672 | /** | 5767 | /** |
5673 | * snd_array_free - free the given array elements | 5768 | * snd_array_free - free the given array elements |
@@ -5680,7 +5775,7 @@ void snd_array_free(struct snd_array *array) | |||
5680 | array->alloced = 0; | 5775 | array->alloced = 0; |
5681 | array->list = NULL; | 5776 | array->list = NULL; |
5682 | } | 5777 | } |
5683 | EXPORT_SYMBOL_HDA(snd_array_free); | 5778 | EXPORT_SYMBOL_GPL(snd_array_free); |
5684 | 5779 | ||
5685 | /** | 5780 | /** |
5686 | * snd_print_pcm_bits - Print the supported PCM fmt bits to the string buffer | 5781 | * snd_print_pcm_bits - Print the supported PCM fmt bits to the string buffer |
@@ -5701,7 +5796,7 @@ void snd_print_pcm_bits(int pcm, char *buf, int buflen) | |||
5701 | 5796 | ||
5702 | buf[j] = '\0'; /* necessary when j == 0 */ | 5797 | buf[j] = '\0'; /* necessary when j == 0 */ |
5703 | } | 5798 | } |
5704 | EXPORT_SYMBOL_HDA(snd_print_pcm_bits); | 5799 | EXPORT_SYMBOL_GPL(snd_print_pcm_bits); |
5705 | 5800 | ||
5706 | MODULE_DESCRIPTION("HDA codec core"); | 5801 | MODULE_DESCRIPTION("HDA codec core"); |
5707 | MODULE_LICENSE("GPL"); | 5802 | MODULE_LICENSE("GPL"); |