Changeset 417
- Timestamp:
- Mar 23, 2009, 12:06:21 AM (16 years ago)
- Location:
- GPL/branches/uniaud32-2.0/alsa-kernel/pci/hda
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
GPL/branches/uniaud32-2.0/alsa-kernel/pci/hda/hda_beep.h
r410 r417 32 32 int tone; 33 33 int nid; 34 int enabled;35 34 struct work_struct beep_work; /* scheduled task for beep event */ 36 35 }; -
GPL/branches/uniaud32-2.0/alsa-kernel/pci/hda/hda_codec.c
r410 r417 32 32 #include "hda_local.h" 33 33 #include <sound/hda_hwdep.h> 34 #include "hda_patch.h" /* codec presets */ 35 36 #ifdef CONFIG_SND_HDA_POWER_SAVE 37 /* define this option here to hide as static */ 38 static int power_save = CONFIG_SND_HDA_POWER_SAVE_DEFAULT; 39 module_param(power_save, int, 0644); 40 MODULE_PARM_DESC(power_save, "Automatic power-saving timeout " 41 "(in second, 0 = disable)."); 42 #endif 34 43 35 44 /* … … 47 56 { 0x1057, "Motorola" }, 48 57 { 0x1095, "Silicon Image" }, 49 { 0x10de, "Nvidia" },50 58 { 0x10ec, "Realtek" }, 51 59 { 0x1106, "VIA" }, … … 59 67 { 0x1aec, "Wolfson Microelectronics" }, 60 68 { 0x434d, "C-Media" }, 61 { 0x8086, "Intel" },62 69 { 0x8384, "SigmaTel" }, 63 70 {0} /* terminator */ 64 71 }; 65 72 66 static DEFINE_MUTEX(preset_mutex); 67 static LIST_HEAD(hda_preset_tables); 68 69 int snd_hda_add_codec_preset(struct hda_codec_preset_list *preset) 70 { 71 mutex_lock(&preset_mutex); 72 list_add_tail(&preset->list, &hda_preset_tables); 73 mutex_unlock(&preset_mutex); 74 return 0; 75 } 76 EXPORT_SYMBOL_HDA(snd_hda_add_codec_preset); 77 78 int snd_hda_delete_codec_preset(struct hda_codec_preset_list *preset) 79 { 80 mutex_lock(&preset_mutex); 81 list_del(&preset->list); 82 mutex_unlock(&preset_mutex); 83 return 0; 84 } 85 EXPORT_SYMBOL_HDA(snd_hda_delete_codec_preset); 73 static const struct hda_codec_preset *hda_preset_tables[] = { 74 #ifdef CONFIG_SND_HDA_CODEC_REALTEK 75 snd_hda_preset_realtek, 76 #endif 77 #ifdef CONFIG_SND_HDA_CODEC_CMEDIA 78 snd_hda_preset_cmedia, 79 #endif 80 #ifdef CONFIG_SND_HDA_CODEC_ANALOG 81 snd_hda_preset_analog, 82 #endif 83 #ifdef CONFIG_SND_HDA_CODEC_SIGMATEL 84 snd_hda_preset_sigmatel, 85 #endif 86 #ifdef CONFIG_SND_HDA_CODEC_SI3054 87 snd_hda_preset_si3054, 88 #endif 89 #ifdef CONFIG_SND_HDA_CODEC_ATIHDMI 90 snd_hda_preset_atihdmi, 91 #endif 92 #ifdef CONFIG_SND_HDA_CODEC_CONEXANT 93 snd_hda_preset_conexant, 94 #endif 95 #ifdef CONFIG_SND_HDA_CODEC_VIA 96 snd_hda_preset_via, 97 #endif 98 #ifdef CONFIG_SND_HDA_CODEC_NVHDMI 99 snd_hda_preset_nvhdmi, 100 #endif 101 #ifdef CONFIG_SND_HDA_CODEC_INTELHDMI 102 snd_hda_preset_intelhdmi, 103 #endif 104 NULL 105 }; 86 106 87 107 #ifdef CONFIG_SND_HDA_POWER_SAVE … … 117 137 return "UNKNOWN"; 118 138 } 119 EXPORT_SYMBOL_HDA(snd_hda_get_jack_location);120 139 121 140 const char *snd_hda_get_jack_connectivity(u32 cfg) … … 125 144 return jack_locations[(cfg >> (AC_DEFCFG_LOCATION_SHIFT + 4)) & 3]; 126 145 } 127 EXPORT_SYMBOL_HDA(snd_hda_get_jack_connectivity);128 146 129 147 const char *snd_hda_get_jack_type(u32 cfg) … … 139 157 >> AC_DEFCFG_DEVICE_SHIFT]; 140 158 } 141 EXPORT_SYMBOL_HDA(snd_hda_get_jack_type);142 159 143 160 /* … … 188 205 return res; 189 206 } 190 EXPORT_SYMBOL_HDA(snd_hda_codec_read);191 207 192 208 /** … … 217 233 return err; 218 234 } 219 EXPORT_SYMBOL_HDA(snd_hda_codec_write);220 235 221 236 /** … … 232 247 snd_hda_codec_write(codec, seq->nid, 0, seq->verb, seq->param); 233 248 } 234 EXPORT_SYMBOL_HDA(snd_hda_sequence_write);235 249 236 250 /** … … 254 268 return (int)(parm & 0x7fff); 255 269 } 256 EXPORT_SYMBOL_HDA(snd_hda_get_sub_nodes);257 270 258 271 /** … … 343 356 return conns; 344 357 } 345 EXPORT_SYMBOL_HDA(snd_hda_get_connections);346 358 347 359 … … 374 386 unsol->queue[wp + 1] = res_ex; 375 387 376 queue_work(bus->workq, &unsol->work); 377 378 return 0; 379 } 380 EXPORT_SYMBOL_HDA(snd_hda_queue_unsol_event); 388 /* 2.4 kernels seem to have a problem with workq wrapper... */ 389 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0) 390 schedule_work(&unsol->work); 391 #endif 392 return 0; 393 } 381 394 382 395 /* … … 440 453 if (!bus) 441 454 return 0; 442 if (bus->workq) 443 flush_workqueue(bus->workq); 444 if (bus->unsol) 455 if (bus->unsol) { 456 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0) 457 flush_scheduled_work(); 458 #endif 445 459 kfree(bus->unsol); 460 } 446 461 list_for_each_entry_safe(codec, n, &bus->codec_list, list, struct hda_codec) { 447 462 snd_hda_codec_free(codec); … … 449 464 if (bus->ops.private_free) 450 465 bus->ops.private_free(bus); 451 if (bus->workq)452 destroy_workqueue(bus->workq);453 466 kfree(bus); 454 467 return 0; … … 458 471 { 459 472 struct hda_bus *bus = device->device_data; 460 bus->shutdown = 1;461 473 return snd_hda_bus_free(bus); 462 474 } … … 484 496 * Returns 0 if successful, or a negative error code. 485 497 */ 486 int /*__devinit*/snd_hda_bus_new(struct snd_card *card,498 int __devinit snd_hda_bus_new(struct snd_card *card, 487 499 const struct hda_bus_template *temp, 488 500 struct hda_bus **busp) … … 490 502 struct hda_bus *bus; 491 503 int err; 492 char qname[8];493 504 static struct snd_device_ops dev_ops = { 494 505 .dev_register = snd_hda_bus_dev_register, … … 514 525 bus->pci = temp->pci; 515 526 bus->modelname = temp->modelname; 516 bus->power_save = temp->power_save;517 527 bus->ops = temp->ops; 518 528 519 529 mutex_init(&bus->cmd_mutex); 520 530 INIT_LIST_HEAD(&bus->codec_list); 521 522 snprintf(qname, sizeof(qname), "hda%d", card->number);523 bus->workq = create_workqueue(qname);524 if (!bus->workq) {525 snd_printk(KERN_ERR "cannot create workqueue %s\n", qname);526 kfree(bus);527 return -ENOMEM;528 }529 531 530 532 err = snd_device_new(card, SNDRV_DEV_BUS, bus, &dev_ops); … … 537 539 return 0; 538 540 } 539 EXPORT_SYMBOL_HDA(snd_hda_bus_new);540 541 541 542 #ifdef CONFIG_SND_HDA_GENERIC … … 546 547 #endif 547 548 548 #ifdef MODULE549 #define HDA_MODREQ_MAX_COUNT 2 /* two request_modules()'s */550 #else551 #define HDA_MODREQ_MAX_COUNT 0 /* all presets are statically linked */552 #endif553 554 549 /* 555 550 * find a matching codec preset … … 558 553 find_codec_preset(struct hda_codec *codec) 559 554 { 560 struct hda_codec_preset_list *tbl; 561 const struct hda_codec_preset *preset; 562 int mod_requested = 0; 555 const struct hda_codec_preset **tbl, *preset; 563 556 564 557 if (is_generic_config(codec)) 565 558 return NULL; /* use the generic parser */ 566 559 567 again: 568 mutex_lock(&preset_mutex); 569 list_for_each_entry(tbl, &hda_preset_tables, list, struct hda_codec_preset_list) { 570 if (!try_module_get(tbl->owner)) { 571 snd_printk(KERN_ERR "hda_codec: cannot module_get\n"); 572 continue; 573 } 574 for (preset = tbl->preset; preset->id; preset++) { 560 for (tbl = hda_preset_tables; *tbl; tbl++) { 561 for (preset = *tbl; preset->id; preset++) { 575 562 u32 mask = preset->mask; 576 563 if (preset->afg && preset->afg != codec->afg) … … 582 569 if (preset->id == (codec->vendor_id & mask) && 583 570 (!preset->rev || 584 preset->rev == codec->revision_id)) { 585 mutex_unlock(&preset_mutex); 586 codec->owner = tbl->owner; 571 preset->rev == codec->revision_id)) 587 572 return preset; 588 }589 573 } 590 module_put(tbl->owner); 591 } 592 mutex_unlock(&preset_mutex); 593 594 #ifndef TARGET_OS2 595 if (mod_requested < HDA_MODREQ_MAX_COUNT) { 596 char name[32]; 597 if (!mod_requested) 598 snprintf(name, sizeof(name), "snd-hda-codec-id:%08x", 599 codec->vendor_id); 600 else 601 snprintf(name, sizeof(name), "snd-hda-codec-id:%04x*", 602 (codec->vendor_id >> 16) & 0xffff); 603 request_module(name); 604 mod_requested++; 605 goto again; 606 } 607 #endif 574 } 608 575 return NULL; 609 576 } … … 644 611 * look for an AFG and MFG nodes 645 612 */ 646 static void /*__devinit*/setup_fg_nodes(struct hda_codec *codec)613 static void __devinit setup_fg_nodes(struct hda_codec *codec) 647 614 { 648 615 int i, total_nodes; … … 700 667 #ifdef CONFIG_SND_HDA_POWER_SAVE 701 668 cancel_delayed_work(&codec->power_work); 702 flush_ workqueue(codec->bus->workq);669 flush_scheduled_work(); 703 670 #endif 704 671 list_del(&codec->list); … … 707 674 if (codec->patch_ops.free) 708 675 codec->patch_ops.free(codec); 709 module_put(codec->owner);710 676 free_hda_cache(&codec->amp_cache); 711 677 free_hda_cache(&codec->cmd_cache); … … 724 690 * Returns 0 if successful, or a negative error code. 725 691 */ 726 int /*__devinit*/snd_hda_codec_new(struct hda_bus *bus, unsigned int codec_addr,727 int do_init,struct hda_codec **codecp)692 int __devinit snd_hda_codec_new(struct hda_bus *bus, unsigned int codec_addr, 693 struct hda_codec **codecp) 728 694 { 729 695 struct hda_codec *codec; … … 751 717 codec->addr = codec_addr; 752 718 mutex_init(&codec->spdif_mutex); 753 mutex_init(&codec->control_mutex);754 719 init_hda_cache(&codec->amp_cache, sizeof(struct hda_amp_info)); 755 720 init_hda_cache(&codec->cmd_cache, sizeof(struct hda_cache_head)); … … 810 775 codec->modelname = kstrdup(bus->modelname, GFP_KERNEL); 811 776 812 if (do_init) { 813 err = snd_hda_codec_configure(codec); 814 if (err < 0) { 815 snd_hda_codec_free(codec); 816 return err; 817 } 777 err = snd_hda_codec_configure(codec); 778 if (err < 0) { 779 snd_hda_codec_free(codec); 780 return err; 818 781 } 819 782 snd_hda_codec_proc_new(codec); … … 829 792 return 0; 830 793 } 831 EXPORT_SYMBOL_HDA(snd_hda_codec_new);832 794 833 795 int snd_hda_codec_configure(struct hda_codec *codec) … … 889 851 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_STREAM_FORMAT, format); 890 852 } 891 EXPORT_SYMBOL_HDA(snd_hda_codec_setup_stream);892 853 893 854 void snd_hda_codec_cleanup_stream(struct hda_codec *codec, hda_nid_t nid) … … 903 864 #endif 904 865 } 905 EXPORT_SYMBOL_HDA(snd_hda_codec_cleanup_stream);906 866 907 867 /* … … 915 875 916 876 /* initialize the hash table */ 917 static void /*__devinit*/init_hda_cache(struct hda_cache_rec *cache,877 static void __devinit init_hda_cache(struct hda_cache_rec *cache, 918 878 unsigned int record_size) 919 879 { … … 985 945 return info->amp_caps; 986 946 } 987 EXPORT_SYMBOL_HDA(query_amp_caps);988 947 989 948 int snd_hda_override_amp_caps(struct hda_codec *codec, hda_nid_t nid, int dir, … … 999 958 return 0; 1000 959 } 1001 EXPORT_SYMBOL_HDA(snd_hda_override_amp_caps);1002 960 1003 961 /* … … 1053 1011 return get_vol_mute(codec, info, nid, ch, direction, index); 1054 1012 } 1055 EXPORT_SYMBOL_HDA(snd_hda_codec_amp_read);1056 1013 1057 1014 /* … … 1073 1030 return 1; 1074 1031 } 1075 EXPORT_SYMBOL_HDA(snd_hda_codec_amp_update);1076 1032 1077 1033 /* … … 1087 1043 return ret; 1088 1044 } 1089 EXPORT_SYMBOL_HDA(snd_hda_codec_amp_stereo);1090 1045 1091 1046 #ifdef SND_HDA_NEEDS_RESUME … … 1113 1068 } 1114 1069 } 1115 EXPORT_SYMBOL_HDA(snd_hda_codec_resume_amp);1116 1070 #endif /* SND_HDA_NEEDS_RESUME */ 1117 1071 … … 1141 1095 return 0; 1142 1096 } 1143 EXPORT_SYMBOL_HDA(snd_hda_mixer_amp_volume_info);1144 1097 1145 1098 int snd_hda_mixer_amp_volume_get(struct snd_kcontrol *kcontrol, … … 1161 1114 return 0; 1162 1115 } 1163 EXPORT_SYMBOL_HDA(snd_hda_mixer_amp_volume_get);1164 1116 1165 1117 int snd_hda_mixer_amp_volume_put(struct snd_kcontrol *kcontrol, … … 1186 1138 return change; 1187 1139 } 1188 EXPORT_SYMBOL_HDA(snd_hda_mixer_amp_volume_put);1189 1140 1190 1141 int snd_hda_mixer_amp_tlv(struct snd_kcontrol *kcontrol, int op_flag, … … 1213 1164 return 0; 1214 1165 } 1215 EXPORT_SYMBOL_HDA(snd_hda_mixer_amp_tlv);1216 1166 1217 1167 /* … … 1233 1183 tlv[3] = step; 1234 1184 } 1235 EXPORT_SYMBOL_HDA(snd_hda_set_vmaster_tlv);1236 1185 1237 1186 /* find a mixer control element with the given name */ … … 1253 1202 return _snd_hda_find_mixer_ctl(codec, name, 0); 1254 1203 } 1255 EXPORT_SYMBOL_HDA(snd_hda_find_mixer_ctl);1256 1204 1257 1205 /* Add a control element and assign to the codec */ … … 1270 1218 return 0; 1271 1219 } 1272 EXPORT_SYMBOL_HDA(snd_hda_ctl_add); 1273 1274 #ifdef CONFIG_SND_HDA_RECONFIG 1220 1275 1221 /* Clear all controls assigned to the given codec */ 1276 1222 void snd_hda_ctls_clear(struct hda_codec *codec) … … 1289 1235 #ifdef CONFIG_SND_HDA_POWER_SAVE 1290 1236 cancel_delayed_work(&codec->power_work); 1291 flush_ workqueue(codec->bus->workq);1237 flush_scheduled_work(); 1292 1238 #endif 1293 1239 snd_hda_ctls_clear(codec); 1294 1240 /* relase PCMs */ 1295 1241 for (i = 0; i < codec->num_pcms; i++) { 1296 if (codec->pcm_info[i].pcm) {1242 if (codec->pcm_info[i].pcm) 1297 1243 snd_device_free(codec->bus->card, 1298 1244 codec->pcm_info[i].pcm); 1299 clear_bit(codec->pcm_info[i].device,1300 codec->bus->pcm_dev_bits);1301 }1302 1245 } 1303 1246 if (codec->patch_ops.free) 1304 1247 codec->patch_ops.free(codec); 1305 codec->proc_widget_hook = NULL;1306 1248 codec->spec = NULL; 1307 1249 free_hda_cache(&codec->amp_cache); 1308 1250 free_hda_cache(&codec->cmd_cache); 1309 init_hda_cache(&codec->amp_cache, sizeof(struct hda_amp_info));1310 init_hda_cache(&codec->cmd_cache, sizeof(struct hda_cache_head));1311 1251 codec->num_pcms = 0; 1312 1252 codec->pcm_info = NULL; 1313 1253 codec->preset = NULL; 1314 module_put(codec->owner); 1315 codec->owner = NULL; 1316 } 1317 #endif /* CONFIG_SND_HDA_RECONFIG */ 1254 } 1318 1255 1319 1256 /* create a virtual master control and add slaves */ … … 1352 1289 return 0; 1353 1290 } 1354 EXPORT_SYMBOL_HDA(snd_hda_add_vmaster);1355 1291 1356 1292 /* switch */ … … 1366 1302 return 0; 1367 1303 } 1368 EXPORT_SYMBOL_HDA(snd_hda_mixer_amp_switch_info);1369 1304 1370 1305 int snd_hda_mixer_amp_switch_get(struct snd_kcontrol *kcontrol, … … 1386 1321 return 0; 1387 1322 } 1388 EXPORT_SYMBOL_HDA(snd_hda_mixer_amp_switch_get);1389 1323 1390 1324 int snd_hda_mixer_amp_switch_put(struct snd_kcontrol *kcontrol, … … 1417 1351 return change; 1418 1352 } 1419 EXPORT_SYMBOL_HDA(snd_hda_mixer_amp_switch_put);1420 1353 1421 1354 /* … … 1435 1368 int err; 1436 1369 1437 mutex_lock(&codec-> control_mutex);1370 mutex_lock(&codec->spdif_mutex); /* reuse spdif_mutex */ 1438 1371 pval = kcontrol->private_value; 1439 1372 kcontrol->private_value = pval & ~AMP_VAL_IDX_MASK; /* index 0 */ 1440 1373 err = snd_hda_mixer_amp_switch_get(kcontrol, ucontrol); 1441 1374 kcontrol->private_value = pval; 1442 mutex_unlock(&codec-> control_mutex);1375 mutex_unlock(&codec->spdif_mutex); 1443 1376 return err; 1444 1377 } 1445 EXPORT_SYMBOL_HDA(snd_hda_mixer_bind_switch_get);1446 1378 1447 1379 int snd_hda_mixer_bind_switch_put(struct snd_kcontrol *kcontrol, … … 1452 1384 int i, indices, err = 0, change = 0; 1453 1385 1454 mutex_lock(&codec-> control_mutex);1386 mutex_lock(&codec->spdif_mutex); /* reuse spdif_mutex */ 1455 1387 pval = kcontrol->private_value; 1456 1388 indices = (pval & AMP_VAL_IDX_MASK) >> AMP_VAL_IDX_SHIFT; … … 1464 1396 } 1465 1397 kcontrol->private_value = pval; 1466 mutex_unlock(&codec-> control_mutex);1398 mutex_unlock(&codec->spdif_mutex); 1467 1399 return err < 0 ? err : change; 1468 1400 } 1469 EXPORT_SYMBOL_HDA(snd_hda_mixer_bind_switch_put);1470 1401 1471 1402 /* … … 1479 1410 int err; 1480 1411 1481 mutex_lock(&codec-> control_mutex);1412 mutex_lock(&codec->spdif_mutex); /* reuse spdif_mutex */ 1482 1413 c = (struct hda_bind_ctls *)kcontrol->private_value; 1483 1414 kcontrol->private_value = *c->values; 1484 1415 err = c->ops->info(kcontrol, uinfo); 1485 1416 kcontrol->private_value = (long)c; 1486 mutex_unlock(&codec-> control_mutex);1417 mutex_unlock(&codec->spdif_mutex); 1487 1418 return err; 1488 1419 } 1489 EXPORT_SYMBOL_HDA(snd_hda_mixer_bind_ctls_info);1490 1420 1491 1421 int snd_hda_mixer_bind_ctls_get(struct snd_kcontrol *kcontrol, … … 1496 1426 int err; 1497 1427 1498 mutex_lock(&codec-> control_mutex);1428 mutex_lock(&codec->spdif_mutex); /* reuse spdif_mutex */ 1499 1429 c = (struct hda_bind_ctls *)kcontrol->private_value; 1500 1430 kcontrol->private_value = *c->values; 1501 1431 err = c->ops->get(kcontrol, ucontrol); 1502 1432 kcontrol->private_value = (long)c; 1503 mutex_unlock(&codec-> control_mutex);1433 mutex_unlock(&codec->spdif_mutex); 1504 1434 return err; 1505 1435 } 1506 EXPORT_SYMBOL_HDA(snd_hda_mixer_bind_ctls_get);1507 1436 1508 1437 int snd_hda_mixer_bind_ctls_put(struct snd_kcontrol *kcontrol, … … 1514 1443 int err = 0, change = 0; 1515 1444 1516 mutex_lock(&codec-> control_mutex);1445 mutex_lock(&codec->spdif_mutex); /* reuse spdif_mutex */ 1517 1446 c = (struct hda_bind_ctls *)kcontrol->private_value; 1518 1447 for (vals = c->values; *vals; vals++) { … … 1524 1453 } 1525 1454 kcontrol->private_value = (long)c; 1526 mutex_unlock(&codec-> control_mutex);1455 mutex_unlock(&codec->spdif_mutex); 1527 1456 return err < 0 ? err : change; 1528 1457 } 1529 EXPORT_SYMBOL_HDA(snd_hda_mixer_bind_ctls_put);1530 1458 1531 1459 int snd_hda_mixer_bind_tlv(struct snd_kcontrol *kcontrol, int op_flag, … … 1536 1464 int err; 1537 1465 1538 mutex_lock(&codec-> control_mutex);1466 mutex_lock(&codec->spdif_mutex); /* reuse spdif_mutex */ 1539 1467 c = (struct hda_bind_ctls *)kcontrol->private_value; 1540 1468 kcontrol->private_value = *c->values; 1541 1469 err = c->ops->tlv(kcontrol, op_flag, size, tlv); 1542 1470 kcontrol->private_value = (long)c; 1543 mutex_unlock(&codec-> control_mutex);1471 mutex_unlock(&codec->spdif_mutex); 1544 1472 return err; 1545 1473 } 1546 EXPORT_SYMBOL_HDA(snd_hda_mixer_bind_tlv);1547 1474 1548 1475 struct hda_ctl_ops snd_hda_bind_vol = { … … 1552 1479 .tlv = snd_hda_mixer_amp_tlv 1553 1480 }; 1554 EXPORT_SYMBOL_HDA(snd_hda_bind_vol);1555 1481 1556 1482 struct hda_ctl_ops snd_hda_bind_sw = { … … 1560 1486 .tlv = snd_hda_mixer_amp_tlv 1561 1487 }; 1562 EXPORT_SYMBOL_HDA(snd_hda_bind_sw);1563 1488 1564 1489 /* … … 1667 1592 hda_nid_t *d; 1668 1593 1669 snd_hda_codec_write _cache(codec, nid, 0, verb, val);1594 snd_hda_codec_write(codec, nid, 0, verb, val); 1670 1595 d = codec->slave_dig_outs; 1671 1596 if (!d) 1672 1597 return; 1673 1598 for (; *d; d++) 1674 snd_hda_codec_write _cache(codec, *d, 0, verb, val);1599 snd_hda_codec_write(codec, *d, 0, verb, val); 1675 1600 } 1676 1601 … … 1822 1747 return 0; 1823 1748 } 1824 EXPORT_SYMBOL_HDA(snd_hda_create_spdif_out_ctls);1825 1749 1826 1750 /* … … 1860 1784 snd_ctl_new1(&spdif_share_sw, mout)); 1861 1785 } 1862 EXPORT_SYMBOL_HDA(snd_hda_create_spdif_share_sw);1863 1786 1864 1787 /* … … 1970 1893 return 0; 1971 1894 } 1972 EXPORT_SYMBOL_HDA(snd_hda_create_spdif_in_ctls);1973 1895 1974 1896 #ifdef SND_HDA_NEEDS_RESUME … … 2016 1938 return err; 2017 1939 } 2018 EXPORT_SYMBOL_HDA(snd_hda_codec_write_cache);2019 1940 2020 1941 /* resume the all commands from the cache */ … … 2032 1953 } 2033 1954 } 2034 EXPORT_SYMBOL_HDA(snd_hda_codec_resume_cache);2035 1955 2036 1956 /** … … 2050 1970 seq->param); 2051 1971 } 2052 EXPORT_SYMBOL_HDA(snd_hda_sequence_write_cache);2053 1972 #endif /* SND_HDA_NEEDS_RESUME */ 2054 1973 … … 2169 2088 * Returns 0 if successful, otherwise a negative error code. 2170 2089 */ 2171 int /*__devinit*/snd_hda_build_controls(struct hda_bus *bus)2090 int __devinit snd_hda_build_controls(struct hda_bus *bus) 2172 2091 { 2173 2092 struct hda_codec *codec; … … 2181 2100 return 0; 2182 2101 } 2183 EXPORT_SYMBOL_HDA(snd_hda_build_controls);2184 2102 2185 2103 int snd_hda_codec_build_controls(struct hda_codec *codec) … … 2293 2211 return val; 2294 2212 } 2295 EXPORT_SYMBOL_HDA(snd_hda_calc_stream_format);2296 2213 2297 2214 /** … … 2308 2225 * Returns 0 if successful, otherwise a negative error code. 2309 2226 */ 2310 staticint snd_hda_query_supported_pcm(struct hda_codec *codec, hda_nid_t nid,2227 int snd_hda_query_supported_pcm(struct hda_codec *codec, hda_nid_t nid, 2311 2228 u32 *ratesp, u64 *formatsp, unsigned int *bpsp) 2312 2229 { … … 2473 2390 return 1; 2474 2391 } 2475 EXPORT_SYMBOL_HDA(snd_hda_is_supported_format);2476 2392 2477 2393 /* … … 2531 2447 2532 2448 /* 2533 * get the empty PCM device number to assign 2534 */ 2535 static int get_empty_pcm_device(struct hda_bus *bus, int type) 2449 * attach a new PCM stream 2450 */ 2451 static int __devinit 2452 snd_hda_attach_pcm(struct hda_codec *codec, struct hda_pcm *pcm) 2453 { 2454 struct hda_bus *bus = codec->bus; 2455 struct hda_pcm_stream *info; 2456 int stream, err; 2457 2458 if (snd_BUG_ON(!pcm->name)) 2459 return -EINVAL; 2460 for (stream = 0; stream < 2; stream++) { 2461 info = &pcm->stream[stream]; 2462 if (info->substreams) { 2463 err = set_pcm_default_values(codec, info); 2464 if (err < 0) 2465 return err; 2466 } 2467 } 2468 return bus->ops.attach_pcm(bus, codec, pcm); 2469 } 2470 2471 /** 2472 * snd_hda_build_pcms - build PCM information 2473 * @bus: the BUS 2474 * 2475 * Create PCM information for each codec included in the bus. 2476 * 2477 * The build_pcms codec patch is requested to set up codec->num_pcms and 2478 * codec->pcm_info properly. The array is referred by the top-level driver 2479 * to create its PCM instances. 2480 * The allocated codec->pcm_info should be released in codec->patch_ops.free 2481 * callback. 2482 * 2483 * At least, substreams, channels_min and channels_max must be filled for 2484 * each stream. substreams = 0 indicates that the stream doesn't exist. 2485 * When rates and/or formats are zero, the supported values are queried 2486 * from the given nid. The nid is used also by the default ops.prepare 2487 * and ops.cleanup callbacks. 2488 * 2489 * The driver needs to call ops.open in its open callback. Similarly, 2490 * ops.close is supposed to be called in the close callback. 2491 * ops.prepare should be called in the prepare or hw_params callback 2492 * with the proper parameters for set up. 2493 * ops.cleanup should be called in hw_free for clean up of streams. 2494 * 2495 * This function returns 0 if successfull, or a negative error code. 2496 */ 2497 int snd_hda_build_pcms(struct hda_bus *bus) 2536 2498 { 2537 2499 static const char *dev_name[HDA_PCM_NTYPES] = { … … 2547 2509 /* normal audio device indices; not linear to keep compatibility */ 2548 2510 static int audio_idx[4] = { 0, 2, 4, 5 }; 2549 int i, dev; 2550 2551 switch (type) { 2552 case HDA_PCM_TYPE_AUDIO: 2553 for (i = 0; i < ARRAY_SIZE(audio_idx); i++) { 2554 dev = audio_idx[i]; 2555 if (!test_bit(dev, bus->pcm_dev_bits)) 2556 break; 2557 } 2558 if (i >= ARRAY_SIZE(audio_idx)) { 2559 snd_printk(KERN_WARNING "Too many audio devices\n"); 2560 return -EAGAIN; 2561 } 2562 break; 2563 case HDA_PCM_TYPE_SPDIF: 2564 case HDA_PCM_TYPE_HDMI: 2565 case HDA_PCM_TYPE_MODEM: 2566 dev = dev_idx[type]; 2567 if (test_bit(dev, bus->pcm_dev_bits)) { 2568 snd_printk(KERN_WARNING "%s already defined\n", 2569 dev_name[type]); 2570 return -EAGAIN; 2571 } 2572 break; 2573 default: 2574 snd_printk(KERN_WARNING "Invalid PCM type %d\n", type); 2575 return -EINVAL; 2576 } 2577 set_bit(dev, bus->pcm_dev_bits); 2578 return dev; 2579 } 2580 2581 /* 2582 * attach a new PCM stream 2583 */ 2584 static int snd_hda_attach_pcm(struct hda_codec *codec, struct hda_pcm *pcm) 2585 { 2586 struct hda_bus *bus = codec->bus; 2587 struct hda_pcm_stream *info; 2588 int stream, err; 2589 2590 if (snd_BUG_ON(!pcm->name)) 2591 return -EINVAL; 2592 for (stream = 0; stream < 2; stream++) { 2593 info = &pcm->stream[stream]; 2594 if (info->substreams) { 2595 err = set_pcm_default_values(codec, info); 2511 struct hda_codec *codec; 2512 int num_devs[HDA_PCM_NTYPES]; 2513 2514 memset(num_devs, 0, sizeof(num_devs)); 2515 list_for_each_entry(codec, &bus->codec_list, list, struct hda_codec) { 2516 unsigned int pcm; 2517 int err; 2518 if (!codec->num_pcms) { 2519 if (!codec->patch_ops.build_pcms) 2520 continue; 2521 err = codec->patch_ops.build_pcms(codec); 2596 2522 if (err < 0) 2597 2523 return err; 2598 2524 } 2599 } 2600 return bus->ops.attach_pcm(bus, codec, pcm); 2601 } 2602 2603 /* assign all PCMs of the given codec */ 2604 int snd_hda_codec_build_pcms(struct hda_codec *codec) 2605 { 2606 unsigned int pcm; 2607 int err; 2608 2609 if (!codec->num_pcms) { 2610 if (!codec->patch_ops.build_pcms) 2611 return 0; 2612 err = codec->patch_ops.build_pcms(codec); 2613 if (err < 0) 2614 return err; 2615 } 2616 for (pcm = 0; pcm < codec->num_pcms; pcm++) { 2617 struct hda_pcm *cpcm = &codec->pcm_info[pcm]; 2618 int dev; 2619 2620 if (!cpcm->stream[0].substreams && !cpcm->stream[1].substreams) 2621 return 0; /* no substreams assigned */ 2622 2623 if (!cpcm->pcm) { 2624 dev = get_empty_pcm_device(codec->bus, cpcm->pcm_type); 2625 if (dev < 0) 2626 return 0; 2627 cpcm->device = dev; 2628 err = snd_hda_attach_pcm(codec, cpcm); 2629 if (err < 0) 2630 return err; 2525 for (pcm = 0; pcm < codec->num_pcms; pcm++) { 2526 struct hda_pcm *cpcm = &codec->pcm_info[pcm]; 2527 int type = cpcm->pcm_type; 2528 int dev; 2529 2530 if (!cpcm->stream[0].substreams && 2531 !cpcm->stream[1].substreams) 2532 continue; /* no substreams assigned */ 2533 2534 switch (type) { 2535 case HDA_PCM_TYPE_AUDIO: 2536 if (num_devs[type] >= ARRAY_SIZE(audio_idx)) { 2537 snd_printk(KERN_WARNING 2538 "Too many audio devices\n"); 2539 continue; 2540 } 2541 dev = audio_idx[num_devs[type]]; 2542 break; 2543 case HDA_PCM_TYPE_SPDIF: 2544 case HDA_PCM_TYPE_HDMI: 2545 case HDA_PCM_TYPE_MODEM: 2546 if (num_devs[type]) { 2547 snd_printk(KERN_WARNING 2548 "%s already defined\n", 2549 dev_name[type]); 2550 continue; 2551 } 2552 dev = dev_idx[type]; 2553 break; 2554 default: 2555 snd_printk(KERN_WARNING 2556 "Invalid PCM type %d\n", type); 2557 continue; 2558 } 2559 num_devs[type]++; 2560 if (!cpcm->pcm) { 2561 cpcm->device = dev; 2562 err = snd_hda_attach_pcm(codec, cpcm); 2563 if (err < 0) 2564 return err; 2565 } 2631 2566 } 2632 2567 } 2633 2568 return 0; 2634 2569 } 2635 2636 /**2637 * snd_hda_build_pcms - build PCM information2638 * @bus: the BUS2639 *2640 * Create PCM information for each codec included in the bus.2641 *2642 * The build_pcms codec patch is requested to set up codec->num_pcms and2643 * codec->pcm_info properly. The array is referred by the top-level driver2644 * to create its PCM instances.2645 * The allocated codec->pcm_info should be released in codec->patch_ops.free2646 * callback.2647 *2648 * At least, substreams, channels_min and channels_max must be filled for2649 * each stream. substreams = 0 indicates that the stream doesn't exist.2650 * When rates and/or formats are zero, the supported values are queried2651 * from the given nid. The nid is used also by the default ops.prepare2652 * and ops.cleanup callbacks.2653 *2654 * The driver needs to call ops.open in its open callback. Similarly,2655 * ops.close is supposed to be called in the close callback.2656 * ops.prepare should be called in the prepare or hw_params callback2657 * with the proper parameters for set up.2658 * ops.cleanup should be called in hw_free for clean up of streams.2659 *2660 * This function returns 0 if successfull, or a negative error code.2661 */2662 int __devinit snd_hda_build_pcms(struct hda_bus *bus)2663 {2664 struct hda_codec *codec;2665 2666 list_for_each_entry(codec, &bus->codec_list, list, struct hda_codec) {2667 int err = snd_hda_codec_build_pcms(codec);2668 if (err < 0)2669 return err;2670 }2671 return 0;2672 }2673 EXPORT_SYMBOL_HDA(snd_hda_build_pcms);2674 2570 2675 2571 /** … … 2727 2623 return -1; 2728 2624 } 2729 EXPORT_SYMBOL_HDA(snd_hda_check_board_config);2730 2731 /**2732 * snd_hda_check_board_codec_sid_config - compare the current codec2733 subsystem ID with the2734 config table2735 2736 This is important for Gateway notebooks with SB450 HDA Audio2737 where the vendor ID of the PCI device is:2738 ATI Technologies Inc SB450 HDA Audio [1002:437b]2739 and the vendor/subvendor are found only at the codec.2740 2741 * @codec: the HDA codec2742 * @num_configs: number of config enums2743 * @models: array of model name strings2744 * @tbl: configuration table, terminated by null entries2745 *2746 * Compares the modelname or PCI subsystem id of the current codec with the2747 * given configuration table. If a matching entry is found, returns its2748 * config value (supposed to be 0 or positive).2749 *2750 * If no entries are matching, the function returns a negative value.2751 */2752 int snd_hda_check_board_codec_sid_config(struct hda_codec *codec,2753 int num_configs, const char **models,2754 const struct snd_pci_quirk *tbl)2755 {2756 const struct snd_pci_quirk *q;2757 2758 /* Search for codec ID */2759 for (q = tbl; q->subvendor; q++) {2760 unsigned long vendorid = (q->subdevice) | (q->subvendor << 16);2761 2762 if (vendorid == codec->subsystem_id)2763 break;2764 }2765 2766 if (!q->subvendor)2767 return -1;2768 2769 tbl = q;2770 2771 if (tbl->value >= 0 && tbl->value < num_configs) {2772 #ifdef CONFIG_SND_DEBUG_DETECT2773 char tmp[10];2774 const char *model = NULL;2775 if (models)2776 model = models[tbl->value];2777 if (!model) {2778 sprintf(tmp, "#%d", tbl->value);2779 model = tmp;2780 }2781 snd_printdd(KERN_INFO "hda_codec: model '%s' is selected "2782 "for config %x:%x (%s)\n",2783 model, tbl->subvendor, tbl->subdevice,2784 (tbl->name ? tbl->name : "Unknown device"));2785 #endif2786 return tbl->value;2787 }2788 return -1;2789 }2790 EXPORT_SYMBOL_HDA(snd_hda_check_board_codec_sid_config);2791 2625 2792 2626 /** … … 2824 2658 return 0; 2825 2659 } 2826 EXPORT_SYMBOL_HDA(snd_hda_add_new_ctls);2827 2660 2828 2661 #ifdef CONFIG_SND_HDA_POWER_SAVE … … 2867 2700 codec->power_transition = 0; 2868 2701 } 2869 EXPORT_SYMBOL_HDA(snd_hda_power_up);2870 2871 #define power_save(codec) \2872 ((codec)->bus->power_save ? *(codec)->bus->power_save : 0)2873 2874 #define power_save(codec) \2875 ((codec)->bus->power_save ? *(codec)->bus->power_save : 0)2876 2702 2877 2703 void snd_hda_power_down(struct hda_codec *codec) … … 2880 2706 if (!codec->power_on || codec->power_count || codec->power_transition) 2881 2707 return; 2882 if (power_save (codec)) {2708 if (power_save) { 2883 2709 codec->power_transition = 1; /* avoid reentrance */ 2884 queue_delayed_work(codec->bus->workq, &codec->power_work, 2885 msecs_to_jiffies(power_save(codec) * 1000)); 2886 } 2887 } 2888 EXPORT_SYMBOL_HDA(snd_hda_power_down); 2710 schedule_delayed_work(&codec->power_work, 2711 msecs_to_jiffies(power_save * 1000)); 2712 } 2713 } 2889 2714 2890 2715 int snd_hda_check_amp_list_power(struct hda_codec *codec, … … 2923 2748 return 0; 2924 2749 } 2925 EXPORT_SYMBOL_HDA(snd_hda_check_amp_list_power);2926 2750 #endif 2927 2751 … … 2943 2767 return 0; 2944 2768 } 2945 EXPORT_SYMBOL_HDA(snd_hda_ch_mode_info);2946 2769 2947 2770 int snd_hda_ch_mode_get(struct hda_codec *codec, … … 2961 2784 return 0; 2962 2785 } 2963 EXPORT_SYMBOL_HDA(snd_hda_ch_mode_get);2964 2786 2965 2787 int snd_hda_ch_mode_put(struct hda_codec *codec, … … 2982 2804 return 1; 2983 2805 } 2984 EXPORT_SYMBOL_HDA(snd_hda_ch_mode_put);2985 2806 2986 2807 /* … … 3003 2824 return 0; 3004 2825 } 3005 EXPORT_SYMBOL_HDA(snd_hda_input_mux_info);3006 2826 3007 2827 int snd_hda_input_mux_put(struct hda_codec *codec, … … 3025 2845 return 1; 3026 2846 } 3027 EXPORT_SYMBOL_HDA(snd_hda_input_mux_put);3028 2847 3029 2848 … … 3078 2897 return 0; 3079 2898 } 3080 EXPORT_SYMBOL_HDA(snd_hda_multi_out_dig_open);3081 2899 3082 2900 int snd_hda_multi_out_dig_prepare(struct hda_codec *codec, … … 3091 2909 return 0; 3092 2910 } 3093 EXPORT_SYMBOL_HDA(snd_hda_multi_out_dig_prepare);3094 2911 3095 2912 /* … … 3104 2921 return 0; 3105 2922 } 3106 EXPORT_SYMBOL_HDA(snd_hda_multi_out_dig_close);3107 2923 3108 2924 /* … … 3144 2960 SNDRV_PCM_HW_PARAM_CHANNELS, 2); 3145 2961 } 3146 EXPORT_SYMBOL_HDA(snd_hda_multi_out_analog_open);3147 2962 3148 2963 /* … … 3203 3018 return 0; 3204 3019 } 3205 EXPORT_SYMBOL_HDA(snd_hda_multi_out_analog_prepare);3206 3020 3207 3021 /* … … 3230 3044 return 0; 3231 3045 } 3232 EXPORT_SYMBOL_HDA(snd_hda_multi_out_analog_cleanup);3233 3046 3234 3047 /* … … 3516 3329 return 0; 3517 3330 } 3518 EXPORT_SYMBOL_HDA(snd_hda_parse_pin_def_config);3519 3331 3520 3332 /* labels for input pins */ … … 3522 3334 "Mic", "Front Mic", "Line", "Front Line", "CD", "Aux" 3523 3335 }; 3524 EXPORT_SYMBOL_HDA(auto_pin_cfg_labels);3525 3336 3526 3337 … … 3550 3361 return 0; 3551 3362 } 3552 EXPORT_SYMBOL_HDA(snd_hda_suspend);3553 3363 3554 3364 /** 3555 3365 * snd_hda_resume - resume the codecs 3556 3366 * @bus: the HDA bus 3367 * @state: resume state 3557 3368 * 3558 3369 * Returns 0 if successful. … … 3571 3382 return 0; 3572 3383 } 3573 EXPORT_SYMBOL_HDA(snd_hda_resume); 3574 #endif /* CONFIG_PM */ 3384 #ifdef CONFIG_SND_HDA_POWER_SAVE 3385 int snd_hda_codecs_inuse(struct hda_bus *bus) 3386 { 3387 struct hda_codec *codec; 3388 3389 list_for_each_entry(codec, &bus->codec_list, list, struct hda_codec) { 3390 if (snd_hda_codec_needs_resume(codec)) 3391 return 1; 3392 } 3393 return 0; 3394 } 3395 #endif 3396 #endif 3575 3397 3576 3398 /* … … 3601 3423 return snd_array_elem(array, array->used++); 3602 3424 } 3603 EXPORT_SYMBOL_HDA(snd_array_new);3604 3425 3605 3426 /* free the given array elements */ … … 3611 3432 array->list = NULL; 3612 3433 } 3613 EXPORT_SYMBOL_HDA(snd_array_free);3614 3615 /*3616 * used by hda_proc.c and hda_eld.c3617 */3618 void snd_print_pcm_rates(int pcm, char *buf, int buflen)3619 {3620 static unsigned int rates[] = {3621 8000, 11025, 16000, 22050, 32000, 44100, 48000, 88200,3622 96000, 176400, 192000, 3840003623 };3624 int i, j;3625 3626 for (i = 0, j = 0; i < ARRAY_SIZE(rates); i++)3627 if (pcm & (1 << i))3628 j += snprintf(buf + j, buflen - j, " %d", rates[i]);3629 3630 buf[j] = '\0'; /* necessary when j == 0 */3631 }3632 EXPORT_SYMBOL_HDA(snd_print_pcm_rates);3633 3634 void snd_print_pcm_bits(int pcm, char *buf, int buflen)3635 {3636 static unsigned int bits[] = { 8, 16, 20, 24, 32 };3637 int i, j;3638 3639 for (i = 0, j = 0; i < ARRAY_SIZE(bits); i++)3640 if (pcm & (AC_SUPPCM_BITS_8 << i))3641 j += snprintf(buf + j, buflen - j, " %d", bits[i]);3642 3643 buf[j] = '\0'; /* necessary when j == 0 */3644 }3645 EXPORT_SYMBOL_HDA(snd_print_pcm_bits);3646 3647 MODULE_DESCRIPTION("HDA codec core");3648 MODULE_LICENSE("GPL"); -
GPL/branches/uniaud32-2.0/alsa-kernel/pci/hda/hda_codec.h
r410 r417 586 586 struct pci_dev *pci; 587 587 const char *modelname; 588 int *power_save;589 588 struct hda_bus_ops ops; 590 589 }; … … 603 602 struct pci_dev *pci; 604 603 const char *modelname; 605 int *power_save;606 604 struct hda_bus_ops ops; 607 605 … … 619 617 /* unsolicited event queue */ 620 618 struct hda_bus_unsolicited *unsol; 621 struct workqueue_struct *workq; /* common workqueue for codecs */ 622 623 /* assigned PCMs */ 624 DECLARE_BITMAP(pcm_dev_bits, SNDRV_PCM_DEVICES); 619 620 struct snd_info_entry *proc; 625 621 626 622 /* misc op flags */ 627 623 unsigned int needs_damn_long_delay :1; 628 unsigned int shutdown :1; /* being unloaded */629 624 }; 630 625 … … 646 641 }; 647 642 648 struct hda_codec_preset_list {649 const struct hda_codec_preset *preset;650 struct module *owner;651 struct list_head list;652 };653 654 /* initial hook */655 int snd_hda_add_codec_preset(struct hda_codec_preset_list *preset);656 int snd_hda_delete_codec_preset(struct hda_codec_preset_list *preset);657 658 643 /* ops set by the preset patch */ 659 644 struct hda_codec_ops { … … 749 734 /* detected preset */ 750 735 const struct hda_codec_preset *preset; 751 struct module *owner;752 736 const char *name; /* codec name */ 753 737 const char *modelname; /* model name for preset */ … … 781 765 struct semaphore spdif_mutex; 782 766 #endif 783 struct mutex control_mutex;784 767 unsigned int spdif_status; /* IEC958 status bits */ 785 768 unsigned short spdif_ctls; /* SPDIF control bits */ … … 804 787 struct delayed_work power_work; /* delayed task for powerdown */ 805 788 #endif 806 807 /* codec-specific additional proc output */808 void (*proc_widget_hook)(struct snd_info_buffer *buffer,809 struct hda_codec *codec, hda_nid_t nid);810 789 }; 811 790 … … 822 801 struct hda_bus **busp); 823 802 int snd_hda_codec_new(struct hda_bus *bus, unsigned int codec_addr, 824 int do_init,struct hda_codec **codecp);803 struct hda_codec **codecp); 825 804 826 805 /* … … 873 852 */ 874 853 int snd_hda_build_pcms(struct hda_bus *bus); 875 int snd_hda_codec_build_pcms(struct hda_codec *codec);876 854 void snd_hda_codec_setup_stream(struct hda_codec *codec, hda_nid_t nid, 877 855 u32 stream_tag, … … 882 860 unsigned int format, 883 861 unsigned int maxbps); 862 int snd_hda_query_supported_pcm(struct hda_codec *codec, hda_nid_t nid, 863 u32 *ratesp, u64 *formatsp, unsigned int *bpsp); 884 864 int snd_hda_is_supported_format(struct hda_codec *codec, hda_nid_t nid, 885 865 unsigned int format); … … 912 892 void snd_hda_power_down(struct hda_codec *codec); 913 893 #define snd_hda_codec_needs_resume(codec) codec->power_count 894 int snd_hda_codecs_inuse(struct hda_bus *bus); 914 895 #else 915 896 static inline void snd_hda_power_up(struct hda_codec *codec) {} 916 897 static inline void snd_hda_power_down(struct hda_codec *codec) {} 917 898 #define snd_hda_codec_needs_resume(codec) 1 918 #endif 919 920 /* 921 * Codec modularization 922 */ 923 924 /* Export symbols only for communication with codec drivers; 925 * When built in kernel, all HD-audio drivers are supposed to be statically 926 * linked to the kernel. Thus, the symbols don't have to (or shouldn't) be 927 * exported unless it's built as a module. 928 */ 929 #if defined(MODULE) && !defined(TARGET_OS2) 930 #define EXPORT_SYMBOL_HDA(sym) EXPORT_SYMBOL_GPL(sym) 931 #else 932 #define EXPORT_SYMBOL_HDA(sym) 899 #define snd_hda_codecs_inuse(bus) 1 933 900 #endif 934 901 -
GPL/branches/uniaud32-2.0/alsa-kernel/pci/hda/hda_generic.c
r411 r417 732 732 snd_printdd("[%s] NID=0x%x, DIR=IN, IDX=0x%x\n", name, node->nid, index); 733 733 err = snd_hda_ctl_add(codec, snd_ctl_new1(&knew, codec)); 734 #ifndef TARGET_OS2735 734 if (err < 0) 736 735 return err; 737 #else738 if (err < 0)739 snd_printdd("Failed here\n");740 #endif741 736 created = 1; 742 737 } else if ((node->wid_caps & AC_WCAP_OUT_AMP) && … … 744 739 /*knew = (struct snd_kcontrol_new)HDA_CODEC_MUTE(name, node->nid, 0, HDA_OUTPUT);*/ 745 740 knew.iface = SNDRV_CTL_ELEM_IFACE_MIXER; 746 knew.index = 0;741 knew.index = index; 747 742 knew.name = name; 748 743 knew.info = snd_hda_mixer_amp_switch_info; … … 752 747 if (is_loopback) 753 748 add_input_loopback(codec, node->nid, HDA_OUTPUT, 0); 754 snd_printdd("[%s] NID=0x%x, DIR=OUT 1\n", name, node->nid);749 snd_printdd("[%s] NID=0x%x, DIR=OUT\n", name, node->nid); 755 750 err = snd_hda_ctl_add(codec, snd_ctl_new1(&knew, codec)); 756 #ifndef TARGET_OS2757 751 if (err < 0) 758 752 return err; 759 #else760 if (err < 0)761 snd_printdd("Failed here1\n");762 #endif763 753 created = 1; 764 754 } … … 779 769 snd_printdd("[%s] NID=0x%x, DIR=IN, IDX=0x%x\n", name, node->nid, index); 780 770 err = snd_hda_ctl_add(codec, snd_ctl_new1(&knew, codec)); 781 #ifndef TARGET_OS2782 771 if (err < 0) 783 772 return err; 784 #else785 if (err < 0)786 snd_printdd("Failed here2\n");787 #endif788 773 created = 1; 789 774 } else if ((node->wid_caps & AC_WCAP_OUT_AMP) && … … 798 783 snd_printdd("[%s] NID=0x%x, DIR=OUT\n", name, node->nid); 799 784 err = snd_hda_ctl_add(codec, snd_ctl_new1(&knew, codec)); 800 #ifndef TARGET_OS2801 785 if (err < 0) 802 786 return err; 803 #else804 if (err < 0)805 snd_printdd("Failed here3\n");806 #endif807 787 created = 1; 808 788 } … … 1158 1138 return err; 1159 1139 } 1160 EXPORT_SYMBOL(snd_hda_parse_generic_codec); -
GPL/branches/uniaud32-2.0/alsa-kernel/pci/hda/hda_hwdep.c
r410 r417 117 117 } 118 118 119 int /*__devinit*/snd_hda_create_hwdep(struct hda_codec *codec)119 int __devinit snd_hda_create_hwdep(struct hda_codec *codec) 120 120 { 121 121 char hwname[16]; … … 146 146 } 147 147 148 #ifdef CONFIG_SND_HDA_RECONFIG149 150 148 /* 151 149 * sysfs interface … … 169 167 return err; 170 168 /* rebuild PCMs */ 171 err = snd_hda_ codec_build_pcms(codec);169 err = snd_hda_build_pcms(codec->bus); 172 170 if (err < 0) 173 171 return err; … … 316 314 } 317 315 316 #ifndef TARGET_OS2 318 317 #define CODEC_ATTR_RW(type) \ 319 318 __ATTR(type, 0644, type##_show, type##_store) … … 350 349 return 0; 351 350 } 352 353 #endif /* CONFIG_SND_HDA_RECONFIG */ 351 #endif /* TARGET_OS2 */ -
GPL/branches/uniaud32-2.0/alsa-kernel/pci/hda/hda_intel.c
r412 r417 51 51 #include "hda_codec.h" 52 52 53 54 53 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; 55 54 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; … … 64 63 static int probe_mask[SNDRV_CARDS] = {-1}; 65 64 #endif 66 static int probe_only[SNDRV_CARDS];67 65 static int single_cmd; 68 66 static int enable_msi; … … 83 81 module_param_array(probe_mask, int, NULL, 0444); 84 82 MODULE_PARM_DESC(probe_mask, "Bitmask to probe codecs (default = -1)."); 85 module_param_array(probe_only, bool, NULL, 0444);86 MODULE_PARM_DESC(probe_only, "Only probing and no codec initialization.");87 83 module_param(single_cmd, bool, 0444); 88 84 MODULE_PARM_DESC(single_cmd, "Use single command to communicate with codecs " … … 92 88 93 89 #ifdef CONFIG_SND_HDA_POWER_SAVE 94 static int power_save = CONFIG_SND_HDA_POWER_SAVE_DEFAULT; 95 module_param(power_save, int, 0644); 96 MODULE_PARM_DESC(power_save, "Automatic power-saving timeout " 97 "(in second, 0 = disable)."); 90 /* power_save option is defined in hda_codec.c */ 98 91 99 92 /* reset the HD-audio controller in power save mode. … … 304 297 #define VIA_HDAC_DEVICE_ID 0x3288 305 298 306 /* HD Audio class code */307 #define PCI_CLASS_MULTIMEDIA_HD_AUDIO 0x0403308 299 309 300 /* … … 444 435 AZX_DRIVER_NVIDIA, 445 436 AZX_DRIVER_TERA, 446 AZX_DRIVER_GENERIC,447 437 AZX_NUM_DRIVERS, /* keep this as last entry */ 448 438 }; … … 458 448 [AZX_DRIVER_NVIDIA] = "HDA NVidia", 459 449 [AZX_DRIVER_TERA] = "HDA Teradici", 460 [AZX_DRIVER_GENERIC] = "HD-Audio Generic",461 450 }; 462 451 … … 1023 1012 snd_pcm_period_elapsed(azx_dev->substream); 1024 1013 spin_lock(&chip->reg_lock); 1025 } else if (chip->bus && chip->bus->workq){1014 } else { 1026 1015 /* bogus IRQ, process it later */ 1027 1016 azx_dev->irq_pending = 1; 1028 queue_work(chip->bus->workq, 1029 &chip->irq_pending_work); 1017 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 0) 1018 schedule_work(&chip->irq_pending_work); 1019 #endif 1030 1020 } 1031 1021 } … … 1100 1090 struct azx_dev *azx_dev) 1101 1091 { 1092 #ifdef TARGET_OS2 1093 volatile u32 *bdl; 1094 #else 1102 1095 u32 *bdl; 1103 1096 #endif 1104 1097 int i, ofs, periods, period_bytes; 1105 1098 int pos_adj; … … 1262 1255 1263 1256 static int __devinit azx_codec_create(struct azx *chip, const char *model, 1264 unsigned int codec_probe_mask, 1265 int no_init) 1257 unsigned int codec_probe_mask) 1266 1258 { 1267 1259 struct hda_bus_template bus_temp; … … 1277 1269 bus_temp.ops.attach_pcm = azx_attach_pcm_stream; 1278 1270 #ifdef CONFIG_SND_HDA_POWER_SAVE 1279 bus_temp.power_save = &power_save;1280 1271 bus_temp.ops.pm_notify = azx_power_notify; 1281 1272 #endif … … 1321 1312 if ((chip->codec_mask & (1 << c)) & codec_probe_mask) { 1322 1313 struct hda_codec *codec; 1323 err = snd_hda_codec_new(chip->bus, c, !no_init,&codec);1314 err = snd_hda_codec_new(chip->bus, c, &codec); 1324 1315 if (err < 0) 1325 1316 continue; … … 1776 1767 chip->azx_dev[i].irq_pending = 0; 1777 1768 spin_unlock_irq(&chip->reg_lock); 1769 flush_scheduled_work(); 1778 1770 } 1779 1771 … … 1946 1938 * power management 1947 1939 */ 1948 1949 static int snd_hda_codecs_inuse(struct hda_bus *bus)1950 {1951 struct hda_codec *codec;1952 1953 list_for_each_entry(codec, &bus->codec_list, list, struct hda_codec) {1954 if (snd_hda_codec_needs_resume(codec))1955 return 1;1956 }1957 return 0;1958 }1959 1960 1940 static int azx_suspend(struct pci_dev *pci, pm_message_t state) 1961 1941 { … … 1983 1963 } 1984 1964 1985 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19)1986 static int azx_resume_early(struct pci_dev *pci)1987 {1988 return pci_restore_state(pci);1989 }1990 #endif1991 1992 1965 static int azx_resume(struct pci_dev *pci) 1993 1966 { … … 1995 1968 struct azx *chip = card->private_data; 1996 1969 1997 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 19) 1970 pci_set_power_state(pci, PCI_D0); 1998 1971 pci_restore_state(pci); 1999 #endif2000 2001 1972 if (pci_enable_device(pci) < 0) { 2002 1973 printk(KERN_ERR "hda-intel: pci_enable_device failed, " … … 2139 2110 SND_PCI_QUIRK(0x17aa, 0x2010, "Thinkpad X/T/R60", 0x01), 2140 2111 SND_PCI_QUIRK(0x17aa, 0x20ac, "Thinkpad X/T/R61", 0x01), 2141 /* broken BIOS */ 2142 SND_PCI_QUIRK(0x1028, 0x20ac, "Dell Studio Desktop", 0x01), 2143 /* including bogus ALC268 in slot#2 that conflicts with ALC888 */ 2144 SND_PCI_QUIRK(0x17c0, 0x4085, "Medion MD96630", 0x01), 2112 /* broken BIOS */ 2113 SND_PCI_QUIRK(0x1028, 0x20ac, "Dell Studio Desktop", 0x01), 2145 2114 {0} 2146 2115 }; … … 2277 2246 chip->capture_streams = ATIHDMI_NUM_CAPTURE; 2278 2247 break; 2279 case AZX_DRIVER_GENERIC:2280 2248 default: 2281 2249 chip->playback_streams = ICH6_NUM_PLAYBACK; … … 2380 2348 } 2381 2349 2382 err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); 2350 card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); 2351 if (!card) { 2352 snd_printk(KERN_ERR SFX "Error creating card!\n"); 2353 return -ENOMEM; 2354 } 2355 2356 err = azx_create(card, pci, dev, pci_id->driver_data, &chip); 2383 2357 if (err < 0) { 2384 snd_ printk(KERN_ERR SFX "Error creating card!\n");2358 snd_card_free(card); 2385 2359 return err; 2386 2360 } 2387 2388 err = azx_create(card, pci, dev, pci_id->driver_data, &chip);2389 if (err < 0)2390 goto out_free;2391 2361 card->private_data = chip; 2392 2362 2393 2363 /* create codec instances */ 2394 err = azx_codec_create(chip, model[dev], probe_mask[dev], 2395 probe_only[dev]); 2396 if (err < 0) 2397 goto out_free; 2364 err = azx_codec_create(chip, model[dev], probe_mask[dev]); 2365 if (err < 0) { 2366 snd_card_free(card); 2367 return err; 2368 } 2398 2369 2399 2370 /* create PCM streams */ 2400 2371 err = snd_hda_build_pcms(chip->bus); 2401 if (err < 0) 2402 goto out_free; 2372 if (err < 0) { 2373 snd_card_free(card); 2374 return err; 2375 } 2403 2376 2404 2377 /* create mixer controls */ 2405 2378 err = azx_mixer_create(chip); 2406 if (err < 0) 2407 goto out_free; 2379 if (err < 0) { 2380 snd_card_free(card); 2381 return err; 2382 } 2408 2383 2409 2384 snd_card_set_dev(card, &pci->dev); 2410 2385 2411 2386 err = snd_card_register(card); 2412 if (err < 0) 2413 goto out_free; 2387 if (err < 0) { 2388 snd_card_free(card); 2389 return err; 2390 } 2414 2391 2415 2392 pci_set_drvdata(pci, card); … … 2419 2396 2420 2397 dev++; 2421 return err;2422 out_free:2423 snd_card_free(card);2424 2398 return err; 2425 2399 } … … 2496 2470 /* Teradici */ 2497 2471 { PCI_DEVICE(0x6549, 0x1200), .driver_data = AZX_DRIVER_TERA }, 2498 /* AMD Generic, PCI class code and Vendor ID for HD Audio */2499 { PCI_DEVICE(PCI_VENDOR_ID_ATI, PCI_ANY_ID),2500 .class = PCI_CLASS_MULTIMEDIA_HD_AUDIO << 8,2501 .class_mask = 0xffffff,2502 .driver_data = AZX_DRIVER_GENERIC },2503 2472 { 0, } 2504 2473 }; … … 2513 2482 #ifdef CONFIG_PM 2514 2483 .suspend = azx_suspend, 2515 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 19)2516 .resume_early = azx_resume_early,2517 #endif2518 2484 .resume = azx_resume, 2519 2485 #endif -
GPL/branches/uniaud32-2.0/alsa-kernel/pci/hda/hda_local.h
r410 r417 289 289 #endif 290 290 291 #define SND_PRINT_RATES_ADVISED_BUFSIZE 80292 void snd_print_pcm_rates(int pcm, char *buf, int buflen);293 294 #define SND_PRINT_BITS_ADVISED_BUFSIZE 16295 void snd_print_pcm_bits(int pcm, char *buf, int buflen);296 297 291 /* 298 292 * Misc … … 301 295 const char **modelnames, 302 296 const struct snd_pci_quirk *pci_list); 303 int snd_hda_check_board_codec_sid_config(struct hda_codec *codec,304 int num_configs, const char **models,305 const struct snd_pci_quirk *tbl);306 297 int snd_hda_add_new_ctls(struct hda_codec *codec, 307 298 struct snd_kcontrol_new *knew); … … 417 408 #ifdef CONFIG_SND_HDA_HWDEP 418 409 int snd_hda_create_hwdep(struct hda_codec *codec); 410 int snd_hda_hwdep_add_sysfs(struct hda_codec *codec); 419 411 #else 420 412 static inline int snd_hda_create_hwdep(struct hda_codec *codec) { return 0; } 421 #endif422 423 #ifdef CONFIG_SND_HDA_RECONFIG424 int snd_hda_hwdep_add_sysfs(struct hda_codec *codec);425 #else426 static inline int snd_hda_hwdep_add_sysfs(struct hda_codec *codec)427 {428 return 0;429 }430 413 #endif 431 414 … … 462 445 #define get_amp_index(kc) (((kc)->private_value >> 19) & 0xf) 463 446 464 /*465 * CEA Short Audio Descriptor data466 */467 struct cea_sad {468 int channels;469 int format; /* (format == 0) indicates invalid SAD */470 int rates;471 int sample_bits; /* for LPCM */472 int max_bitrate; /* for AC3...ATRAC */473 int profile; /* for WMAPRO */474 };475 476 #define ELD_FIXED_BYTES 20477 #define ELD_MAX_MNL 16478 #define ELD_MAX_SAD 16479 480 /*481 * ELD: EDID Like Data482 */483 struct hdmi_eld {484 int eld_size;485 int baseline_len;486 int eld_ver; /* (eld_ver == 0) indicates invalid ELD */487 int cea_edid_ver;488 char monitor_name[ELD_MAX_MNL + 1];489 int manufacture_id;490 int product_id;491 u64 port_id;492 int support_hdcp;493 int support_ai;494 int conn_type;495 int aud_synch_delay;496 int spk_alloc;497 int sad_count;498 struct cea_sad sad[ELD_MAX_SAD];499 #ifdef CONFIG_PROC_FS500 struct snd_info_entry *proc_entry;501 #endif502 };503 504 int snd_hdmi_get_eld_size(struct hda_codec *codec, hda_nid_t nid);505 int snd_hdmi_get_eld(struct hdmi_eld *, struct hda_codec *, hda_nid_t);506 void snd_hdmi_show_eld(struct hdmi_eld *eld);507 508 #ifdef CONFIG_PROC_FS509 int snd_hda_eld_proc_new(struct hda_codec *codec, struct hdmi_eld *eld);510 void snd_hda_eld_proc_free(struct hda_codec *codec, struct hdmi_eld *eld);511 #else512 static inline int snd_hda_eld_proc_new(struct hda_codec *codec,513 struct hdmi_eld *eld)514 {515 return 0;516 }517 static inline void snd_hda_eld_proc_free(struct hda_codec *codec,518 struct hdmi_eld *eld)519 {520 }521 #endif522 523 #define SND_PRINT_CHANNEL_ALLOCATION_ADVISED_BUFSIZE 80524 void snd_print_channel_allocation(int spk_alloc, char *buf, int buflen);525 526 447 #endif /* __SOUND_HDA_LOCAL_H */ -
GPL/branches/uniaud32-2.0/alsa-kernel/pci/hda/hda_proc.c
r410 r417 92 92 static void print_pcm_rates(struct snd_info_buffer *buffer, unsigned int pcm) 93 93 { 94 char buf[SND_PRINT_RATES_ADVISED_BUFSIZE]; 94 static unsigned int rates[] = { 95 8000, 11025, 16000, 22050, 32000, 44100, 48000, 88200, 96 96000, 176400, 192000, 384000 97 }; 98 int i; 95 99 96 100 pcm &= AC_SUPPCM_RATES; 97 101 snd_iprintf(buffer, " rates [0x%x]:", pcm); 98 snd_print_pcm_rates(pcm, buf, sizeof(buf)); 99 snd_iprintf(buffer, "%s\n", buf); 102 for (i = 0; i < ARRAY_SIZE(rates); i++) 103 if (pcm & (1 << i)) 104 snd_iprintf(buffer, " %d", rates[i]); 105 snd_iprintf(buffer, "\n"); 100 106 } 101 107 102 108 static void print_pcm_bits(struct snd_info_buffer *buffer, unsigned int pcm) 103 109 { 104 char buf[SND_PRINT_BITS_ADVISED_BUFSIZE]; 105 106 snd_iprintf(buffer, " bits [0x%x]:", (pcm >> 16) & 0xff); 107 snd_print_pcm_bits(pcm, buf, sizeof(buf)); 108 snd_iprintf(buffer, "%s\n", buf); 110 static unsigned int bits[] = { 8, 16, 20, 24, 32 }; 111 int i; 112 113 pcm = (pcm >> 16) & 0xff; 114 snd_iprintf(buffer, " bits [0x%x]:", pcm); 115 for (i = 0; i < ARRAY_SIZE(bits); i++) 116 if (pcm & (1 << i)) 117 snd_iprintf(buffer, " %d", bits[i]); 118 snd_iprintf(buffer, "\n"); 109 119 } 110 120 … … 415 425 } 416 426 427 static void print_realtek_coef(struct snd_info_buffer *buffer, 428 struct hda_codec *codec, hda_nid_t nid) 429 { 430 int coeff = snd_hda_codec_read(codec, nid, 0, 431 AC_VERB_GET_PROC_COEF, 0); 432 snd_iprintf(buffer, " Processing Coefficient: 0x%02x\n", coeff); 433 coeff = snd_hda_codec_read(codec, nid, 0, 434 AC_VERB_GET_COEF_INDEX, 0); 435 snd_iprintf(buffer, " Coefficient Index: 0x%02x\n", coeff); 436 } 437 417 438 static void print_gpio(struct snd_info_buffer *buffer, 418 439 struct hda_codec *codec, hda_nid_t nid) … … 447 468 snd_iprintf(buffer, 448 469 " IO[%d]: enable=%d, dir=%d, wake=%d, " 449 "sticky=%d, data=%d , unsol=%d\n", i,470 "sticky=%d, data=%d\n", i, 450 471 (enable & (1<<i)) ? 1 : 0, 451 472 (direction & (1<<i)) ? 1 : 0, 452 473 (wake & (1<<i)) ? 1 : 0, 453 474 (sticky & (1<<i)) ? 1 : 0, 454 (data & (1<<i)) ? 1 : 0, 455 (unsol & (1<<i)) ? 1 : 0); 475 (data & (1<<i)) ? 1 : 0); 456 476 /* FIXME: add GPO and GPI pin information */ 457 477 } … … 494 514 495 515 print_gpio(buffer, codec, codec->afg); 496 if (codec->proc_widget_hook)497 codec->proc_widget_hook(buffer, codec, codec->afg);498 516 499 517 for (i = 0; i < nodes; i++, nid++) { … … 598 616 print_proc_caps(buffer, codec, nid); 599 617 600 if (codec->proc_widget_hook) 601 codec->proc_widget_hook(buffer, codec, nid); 618 /* NID 0x20 == Realtek Define Registers */ 619 if (codec->vendor_id == 0x10ec && nid == 0x20) 620 print_realtek_coef(buffer, codec, nid); 602 621 } 603 622 snd_hda_power_down(codec); -
GPL/branches/uniaud32-2.0/alsa-kernel/pci/hda/patch_analog.c
r410 r417 28 28 #include "hda_codec.h" 29 29 #include "hda_local.h" 30 #include "hda_patch.h" 30 31 31 32 struct ad198x_spec { … … 638 639 639 640 static struct snd_kcontrol_new ad1986a_laptop_eapd_mixers[] = { 640 HDA_BIND_VOL("Master Playback Volume", &ad1986a_laptop_master_vol),641 HDA_BIND_SW("Master Playback Switch", &ad1986a_laptop_master_sw),642 HDA_CODEC_VOLUME("PCM Playback Volume", 0x03, 0x0, HDA_OUTPUT),643 HDA_CODEC_MUTE("PCM Playback Switch", 0x03, 0x0, HDA_OUTPUT),644 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x17, 0, HDA_OUTPUT),645 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x17, 0, HDA_OUTPUT),646 HDA_CODEC_VOLUME("Mic Playback Volume", 0x13, 0x0, HDA_OUTPUT),647 HDA_CODEC_MUTE("Mic Playback Switch", 0x13, 0x0, HDA_OUTPUT),648 HDA_CODEC_VOLUME("Mic Boost", 0x0f, 0x0, HDA_OUTPUT),649 HDA_CODEC_VOLUME("Capture Volume", 0x12, 0x0, HDA_OUTPUT),650 HDA_CODEC_MUTE("Capture Switch", 0x12, 0x0, HDA_OUTPUT),651 {652 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,653 .name = "Capture Source",654 .info = ad198x_mux_enum_info,655 .get = ad198x_mux_enum_get,656 .put = ad198x_mux_enum_put,657 },658 {659 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,660 .name = "External Amplifier",661 .info = ad198x_eapd_info,662 .get = ad198x_eapd_get,663 .put = ad198x_eapd_put,664 .private_value = 0x1b | (1 << 8), /* port-D, inversed */665 },666 {0} /* end */667 };668 669 static struct snd_kcontrol_new ad1986a_samsung_mixers[] = {670 641 HDA_BIND_VOL("Master Playback Volume", &ad1986a_laptop_master_vol), 671 642 HDA_BIND_SW("Master Playback Switch", &ad1986a_laptop_master_sw), … … 960 931 AD1986A_LAPTOP_AUTOMUTE, 961 932 AD1986A_ULTRA, 962 AD1986A_SAMSUNG,963 933 AD1986A_MODELS 964 934 }; … … 971 941 [AD1986A_LAPTOP_AUTOMUTE] = "laptop-automute", 972 942 [AD1986A_ULTRA] = "ultra", 973 [AD1986A_SAMSUNG] = "samsung",974 943 }; 975 944 … … 994 963 SND_PCI_QUIRK(0x144d, 0xb03c, "Samsung R55", AD1986A_3STACK), 995 964 SND_PCI_QUIRK(0x144d, 0xc01e, "FSC V2060", AD1986A_LAPTOP), 996 SND_PCI_QUIRK(0x144d, 0xc023, "Samsung X60", AD1986A_ SAMSUNG),997 SND_PCI_QUIRK(0x144d, 0xc024, "Samsung R65", AD1986A_ SAMSUNG),998 SND_PCI_QUIRK(0x144d, 0xc026, "Samsung X11", AD1986A_ SAMSUNG),965 SND_PCI_QUIRK(0x144d, 0xc023, "Samsung X60", AD1986A_LAPTOP_EAPD), 966 SND_PCI_QUIRK(0x144d, 0xc024, "Samsung R65", AD1986A_LAPTOP_EAPD), 967 SND_PCI_QUIRK(0x144d, 0xc026, "Samsung X11", AD1986A_LAPTOP_EAPD), 999 968 SND_PCI_QUIRK(0x144d, 0xc027, "Samsung Q1", AD1986A_ULTRA), 1000 969 SND_PCI_QUIRK(0x144d, 0xc504, "Samsung Q35", AD1986A_3STACK), … … 1078 1047 case AD1986A_LAPTOP_EAPD: 1079 1048 spec->mixers[0] = ad1986a_laptop_eapd_mixers; 1080 spec->num_init_verbs = 2;1081 spec->init_verbs[1] = ad1986a_eapd_init_verbs;1082 spec->multiout.max_channels = 2;1083 spec->multiout.num_dacs = 1;1084 spec->multiout.dac_nids = ad1986a_laptop_dac_nids;1085 if (!is_jack_available(codec, 0x25))1086 spec->multiout.dig_out_nid = 0;1087 spec->input_mux = &ad1986a_laptop_eapd_capture_source;1088 break;1089 case AD1986A_SAMSUNG:1090 spec->mixers[0] = ad1986a_samsung_mixers;1091 1049 spec->num_init_verbs = 3; 1092 1050 spec->init_verbs[1] = ad1986a_eapd_init_verbs; … … 3901 3859 static struct snd_pci_quirk ad1884a_cfg_tbl[] = { 3902 3860 SND_PCI_QUIRK(0x103c, 0x3030, "HP", AD1884A_MOBILE), 3903 SND_PCI_QUIRK(0x103c, 0x3037, "HP 2230s", AD1884A_LAPTOP),3904 3861 SND_PCI_QUIRK(0x103c, 0x3056, "HP", AD1884A_MOBILE), 3905 SND_PCI_QUIRK(0x103c, 0x30e6, "HP 6730b", AD1884A_LAPTOP),3906 3862 SND_PCI_QUIRK(0x103c, 0x30e7, "HP EliteBook 8530p", AD1884A_LAPTOP), 3907 3863 SND_PCI_QUIRK(0x103c, 0x3614, "HP 6730s", AD1884A_LAPTOP), … … 4264 4220 spec->adc_nids = ad1882_adc_nids; 4265 4221 spec->capsrc_nids = ad1882_capsrc_nids; 4266 if (codec->vendor_id == 0x11d 41882)4222 if (codec->vendor_id == 0x11d1882) 4267 4223 spec->input_mux = &ad1882_capture_source; 4268 4224 else … … 4270 4226 spec->num_mixers = 2; 4271 4227 spec->mixers[0] = ad1882_base_mixers; 4272 if (codec->vendor_id == 0x11d 41882)4228 if (codec->vendor_id == 0x11d1882) 4273 4229 spec->mixers[1] = ad1882_loopback_mixers; 4274 4230 else … … 4310 4266 * patch entries 4311 4267 */ 4312 st atic struct hda_codec_preset snd_hda_preset_analog[] = {4268 struct hda_codec_preset snd_hda_preset_analog[] = { 4313 4269 { .id = 0x11d4184a, .name = "AD1884A", .patch = patch_ad1884a }, 4314 4270 { .id = 0x11d41882, .name = "AD1882", .patch = patch_ad1882 }, … … 4328 4284 {0} /* terminator */ 4329 4285 }; 4330 4331 MODULE_ALIAS("snd-hda-codec-id:11d4*");4332 4333 MODULE_LICENSE("GPL");4334 MODULE_DESCRIPTION("Analog Devices HD-audio codec");4335 4336 static struct hda_codec_preset_list analog_list = {4337 .preset = snd_hda_preset_analog,4338 .owner = THIS_MODULE,4339 };4340 4341 static int __init patch_analog_init(void)4342 {4343 return snd_hda_add_codec_preset(&analog_list);4344 }4345 4346 static void __exit patch_analog_exit(void)4347 {4348 snd_hda_delete_codec_preset(&analog_list);4349 }4350 4351 module_init(patch_analog_init)4352 module_exit(patch_analog_exit) -
GPL/branches/uniaud32-2.0/alsa-kernel/pci/hda/patch_atihdmi.c
r410 r417 28 28 #include "hda_codec.h" 29 29 #include "hda_local.h" 30 #include "hda_patch.h" 30 31 31 32 struct atihdmi_spec { … … 187 188 * patch entries 188 189 */ 189 st atic struct hda_codec_preset snd_hda_preset_atihdmi[] = {190 { .id = 0x1002793c, .name = " RS600 HDMI", .patch = patch_atihdmi },191 { .id = 0x10027919, .name = " RS600 HDMI", .patch = patch_atihdmi },192 { .id = 0x1002791a, .name = " RS690/780 HDMI", .patch = patch_atihdmi },193 { .id = 0x1002aa01, .name = " R6xx HDMI", .patch = patch_atihdmi },190 struct hda_codec_preset snd_hda_preset_atihdmi[] = { 191 { .id = 0x1002793c, .name = "ATI RS600 HDMI", .patch = patch_atihdmi }, 192 { .id = 0x10027919, .name = "ATI RS600 HDMI", .patch = patch_atihdmi }, 193 { .id = 0x1002791a, .name = "ATI RS690/780 HDMI", .patch = patch_atihdmi }, 194 { .id = 0x1002aa01, .name = "ATI R6xx HDMI", .patch = patch_atihdmi }, 194 195 { .id = 0x10951390, .name = "SiI1390 HDMI", .patch = patch_atihdmi }, 196 { .id = 0x10951392, .name = "SiI1392 HDMI", .patch = patch_atihdmi }, 195 197 { .id = 0x17e80047, .name = "Chrontel HDMI", .patch = patch_atihdmi }, 196 198 {0} /* terminator */ 197 199 }; 198 199 MODULE_ALIAS("snd-hda-codec-id:1002793c");200 MODULE_ALIAS("snd-hda-codec-id:10027919");201 MODULE_ALIAS("snd-hda-codec-id:1002791a");202 MODULE_ALIAS("snd-hda-codec-id:1002aa01");203 MODULE_ALIAS("snd-hda-codec-id:10951390");204 MODULE_ALIAS("snd-hda-codec-id:17e80047");205 206 MODULE_LICENSE("GPL");207 MODULE_DESCRIPTION("ATI HDMI HD-audio codec");208 209 static struct hda_codec_preset_list atihdmi_list = {210 .preset = snd_hda_preset_atihdmi,211 .owner = THIS_MODULE,212 };213 214 static int __init patch_atihdmi_init(void)215 {216 return snd_hda_add_codec_preset(&atihdmi_list);217 }218 219 static void __exit patch_atihdmi_exit(void)220 {221 snd_hda_delete_codec_preset(&atihdmi_list);222 }223 224 module_init(patch_atihdmi_init)225 module_exit(patch_atihdmi_exit) -
GPL/branches/uniaud32-2.0/alsa-kernel/pci/hda/patch_cmedia.c
r410 r417 29 29 #include "hda_codec.h" 30 30 #include "hda_local.h" 31 #include "hda_patch.h" 31 32 #define NUM_PINS 11 32 33 … … 736 737 * patch entries 737 738 */ 738 st atic struct hda_codec_preset snd_hda_preset_cmedia[] = {739 struct hda_codec_preset snd_hda_preset_cmedia[] = { 739 740 { .id = 0x13f69880, .name = "CMI9880", .patch = patch_cmi9880 }, 740 741 { .id = 0x434d4980, .name = "CMI9880", .patch = patch_cmi9880 }, 741 742 {0} /* terminator */ 742 743 }; 743 744 MODULE_ALIAS("snd-hda-codec-id:13f69880");745 MODULE_ALIAS("snd-hda-codec-id:434d4980");746 747 MODULE_LICENSE("GPL");748 MODULE_DESCRIPTION("C-Media HD-audio codec");749 750 static struct hda_codec_preset_list cmedia_list = {751 .preset = snd_hda_preset_cmedia,752 .owner = THIS_MODULE,753 };754 755 static int __init patch_cmedia_init(void)756 {757 return snd_hda_add_codec_preset(&cmedia_list);758 }759 760 static void __exit patch_cmedia_exit(void)761 {762 snd_hda_delete_codec_preset(&cmedia_list);763 }764 765 module_init(patch_cmedia_init)766 module_exit(patch_cmedia_exit) -
GPL/branches/uniaud32-2.0/alsa-kernel/pci/hda/patch_conexant.c
r410 r417 26 26 #include <linux/pci.h> 27 27 #include <sound/core.h> 28 #include <sound/jack.h>29 30 28 #include "hda_codec.h" 31 29 #include "hda_local.h" 30 #include "hda_patch.h" 32 31 33 32 #define CXT_PIN_DIR_IN 0x00 … … 40 39 #define CONEXANT_MIC_EVENT 0x38 41 40 42 /* Conexant 5051 specific */ 43 44 #define CXT5051_SPDIF_OUT 0x1C 45 #define CXT5051_PORTB_EVENT 0x38 46 #define CXT5051_PORTC_EVENT 0x39 47 48 49 struct conexant_jack { 50 51 hda_nid_t nid; 52 int type; 53 struct snd_jack *jack; 54 55 }; 41 56 42 57 43 struct conexant_spec { … … 98 84 99 85 unsigned int spdif_route; 100 101 /* jack detection */102 struct snd_array jacks;103 86 104 87 /* dynamic controls, init_verbs and input_mux */ … … 348 331 } 349 332 350 static int conexant_add_jack(struct hda_codec *codec,351 hda_nid_t nid, int type)352 {353 struct conexant_spec *spec;354 struct conexant_jack *jack;355 const char *name;356 357 spec = codec->spec;358 snd_array_init(&spec->jacks, sizeof(*jack), 32);359 jack = snd_array_new(&spec->jacks);360 name = (type == SND_JACK_HEADPHONE) ? "Headphone" : "Mic" ;361 362 if (!jack)363 return -ENOMEM;364 365 jack->nid = nid;366 jack->type = type;367 368 return snd_jack_new(codec->bus->card, name, type, &jack->jack);369 }370 371 static void conexant_report_jack(struct hda_codec *codec, hda_nid_t nid)372 {373 struct conexant_spec *spec = codec->spec;374 struct conexant_jack *jacks = spec->jacks.list;375 376 if (jacks) {377 int i;378 for (i = 0; i < spec->jacks.used; i++) {379 if (jacks->nid == nid) {380 unsigned int present;381 present = snd_hda_codec_read(codec, nid, 0,382 AC_VERB_GET_PIN_SENSE, 0) &383 AC_PINSENSE_PRESENCE;384 385 present = (present) ? jacks->type : 0 ;386 387 snd_jack_report(jacks->jack,388 present);389 }390 jacks++;391 }392 }393 }394 395 static int conexant_init_jacks(struct hda_codec *codec)396 {397 #ifdef CONFIG_SND_JACK398 struct conexant_spec *spec = codec->spec;399 int i;400 401 for (i = 0; i < spec->num_init_verbs; i++) {402 const struct hda_verb *hv;403 404 hv = spec->init_verbs[i];405 while (hv->nid) {406 int err = 0;407 switch (hv->param ^ AC_USRSP_EN) {408 case CONEXANT_HP_EVENT:409 err = conexant_add_jack(codec, hv->nid,410 SND_JACK_HEADPHONE);411 conexant_report_jack(codec, hv->nid);412 break;413 case CXT5051_PORTC_EVENT:414 case CONEXANT_MIC_EVENT:415 err = conexant_add_jack(codec, hv->nid,416 SND_JACK_MICROPHONE);417 conexant_report_jack(codec, hv->nid);418 break;419 }420 if (err < 0)421 return err;422 ++hv;423 }424 }425 #endif426 return 0;427 428 }429 430 333 static int conexant_init(struct hda_codec *codec) 431 334 { … … 440 343 static void conexant_free(struct hda_codec *codec) 441 344 { 442 #ifdef CONFIG_SND_JACK443 struct conexant_spec *spec = codec->spec;444 if (spec->jacks.list) {445 struct conexant_jack *jacks = spec->jacks.list;446 int i;447 for (i = 0; i < spec->jacks.used; i++)448 snd_device_free(codec->bus->card, &jacks[i].jack);449 snd_array_free(&spec->jacks);450 }451 #endif452 345 kfree(codec->spec); 453 346 } … … 1635 1528 static hda_nid_t cxt5051_dac_nids[1] = { 0x10 }; 1636 1529 static hda_nid_t cxt5051_adc_nids[2] = { 0x14, 0x15 }; 1530 #define CXT5051_SPDIF_OUT 0x1C 1531 #define CXT5051_PORTB_EVENT 0x38 1532 #define CXT5051_PORTC_EVENT 0x39 1637 1533 1638 1534 static struct hda_channel_mode cxt5051_modes[1] = { … … 1714 1610 unsigned int res) 1715 1611 { 1716 int nid = (res & AC_UNSOL_RES_SUBTAG) >> 20;1717 1612 switch (res >> 26) { 1718 1613 case CONEXANT_HP_EVENT: … … 1726 1621 break; 1727 1622 } 1728 conexant_report_jack(codec, nid);1729 1623 } 1730 1624 … … 1801 1695 { 1802 1696 conexant_init(codec); 1803 conexant_init_jacks(codec);1804 1697 if (codec->patch_ops.unsol_event) { 1805 1698 cxt5051_hp_automute(codec); … … 1879 1772 */ 1880 1773 1881 st atic struct hda_codec_preset snd_hda_preset_conexant[] = {1774 struct hda_codec_preset snd_hda_preset_conexant[] = { 1882 1775 { .id = 0x14f15045, .name = "CX20549 (Venice)", 1883 1776 .patch = patch_cxt5045 }, … … 1888 1781 {0} /* terminator */ 1889 1782 }; 1890 1891 MODULE_ALIAS("snd-hda-codec-id:14f15045");1892 MODULE_ALIAS("snd-hda-codec-id:14f15047");1893 MODULE_ALIAS("snd-hda-codec-id:14f15051");1894 1895 MODULE_LICENSE("GPL");1896 MODULE_DESCRIPTION("Conexant HD-audio codec");1897 1898 static struct hda_codec_preset_list conexant_list = {1899 .preset = snd_hda_preset_conexant,1900 .owner = THIS_MODULE,1901 };1902 1903 static int __init patch_conexant_init(void)1904 {1905 return snd_hda_add_codec_preset(&conexant_list);1906 }1907 1908 static void __exit patch_conexant_exit(void)1909 {1910 snd_hda_delete_codec_preset(&conexant_list);1911 }1912 1913 module_init(patch_conexant_init)1914 module_exit(patch_conexant_exit) -
GPL/branches/uniaud32-2.0/alsa-kernel/pci/hda/patch_realtek.c
r410 r417 31 31 #include "hda_codec.h" 32 32 #include "hda_local.h" 33 #include "hda_patch.h" 33 34 34 35 #define ALC880_FRONT_EVENT 0x01 … … 216 217 ALC883_ACER, 217 218 ALC883_ACER_ASPIRE, 218 ALC888_ACER_ASPIRE_4930G,219 219 ALC883_MEDION, 220 220 ALC883_MEDION_MD2, … … 230 230 ALC883_CLEVO_M720, 231 231 ALC883_FUJITSU_PI2515, 232 ALC888_FUJITSU_XA3530,233 232 ALC883_3ST_6ch_INTEL, 234 233 ALC888_ASUS_M90V, 235 234 ALC888_ASUS_EEE1601, 236 ALC1200_ASUS_P5Q,237 235 ALC883_AUTO, 238 236 ALC883_MODEL_LAST, … … 384 382 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 385 383 struct alc_spec *spec = codec->spec; 386 const struct hda_input_mux *imux ;384 const struct hda_input_mux *imux = spec->input_mux; 387 385 unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); 388 unsigned int mux_idx;389 386 hda_nid_t nid = spec->capsrc_nids ? 390 387 spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx]; 391 392 mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;393 imux = &spec->input_mux[mux_idx];394 388 395 389 if (spec->is_mix_capture) { … … 413 407 } else { 414 408 /* MUX style (e.g. ALC880) */ 415 return snd_hda_input_mux_put(codec, imux, ucontrol, nid, 409 unsigned int mux_idx; 410 mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx; 411 return snd_hda_input_mux_put(codec, &spec->input_mux[mux_idx], 412 ucontrol, nid, 416 413 &spec->cur_mux[adc_idx]); 417 414 } … … 765 762 spec->init_verbs[spec->num_init_verbs++] = verb; 766 763 } 767 768 #ifdef CONFIG_PROC_FS769 /*770 * hook for proc771 */772 static void print_realtek_coef(struct snd_info_buffer *buffer,773 struct hda_codec *codec, hda_nid_t nid)774 {775 int coeff;776 777 if (nid != 0x20)778 return;779 coeff = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0);780 snd_iprintf(buffer, " Processing Coefficient: 0x%02x\n", coeff);781 coeff = snd_hda_codec_read(codec, nid, 0,782 AC_VERB_GET_COEF_INDEX, 0);783 snd_iprintf(buffer, " Coefficient Index: 0x%02x\n", coeff);784 }785 #else786 #define print_realtek_coef NULL787 #endif788 764 789 765 /* … … 1178 1154 1179 1155 /* 1180 * ALC8881181 */1182 1183 /*1184 * 2ch mode1185 */1186 static struct hda_verb alc888_4ST_ch2_intel_init[] = {1187 /* Mic-in jack as mic in */1188 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },1189 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },1190 /* Line-in jack as Line in */1191 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },1192 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },1193 /* Line-Out as Front */1194 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},1195 {0} /* end */1196 };1197 1198 /*1199 * 4ch mode1200 */1201 static struct hda_verb alc888_4ST_ch4_intel_init[] = {1202 /* Mic-in jack as mic in */1203 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },1204 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },1205 /* Line-in jack as Surround */1206 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },1207 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },1208 /* Line-Out as Front */1209 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},1210 {0} /* end */1211 };1212 1213 /*1214 * 6ch mode1215 */1216 static struct hda_verb alc888_4ST_ch6_intel_init[] = {1217 /* Mic-in jack as CLFE */1218 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },1219 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },1220 /* Line-in jack as Surround */1221 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },1222 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },1223 /* Line-Out as CLFE (workaround because Mic-in is not loud enough) */1224 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},1225 {0} /* end */1226 };1227 1228 /*1229 * 8ch mode1230 */1231 static struct hda_verb alc888_4ST_ch8_intel_init[] = {1232 /* Mic-in jack as CLFE */1233 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },1234 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },1235 /* Line-in jack as Surround */1236 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },1237 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },1238 /* Line-Out as Side */1239 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},1240 {0} /* end */1241 };1242 1243 static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = {1244 { 2, alc888_4ST_ch2_intel_init },1245 { 4, alc888_4ST_ch4_intel_init },1246 { 6, alc888_4ST_ch6_intel_init },1247 { 8, alc888_4ST_ch8_intel_init },1248 };1249 1250 /*1251 * ALC888 Fujitsu Siemens Amillo xa35301252 */1253 1254 static struct hda_verb alc888_fujitsu_xa3530_verbs[] = {1255 /* Front Mic: set to PIN_IN (empty by default) */1256 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},1257 /* Connect Internal HP to Front */1258 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},1259 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},1260 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},1261 /* Connect Bass HP to Front */1262 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},1263 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},1264 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},1265 /* Connect Line-Out side jack (SPDIF) to Side */1266 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},1267 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},1268 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},1269 /* Connect Mic jack to CLFE */1270 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},1271 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},1272 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},1273 /* Connect Line-in jack to Surround */1274 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},1275 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},1276 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},1277 /* Connect HP out jack to Front */1278 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},1279 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},1280 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},1281 /* Enable unsolicited event for HP jack and Line-out jack */1282 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},1283 {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},1284 {0}1285 };1286 1287 static void alc888_fujitsu_xa3530_automute(struct hda_codec *codec)1288 {1289 unsigned int present;1290 unsigned int bits;1291 /* Line out presence */1292 present = snd_hda_codec_read(codec, 0x17, 0,1293 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;1294 /* HP out presence */1295 present = present || snd_hda_codec_read(codec, 0x1b, 0,1296 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;1297 bits = present ? HDA_AMP_MUTE : 0;1298 /* Toggle internal speakers muting */1299 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,1300 HDA_AMP_MUTE, bits);1301 /* Toggle internal bass muting */1302 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,1303 HDA_AMP_MUTE, bits);1304 }1305 1306 static void alc888_fujitsu_xa3530_unsol_event(struct hda_codec *codec,1307 unsigned int res)1308 {1309 if (res >> 26 == ALC880_HP_EVENT)1310 alc888_fujitsu_xa3530_automute(codec);1311 }1312 1313 1314 /*1315 * ALC888 Acer Aspire 4930G model1316 */1317 1318 static struct hda_verb alc888_acer_aspire_4930g_verbs[] = {1319 /* Front Mic: set to PIN_IN (empty by default) */1320 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},1321 /* Unselect Front Mic by default in input mixer 3 */1322 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},1323 /* Enable unsolicited event for HP jack */1324 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},1325 /* Connect Internal HP to front */1326 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},1327 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},1328 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},1329 /* Connect HP out to front */1330 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},1331 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},1332 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},1333 {0}1334 };1335 1336 static struct hda_input_mux alc888_2_capture_sources[2] = {1337 /* Front mic only available on one ADC */1338 {1339 .num_items = 4,1340 .items = {1341 { "Mic", 0x0 },1342 { "Line", 0x2 },1343 { "CD", 0x4 },1344 { "Front Mic", 0xb },1345 },1346 },1347 {1348 .num_items = 3,1349 .items = {1350 { "Mic", 0x0 },1351 { "Line", 0x2 },1352 { "CD", 0x4 },1353 },1354 }1355 };1356 1357 static struct snd_kcontrol_new alc888_base_mixer[] = {1358 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),1359 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),1360 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),1361 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),1362 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,1363 HDA_OUTPUT),1364 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),1365 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),1366 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),1367 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),1368 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),1369 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),1370 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),1371 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),1372 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),1373 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),1374 HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),1375 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),1376 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),1377 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),1378 {0} /* end */1379 };1380 1381 static void alc888_acer_aspire_4930g_automute(struct hda_codec *codec)1382 {1383 unsigned int present;1384 unsigned int bits;1385 present = snd_hda_codec_read(codec, 0x15, 0,1386 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;1387 bits = present ? HDA_AMP_MUTE : 0;1388 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,1389 HDA_AMP_MUTE, bits);1390 }1391 1392 static void alc888_acer_aspire_4930g_unsol_event(struct hda_codec *codec,1393 unsigned int res)1394 {1395 if (res >> 26 == ALC880_HP_EVENT)1396 alc888_acer_aspire_4930g_automute(codec);1397 }1398 1399 /*1400 1156 * ALC880 3-stack model 1401 1157 * … … 1502 1258 int err; 1503 1259 1504 mutex_lock(&codec-> control_mutex);1260 mutex_lock(&codec->spdif_mutex); /* reuse spdif_mutex */ 1505 1261 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, 1506 1262 HDA_INPUT); 1507 1263 err = snd_hda_mixer_amp_volume_info(kcontrol, uinfo); 1508 mutex_unlock(&codec-> control_mutex);1264 mutex_unlock(&codec->spdif_mutex); /* reuse spdif_mutex */ 1509 1265 return err; 1510 1266 } … … 1517 1273 int err; 1518 1274 1519 mutex_lock(&codec-> control_mutex);1275 mutex_lock(&codec->spdif_mutex); /* reuse spdif_mutex */ 1520 1276 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[0], 3, 0, 1521 1277 HDA_INPUT); 1522 1278 err = snd_hda_mixer_amp_tlv(kcontrol, op_flag, size, tlv); 1523 mutex_unlock(&codec-> control_mutex);1279 mutex_unlock(&codec->spdif_mutex); /* reuse spdif_mutex */ 1524 1280 return err; 1525 1281 } … … 1537 1293 int err; 1538 1294 1539 mutex_lock(&codec-> control_mutex);1295 mutex_lock(&codec->spdif_mutex); /* reuse spdif_mutex */ 1540 1296 kcontrol->private_value = HDA_COMPOSE_AMP_VAL(spec->adc_nids[adc_idx], 1541 1297 3, 0, HDA_INPUT); 1542 1298 err = func(kcontrol, ucontrol); 1543 mutex_unlock(&codec-> control_mutex);1299 mutex_unlock(&codec->spdif_mutex); /* reuse spdif_mutex */ 1544 1300 return err; 1545 1301 } … … 4290 4046 alc_capture_mixer3, 4291 4047 }; 4292 if (spec->num_adc_nids > 0 && spec->num_adc_nids < =3)4048 if (spec->num_adc_nids > 0 && spec->num_adc_nids < 3) 4293 4049 spec->cap_mixer = caps[spec->num_adc_nids - 1]; 4294 4050 } … … 4365 4121 spec->loopback.amplist = alc880_loopbacks; 4366 4122 #endif 4367 codec->proc_widget_hook = print_realtek_coef;4368 4123 4369 4124 return 0; … … 5891 5646 spec->loopback.amplist = alc260_loopbacks; 5892 5647 #endif 5893 codec->proc_widget_hook = print_realtek_coef;5894 5648 5895 5649 return 0; … … 7097 6851 spec->loopback.amplist = alc882_loopbacks; 7098 6852 #endif 7099 codec->proc_widget_hook = print_realtek_coef;7100 6853 7101 6854 return 0; … … 7116 6869 #define ALC883_DIGIN_NID 0x0a 7117 6870 7118 #define ALC1200_DIGOUT_NID 0x107119 7120 6871 static hda_nid_t alc883_dac_nids[4] = { 7121 6872 /* front, rear, clfe, rear_surr */ … … 7133 6884 }; 7134 6885 7135 static hda_nid_t alc883_adc_nids_rev[2] = {7136 /* ADC2-1 */7137 0x09, 0x087138 };7139 7140 6886 static hda_nid_t alc883_capsrc_nids[2] = { 0x23, 0x22 }; 7141 7142 static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };7143 6887 7144 6888 /* input MUX */ … … 8433 8177 [ALC883_ACER] = "acer", 8434 8178 [ALC883_ACER_ASPIRE] = "acer-aspire", 8435 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",8436 8179 [ALC883_MEDION] = "medion", 8437 8180 [ALC883_MEDION_MD2] = "medion-md2", … … 8447 8190 [ALC883_CLEVO_M720] = "clevo-m720", 8448 8191 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515", 8449 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",8450 8192 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel", 8451 [ALC1200_ASUS_P5Q] = "asus-p5q",8452 8193 [ALC883_AUTO] = "auto", 8453 8194 }; … … 8460 8201 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE), 8461 8202 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE), 8462 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",8463 ALC888_ACER_ASPIRE_4930G),8464 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",8465 ALC888_ACER_ASPIRE_4930G),8466 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",8467 ALC888_ACER_ASPIRE_4930G),8468 8203 SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), /* default Acer */ 8469 8204 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL), … … 8472 8207 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP), 8473 8208 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG), 8474 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),8475 8209 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V), 8476 8210 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG), 8477 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),8478 8211 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601), 8479 8212 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG), 8480 8213 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC883_6ST_DIG), 8481 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),8482 8214 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC), 8483 8215 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD), … … 8503 8235 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG), 8504 8236 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG), 8505 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),8506 8237 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG), 8507 8238 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG), … … 8515 8246 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION), 8516 8247 SND_PCI_QUIRK(0x1734, 0x1108, "Fujitsu AMILO Pi2515", ALC883_FUJITSU_PI2515), 8517 SND_PCI_QUIRK(0x1734, 0x113d, "Fujitsu AMILO Xa3530",8518 ALC888_FUJITSU_XA3530),8519 8248 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch), 8520 8249 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763), … … 8528 8257 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL), 8529 8258 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL), 8530 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),8531 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC883_3ST_6ch_INTEL),8532 8259 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC883_3ST_6ch), 8533 8260 {0} … … 8644 8371 .init_hook = alc883_acer_aspire_automute, 8645 8372 }, 8646 [ALC888_ACER_ASPIRE_4930G] = {8647 .mixers = { alc888_base_mixer,8648 alc883_chmode_mixer },8649 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,8650 alc888_acer_aspire_4930g_verbs },8651 .num_dacs = ARRAY_SIZE(alc883_dac_nids),8652 .dac_nids = alc883_dac_nids,8653 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),8654 .adc_nids = alc883_adc_nids_rev,8655 .capsrc_nids = alc883_capsrc_nids_rev,8656 .dig_out_nid = ALC883_DIGOUT_NID,8657 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),8658 .channel_mode = alc883_3ST_6ch_modes,8659 .need_dac_fix = 1,8660 .num_mux_defs =8661 ARRAY_SIZE(alc888_2_capture_sources),8662 .input_mux = alc888_2_capture_sources,8663 .unsol_event = alc888_acer_aspire_4930g_unsol_event,8664 .init_hook = alc888_acer_aspire_4930g_automute,8665 },8666 8373 [ALC883_MEDION] = { 8667 8374 .mixers = { alc883_fivestack_mixer, … … 8806 8513 .unsol_event = alc883_2ch_fujitsu_pi2515_unsol_event, 8807 8514 .init_hook = alc883_2ch_fujitsu_pi2515_automute, 8808 },8809 [ALC888_FUJITSU_XA3530] = {8810 .mixers = { alc888_base_mixer, alc883_chmode_mixer },8811 .init_verbs = { alc883_init_verbs,8812 alc888_fujitsu_xa3530_verbs },8813 .num_dacs = ARRAY_SIZE(alc883_dac_nids),8814 .dac_nids = alc883_dac_nids,8815 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),8816 .adc_nids = alc883_adc_nids_rev,8817 .capsrc_nids = alc883_capsrc_nids_rev,8818 .dig_out_nid = ALC883_DIGOUT_NID,8819 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),8820 .channel_mode = alc888_4ST_8ch_intel_modes,8821 .num_mux_defs =8822 ARRAY_SIZE(alc888_2_capture_sources),8823 .input_mux = alc888_2_capture_sources,8824 .unsol_event = alc888_fujitsu_xa3530_unsol_event,8825 .init_hook = alc888_fujitsu_xa3530_automute,8826 8515 }, 8827 8516 [ALC888_LENOVO_SKY] = { … … 8866 8555 .unsol_event = alc883_eee1601_unsol_event, 8867 8556 .init_hook = alc883_eee1601_inithook, 8868 },8869 [ALC1200_ASUS_P5Q] = {8870 .mixers = { alc883_base_mixer, alc883_chmode_mixer },8871 .init_verbs = { alc883_init_verbs },8872 .num_dacs = ARRAY_SIZE(alc883_dac_nids),8873 .dac_nids = alc883_dac_nids,8874 .dig_out_nid = ALC1200_DIGOUT_NID,8875 .dig_in_nid = ALC883_DIGIN_NID,8876 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),8877 .channel_mode = alc883_sixstack_modes,8878 .input_mux = &alc883_capture_source,8879 8557 }, 8880 8558 }; … … 9074 8752 spec->loopback.amplist = alc883_loopbacks; 9075 8753 #endif 9076 codec->proc_widget_hook = print_realtek_coef;9077 8754 9078 8755 return 0; … … 10567 10244 SND_PCI_QUIRK(0x104d, 0x900e, "Sony ASSAMD", ALC262_SONY_ASSAMD), 10568 10245 SND_PCI_QUIRK(0x104d, 0x9015, "Sony 0x9015", ALC262_SONY_ASSAMD), 10569 SND_PCI_QUIRK(0x104d, 0x9033, "Sony VAIO VGN-SR19XN",10570 ALC262_SONY_ASSAMD),10571 10246 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1", 10572 10247 ALC262_TOSHIBA_RX1), … … 10576 10251 SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA), 10577 10252 SND_PCI_QUIRK(0x144d, 0xc039, "Samsung Q1U EL", ALC262_ULTRA), 10578 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),10579 10253 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000), 10580 10254 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), … … 10884 10558 spec->loopback.amplist = alc262_loopbacks; 10885 10559 #endif 10886 codec->proc_widget_hook = print_realtek_coef;10887 10560 10888 10561 return 0; … … 11698 11371 ALC268_ACER_ASPIRE_ONE), 11699 11372 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), 11700 SND_PCI_QUIRK(0x1028, 0x02b0, "Dell Inspiron Mini9", ALC268_DELL),11701 11373 SND_PCI_QUIRK(0x103c, 0x30cc, "TOSHIBA", ALC268_TOSHIBA), 11702 11374 SND_PCI_QUIRK(0x1043, 0x1205, "ASUS W7J", ALC268_3ST), … … 11950 11622 if (board_config == ALC268_AUTO) 11951 11623 spec->init_hook = alc268_auto_init; 11952 11953 codec->proc_widget_hook = print_realtek_coef;11954 11624 11955 11625 return 0; … … 12754 12424 spec->loopback.amplist = alc269_loopbacks; 12755 12425 #endif 12756 codec->proc_widget_hook = print_realtek_coef;12757 12426 12758 12427 return 0; … … 13842 13511 spec->loopback.amplist = alc861_loopbacks; 13843 13512 #endif 13844 codec->proc_widget_hook = print_realtek_coef;13845 13513 13846 13514 return 0; … … 14804 14472 spec->loopback.amplist = alc861vd_loopbacks; 14805 14473 #endif 14806 codec->proc_widget_hook = print_realtek_coef;14807 14474 14808 14475 return 0; … … 16614 16281 spec->loopback.amplist = alc662_loopbacks; 16615 16282 #endif 16616 codec->proc_widget_hook = print_realtek_coef;16617 16283 16618 16284 return 0; … … 16622 16288 * patch entries 16623 16289 */ 16624 st atic struct hda_codec_preset snd_hda_preset_realtek[] = {16290 struct hda_codec_preset snd_hda_preset_realtek[] = { 16625 16291 { .id = 0x10ec0260, .name = "ALC260", .patch = patch_alc260 }, 16626 16292 { .id = 0x10ec0262, .name = "ALC262", .patch = patch_alc262 }, … … 16648 16314 { .id = 0x10ec0885, .name = "ALC885", .patch = patch_alc882 }, 16649 16315 { .id = 0x10ec0887, .name = "ALC887", .patch = patch_alc883 }, 16316 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 }, 16650 16317 { .id = 0x10ec0888, .rev = 0x100101, .name = "ALC1200", 16651 16318 .patch = patch_alc883 }, 16652 { .id = 0x10ec0888, .name = "ALC888", .patch = patch_alc883 },16653 16319 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc883 }, 16654 16320 {0} /* terminator */ 16655 16321 }; 16656 16657 MODULE_ALIAS("snd-hda-codec-id:10ec*");16658 16659 MODULE_LICENSE("GPL");16660 MODULE_DESCRIPTION("Realtek HD-audio codec");16661 16662 static struct hda_codec_preset_list realtek_list = {16663 .preset = snd_hda_preset_realtek,16664 .owner = THIS_MODULE,16665 };16666 16667 static int __init patch_realtek_init(void)16668 {16669 return snd_hda_add_codec_preset(&realtek_list);16670 }16671 16672 static void __exit patch_realtek_exit(void)16673 {16674 snd_hda_delete_codec_preset(&realtek_list);16675 }16676 16677 module_init(patch_realtek_init)16678 module_exit(patch_realtek_exit) -
GPL/branches/uniaud32-2.0/alsa-kernel/pci/hda/patch_si3054.c
r410 r417 29 29 #include "hda_codec.h" 30 30 #include "hda_local.h" 31 #include "hda_patch.h" 31 32 32 33 /* si3054 verbs */ … … 283 284 * patch entries 284 285 */ 285 st atic struct hda_codec_preset snd_hda_preset_si3054[] = {286 struct hda_codec_preset snd_hda_preset_si3054[] = { 286 287 { .id = 0x163c3055, .name = "Si3054", .patch = patch_si3054 }, 287 288 { .id = 0x163c3155, .name = "Si3054", .patch = patch_si3054 }, … … 301 302 }; 302 303 303 MODULE_ALIAS("snd-hda-codec-id:163c3055");304 MODULE_ALIAS("snd-hda-codec-id:163c3155");305 MODULE_ALIAS("snd-hda-codec-id:11c13026");306 MODULE_ALIAS("snd-hda-codec-id:11c13055");307 MODULE_ALIAS("snd-hda-codec-id:11c13155");308 MODULE_ALIAS("snd-hda-codec-id:10573055");309 MODULE_ALIAS("snd-hda-codec-id:10573057");310 MODULE_ALIAS("snd-hda-codec-id:10573155");311 MODULE_ALIAS("snd-hda-codec-id:11063288");312 MODULE_ALIAS("snd-hda-codec-id:15433155");313 MODULE_ALIAS("snd-hda-codec-id:18540018");314 315 MODULE_LICENSE("GPL");316 MODULE_DESCRIPTION("Si3054 HD-audio modem codec");317 318 static struct hda_codec_preset_list si3054_list = {319 .preset = snd_hda_preset_si3054,320 .owner = THIS_MODULE,321 };322 323 static int __init patch_si3054_init(void)324 {325 return snd_hda_add_codec_preset(&si3054_list);326 }327 328 static void __exit patch_si3054_exit(void)329 {330 snd_hda_delete_codec_preset(&si3054_list);331 }332 333 module_init(patch_si3054_init)334 module_exit(patch_si3054_exit) -
GPL/branches/uniaud32-2.0/alsa-kernel/pci/hda/patch_sigmatel.c
r410 r417 34 34 #include "hda_codec.h" 35 35 #include "hda_local.h" 36 #include "hda_patch.h" 36 37 #include "hda_beep.h" 37 38 38 enum { 39 STAC_VREF_EVENT = 1, 40 STAC_INSERT_EVENT, 41 STAC_PWR_EVENT, 42 STAC_HP_EVENT, 43 }; 39 #define STAC_INSERT_EVENT 0x10 40 #define STAC_PWR_EVENT 0x20 41 #define STAC_HP_EVENT 0x30 42 #define STAC_VREF_EVENT 0x40 44 43 45 44 enum { … … 56 55 STAC_9200_DELL_M26, 57 56 STAC_9200_DELL_M27, 58 STAC_9200_M4, 59 STAC_9200_M4_2, 57 STAC_9200_GATEWAY, 60 58 STAC_9200_PANASONIC, 61 59 STAC_9200_MODELS … … 71 69 72 70 enum { 73 STAC_92HD73XX_NO_JD, /* no jack-detection */74 71 STAC_92HD73XX_REF, 75 STAC_DELL_M6_AMIC, 76 STAC_DELL_M6_DMIC, 77 STAC_DELL_M6_BOTH, 72 STAC_DELL_M6, 78 73 STAC_DELL_EQ, 79 74 STAC_92HD73XX_MODELS … … 89 84 STAC_DELL_M4_1, 90 85 STAC_DELL_M4_2, 91 STAC_DELL_M4_3,92 86 STAC_HP_M4, 93 STAC_HP_DV5,94 87 STAC_92HD71BXX_MODELS 95 88 }; … … 97 90 enum { 98 91 STAC_925x_REF, 99 STAC_M1,100 STAC_M1_2,101 STAC_M2,102 92 STAC_M2_2, 103 STAC_M3, 104 STAC_M5, 105 STAC_M6, 93 STAC_MA6, 94 STAC_PA6, 106 95 STAC_925x_MODELS 107 96 }; … … 135 124 136 125 enum { 137 STAC_D965_REF_NO_JD, /* no jack-detection */138 126 STAC_D965_REF, 139 127 STAC_D965_3ST, … … 146 134 struct sigmatel_event { 147 135 hda_nid_t nid; 148 unsigned char type;149 unsigned char tag;150 136 int data; 151 137 }; … … 162 148 163 149 int board_config; 164 unsigned int eapd_switch: 1;165 150 unsigned int surr_switch: 1; 151 unsigned int line_switch: 1; 152 unsigned int mic_switch: 1; 166 153 unsigned int alt_switch: 1; 167 154 unsigned int hp_detect: 1; … … 200 187 struct hda_multi_out multiout; 201 188 hda_nid_t dac_nids[5]; 202 hda_nid_t hp_dacs[5];203 hda_nid_t speaker_dacs[5];204 189 205 190 /* capture */ … … 225 210 unsigned int num_pins; 226 211 unsigned int *pin_configs; 212 unsigned int *bios_pin_configs; 227 213 228 214 /* codec specific stuff */ … … 245 231 unsigned int io_switch[2]; 246 232 unsigned int clfe_swap; 247 hda_nid_t line_switch; /* shared line-in for input and output */ 248 hda_nid_t mic_switch; /* shared mic-in for input and output */ 249 hda_nid_t hp_switch; /* NID of HP as line-out */ 233 unsigned int hp_switch; 250 234 unsigned int aloopback; 251 235 … … 298 282 299 283 #define STAC92HD73_DAC_COUNT 5 284 static hda_nid_t stac92hd73xx_dac_nids[STAC92HD73_DAC_COUNT] = { 285 0x15, 0x16, 0x17, 0x18, 0x19, 286 }; 300 287 301 288 static hda_nid_t stac92hd73xx_mux_nids[4] = { … … 316 303 }; 317 304 305 #define STAC92HD81_DAC_COUNT 2 318 306 #define STAC92HD83_DAC_COUNT 3 307 static hda_nid_t stac92hd83xxx_dac_nids[STAC92HD73_DAC_COUNT] = { 308 0x13, 0x14, 0x22, 309 }; 319 310 320 311 static hda_nid_t stac92hd83xxx_dmux_nids[2] = { … … 335 326 336 327 static unsigned int stac92hd83xxx_pwr_mapping[4] = { 337 0x03, 0x0c, 0x20, 0x80, 338 }; 339 340 static hda_nid_t stac92hd83xxx_amp_nids[1] = { 341 0xc, 328 0x03, 0x0c, 0x10, 0x40, 342 329 }; 343 330 … … 360 347 static hda_nid_t stac92hd71bxx_smux_nids[2] = { 361 348 0x24, 0x25, 349 }; 350 351 static hda_nid_t stac92hd71bxx_dac_nids[1] = { 352 0x10, /*0x11, */ 362 353 }; 363 354 … … 593 584 nid = codec->slave_dig_outs[smux_idx - 1]; 594 585 if (spec->cur_smux[smux_idx] == smux->num_items - 1) 595 val = HDA_AMP_MUTE;586 val = AMP_OUT_MUTE; 596 587 else 597 val = 0;588 val = AMP_OUT_UNMUTE; 598 589 /* un/mute SPDIF out */ 599 snd_hda_codec_ amp_stereo(codec, nid, HDA_OUTPUT, 0,600 HDA_AMP_MUTE, val);590 snd_hda_codec_write_cache(codec, nid, 0, 591 AC_VERB_SET_AMP_GAIN_MUTE, val); 601 592 } 602 593 return 0; … … 763 754 /* set master volume and direct control */ 764 755 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, 756 /* setup audio connections */ 757 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00}, 758 { 0x10, AC_VERB_SET_CONNECT_SEL, 0x01}, 759 { 0x11, AC_VERB_SET_CONNECT_SEL, 0x02}, 765 760 /* setup adcs to point to mixer */ 766 761 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b}, … … 781 776 * and direct control */ 782 777 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xec}, 778 /* setup audio connections */ 779 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, 780 { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x02}, 781 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x01}, 783 782 /* setup adcs to point to mixer */ 784 783 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b}, … … 794 793 static struct hda_verb dell_m6_core_init[] = { 795 794 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, 795 /* setup audio connections */ 796 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x00}, 797 { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x01}, 798 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x02}, 796 799 /* setup adcs to point to mixer */ 797 800 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b}, … … 808 811 /* set master volume and direct control */ 809 812 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, 813 /* setup audio connections */ 814 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00}, 815 { 0x10, AC_VERB_SET_CONNECT_SEL, 0x01}, 816 { 0x11, AC_VERB_SET_CONNECT_SEL, 0x02}, 817 /* connect hp ports to dac3 */ 818 { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x03}, 819 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x03}, 810 820 /* setup adcs to point to mixer */ 811 821 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b}, … … 825 835 /* set master volume and direct control */ 826 836 { 0x1f, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, 837 /* setup audio connections */ 838 { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x00 }, 839 { 0x10, AC_VERB_SET_CONNECT_SEL, 0x01 }, 840 { 0x11, AC_VERB_SET_CONNECT_SEL, 0x02 }, 827 841 /* dac3 is connected to import3 mux */ 828 842 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0xb07f}, 843 /* connect hp ports to dac4 */ 844 { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x04}, 845 { 0x0d, AC_VERB_SET_CONNECT_SEL, 0x04}, 829 846 /* setup adcs to point to mixer */ 830 847 { 0x20, AC_VERB_SET_CONNECT_SEL, 0x0b}, … … 852 869 /* power state controls amps */ 853 870 { 0x01, AC_VERB_SET_EAPD, 1 << 2}, 854 {0}855 871 }; 856 872 … … 858 874 /* set master volume and direct control */ 859 875 { 0x28, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, 876 /* connect headphone jack to dac1 */ 877 { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x01}, 860 878 /* unmute right and left channels for nodes 0x0a, 0xd, 0x0f */ 861 879 { 0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 862 880 { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 863 881 { 0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, 864 {0}865 882 }; 866 883 … … 877 894 /* set master volume and direct control */ 878 895 { 0x28, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, 896 /* connect headphone jack to dac1 */ 897 { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x01}, 879 898 /* unmute right and left channels for nodes 0x0a, 0xd */ 880 899 { 0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, … … 886 905 /* set dac0mux for dac converter */ 887 906 { 0x06, AC_VERB_SET_CONNECT_SEL, 0x00}, 888 /* mute the master volume */889 { 0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },890 907 {0} 891 908 }; … … 1078 1095 HDA_CODEC_MUTE_IDX("Capture Switch", 0x1, 0x18, 0x0, HDA_OUTPUT), 1079 1096 1080 HDA_CODEC_VOLUME("DAC0 Capture Volume", 0x1b, 0 x3, HDA_INPUT),1081 HDA_CODEC_MUTE("DAC0 Capture Switch", 0x1b, 0 x3, HDA_INPUT),1082 1083 HDA_CODEC_VOLUME("DAC1 Capture Volume", 0x1b, 0x 4, HDA_INPUT),1084 HDA_CODEC_MUTE("DAC1 Capture Switch", 0x1b, 0x 4, HDA_INPUT),1085 1086 HDA_CODEC_VOLUME("Front Mic Capture Volume", 0x1b, 0x 0, HDA_INPUT),1087 HDA_CODEC_MUTE("Front Mic Capture Switch", 0x1b, 0x 0, HDA_INPUT),1088 1089 HDA_CODEC_VOLUME("Line In Capture Volume", 0x1b, 0x 2, HDA_INPUT),1090 HDA_CODEC_MUTE("Line In Capture Switch", 0x1b, 0x 2, HDA_INPUT),1097 HDA_CODEC_VOLUME("DAC0 Capture Volume", 0x1b, 0, HDA_INPUT), 1098 HDA_CODEC_MUTE("DAC0 Capture Switch", 0x1b, 0, HDA_INPUT), 1099 1100 HDA_CODEC_VOLUME("DAC1 Capture Volume", 0x1b, 0x1, HDA_INPUT), 1101 HDA_CODEC_MUTE("DAC1 Capture Switch", 0x1b, 0x1, HDA_INPUT), 1102 1103 HDA_CODEC_VOLUME("Front Mic Capture Volume", 0x1b, 0x2, HDA_INPUT), 1104 HDA_CODEC_MUTE("Front Mic Capture Switch", 0x1b, 0x2, HDA_INPUT), 1105 1106 HDA_CODEC_VOLUME("Line In Capture Volume", 0x1b, 0x3, HDA_INPUT), 1107 HDA_CODEC_MUTE("Line In Capture Switch", 0x1b, 0x3, HDA_INPUT), 1091 1108 1092 1109 /* 1093 HDA_CODEC_VOLUME("Mic Capture Volume", 0x1b, 0x 1, HDA_INPUT),1094 HDA_CODEC_MUTE("Mic Capture Switch", 0x1b 0x 1, HDA_INPUT),1110 HDA_CODEC_VOLUME("Mic Capture Volume", 0x1b, 0x4, HDA_INPUT), 1111 HDA_CODEC_MUTE("Mic Capture Switch", 0x1b 0x4, HDA_INPUT), 1095 1112 */ 1096 1113 {0} /* end */ … … 1139 1156 1140 1157 static struct snd_kcontrol_new stac925x_mixer[] = { 1141 HDA_CODEC_VOLUME("Master Playback Volume", 0x0e, 0, HDA_OUTPUT),1142 HDA_CODEC_MUTE("Master Playback Switch", 0x0e, 0, HDA_OUTPUT),1143 1158 STAC_INPUT_SOURCE(1), 1144 1159 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_OUTPUT), … … 1234 1249 1235 1250 static void stac92xx_free_kctls(struct hda_codec *codec); 1236 static int stac92xx_add_jack(struct hda_codec *codec, hda_nid_t nid, int type);1237 1251 1238 1252 static int stac92xx_build_controls(struct hda_codec *codec) 1239 1253 { 1240 1254 struct sigmatel_spec *spec = codec->spec; 1241 struct auto_pin_cfg *cfg = &spec->autocfg;1242 hda_nid_t nid;1243 1255 int err; 1244 1256 int i; … … 1271 1283 } 1272 1284 stac_smux_mixer.count = spec->num_smuxes; 1273 err = snd_ hda_ctl_add(codec,1285 err = snd_ctl_add(codec->bus->card, 1274 1286 snd_ctl_new1(&stac_smux_mixer, codec)); 1275 1287 if (err < 0) … … 1311 1323 1312 1324 stac92xx_free_kctls(codec); /* no longer needed */ 1313 1314 /* create jack input elements */1315 if (spec->hp_detect) {1316 for (i = 0; i < cfg->hp_outs; i++) {1317 int type = SND_JACK_HEADPHONE;1318 nid = cfg->hp_pins[i];1319 /* jack detection */1320 if (cfg->hp_outs == i)1321 type |= SND_JACK_LINEOUT;1322 err = stac92xx_add_jack(codec, nid, type);1323 if (err < 0)1324 return err;1325 }1326 }1327 for (i = 0; i < cfg->line_outs; i++) {1328 err = stac92xx_add_jack(codec, cfg->line_out_pins[i],1329 SND_JACK_LINEOUT);1330 if (err < 0)1331 return err;1332 }1333 for (i = 0; i < AUTO_PIN_LAST; i++) {1334 nid = cfg->input_pins[i];1335 if (nid) {1336 err = stac92xx_add_jack(codec, nid,1337 SND_JACK_MICROPHONE);1338 if (err < 0)1339 return err;1340 }1341 }1342 1343 1325 return 0; 1344 1326 } … … 1349 1331 }; 1350 1332 1351 static unsigned int gateway9200_m4_pin_configs[8] = { 1352 0x400000fe, 0x404500f4, 0x400100f0, 0x90110010, 1353 0x400100f1, 0x02a1902e, 0x500000f2, 0x500000f3, 1354 }; 1355 static unsigned int gateway9200_m4_2_pin_configs[8] = { 1356 0x400000fe, 0x404500f4, 0x400100f0, 0x90110010, 1357 0x400100f1, 0x02a1902e, 0x500000f2, 0x500000f3, 1358 }; 1359 1360 /* 1333 /* 1361 1334 STAC 9200 pin configs for 1362 1335 102801A8 … … 1488 1461 [STAC_9200_DELL_M26] = dell9200_m26_pin_configs, 1489 1462 [STAC_9200_DELL_M27] = dell9200_m27_pin_configs, 1490 [STAC_9200_M4] = gateway9200_m4_pin_configs,1491 [STAC_9200_M4_2] = gateway9200_m4_2_pin_configs,1492 1463 [STAC_9200_PANASONIC] = ref9200_pin_configs, 1493 1464 }; … … 1506 1477 [STAC_9200_DELL_M26] = "dell-m26", 1507 1478 [STAC_9200_DELL_M27] = "dell-m27", 1508 [STAC_9200_M4] = "gateway-m4", 1509 [STAC_9200_M4_2] = "gateway-m4-2", 1479 [STAC_9200_GATEWAY] = "gateway", 1510 1480 [STAC_9200_PANASONIC] = "panasonic", 1511 1481 }; … … 1577 1547 SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-74", STAC_9200_PANASONIC), 1578 1548 /* Gateway machines needs EAPD to be set on resume */ 1579 SND_PCI_QUIRK(0x107b, 0x0205, "Gateway S-7110M", STAC_9200_M4), 1580 SND_PCI_QUIRK(0x107b, 0x0317, "Gateway MT3423, MX341*", STAC_9200_M4_2), 1581 SND_PCI_QUIRK(0x107b, 0x0318, "Gateway ML3019, MT3707", STAC_9200_M4_2), 1549 SND_PCI_QUIRK(0x107b, 0x0205, "Gateway S-7110M", STAC_9200_GATEWAY), 1550 SND_PCI_QUIRK(0x107b, 0x0317, "Gateway MT3423, MX341*", 1551 STAC_9200_GATEWAY), 1552 SND_PCI_QUIRK(0x107b, 0x0318, "Gateway ML3019, MT3707", 1553 STAC_9200_GATEWAY), 1582 1554 /* OQO Mobile */ 1583 1555 SND_PCI_QUIRK(0x1106, 0x3288, "OQO Model 2", STAC_9200_OQO), … … 1590 1562 }; 1591 1563 1592 static unsigned int stac925xM1_pin_configs[8] = { 1593 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020, 1594 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e, 1595 }; 1596 1597 static unsigned int stac925xM1_2_pin_configs[8] = { 1598 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020, 1599 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e, 1600 }; 1601 1602 static unsigned int stac925xM2_pin_configs[8] = { 1603 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020, 1604 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e, 1564 static unsigned int stac925x_MA6_pin_configs[8] = { 1565 0x40c003f0, 0x424503f2, 0x01813022, 0x02a19021, 1566 0x90a70320, 0x90100211, 0x400003f1, 0x9033032e, 1567 }; 1568 1569 static unsigned int stac925x_PA6_pin_configs[8] = { 1570 0x40c003f0, 0x424503f2, 0x01813022, 0x02a19021, 1571 0x50a103f0, 0x90100211, 0x400003f1, 0x9033032e, 1605 1572 }; 1606 1573 1607 1574 static unsigned int stac925xM2_2_pin_configs[8] = { 1608 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020, 1609 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e, 1610 }; 1611 1612 static unsigned int stac925xM3_pin_configs[8] = { 1613 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020, 1614 0x40a000f0, 0x90100210, 0x400003f1, 0x503303f3, 1615 }; 1616 1617 static unsigned int stac925xM5_pin_configs[8] = { 1618 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020, 1619 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e, 1620 }; 1621 1622 static unsigned int stac925xM6_pin_configs[8] = { 1623 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020, 1624 0x40a000f0, 0x90100210, 0x400003f1, 0x90330320, 1575 0x40c003f3, 0x424503f2, 0x04180011, 0x02a19020, 1576 0x50a103f0, 0x90100212, 0x400003f1, 0x9033032e, 1625 1577 }; 1626 1578 1627 1579 static unsigned int *stac925x_brd_tbl[STAC_925x_MODELS] = { 1628 1580 [STAC_REF] = ref925x_pin_configs, 1629 [STAC_M1] = stac925xM1_pin_configs,1630 [STAC_M1_2] = stac925xM1_2_pin_configs,1631 [STAC_M2] = stac925xM2_pin_configs,1632 1581 [STAC_M2_2] = stac925xM2_2_pin_configs, 1633 [STAC_M3] = stac925xM3_pin_configs, 1634 [STAC_M5] = stac925xM5_pin_configs, 1635 [STAC_M6] = stac925xM6_pin_configs, 1582 [STAC_MA6] = stac925x_MA6_pin_configs, 1583 [STAC_PA6] = stac925x_PA6_pin_configs, 1636 1584 }; 1637 1585 1638 1586 static const char *stac925x_models[STAC_925x_MODELS] = { 1639 1587 [STAC_REF] = "ref", 1640 [STAC_M1] = "m1",1641 [STAC_M1_2] = "m1-2",1642 [STAC_M2] = "m2",1643 1588 [STAC_M2_2] = "m2-2", 1644 [STAC_M3] = "m3", 1645 [STAC_M5] = "m5", 1646 [STAC_M6] = "m6", 1647 }; 1648 1649 static struct snd_pci_quirk stac925x_codec_id_cfg_tbl[] = { 1650 SND_PCI_QUIRK(0x107b, 0x0316, "Gateway M255", STAC_M2), 1651 SND_PCI_QUIRK(0x107b, 0x0366, "Gateway MP6954", STAC_M5), 1652 SND_PCI_QUIRK(0x107b, 0x0461, "Gateway NX560XL", STAC_M1), 1653 SND_PCI_QUIRK(0x107b, 0x0681, "Gateway NX860", STAC_M2), 1654 SND_PCI_QUIRK(0x107b, 0x0367, "Gateway MX6453", STAC_M1_2), 1655 /* Not sure about the brand name for those */ 1656 SND_PCI_QUIRK(0x107b, 0x0281, "Gateway mobile", STAC_M1), 1657 SND_PCI_QUIRK(0x107b, 0x0507, "Gateway mobile", STAC_M3), 1658 SND_PCI_QUIRK(0x107b, 0x0281, "Gateway mobile", STAC_M6), 1659 SND_PCI_QUIRK(0x107b, 0x0685, "Gateway mobile", STAC_M2_2), 1660 {0} /* terminator */ 1589 [STAC_MA6] = "m6", 1590 [STAC_PA6] = "pa6", 1661 1591 }; 1662 1592 … … 1665 1595 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, "DFI LanParty", STAC_REF), 1666 1596 SND_PCI_QUIRK(0x8384, 0x7632, "Stac9202 Reference Board", STAC_REF), 1667 1668 /* Default table for unknown ID */ 1669 SND_PCI_QUIRK(0x1002, 0x437b, "Gateway mobile", STAC_M2_2), 1670 1597 SND_PCI_QUIRK(0x107b, 0x0316, "Gateway M255", STAC_REF), 1598 SND_PCI_QUIRK(0x107b, 0x0366, "Gateway MP6954", STAC_REF), 1599 SND_PCI_QUIRK(0x107b, 0x0461, "Gateway NX560XL", STAC_MA6), 1600 SND_PCI_QUIRK(0x107b, 0x0681, "Gateway NX860", STAC_PA6), 1601 SND_PCI_QUIRK(0x1002, 0x437b, "Gateway MX6453", STAC_M2_2), 1671 1602 {0} /* terminator */ 1672 1603 }; … … 1688 1619 static unsigned int *stac92hd73xx_brd_tbl[STAC_92HD73XX_MODELS] = { 1689 1620 [STAC_92HD73XX_REF] = ref92hd73xx_pin_configs, 1690 [STAC_DELL_M6_AMIC] = dell_m6_pin_configs, 1691 [STAC_DELL_M6_DMIC] = dell_m6_pin_configs, 1692 [STAC_DELL_M6_BOTH] = dell_m6_pin_configs, 1621 [STAC_DELL_M6] = dell_m6_pin_configs, 1693 1622 [STAC_DELL_EQ] = dell_m6_pin_configs, 1694 1623 }; 1695 1624 1696 1625 static const char *stac92hd73xx_models[STAC_92HD73XX_MODELS] = { 1697 [STAC_92HD73XX_NO_JD] = "no-jd",1698 1626 [STAC_92HD73XX_REF] = "ref", 1699 [STAC_DELL_M6_AMIC] = "dell-m6-amic", 1700 [STAC_DELL_M6_DMIC] = "dell-m6-dmic", 1701 [STAC_DELL_M6_BOTH] = "dell-m6", 1627 [STAC_DELL_M6] = "dell-m6", 1702 1628 [STAC_DELL_EQ] = "dell-eq", 1703 1629 }; … … 1708 1634 "DFI LanParty", STAC_92HD73XX_REF), 1709 1635 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0254, 1710 " Dell Studio 1535", STAC_DELL_M6_DMIC),1636 "unknown Dell", STAC_DELL_M6), 1711 1637 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0255, 1712 "unknown Dell", STAC_DELL_M6 _DMIC),1638 "unknown Dell", STAC_DELL_M6), 1713 1639 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0256, 1714 "unknown Dell", STAC_DELL_M6 _BOTH),1640 "unknown Dell", STAC_DELL_M6), 1715 1641 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0257, 1716 "unknown Dell", STAC_DELL_M6 _BOTH),1642 "unknown Dell", STAC_DELL_M6), 1717 1643 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x025e, 1718 "unknown Dell", STAC_DELL_M6 _AMIC),1644 "unknown Dell", STAC_DELL_M6), 1719 1645 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x025f, 1720 "unknown Dell", STAC_DELL_M6 _AMIC),1646 "unknown Dell", STAC_DELL_M6), 1721 1647 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0271, 1722 "unknown Dell", STAC_DELL_M6_DMIC), 1723 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0272, 1724 "unknown Dell", STAC_DELL_M6_DMIC), 1725 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x029f, 1726 "Dell Studio 1537", STAC_DELL_M6_DMIC), 1727 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02a0, 1728 "Dell Studio 17", STAC_DELL_M6_DMIC), 1648 "unknown Dell", STAC_DELL_M6), 1729 1649 {0} /* terminator */ 1730 1650 }; … … 1748 1668 /* SigmaTel reference board */ 1749 1669 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, 1750 "DFI LanParty", STAC_92HD83XXX_REF), 1751 {0} /* terminator */ 1670 "DFI LanParty", STAC_92HD71BXX_REF), 1752 1671 }; 1753 1672 … … 1770 1689 }; 1771 1690 1772 static unsigned int dell_m4_3_pin_configs[11] = {1773 0x0421101f, 0x04a11221, 0x90a70330, 0x90170110,1774 0x40f000f0, 0x40f000f0, 0x40f000f0, 0x90a000f0,1775 0x40f000f0, 0x044413b0, 0x044413b0,1776 };1777 1778 1691 static unsigned int *stac92hd71bxx_brd_tbl[STAC_92HD71BXX_MODELS] = { 1779 1692 [STAC_92HD71BXX_REF] = ref92hd71bxx_pin_configs, 1780 1693 [STAC_DELL_M4_1] = dell_m4_1_pin_configs, 1781 1694 [STAC_DELL_M4_2] = dell_m4_2_pin_configs, 1782 [STAC_DELL_M4_3] = dell_m4_3_pin_configs,1783 1695 [STAC_HP_M4] = NULL, 1784 [STAC_HP_DV5] = NULL,1785 1696 }; 1786 1697 … … 1789 1700 [STAC_DELL_M4_1] = "dell-m4-1", 1790 1701 [STAC_DELL_M4_2] = "dell-m4-2", 1791 [STAC_DELL_M4_3] = "dell-m4-3",1792 1702 [STAC_HP_M4] = "hp-m4", 1793 [STAC_HP_DV5] = "hp-dv5",1794 1703 }; 1795 1704 … … 1798 1707 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, 1799 1708 "DFI LanParty", STAC_92HD71BXX_REF), 1800 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30f2,1801 "HP dv5", STAC_HP_M4),1802 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30f4,1803 "HP dv7", STAC_HP_M4),1804 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x30fc,1805 "HP dv7", STAC_HP_M4),1806 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3603,1807 "HP dv5", STAC_HP_DV5),1808 1709 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x361a, 1809 1710 "unknown HP", STAC_HP_M4), … … 1830 1731 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0264, 1831 1732 "unknown Dell", STAC_DELL_M4_2), 1832 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02aa,1833 "unknown Dell", STAC_DELL_M4_3),1834 1733 {0} /* terminator */ 1835 1734 }; … … 2121 2020 2122 2021 static unsigned int *stac927x_brd_tbl[STAC_927X_MODELS] = { 2123 [STAC_D965_REF_NO_JD] = ref927x_pin_configs,2124 2022 [STAC_D965_REF] = ref927x_pin_configs, 2125 2023 [STAC_D965_3ST] = d965_3st_pin_configs, … … 2130 2028 2131 2029 static const char *stac927x_models[STAC_927X_MODELS] = { 2132 [STAC_D965_REF_NO_JD] = "ref-no-jd",2133 2030 [STAC_D965_REF] = "ref", 2134 2031 [STAC_D965_3ST] = "3stack", … … 2289 2186 struct sigmatel_spec *spec = codec->spec; 2290 2187 2291 kfree(spec->pin_configs); 2292 spec->pin_configs = kcalloc(spec->num_pins, sizeof(*spec->pin_configs), 2293 GFP_KERNEL); 2294 if (!spec->pin_configs) 2295 return -ENOMEM; 2188 if (! spec->bios_pin_configs) { 2189 spec->bios_pin_configs = kcalloc(spec->num_pins, 2190 sizeof(*spec->bios_pin_configs), GFP_KERNEL); 2191 if (! spec->bios_pin_configs) 2192 return -ENOMEM; 2193 } 2296 2194 2297 2195 for (i = 0; i < spec->num_pins; i++) { … … 2303 2201 snd_printdd(KERN_INFO "hda_codec: pin nid %2.2x bios pin config %8.8x\n", 2304 2202 nid, pin_cfg); 2305 spec-> pin_configs[i] = pin_cfg;2203 spec->bios_pin_configs[i] = pin_cfg; 2306 2204 } 2307 2205 … … 2345 2243 } 2346 2244 2347 static int stac_save_pin_cfgs(struct hda_codec *codec, unsigned int *pins)2348 {2349 struct sigmatel_spec *spec = codec->spec;2350 2351 if (!pins)2352 return stac92xx_save_bios_config_regs(codec);2353 2354 kfree(spec->pin_configs);2355 spec->pin_configs = kmemdup(pins,2356 spec->num_pins * sizeof(*pins),2357 GFP_KERNEL);2358 if (!spec->pin_configs)2359 return -ENOMEM;2360 2361 stac92xx_set_config_regs(codec);2362 return 0;2363 }2364 2365 static void stac_change_pin_config(struct hda_codec *codec, hda_nid_t nid,2366 unsigned int cfg)2367 {2368 struct sigmatel_spec *spec = codec->spec;2369 int i;2370 2371 for (i = 0; i < spec->num_pins; i++) {2372 if (spec->pin_nids[i] == nid) {2373 spec->pin_configs[i] = cfg;2374 stac92xx_set_config_reg(codec, nid, cfg);2375 break;2376 }2377 }2378 }2379 2380 2245 /* 2381 2246 * Analog playback callbacks … … 2455 2320 if (spec->powerdown_adcs) { 2456 2321 msleep(40); 2457 snd_hda_codec_write (codec, nid, 0,2322 snd_hda_codec_write_cache(codec, nid, 0, 2458 2323 AC_VERB_SET_POWER_STATE, AC_PWRST_D0); 2459 2324 } … … 2471 2336 snd_hda_codec_cleanup_stream(codec, nid); 2472 2337 if (spec->powerdown_adcs) 2473 snd_hda_codec_write (codec, nid, 0,2338 snd_hda_codec_write_cache(codec, nid, 0, 2474 2339 AC_VERB_SET_POWER_STATE, AC_PWRST_D3); 2475 2340 return 0; … … 2599 2464 struct sigmatel_spec *spec = codec->spec; 2600 2465 2601 ucontrol->value.integer.value[0] = !!spec->hp_switch;2466 ucontrol->value.integer.value[0] = spec->hp_switch; 2602 2467 return 0; 2603 2468 } 2604 2605 static void stac_issue_unsol_event(struct hda_codec *codec, hda_nid_t nid,2606 unsigned char type);2607 2469 2608 2470 static int stac92xx_hp_switch_put(struct snd_kcontrol *kcontrol, … … 2611 2473 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 2612 2474 struct sigmatel_spec *spec = codec->spec; 2613 int nid = kcontrol->private_value; 2614 2615 spec->hp_switch = ucontrol->value.integer.value[0] ? nid : 0; 2475 struct auto_pin_cfg *cfg = &spec->autocfg; 2476 int nid = cfg->hp_pins[cfg->hp_outs - 1]; 2477 2478 spec->hp_switch = ucontrol->value.integer.value[0]; 2616 2479 2617 2480 /* check to be sure that the ports are upto date with 2618 2481 * switch changes 2619 2482 */ 2620 stac_issue_unsol_event(codec, nid, STAC_HP_EVENT);2483 codec->patch_ops.unsol_event(codec, (STAC_HP_EVENT | nid) << 26); 2621 2484 2622 2485 return 1; … … 2658 2521 */ 2659 2522 if (spec->hp_detect) 2660 stac_issue_unsol_event(codec, nid, STAC_HP_EVENT); 2523 codec->patch_ops.unsol_event(codec, 2524 (STAC_HP_EVENT | nid) << 26); 2661 2525 2662 2526 return 1; … … 2746 2610 2747 2611 /* add dynamic controls */ 2748 static int stac92xx_add_control_temp(struct sigmatel_spec *spec, 2749 struct snd_kcontrol_new *ktemp, 2750 int idx, const char *name, 2751 unsigned long val) 2612 static int stac92xx_add_control_idx(struct sigmatel_spec *spec, int type, 2613 int idx, const char *name, unsigned long val) 2752 2614 { 2753 2615 struct snd_kcontrol_new *knew; … … 2757 2619 if (!knew) 2758 2620 return -ENOMEM; 2759 *knew = *ktemp;2621 *knew = stac92xx_control_templates[type]; 2760 2622 knew->index = idx; 2761 2623 knew->name = kstrdup(name, GFP_KERNEL); 2762 if (! knew->name)2624 if (! knew->name) 2763 2625 return -ENOMEM; 2764 2626 knew->private_value = val; … … 2766 2628 } 2767 2629 2768 static inline int stac92xx_add_control_idx(struct sigmatel_spec *spec,2769 int type, int idx, const char *name,2770 unsigned long val)2771 {2772 return stac92xx_add_control_temp(spec,2773 &stac92xx_control_templates[type],2774 idx, name, val);2775 }2776 2777 2630 2778 2631 /* add dynamic controls */ 2779 static in line int stac92xx_add_control(struct sigmatel_spec *spec, int type,2780 2632 static int stac92xx_add_control(struct sigmatel_spec *spec, int type, 2633 const char *name, unsigned long val) 2781 2634 { 2782 2635 return stac92xx_add_control_idx(spec, type, 0, name, val); 2783 2636 } 2784 2637 2785 /* check whether the line-input can be used as line-out */ 2786 static hda_nid_t check_line_out_switch(struct hda_codec *codec) 2787 { 2788 struct sigmatel_spec *spec = codec->spec; 2789 struct auto_pin_cfg *cfg = &spec->autocfg; 2790 hda_nid_t nid; 2791 unsigned int pincap; 2792 2793 if (cfg->line_out_type != AUTO_PIN_LINE_OUT) 2794 return 0; 2795 nid = cfg->input_pins[AUTO_PIN_LINE]; 2796 pincap = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP); 2797 if (pincap & AC_PINCAP_OUT) 2798 return nid; 2638 /* flag inputs as additional dynamic lineouts */ 2639 static int stac92xx_add_dyn_out_pins(struct hda_codec *codec, struct auto_pin_cfg *cfg) 2640 { 2641 struct sigmatel_spec *spec = codec->spec; 2642 unsigned int wcaps, wtype; 2643 int i, num_dacs = 0; 2644 2645 /* use the wcaps cache to count all DACs available for line-outs */ 2646 for (i = 0; i < codec->num_nodes; i++) { 2647 wcaps = codec->wcaps[i]; 2648 wtype = (wcaps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; 2649 2650 if (wtype == AC_WID_AUD_OUT && !(wcaps & AC_WCAP_DIGITAL)) 2651 num_dacs++; 2652 } 2653 2654 snd_printdd("%s: total dac count=%d\n", __func__, num_dacs); 2655 2656 switch (cfg->line_outs) { 2657 case 3: 2658 /* add line-in as side */ 2659 if (cfg->input_pins[AUTO_PIN_LINE] && num_dacs > 3) { 2660 cfg->line_out_pins[cfg->line_outs] = 2661 cfg->input_pins[AUTO_PIN_LINE]; 2662 spec->line_switch = 1; 2663 cfg->line_outs++; 2664 } 2665 break; 2666 case 2: 2667 /* add line-in as clfe and mic as side */ 2668 if (cfg->input_pins[AUTO_PIN_LINE] && num_dacs > 2) { 2669 cfg->line_out_pins[cfg->line_outs] = 2670 cfg->input_pins[AUTO_PIN_LINE]; 2671 spec->line_switch = 1; 2672 cfg->line_outs++; 2673 } 2674 if (cfg->input_pins[AUTO_PIN_MIC] && num_dacs > 3) { 2675 cfg->line_out_pins[cfg->line_outs] = 2676 cfg->input_pins[AUTO_PIN_MIC]; 2677 spec->mic_switch = 1; 2678 cfg->line_outs++; 2679 } 2680 break; 2681 case 1: 2682 /* add line-in as surr and mic as clfe */ 2683 if (cfg->input_pins[AUTO_PIN_LINE] && num_dacs > 1) { 2684 cfg->line_out_pins[cfg->line_outs] = 2685 cfg->input_pins[AUTO_PIN_LINE]; 2686 spec->line_switch = 1; 2687 cfg->line_outs++; 2688 } 2689 if (cfg->input_pins[AUTO_PIN_MIC] && num_dacs > 2) { 2690 cfg->line_out_pins[cfg->line_outs] = 2691 cfg->input_pins[AUTO_PIN_MIC]; 2692 spec->mic_switch = 1; 2693 cfg->line_outs++; 2694 } 2695 break; 2696 } 2697 2799 2698 return 0; 2800 2699 } 2801 2700 2802 /* check whether the mic-input can be used as line-out */2803 static hda_nid_t check_mic_out_switch(struct hda_codec *codec)2804 {2805 struct sigmatel_spec *spec = codec->spec;2806 struct auto_pin_cfg *cfg = &spec->autocfg;2807 unsigned int def_conf, pincap;2808 unsigned int mic_pin;2809 2810 if (cfg->line_out_type != AUTO_PIN_LINE_OUT)2811 return 0;2812 mic_pin = AUTO_PIN_MIC;2813 for (;;) {2814 hda_nid_t nid = cfg->input_pins[mic_pin];2815 def_conf = snd_hda_codec_read(codec, nid, 0,2816 AC_VERB_GET_CONFIG_DEFAULT, 0);2817 /* some laptops have an internal analog microphone2818 * which can't be used as a output */2819 if (get_defcfg_connect(def_conf) != AC_JACK_PORT_FIXED) {2820 pincap = snd_hda_param_read(codec, nid, AC_PAR_PIN_CAP);2821 if (pincap & AC_PINCAP_OUT)2822 return nid;2823 }2824 if (mic_pin == AUTO_PIN_MIC)2825 mic_pin = AUTO_PIN_FRONT_MIC;2826 else2827 break;2828 }2829 return 0;2830 }2831 2701 2832 2702 static int is_in_dac_nids(struct sigmatel_spec *spec, hda_nid_t nid) … … 2841 2711 return 0; 2842 2712 } 2843 2844 static int check_all_dac_nids(struct sigmatel_spec *spec, hda_nid_t nid)2845 {2846 int i;2847 if (is_in_dac_nids(spec, nid))2848 return 1;2849 for (i = 0; i < spec->autocfg.hp_outs; i++)2850 if (spec->hp_dacs[i] == nid)2851 return 1;2852 for (i = 0; i < spec->autocfg.speaker_outs; i++)2853 if (spec->speaker_dacs[i] == nid)2854 return 1;2855 return 0;2856 }2857 2858 static hda_nid_t get_unassigned_dac(struct hda_codec *codec, hda_nid_t nid)2859 {2860 struct sigmatel_spec *spec = codec->spec;2861 int j, conn_len;2862 hda_nid_t conn[HDA_MAX_CONNECTIONS];2863 unsigned int wcaps, wtype;2864 2865 conn_len = snd_hda_get_connections(codec, nid, conn,2866 HDA_MAX_CONNECTIONS);2867 for (j = 0; j < conn_len; j++) {2868 wcaps = snd_hda_param_read(codec, conn[j],2869 AC_PAR_AUDIO_WIDGET_CAP);2870 wtype = (wcaps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;2871 /* we check only analog outputs */2872 if (wtype != AC_WID_AUD_OUT || (wcaps & AC_WCAP_DIGITAL))2873 continue;2874 /* if this route has a free DAC, assign it */2875 if (!check_all_dac_nids(spec, conn[j])) {2876 if (conn_len > 1) {2877 /* select this DAC in the pin's input mux */2878 snd_hda_codec_write_cache(codec, nid, 0,2879 AC_VERB_SET_CONNECT_SEL, j);2880 }2881 return conn[j];2882 }2883 }2884 return 0;2885 }2886 2887 static int add_spec_dacs(struct sigmatel_spec *spec, hda_nid_t nid);2888 static int add_spec_extra_dacs(struct sigmatel_spec *spec, hda_nid_t nid);2889 2713 2890 2714 /* … … 2895 2719 * and 9202/925x. For those, dac_nids[] must be hard-coded. 2896 2720 */ 2897 static int stac92xx_auto_fill_dac_nids(struct hda_codec *codec) 2898 { 2899 struct sigmatel_spec *spec = codec->spec; 2900 struct auto_pin_cfg *cfg = &spec->autocfg; 2901 int i; 2902 hda_nid_t nid, dac; 2721 static int stac92xx_auto_fill_dac_nids(struct hda_codec *codec, 2722 struct auto_pin_cfg *cfg) 2723 { 2724 struct sigmatel_spec *spec = codec->spec; 2725 int i, j, conn_len = 0; 2726 hda_nid_t nid, conn[HDA_MAX_CONNECTIONS]; 2727 unsigned int wcaps, wtype; 2903 2728 2904 2729 for (i = 0; i < cfg->line_outs; i++) { 2905 2730 nid = cfg->line_out_pins[i]; 2906 dac = get_unassigned_dac(codec, nid); 2907 if (!dac) { 2731 conn_len = snd_hda_get_connections(codec, nid, conn, 2732 HDA_MAX_CONNECTIONS); 2733 for (j = 0; j < conn_len; j++) { 2734 wcaps = snd_hda_param_read(codec, conn[j], 2735 AC_PAR_AUDIO_WIDGET_CAP); 2736 wtype = (wcaps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT; 2737 if (wtype != AC_WID_AUD_OUT || 2738 (wcaps & AC_WCAP_DIGITAL)) 2739 continue; 2740 /* conn[j] is a DAC routed to this line-out */ 2741 if (!is_in_dac_nids(spec, conn[j])) 2742 break; 2743 } 2744 2745 if (j == conn_len) { 2908 2746 if (spec->multiout.num_dacs > 0) { 2909 2747 /* we have already working output pins, … … 2919 2757 return -ENODEV; 2920 2758 } 2921 add_spec_dacs(spec, dac); 2922 } 2923 2924 /* add line-in as output */ 2925 nid = check_line_out_switch(codec); 2926 if (nid) { 2927 dac = get_unassigned_dac(codec, nid); 2928 if (dac) { 2929 snd_printdd("STAC: Add line-in 0x%x as output %d\n", 2930 nid, cfg->line_outs); 2931 cfg->line_out_pins[cfg->line_outs] = nid; 2932 cfg->line_outs++; 2933 spec->line_switch = nid; 2934 add_spec_dacs(spec, dac); 2759 2760 spec->multiout.dac_nids[i] = conn[j]; 2761 spec->multiout.num_dacs++; 2762 if (conn_len > 1) { 2763 /* select this DAC in the pin's input mux */ 2764 snd_hda_codec_write_cache(codec, nid, 0, 2765 AC_VERB_SET_CONNECT_SEL, j); 2766 2935 2767 } 2936 2768 } 2937 /* add mic as output */ 2938 nid = check_mic_out_switch(codec); 2939 if (nid) { 2940 dac = get_unassigned_dac(codec, nid); 2941 if (dac) { 2942 snd_printdd("STAC: Add mic-in 0x%x as output %d\n", 2943 nid, cfg->line_outs); 2944 cfg->line_out_pins[cfg->line_outs] = nid; 2945 cfg->line_outs++; 2946 spec->mic_switch = nid; 2947 add_spec_dacs(spec, dac); 2948 } 2949 } 2950 2951 for (i = 0; i < cfg->hp_outs; i++) { 2952 nid = cfg->hp_pins[i]; 2953 dac = get_unassigned_dac(codec, nid); 2954 if (dac) { 2955 if (!spec->multiout.hp_nid) 2956 spec->multiout.hp_nid = dac; 2957 else 2958 add_spec_extra_dacs(spec, dac); 2959 } 2960 spec->hp_dacs[i] = dac; 2961 } 2962 2963 for (i = 0; i < cfg->speaker_outs; i++) { 2964 nid = cfg->speaker_pins[i]; 2965 dac = get_unassigned_dac(codec, nid); 2966 if (dac) 2967 add_spec_extra_dacs(spec, dac); 2968 spec->speaker_dacs[i] = dac; 2969 } 2970 2971 snd_printd("stac92xx: dac_nids=%d (0x%x/0x%x/0x%x/0x%x/0x%x)\n", 2769 2770 snd_printd("dac_nids=%d (0x%x/0x%x/0x%x/0x%x/0x%x)\n", 2972 2771 spec->multiout.num_dacs, 2973 2772 spec->multiout.dac_nids[0], … … 2976 2775 spec->multiout.dac_nids[3], 2977 2776 spec->multiout.dac_nids[4]); 2978 2979 2777 return 0; 2980 2778 } … … 3001 2799 static int add_spec_dacs(struct sigmatel_spec *spec, hda_nid_t nid) 3002 2800 { 3003 if (spec->multiout.num_dacs > 4) { 2801 if (!spec->multiout.hp_nid) 2802 spec->multiout.hp_nid = nid; 2803 else if (spec->multiout.num_dacs > 4) { 3004 2804 printk(KERN_WARNING "stac92xx: No space for DAC 0x%x\n", nid); 3005 2805 return 1; … … 3011 2811 } 3012 2812 3013 static int add_spec_extra_dacs(struct sigmatel_spec *spec, hda_nid_t nid) 3014 { 3015 int i; 3016 for (i = 0; i < ARRAY_SIZE(spec->multiout.extra_out_nid); i++) { 3017 if (!spec->multiout.extra_out_nid[i]) { 3018 spec->multiout.extra_out_nid[i] = nid; 3019 return 0; 3020 } 3021 } 3022 printk(KERN_WARNING "stac92xx: No space for extra DAC 0x%x\n", nid); 3023 return 1; 3024 } 3025 3026 static int is_unique_dac(struct sigmatel_spec *spec, hda_nid_t nid) 3027 { 3028 int i; 3029 3030 if (spec->autocfg.line_outs != 1) 3031 return 0; 2813 static int check_in_dac_nids(struct sigmatel_spec *spec, hda_nid_t nid) 2814 { 2815 if (is_in_dac_nids(spec, nid)) 2816 return 1; 3032 2817 if (spec->multiout.hp_nid == nid) 3033 return 0; 3034 for (i = 0; i < ARRAY_SIZE(spec->multiout.extra_out_nid); i++) 3035 if (spec->multiout.extra_out_nid[i] == nid) 3036 return 0; 3037 return 1; 2818 return 1; 2819 return 0; 3038 2820 } 3039 2821 … … 3042 2824 const struct auto_pin_cfg *cfg) 3043 2825 { 3044 struct sigmatel_spec *spec = codec->spec;3045 2826 static const char *chname[4] = { 3046 2827 "Front", "Surround", NULL /*CLFE*/, "Side" … … 3048 2829 hda_nid_t nid = 0; 3049 2830 int i, err; 3050 unsigned int wid_caps; 3051 3052 for (i = 0; i < cfg->line_outs && spec->multiout.dac_nids[i]; i++) { 2831 2832 struct sigmatel_spec *spec = codec->spec; 2833 unsigned int wid_caps, pincap; 2834 2835 2836 for (i = 0; i < cfg->line_outs && i < spec->multiout.num_dacs; i++) { 2837 if (!spec->multiout.dac_nids[i]) 2838 continue; 2839 3053 2840 nid = spec->multiout.dac_nids[i]; 2841 3054 2842 if (i == 2) { 3055 2843 /* Center/LFE */ … … 3073 2861 3074 2862 } else { 3075 const char *name = chname[i]; 3076 /* if it's a single DAC, assign a better name */ 3077 if (!i && is_unique_dac(spec, nid)) { 3078 switch (cfg->line_out_type) { 3079 case AUTO_PIN_HP_OUT: 3080 name = "Headphone"; 3081 break; 3082 case AUTO_PIN_SPEAKER_OUT: 3083 name = "Speaker"; 3084 break; 3085 } 3086 } 3087 err = create_controls(spec, name, nid, 3); 2863 err = create_controls(spec, chname[i], nid, 3); 3088 2864 if (err < 0) 3089 2865 return err; … … 3091 2867 } 3092 2868 3093 if (cfg->hp_outs > 1 && cfg->line_out_type == AUTO_PIN_LINE_OUT) { 2869 if ((spec->multiout.num_dacs - cfg->line_outs) > 0 && 2870 cfg->hp_outs && !spec->multiout.hp_nid) 2871 spec->multiout.hp_nid = nid; 2872 2873 if (cfg->hp_outs > 1) { 3094 2874 err = stac92xx_add_control(spec, 3095 2875 STAC_CTL_WIDGET_HP_SWITCH, 3096 "Headphone as Line Out Switch", 3097 cfg->hp_pins[cfg->hp_outs - 1]); 2876 "Headphone as Line Out Switch", 0); 3098 2877 if (err < 0) 3099 2878 return err; … … 3101 2880 3102 2881 if (spec->line_switch) { 3103 err = stac92xx_add_control(spec, STAC_CTL_WIDGET_IO_SWITCH, 3104 "Line In as Output Switch", 3105 spec->line_switch << 8); 3106 if (err < 0) 3107 return err; 2882 nid = cfg->input_pins[AUTO_PIN_LINE]; 2883 pincap = snd_hda_param_read(codec, nid, 2884 AC_PAR_PIN_CAP); 2885 if (pincap & AC_PINCAP_OUT) { 2886 err = stac92xx_add_control(spec, 2887 STAC_CTL_WIDGET_IO_SWITCH, 2888 "Line In as Output Switch", nid << 8); 2889 if (err < 0) 2890 return err; 2891 } 3108 2892 } 3109 2893 3110 2894 if (spec->mic_switch) { 3111 err = stac92xx_add_control(spec, STAC_CTL_WIDGET_IO_SWITCH, 3112 "Mic as Output Switch", 3113 (spec->mic_switch << 8) | 1); 3114 if (err < 0) 3115 return err; 2895 unsigned int def_conf; 2896 unsigned int mic_pin = AUTO_PIN_MIC; 2897 again: 2898 nid = cfg->input_pins[mic_pin]; 2899 def_conf = snd_hda_codec_read(codec, nid, 0, 2900 AC_VERB_GET_CONFIG_DEFAULT, 0); 2901 /* some laptops have an internal analog microphone 2902 * which can't be used as a output */ 2903 if (get_defcfg_connect(def_conf) != AC_JACK_PORT_FIXED) { 2904 pincap = snd_hda_param_read(codec, nid, 2905 AC_PAR_PIN_CAP); 2906 if (pincap & AC_PINCAP_OUT) { 2907 err = stac92xx_add_control(spec, 2908 STAC_CTL_WIDGET_IO_SWITCH, 2909 "Mic as Output Switch", (nid << 8) | 1); 2910 nid = snd_hda_codec_read(codec, nid, 0, 2911 AC_VERB_GET_CONNECT_LIST, 0) & 0xff; 2912 if (!check_in_dac_nids(spec, nid)) 2913 add_spec_dacs(spec, nid); 2914 if (err < 0) 2915 return err; 2916 } 2917 } else if (mic_pin == AUTO_PIN_MIC) { 2918 mic_pin = AUTO_PIN_FRONT_MIC; 2919 goto again; 2920 } 3116 2921 } 3117 2922 … … 3125 2930 struct sigmatel_spec *spec = codec->spec; 3126 2931 hda_nid_t nid; 3127 int i, err, nums;3128 3129 nums = 0;2932 int i, old_num_dacs, err; 2933 2934 old_num_dacs = spec->multiout.num_dacs; 3130 2935 for (i = 0; i < cfg->hp_outs; i++) { 3131 static const char *pfxs[] = {3132 "Headphone", "Headphone2", "Headphone3",3133 };3134 2936 unsigned int wid_caps = get_wcaps(codec, cfg->hp_pins[i]); 3135 2937 if (wid_caps & AC_WCAP_UNSOL_CAP) 3136 2938 spec->hp_detect = 1; 3137 if (nums >= ARRAY_SIZE(pfxs)) 2939 nid = snd_hda_codec_read(codec, cfg->hp_pins[i], 0, 2940 AC_VERB_GET_CONNECT_LIST, 0) & 0xff; 2941 if (check_in_dac_nids(spec, nid)) 2942 nid = 0; 2943 if (! nid) 3138 2944 continue; 3139 nid = spec->hp_dacs[i]; 3140 if (!nid) 2945 add_spec_dacs(spec, nid); 2946 } 2947 for (i = 0; i < cfg->speaker_outs; i++) { 2948 nid = snd_hda_codec_read(codec, cfg->speaker_pins[i], 0, 2949 AC_VERB_GET_CONNECT_LIST, 0) & 0xff; 2950 if (check_in_dac_nids(spec, nid)) 2951 nid = 0; 2952 if (! nid) 3141 2953 continue; 3142 err = create_controls(spec, pfxs[nums++], nid, 3); 3143 if (err < 0) 3144 return err; 3145 } 3146 nums = 0; 3147 for (i = 0; i < cfg->speaker_outs; i++) { 2954 add_spec_dacs(spec, nid); 2955 } 2956 for (i = 0; i < cfg->line_outs; i++) { 2957 nid = snd_hda_codec_read(codec, cfg->line_out_pins[i], 0, 2958 AC_VERB_GET_CONNECT_LIST, 0) & 0xff; 2959 if (check_in_dac_nids(spec, nid)) 2960 nid = 0; 2961 if (! nid) 2962 continue; 2963 add_spec_dacs(spec, nid); 2964 } 2965 for (i = old_num_dacs; i < spec->multiout.num_dacs; i++) { 3148 2966 static const char *pfxs[] = { 3149 2967 "Speaker", "External Speaker", "Speaker2", 3150 2968 }; 3151 if (nums >= ARRAY_SIZE(pfxs)) 3152 continue; 3153 nid = spec->speaker_dacs[i]; 3154 if (!nid) 3155 continue; 3156 err = create_controls(spec, pfxs[nums++], nid, 3); 2969 err = create_controls(spec, pfxs[i - old_num_dacs], 2970 spec->multiout.dac_nids[i], 3); 3157 2971 if (err < 0) 3158 2972 return err; 3159 2973 } 2974 if (spec->multiout.hp_nid) { 2975 err = create_controls(spec, "Headphone", 2976 spec->multiout.hp_nid, 3); 2977 if (err < 0) 2978 return err; 2979 } 2980 3160 2981 return 0; 3161 2982 } … … 3250 3071 return 0; 3251 3072 } 3252 3253 #ifdef CONFIG_SND_HDA_INPUT_BEEP3254 #define stac92xx_dig_beep_switch_info snd_ctl_boolean_mono_info3255 3256 static int stac92xx_dig_beep_switch_get(struct snd_kcontrol *kcontrol,3257 struct snd_ctl_elem_value *ucontrol)3258 {3259 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);3260 ucontrol->value.integer.value[0] = codec->beep->enabled;3261 return 0;3262 }3263 3264 static int stac92xx_dig_beep_switch_put(struct snd_kcontrol *kcontrol,3265 struct snd_ctl_elem_value *ucontrol)3266 {3267 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);3268 int enabled = !!ucontrol->value.integer.value[0];3269 if (codec->beep->enabled != enabled) {3270 codec->beep->enabled = enabled;3271 return 1;3272 }3273 return 0;3274 }3275 3276 static struct snd_kcontrol_new stac92xx_dig_beep_ctrl = {3277 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,3278 .info = stac92xx_dig_beep_switch_info,3279 .get = stac92xx_dig_beep_switch_get,3280 .put = stac92xx_dig_beep_switch_put,3281 };3282 3283 static int stac92xx_beep_switch_ctl(struct hda_codec *codec)3284 {3285 return stac92xx_add_control_temp(codec->spec, &stac92xx_dig_beep_ctrl,3286 0, "PC Beep Playback Switch", 0);3287 }3288 #endif3289 3073 3290 3074 static int stac92xx_auto_create_mux_input_ctls(struct hda_codec *codec) … … 3495 3279 struct sigmatel_spec *spec = codec->spec; 3496 3280 int err; 3281 int hp_speaker_swap = 0; 3497 3282 3498 3283 if ((err = snd_hda_parse_pin_def_config(codec, … … 3512 3297 * HP pins as primary outputs. 3513 3298 */ 3514 snd_printdd("stac92xx: Enabling multi-HPs workaround\n");3515 3299 memcpy(spec->autocfg.speaker_pins, spec->autocfg.line_out_pins, 3516 3300 sizeof(spec->autocfg.line_out_pins)); … … 3519 3303 sizeof(spec->autocfg.hp_pins)); 3520 3304 spec->autocfg.line_outs = spec->autocfg.hp_outs; 3521 spec->autocfg.line_out_type = AUTO_PIN_HP_OUT; 3522 spec->autocfg.hp_outs = 0; 3305 hp_speaker_swap = 1; 3523 3306 } 3524 3307 if (spec->autocfg.mono_out_pin) { … … 3572 3355 } 3573 3356 3574 if (!spec->multiout.num_dacs) { 3575 err = stac92xx_auto_fill_dac_nids(codec); 3576 if (err < 0) 3357 if ((err = stac92xx_add_dyn_out_pins(codec, &spec->autocfg)) < 0) 3358 return err; 3359 if (spec->multiout.num_dacs == 0) 3360 if ((err = stac92xx_auto_fill_dac_nids(codec, &spec->autocfg)) < 0) 3577 3361 return err; 3578 err = stac92xx_auto_create_multi_out_ctls(codec, 3579 3580 if (err < 0) 3581 return err;3582 }3362 3363 err = stac92xx_auto_create_multi_out_ctls(codec, &spec->autocfg); 3364 3365 if (err < 0) 3366 return err; 3583 3367 3584 3368 /* setup analog beep controls */ … … 3594 3378 if (spec->digbeep_nid > 0) { 3595 3379 hda_nid_t nid = spec->digbeep_nid; 3596 unsigned int caps;3597 3380 3598 3381 err = stac92xx_auto_create_beep_ctls(codec, nid); … … 3602 3385 if (err < 0) 3603 3386 return err; 3604 /* if no beep switch is available, make its own one */3605 caps = query_amp_caps(codec, nid, HDA_OUTPUT);3606 if (codec->beep &&3607 !((caps & AC_AMPCAP_MUTE) >> AC_AMPCAP_MUTE_SHIFT)) {3608 err = stac92xx_beep_switch_ctl(codec);3609 if (err < 0)3610 return err;3611 }3612 3387 } 3613 3388 #endif 3389 3390 if (hp_speaker_swap == 1) { 3391 /* Restore the hp_outs and line_outs */ 3392 memcpy(spec->autocfg.hp_pins, spec->autocfg.line_out_pins, 3393 sizeof(spec->autocfg.line_out_pins)); 3394 spec->autocfg.hp_outs = spec->autocfg.line_outs; 3395 memcpy(spec->autocfg.line_out_pins, spec->autocfg.speaker_pins, 3396 sizeof(spec->autocfg.speaker_pins)); 3397 spec->autocfg.line_outs = spec->autocfg.speaker_outs; 3398 memset(spec->autocfg.speaker_pins, 0, 3399 sizeof(spec->autocfg.speaker_pins)); 3400 spec->autocfg.speaker_outs = 0; 3401 } 3614 3402 3615 3403 err = stac92xx_auto_create_hp_ctls(codec, &spec->autocfg); … … 3661 3449 3662 3450 spec->input_mux = &spec->private_imux; 3663 if (!spec->dinput_mux) 3664 spec->dinput_mux = &spec->private_dimux; 3451 spec->dinput_mux = &spec->private_dimux; 3665 3452 spec->sinput_mux = &spec->private_smux; 3666 3453 spec->mono_mux = &spec->private_mono_mux; … … 3755 3542 return err; 3756 3543 3757 if (spec->num_muxes > 0) {3758 err = stac92xx_auto_create_mux_input_ctls(codec);3759 if (err < 0)3760 return err;3761 }3762 3763 3544 if (spec->autocfg.dig_out_pin) 3764 3545 spec->multiout.dig_out_nid = 0x05; … … 3814 3595 hda_nid_t nid, int type) 3815 3596 { 3816 #ifdef CONFIG_SND_JACK3817 3597 struct sigmatel_spec *spec = codec->spec; 3818 3598 struct sigmatel_jack *jack; … … 3838 3618 3839 3619 return snd_jack_new(codec->bus->card, name, type, &jack->jack); 3840 #else 3841 return 0; 3842 #endif 3843 } 3844 3845 static int stac_add_event(struct sigmatel_spec *spec, hda_nid_t nid, 3846 unsigned char type, int data) 3620 } 3621 3622 static int stac92xx_add_event(struct sigmatel_spec *spec, hda_nid_t nid, 3623 int data) 3847 3624 { 3848 3625 struct sigmatel_event *event; … … 3853 3630 return -ENOMEM; 3854 3631 event->nid = nid; 3855 event->type = type;3856 event->tag = spec->events.used;3857 3632 event->data = data; 3858 3633 3859 return event->tag; 3860 } 3861 3862 static struct sigmatel_event *stac_get_event(struct hda_codec *codec, 3863 hda_nid_t nid, unsigned char type) 3864 { 3865 struct sigmatel_spec *spec = codec->spec; 3866 struct sigmatel_event *event = spec->events.list; 3867 int i; 3868 3869 for (i = 0; i < spec->events.used; i++, event++) { 3870 if (event->nid == nid && event->type == type) 3871 return event; 3872 } 3873 return NULL; 3874 } 3875 3876 static struct sigmatel_event *stac_get_event_from_tag(struct hda_codec *codec, 3877 unsigned char tag) 3878 { 3879 struct sigmatel_spec *spec = codec->spec; 3880 struct sigmatel_event *event = spec->events.list; 3881 int i; 3882 3883 for (i = 0; i < spec->events.used; i++, event++) { 3884 if (event->tag == tag) 3885 return event; 3886 } 3887 return NULL; 3634 return 0; 3635 } 3636 3637 static int stac92xx_event_data(struct hda_codec *codec, hda_nid_t nid) 3638 { 3639 struct sigmatel_spec *spec = codec->spec; 3640 struct sigmatel_event *events = spec->events.list; 3641 if (events) { 3642 int i; 3643 for (i = 0; i < spec->events.used; i++) 3644 if (events[i].nid == nid) 3645 return events[i].data; 3646 } 3647 return 0; 3888 3648 } 3889 3649 3890 3650 static void enable_pin_detect(struct hda_codec *codec, hda_nid_t nid, 3891 unsigned int type) 3892 { 3893 struct sigmatel_event *event; 3894 int tag; 3895 3896 if (!(get_wcaps(codec, nid) & AC_WCAP_UNSOL_CAP)) 3897 return; 3898 event = stac_get_event(codec, nid, type); 3899 if (event) 3900 tag = event->tag; 3901 else 3902 tag = stac_add_event(codec->spec, nid, type, 0); 3903 if (tag < 0) 3904 return; 3905 snd_hda_codec_write_cache(codec, nid, 0, 3906 AC_VERB_SET_UNSOLICITED_ENABLE, 3907 AC_USRSP_EN | tag); 3651 unsigned int event) 3652 { 3653 if (get_wcaps(codec, nid) & AC_WCAP_UNSOL_CAP) { 3654 snd_hda_codec_write_cache(codec, nid, 0, 3655 AC_VERB_SET_UNSOLICITED_ENABLE, 3656 (AC_USRSP_EN | event | nid)); 3657 } 3908 3658 } 3909 3659 … … 3925 3675 hda_nid_t *dac; 3926 3676 for (dac = spec->dac_list; *dac; dac++) 3927 if (!check_all_dac_nids(spec, *dac)) 3928 snd_hda_codec_write(codec, *dac, 0, 3677 if (!is_in_dac_nids(spec, *dac) && 3678 spec->multiout.hp_nid != *dac) 3679 snd_hda_codec_write_cache(codec, *dac, 0, 3929 3680 AC_VERB_SET_POWER_STATE, AC_PWRST_D3); 3930 3681 } 3931 3682 3932 static void stac_toggle_power_map(struct hda_codec *codec, hda_nid_t nid,3933 int enable);3934 3935 3683 static int stac92xx_init(struct hda_codec *codec) 3936 3684 { 3937 3685 struct sigmatel_spec *spec = codec->spec; 3938 3686 struct auto_pin_cfg *cfg = &spec->autocfg; 3939 unsigned int gpio; 3940 int i; 3687 int i, err; 3941 3688 3942 3689 snd_hda_sequence_write(codec, spec->init); … … 3945 3692 if (spec->powerdown_adcs) 3946 3693 for (i = 0; i < spec->num_adcs; i++) 3947 snd_hda_codec_write (codec,3694 snd_hda_codec_write_cache(codec, 3948 3695 spec->adc_nids[i], 0, 3949 3696 AC_VERB_SET_POWER_STATE, AC_PWRST_D3); 3950 3951 /* set up GPIO */3952 gpio = spec->gpio_data;3953 /* turn on EAPD statically when spec->eapd_switch isn't set.3954 * otherwise, unsol event will turn it on/off dynamically3955 */3956 if (!spec->eapd_switch)3957 gpio |= spec->eapd_mask;3958 stac_gpio_set(codec, spec->gpio_mask, spec->gpio_dir, gpio);3959 3960 3697 /* set up pins */ 3961 3698 if (spec->hp_detect) { 3962 3699 /* Enable unsolicited responses on the HP widget */ 3963 3700 for (i = 0; i < cfg->hp_outs; i++) { 3701 int type = SND_JACK_HEADPHONE; 3964 3702 hda_nid_t nid = cfg->hp_pins[i]; 3965 enable_pin_detect(codec, nid, STAC_HP_EVENT); 3703 enable_pin_detect(codec, nid, STAC_HP_EVENT | nid); 3704 /* jack detection */ 3705 if (cfg->hp_outs == i) 3706 type |= SND_JACK_LINEOUT; 3707 err = stac92xx_add_jack(codec, nid, type); 3708 if (err < 0) 3709 return err; 3710 3966 3711 } 3967 3712 /* force to enable the first line-out; the others are set up … … 3971 3716 AC_PINCTL_OUT_EN); 3972 3717 /* fake event to set up pins */ 3973 stac_issue_unsol_event(codec, spec->autocfg.hp_pins[0],3974 STAC_HP_EVENT);3718 codec->patch_ops.unsol_event(codec, 3719 (STAC_HP_EVENT | spec->autocfg.hp_pins[0]) << 26); 3975 3720 } else { 3976 3721 stac92xx_auto_init_multi_out(codec); 3977 3722 stac92xx_auto_init_hp_out(codec); 3978 for (i = 0; i < cfg->hp_outs; i++) 3979 stac_toggle_power_map(codec, cfg->hp_pins[i], 1); 3723 } 3724 for (i = 0; i < cfg->line_outs; i++) { 3725 err = stac92xx_add_jack(codec, 3726 cfg->line_out_pins[i], SND_JACK_LINEOUT); 3727 if (err < 0) 3728 return err; 3980 3729 } 3981 3730 for (i = 0; i < AUTO_PIN_LAST; i++) { 3982 3731 hda_nid_t nid = cfg->input_pins[i]; 3983 3732 if (nid) { 3984 unsigned int pinctl, conf; 3985 if (i == AUTO_PIN_MIC || i == AUTO_PIN_FRONT_MIC) { 3986 /* for mic pins, force to initialize */ 3987 pinctl = stac92xx_get_vref(codec, nid); 3988 pinctl |= AC_PINCTL_IN_EN; 3989 stac92xx_auto_set_pinctl(codec, nid, pinctl); 3990 } else { 3991 pinctl = snd_hda_codec_read(codec, nid, 0, 3992 AC_VERB_GET_PIN_WIDGET_CONTROL, 0); 3993 /* if PINCTL already set then skip */ 3994 if (!(pinctl & AC_PINCTL_IN_EN)) { 3995 pinctl |= AC_PINCTL_IN_EN; 3996 stac92xx_auto_set_pinctl(codec, nid, 3997 pinctl); 3998 } 3999 } 4000 conf = snd_hda_codec_read(codec, nid, 0, 4001 AC_VERB_GET_CONFIG_DEFAULT, 0); 4002 if (get_defcfg_connect(conf) != AC_JACK_PORT_FIXED) { 4003 enable_pin_detect(codec, nid, 4004 STAC_INSERT_EVENT); 4005 stac_issue_unsol_event(codec, nid, 4006 STAC_INSERT_EVENT); 4007 } 3733 unsigned int pinctl = snd_hda_codec_read(codec, nid, 3734 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0); 3735 /* if PINCTL already set then skip */ 3736 if (pinctl & AC_PINCAP_IN) 3737 continue; 3738 pinctl = AC_PINCTL_IN_EN; 3739 if (i == AUTO_PIN_MIC || i == AUTO_PIN_FRONT_MIC) 3740 pinctl |= stac92xx_get_vref(codec, nid); 3741 stac92xx_auto_set_pinctl(codec, nid, pinctl); 3742 err = stac92xx_add_jack(codec, nid, 3743 SND_JACK_MICROPHONE); 3744 if (err < 0) 3745 return err; 3746 enable_pin_detect(codec, nid, STAC_INSERT_EVENT | nid); 4008 3747 } 4009 3748 } … … 4011 3750 stac92xx_auto_set_pinctl(codec, spec->dmic_nids[i], 4012 3751 AC_PINCTL_IN_EN); 3752 for (i = 0; i < spec->num_pwrs; i++) { 3753 int event = is_nid_hp_pin(cfg, spec->pwr_nids[i]) 3754 ? STAC_HP_EVENT : STAC_PWR_EVENT; 3755 int pinctl = snd_hda_codec_read(codec, spec->pwr_nids[i], 3756 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0); 3757 int def_conf = snd_hda_codec_read(codec, spec->pwr_nids[i], 3758 0, AC_VERB_GET_CONFIG_DEFAULT, 0); 3759 def_conf = get_defcfg_connect(def_conf); 3760 /* outputs are only ports capable of power management 3761 * any attempts on powering down a input port cause the 3762 * referenced VREF to act quirky. 3763 */ 3764 if (pinctl & AC_PINCTL_IN_EN) 3765 continue; 3766 /* skip any ports that don't have jacks since presence 3767 * detection is useless */ 3768 if (def_conf && def_conf != AC_JACK_PORT_FIXED) 3769 continue; 3770 enable_pin_detect(codec, spec->pwr_nids[i], event | i); 3771 codec->patch_ops.unsol_event(codec, (event | i) << 26); 3772 } 3773 if (spec->dac_list) 3774 stac92xx_power_down(codec); 4013 3775 if (cfg->dig_out_pin) 4014 3776 stac92xx_auto_set_pinctl(codec, cfg->dig_out_pin, … … 4017 3779 stac92xx_auto_set_pinctl(codec, cfg->dig_in_pin, 4018 3780 AC_PINCTL_IN_EN); 4019 for (i = 0; i < spec->num_pwrs; i++) { 4020 hda_nid_t nid = spec->pwr_nids[i]; 4021 int pinctl, def_conf; 4022 4023 /* power on when no jack detection is available */ 4024 if (!spec->hp_detect) { 4025 stac_toggle_power_map(codec, nid, 1); 4026 continue; 4027 } 4028 4029 if (is_nid_hp_pin(cfg, nid)) 4030 continue; /* already has an unsol event */ 4031 4032 pinctl = snd_hda_codec_read(codec, nid, 0, 4033 AC_VERB_GET_PIN_WIDGET_CONTROL, 0); 4034 /* outputs are only ports capable of power management 4035 * any attempts on powering down a input port cause the 4036 * referenced VREF to act quirky. 4037 */ 4038 if (pinctl & AC_PINCTL_IN_EN) { 4039 stac_toggle_power_map(codec, nid, 1); 4040 continue; 4041 } 4042 def_conf = snd_hda_codec_read(codec, nid, 0, 4043 AC_VERB_GET_CONFIG_DEFAULT, 0); 4044 def_conf = get_defcfg_connect(def_conf); 4045 /* skip any ports that don't have jacks since presence 4046 * detection is useless */ 4047 if (def_conf != AC_JACK_PORT_COMPLEX) { 4048 if (def_conf != AC_JACK_PORT_NONE) 4049 stac_toggle_power_map(codec, nid, 1); 4050 continue; 4051 } 4052 if (!stac_get_event(codec, nid, STAC_INSERT_EVENT)) { 4053 enable_pin_detect(codec, nid, STAC_PWR_EVENT); 4054 stac_issue_unsol_event(codec, nid, STAC_PWR_EVENT); 4055 } 4056 } 4057 if (spec->dac_list) 4058 stac92xx_power_down(codec); 3781 3782 stac_gpio_set(codec, spec->gpio_mask, 3783 spec->gpio_dir, spec->gpio_data); 3784 4059 3785 return 0; 4060 3786 } … … 4062 3788 static void stac92xx_free_jacks(struct hda_codec *codec) 4063 3789 { 4064 #ifdef CONFIG_SND_JACK 4065 /* free jack instances manually when clearing/reconfiguring */ 4066 struct sigmatel_spec *spec = codec->spec; 4067 if (!codec->bus->shutdown && spec->jacks.list) { 3790 struct sigmatel_spec *spec = codec->spec; 3791 if (spec->jacks.list) { 4068 3792 struct sigmatel_jack *jacks = spec->jacks.list; 4069 3793 int i; … … 4072 3796 } 4073 3797 snd_array_free(&spec->jacks); 4074 #endif4075 3798 } 4076 3799 … … 4095 3818 return; 4096 3819 4097 kfree(spec->pin_configs); 3820 if (spec->bios_pin_configs) 3821 kfree(spec->bios_pin_configs); 4098 3822 stac92xx_free_jacks(codec); 4099 3823 snd_array_free(&spec->events); … … 4116 3840 */ 4117 3841 struct sigmatel_spec *spec = codec->spec; 4118 if (nid == spec->line_switch || nid == spec->mic_switch) 3842 struct auto_pin_cfg *cfg = &spec->autocfg; 3843 if ((nid == cfg->input_pins[AUTO_PIN_LINE] && 3844 spec->line_switch) || 3845 (nid == cfg->input_pins[AUTO_PIN_MIC] && 3846 spec->mic_switch)) 4119 3847 return; 4120 3848 } … … 4140 3868 } 4141 3869 4142 static int get_ pin_presence(struct hda_codec *codec, hda_nid_t nid)3870 static int get_hp_pin_presence(struct hda_codec *codec, hda_nid_t nid) 4143 3871 { 4144 3872 if (!nid) 4145 3873 return 0; 4146 3874 if (snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PIN_SENSE, 0x00) 4147 & (1 << 31)) 4148 return 1; 3875 & (1 << 31)) { 3876 unsigned int pinctl; 3877 pinctl = snd_hda_codec_read(codec, nid, 0, 3878 AC_VERB_GET_PIN_WIDGET_CONTROL, 0); 3879 if (pinctl & AC_PINCTL_IN_EN) 3880 return 0; /* mic- or line-input */ 3881 else 3882 return 1; /* HP-output */ 3883 } 4149 3884 return 0; 4150 3885 } 4151 3886 4152 /* return non-zero if the hp-pin of the given array index isn't 4153 * a jack-detection target 4154 */ 4155 static int no_hp_sensing(struct sigmatel_spec *spec, int i) 4156 { 3887 static void stac92xx_hp_detect(struct hda_codec *codec, unsigned int res) 3888 { 3889 struct sigmatel_spec *spec = codec->spec; 4157 3890 struct auto_pin_cfg *cfg = &spec->autocfg; 4158 4159 /* ignore sensing of shared line and mic jacks */ 4160 if (cfg->hp_pins[i] == spec->line_switch) 4161 return 1; 4162 if (cfg->hp_pins[i] == spec->mic_switch) 4163 return 1; 4164 /* ignore if the pin is set as line-out */ 4165 if (cfg->hp_pins[i] == spec->hp_switch) 4166 return 1; 4167 return 0; 4168 } 4169 4170 static void stac92xx_hp_detect(struct hda_codec *codec) 4171 { 4172 struct sigmatel_spec *spec = codec->spec; 4173 struct auto_pin_cfg *cfg = &spec->autocfg; 3891 int nid = cfg->hp_pins[cfg->hp_outs - 1]; 4174 3892 int i, presence; 4175 3893 … … 4182 3900 if (presence) 4183 3901 break; 4184 if (no_hp_sensing(spec, i)) 4185 continue; 4186 presence = get_pin_presence(codec, cfg->hp_pins[i]); 4187 if (presence) { 4188 unsigned int pinctl; 4189 pinctl = snd_hda_codec_read(codec, cfg->hp_pins[i], 0, 4190 AC_VERB_GET_PIN_WIDGET_CONTROL, 0); 4191 if (pinctl & AC_PINCTL_IN_EN) 4192 presence = 0; /* mic- or line-input */ 4193 } 3902 if (spec->hp_switch && cfg->hp_pins[i] == nid) 3903 break; 3904 presence = get_hp_pin_presence(codec, cfg->hp_pins[i]); 4194 3905 } 4195 3906 4196 3907 if (presence) { 4197 /* disable lineouts */3908 /* disable lineouts, enable hp */ 4198 3909 if (spec->hp_switch) 4199 stac92xx_reset_pinctl(codec, spec->hp_switch, 4200 AC_PINCTL_OUT_EN); 3910 stac92xx_reset_pinctl(codec, nid, AC_PINCTL_OUT_EN); 4201 3911 for (i = 0; i < cfg->line_outs; i++) 4202 3912 stac92xx_reset_pinctl(codec, cfg->line_out_pins[i], … … 4205 3915 stac92xx_reset_pinctl(codec, cfg->speaker_pins[i], 4206 3916 AC_PINCTL_OUT_EN); 4207 if (spec->eapd_mask && spec->eapd_switch)3917 if (spec->eapd_mask) 4208 3918 stac_gpio_set(codec, spec->gpio_mask, 4209 3919 spec->gpio_dir, spec->gpio_data & 4210 3920 ~spec->eapd_mask); 4211 3921 } else { 4212 /* enable lineouts */3922 /* enable lineouts, disable hp */ 4213 3923 if (spec->hp_switch) 4214 stac92xx_set_pinctl(codec, spec->hp_switch, 4215 AC_PINCTL_OUT_EN); 3924 stac92xx_set_pinctl(codec, nid, AC_PINCTL_OUT_EN); 4216 3925 for (i = 0; i < cfg->line_outs; i++) 4217 3926 stac92xx_set_pinctl(codec, cfg->line_out_pins[i], … … 4220 3929 stac92xx_set_pinctl(codec, cfg->speaker_pins[i], 4221 3930 AC_PINCTL_OUT_EN); 4222 if (spec->eapd_mask && spec->eapd_switch)3931 if (spec->eapd_mask) 4223 3932 stac_gpio_set(codec, spec->gpio_mask, 4224 3933 spec->gpio_dir, spec->gpio_data | 4225 3934 spec->eapd_mask); 4226 3935 } 4227 /* toggle hp outs */ 4228 for (i = 0; i < cfg->hp_outs; i++) { 4229 unsigned int val = AC_PINCTL_OUT_EN | AC_PINCTL_HP_EN; 4230 if (no_hp_sensing(spec, i)) 4231 continue; 4232 if (presence) 4233 stac92xx_set_pinctl(codec, cfg->hp_pins[i], val); 4234 #if 0 /* FIXME */ 4235 /* Resetting the pinctl like below may lead to (a sort of) regressions 4236 * on some devices since they use the HP pin actually for line/speaker 4237 * outs although the default pin config shows a different pin (that is 4238 * wrong and useless). 4239 * 4240 * So, it's basically a problem of default pin configs, likely a BIOS issue. 4241 * But, disabling the code below just works around it, and I'm too tired of 4242 * bug reports with such devices... 4243 */ 4244 else 4245 stac92xx_reset_pinctl(codec, cfg->hp_pins[i], val); 4246 #endif /* FIXME */ 4247 } 3936 if (!spec->hp_switch && cfg->hp_outs > 1 && presence) 3937 stac92xx_set_pinctl(codec, nid, AC_PINCTL_OUT_EN); 4248 3938 } 4249 3939 4250 static void stac_toggle_power_map(struct hda_codec *codec, hda_nid_t nid, 4251 int enable) 4252 { 4253 struct sigmatel_spec *spec = codec->spec; 4254 unsigned int idx, val; 4255 4256 for (idx = 0; idx < spec->num_pwrs; idx++) { 4257 if (spec->pwr_nids[idx] == nid) 4258 break; 4259 } 4260 if (idx >= spec->num_pwrs) 4261 return; 3940 static void stac92xx_pin_sense(struct hda_codec *codec, int idx) 3941 { 3942 struct sigmatel_spec *spec = codec->spec; 3943 hda_nid_t nid = spec->pwr_nids[idx]; 3944 int presence, val; 3945 val = snd_hda_codec_read(codec, codec->afg, 0, 0x0fec, 0x0) 3946 & 0x000000ff; 3947 presence = get_hp_pin_presence(codec, nid); 4262 3948 4263 3949 /* several codecs have two power down bits */ … … 4267 3953 idx = 1 << idx; 4268 3954 4269 val = snd_hda_codec_read(codec, codec->afg, 0, 0x0fec, 0x0) & 0xff; 4270 if (enable) 3955 if (presence) 4271 3956 val &= ~idx; 4272 3957 else … … 4275 3960 /* power down unused output ports */ 4276 3961 snd_hda_codec_write(codec, codec->afg, 0, 0x7ec, val); 4277 }4278 4279 static void stac92xx_pin_sense(struct hda_codec *codec, hda_nid_t nid)4280 {4281 stac_toggle_power_map(codec, nid, get_pin_presence(codec, nid));4282 3962 } 4283 3963 … … 4301 3981 ? SND_JACK_HEADPHONE : SND_JACK_LINEOUT; 4302 3982 snd_jack_report(jacks->jack, 4303 get_ pin_presence(codec, nid)3983 get_hp_pin_presence(codec, nid) 4304 3984 ? type : 0); 4305 3985 } … … 4309 3989 } 4310 3990 4311 static void stac_issue_unsol_event(struct hda_codec *codec, hda_nid_t nid,4312 unsigned char type)4313 {4314 struct sigmatel_event *event = stac_get_event(codec, nid, type);4315 if (!event)4316 return;4317 codec->patch_ops.unsol_event(codec, (unsigned)event->tag << 26);4318 }4319 4320 3991 static void stac92xx_unsol_event(struct hda_codec *codec, unsigned int res) 4321 3992 { 4322 3993 struct sigmatel_spec *spec = codec->spec; 4323 struct sigmatel_event *event; 4324 int tag, data; 4325 4326 tag = (res >> 26) & 0x7f; 4327 event = stac_get_event_from_tag(codec, tag); 4328 if (!event) 4329 return; 4330 4331 switch (event->type) { 3994 int event = (res >> 26) & 0x70; 3995 int nid = res >> 26 & 0x0f; 3996 3997 switch (event) { 4332 3998 case STAC_HP_EVENT: 4333 stac92xx_hp_detect(codec );3999 stac92xx_hp_detect(codec, res); 4334 4000 /* fallthru */ 4335 4001 case STAC_INSERT_EVENT: 4336 4002 case STAC_PWR_EVENT: 4337 if (spec->num_pwrs > 0) 4338 stac92xx_pin_sense(codec, event->nid); 4339 stac92xx_report_jack(codec, event->nid); 4003 if (nid) { 4004 if (spec->num_pwrs > 0) 4005 stac92xx_pin_sense(codec, nid); 4006 stac92xx_report_jack(codec, nid); 4007 } 4340 4008 break; 4341 case STAC_VREF_EVENT: 4342 data = snd_hda_codec_read(codec, codec->afg, 0, 4343 AC_VERB_GET_GPIO_DATA, 0); 4009 case STAC_VREF_EVENT: { 4010 int data = snd_hda_codec_read(codec, codec->afg, 0, 4011 AC_VERB_GET_GPIO_DATA, 0); 4012 int idx = stac92xx_event_data(codec, nid); 4344 4013 /* toggle VREF state based on GPIOx status */ 4345 4014 snd_hda_codec_write(codec, codec->afg, 0, 0x7e0, 4346 !!(data & (1 << event->data)));4015 !!(data & (1 << idx))); 4347 4016 break; 4348 } 4349 } 4350 4351 #ifdef CONFIG_PROC_FS 4352 static void stac92hd_proc_hook(struct snd_info_buffer *buffer, 4353 struct hda_codec *codec, hda_nid_t nid) 4354 { 4355 if (nid == codec->afg) 4356 snd_iprintf(buffer, "Power-Map: 0x%02x\n", 4357 snd_hda_codec_read(codec, nid, 0, 0x0fec, 0x0)); 4358 } 4359 4360 static void analog_loop_proc_hook(struct snd_info_buffer *buffer, 4361 struct hda_codec *codec, 4362 unsigned int verb) 4363 { 4364 snd_iprintf(buffer, "Analog Loopback: 0x%02x\n", 4365 snd_hda_codec_read(codec, codec->afg, 0, verb, 0)); 4366 } 4367 4368 /* stac92hd71bxx, stac92hd73xx */ 4369 static void stac92hd7x_proc_hook(struct snd_info_buffer *buffer, 4370 struct hda_codec *codec, hda_nid_t nid) 4371 { 4372 stac92hd_proc_hook(buffer, codec, nid); 4373 if (nid == codec->afg) 4374 analog_loop_proc_hook(buffer, codec, 0xfa0); 4375 } 4376 4377 static void stac9205_proc_hook(struct snd_info_buffer *buffer, 4378 struct hda_codec *codec, hda_nid_t nid) 4379 { 4380 if (nid == codec->afg) 4381 analog_loop_proc_hook(buffer, codec, 0xfe0); 4382 } 4383 4384 static void stac927x_proc_hook(struct snd_info_buffer *buffer, 4385 struct hda_codec *codec, hda_nid_t nid) 4386 { 4387 if (nid == codec->afg) 4388 analog_loop_proc_hook(buffer, codec, 0xfeb); 4389 } 4390 #else 4391 #define stac92hd_proc_hook NULL 4392 #define stac92hd7x_proc_hook NULL 4393 #define stac9205_proc_hook NULL 4394 #define stac927x_proc_hook NULL 4395 #endif 4017 } 4018 } 4019 } 4396 4020 4397 4021 #ifdef SND_HDA_NEEDS_RESUME … … 4401 4025 4402 4026 stac92xx_set_config_regs(codec); 4403 stac92xx_init(codec); 4027 snd_hda_sequence_write(codec, spec->init); 4028 stac_gpio_set(codec, spec->gpio_mask, 4029 spec->gpio_dir, spec->gpio_data); 4404 4030 snd_hda_codec_resume_amp(codec); 4405 4031 snd_hda_codec_resume_cache(codec); 4406 /* fake event to set up pins again to override cached values */ 4032 /* power down inactive DACs */ 4033 if (spec->dac_list) 4034 stac92xx_power_down(codec); 4035 /* invoke unsolicited event to reset the HP state */ 4407 4036 if (spec->hp_detect) 4408 stac_issue_unsol_event(codec, spec->autocfg.hp_pins[0], 4409 STAC_HP_EVENT); 4410 return 0; 4411 } 4412 4413 static int stac92xx_suspend(struct hda_codec *codec, pm_message_t state) 4414 { 4415 struct sigmatel_spec *spec = codec->spec; 4416 if (spec->eapd_mask) 4417 stac_gpio_set(codec, spec->gpio_mask, 4418 spec->gpio_dir, spec->gpio_data & 4419 ~spec->eapd_mask); 4037 codec->patch_ops.unsol_event(codec, STAC_HP_EVENT << 26); 4420 4038 return 0; 4421 4039 } … … 4429 4047 .unsol_event = stac92xx_unsol_event, 4430 4048 #ifdef SND_HDA_NEEDS_RESUME 4431 .suspend = stac92xx_suspend,4432 4049 .resume = stac92xx_resume, 4433 4050 #endif … … 4452 4069 snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC9200, using BIOS defaults\n"); 4453 4070 err = stac92xx_save_bios_config_regs(codec); 4454 } else 4455 err = stac_save_pin_cfgs(codec, 4456 stac9200_brd_tbl[spec->board_config]); 4457 if (err < 0) { 4458 stac92xx_free(codec); 4459 return err; 4071 if (err < 0) { 4072 stac92xx_free(codec); 4073 return err; 4074 } 4075 spec->pin_configs = spec->bios_pin_configs; 4076 } else { 4077 spec->pin_configs = stac9200_brd_tbl[spec->board_config]; 4078 stac92xx_set_config_regs(codec); 4460 4079 } 4461 4080 … … 4470 4089 spec->num_pwrs = 0; 4471 4090 4472 if (spec->board_config == STAC_9200_M4 || 4473 spec->board_config == STAC_9200_M4_2 || 4091 if (spec->board_config == STAC_9200_GATEWAY || 4474 4092 spec->board_config == STAC_9200_OQO) 4475 4093 spec->init = stac9200_eapd_init; … … 4489 4107 } 4490 4108 4491 /* CF-74 has no headphone detection, and the driver should *NOT*4492 * do detection and HP/speaker toggle because the hardware does it.4493 */4494 if (spec->board_config == STAC_9200_PANASONIC)4495 spec->hp_detect = 0;4496 4497 4109 codec->patch_ops = stac92xx_patch_ops; 4498 4110 … … 4512 4124 spec->num_pins = ARRAY_SIZE(stac925x_pin_nids); 4513 4125 spec->pin_nids = stac925x_pin_nids; 4514 4515 /* Check first for codec ID */ 4516 spec->board_config = snd_hda_check_board_codec_sid_config(codec, 4517 STAC_925x_MODELS, 4518 stac925x_models, 4519 stac925x_codec_id_cfg_tbl); 4520 4521 /* Now checks for PCI ID, if codec ID is not found */ 4522 if (spec->board_config < 0) 4523 spec->board_config = snd_hda_check_board_config(codec, 4524 STAC_925x_MODELS, 4126 spec->board_config = snd_hda_check_board_config(codec, STAC_925x_MODELS, 4525 4127 stac925x_models, 4526 4128 stac925x_cfg_tbl); 4527 4129 again: 4528 4130 if (spec->board_config < 0) { 4529 snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC925x," 4131 snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC925x," 4530 4132 "using BIOS defaults\n"); 4531 4133 err = stac92xx_save_bios_config_regs(codec); 4532 } else 4533 err = stac_save_pin_cfgs(codec, 4534 stac925x_brd_tbl[spec->board_config]); 4535 if (err < 0) { 4536 stac92xx_free(codec); 4537 return err; 4134 if (err < 0) { 4135 stac92xx_free(codec); 4136 return err; 4137 } 4138 spec->pin_configs = spec->bios_pin_configs; 4139 } else if (stac925x_brd_tbl[spec->board_config] != NULL){ 4140 spec->pin_configs = stac925x_brd_tbl[spec->board_config]; 4141 stac92xx_set_config_regs(codec); 4538 4142 } 4539 4143 … … 4599 4203 hda_nid_t conn[STAC92HD73_DAC_COUNT + 2]; 4600 4204 int err = 0; 4601 int num_dacs;4602 4205 4603 4206 spec = kzalloc(sizeof(*spec), GFP_KERNEL); … … 4618 4221 " STAC92HD73XX, using BIOS defaults\n"); 4619 4222 err = stac92xx_save_bios_config_regs(codec); 4620 } else 4621 err = stac_save_pin_cfgs(codec, 4622 stac92hd73xx_brd_tbl[spec->board_config]); 4623 if (err < 0) { 4624 stac92xx_free(codec); 4625 return err; 4626 } 4627 4628 num_dacs = snd_hda_get_connections(codec, 0x0a, 4223 if (err < 0) { 4224 stac92xx_free(codec); 4225 return err; 4226 } 4227 spec->pin_configs = spec->bios_pin_configs; 4228 } else { 4229 spec->pin_configs = stac92hd73xx_brd_tbl[spec->board_config]; 4230 stac92xx_set_config_regs(codec); 4231 } 4232 4233 spec->multiout.num_dacs = snd_hda_get_connections(codec, 0x0a, 4629 4234 conn, STAC92HD73_DAC_COUNT + 2) - 1; 4630 4235 4631 if ( num_dacs < 3 || num_dacs > 5) {4236 if (spec->multiout.num_dacs < 0) { 4632 4237 printk(KERN_WARNING "hda_codec: Could not determine " 4633 4238 "number of channels defaulting to DAC count\n"); 4634 num_dacs = STAC92HD73_DAC_COUNT; 4635 } 4636 switch (num_dacs) { 4239 spec->multiout.num_dacs = STAC92HD73_DAC_COUNT; 4240 } 4241 4242 switch (spec->multiout.num_dacs) { 4637 4243 case 0x3: /* 6 Channel */ 4638 4244 spec->mixer = stac92hd73xx_6ch_mixer; … … 4646 4252 spec->mixer = stac92hd73xx_10ch_mixer; 4647 4253 spec->init = stac92hd73xx_10ch_core_init; 4648 } 4649 spec->multiout.dac_nids = spec->dac_nids; 4650 4254 }; 4255 4256 spec->multiout.dac_nids = stac92hd73xx_dac_nids; 4651 4257 spec->aloopback_mask = 0x01; 4652 4258 spec->aloopback_shift = 8; … … 4671 4277 spec->init = dell_eq_core_init; 4672 4278 /* fallthru */ 4673 case STAC_DELL_M6_AMIC: 4674 case STAC_DELL_M6_DMIC: 4675 case STAC_DELL_M6_BOTH: 4279 case STAC_DELL_M6: 4676 4280 spec->num_smuxes = 0; 4677 4281 spec->mixer = &stac92hd73xx_6ch_mixer[DELL_M6_MIXER]; 4678 4282 spec->amp_nids = &stac92hd73xx_amp_nids[DELL_M6_AMP]; 4679 spec->eapd_switch = 0;4680 4283 spec->num_amps = 1; 4681 4284 4682 if ( spec->board_config != STAC_DELL_EQ)4285 if (!spec->init) 4683 4286 spec->init = dell_m6_core_init; 4684 switch (spec->board_config) { 4685 case STAC_DELL_M6_AMIC: /* Analog Mics */ 4287 switch (codec->subsystem_id) { 4288 case 0x1028025e: /* Analog Mics */ 4289 case 0x1028025f: 4686 4290 stac92xx_set_config_reg(codec, 0x0b, 0x90A70170); 4687 4291 spec->num_dmics = 0; 4688 4292 spec->private_dimux.num_items = 1; 4689 4293 break; 4690 case STAC_DELL_M6_DMIC: /* Digital Mics */ 4294 case 0x10280271: /* Digital Mics */ 4295 case 0x10280272: 4296 case 0x10280254: 4297 case 0x10280255: 4691 4298 stac92xx_set_config_reg(codec, 0x13, 0x90A60160); 4692 4299 spec->num_dmics = 1; 4693 4300 spec->private_dimux.num_items = 2; 4694 4301 break; 4695 case STAC_DELL_M6_BOTH: /* Both */ 4302 case 0x10280256: /* Both */ 4303 case 0x10280057: 4696 4304 stac92xx_set_config_reg(codec, 0x0b, 0x90A70170); 4697 4305 stac92xx_set_config_reg(codec, 0x13, 0x90A60160); … … 4704 4312 spec->num_dmics = STAC92HD73XX_NUM_DMICS; 4705 4313 spec->num_smuxes = ARRAY_SIZE(stac92hd73xx_smux_nids); 4706 spec->eapd_switch = 1;4707 4314 } 4708 4315 if (spec->board_config > STAC_92HD73XX_REF) { … … 4733 4340 } 4734 4341 4735 if (spec->board_config == STAC_92HD73XX_NO_JD)4736 spec->hp_detect = 0;4737 4738 4342 codec->patch_ops = stac92xx_patch_ops; 4739 4740 codec->proc_widget_hook = stac92hd7x_proc_hook;4741 4343 4742 4344 return 0; … … 4769 4371 spec->adc_nids = stac92hd83xxx_adc_nids; 4770 4372 spec->pwr_nids = stac92hd83xxx_pwr_nids; 4771 spec->amp_nids = stac92hd83xxx_amp_nids;4772 4373 spec->pwr_mapping = stac92hd83xxx_pwr_mapping; 4773 4374 spec->num_pwrs = ARRAY_SIZE(stac92hd83xxx_pwr_nids); 4774 spec->multiout.dac_nids = s pec->dac_nids;4375 spec->multiout.dac_nids = stac92hd83xxx_dac_nids; 4775 4376 4776 4377 spec->init = stac92hd83xxx_core_init; 4777 4378 switch (codec->vendor_id) { 4778 4379 case 0x111d7605: 4380 spec->multiout.num_dacs = STAC92HD81_DAC_COUNT; 4779 4381 break; 4780 4382 default: 4781 4383 spec->num_pwrs--; 4782 4384 spec->init++; /* switch to config #2 */ 4385 spec->multiout.num_dacs = STAC92HD83_DAC_COUNT; 4783 4386 } 4784 4387 … … 4787 4390 spec->num_dmuxes = ARRAY_SIZE(stac92hd83xxx_dmux_nids); 4788 4391 spec->num_adcs = ARRAY_SIZE(stac92hd83xxx_adc_nids); 4789 spec->num_amps = ARRAY_SIZE(stac92hd83xxx_amp_nids);4790 4392 spec->num_dmics = STAC92HD83XXX_NUM_DMICS; 4791 4393 spec->dinput_mux = &stac92hd83xxx_dmux; … … 4800 4402 " STAC92HD83XXX, using BIOS defaults\n"); 4801 4403 err = stac92xx_save_bios_config_regs(codec); 4802 } else 4803 err = stac_save_pin_cfgs(codec, 4804 stac92hd83xxx_brd_tbl[spec->board_config]); 4805 if (err < 0) { 4806 stac92xx_free(codec); 4807 return err; 4404 if (err < 0) { 4405 stac92xx_free(codec); 4406 return err; 4407 } 4408 spec->pin_configs = spec->bios_pin_configs; 4409 } else { 4410 spec->pin_configs = stac92hd83xxx_brd_tbl[spec->board_config]; 4411 stac92xx_set_config_regs(codec); 4808 4412 } 4809 4413 … … 4826 4430 codec->patch_ops = stac92xx_patch_ops; 4827 4431 4828 codec->proc_widget_hook = stac92hd_proc_hook;4829 4830 4432 return 0; 4831 4433 } 4434 4435 #ifdef SND_HDA_NEEDS_RESUME 4436 static void stac92hd71xx_set_power_state(struct hda_codec *codec, int pwr) 4437 { 4438 struct sigmatel_spec *spec = codec->spec; 4439 int i; 4440 snd_hda_codec_write_cache(codec, codec->afg, 0, 4441 AC_VERB_SET_POWER_STATE, pwr); 4442 4443 msleep(1); 4444 for (i = 0; i < spec->num_adcs; i++) { 4445 snd_hda_codec_write_cache(codec, 4446 spec->adc_nids[i], 0, 4447 AC_VERB_SET_POWER_STATE, pwr); 4448 } 4449 }; 4450 4451 static int stac92hd71xx_resume(struct hda_codec *codec) 4452 { 4453 stac92hd71xx_set_power_state(codec, AC_PWRST_D0); 4454 return stac92xx_resume(codec); 4455 } 4456 4457 static int stac92hd71xx_suspend(struct hda_codec *codec, pm_message_t state) 4458 { 4459 stac92hd71xx_set_power_state(codec, AC_PWRST_D3); 4460 return 0; 4461 }; 4462 4463 #endif 4464 4465 static struct hda_codec_ops stac92hd71bxx_patch_ops = { 4466 .build_controls = stac92xx_build_controls, 4467 .build_pcms = stac92xx_build_pcms, 4468 .init = stac92xx_init, 4469 .free = stac92xx_free, 4470 .unsol_event = stac92xx_unsol_event, 4471 #ifdef SND_HDA_NEEDS_RESUME 4472 .resume = stac92hd71xx_resume, 4473 .suspend = stac92hd71xx_suspend, 4474 #endif 4475 }; 4832 4476 4833 4477 static struct hda_input_mux stac92hd71bxx_dmux = { … … 4866 4510 " STAC92HD71BXX, using BIOS defaults\n"); 4867 4511 err = stac92xx_save_bios_config_regs(codec); 4868 } else 4869 err = stac_save_pin_cfgs(codec, 4870 stac92hd71bxx_brd_tbl[spec->board_config]); 4871 if (err < 0) { 4872 stac92xx_free(codec); 4873 return err; 4874 } 4875 4876 if (spec->board_config > STAC_92HD71BXX_REF) { 4877 /* GPIO0 = EAPD */ 4878 spec->gpio_mask = 0x01; 4879 spec->gpio_dir = 0x01; 4880 spec->gpio_data = 0x01; 4512 if (err < 0) { 4513 stac92xx_free(codec); 4514 return err; 4515 } 4516 spec->pin_configs = spec->bios_pin_configs; 4517 } else { 4518 spec->pin_configs = stac92hd71bxx_brd_tbl[spec->board_config]; 4519 stac92xx_set_config_regs(codec); 4881 4520 } 4882 4521 … … 4891 4530 break; 4892 4531 case 0x111d7608: /* 5 Port with Analog Mixer */ 4893 switch ( spec->board_config) {4894 case STAC_HP_M4:4532 switch (codec->subsystem_id) { 4533 case 0x103c361a: 4895 4534 /* Enable VREF power saving on GPIO1 detect */ 4896 err = stac_add_event(spec, codec->afg, 4897 STAC_VREF_EVENT, 0x02); 4898 if (err < 0) 4899 return err; 4900 snd_hda_codec_write_cache(codec, codec->afg, 0, 4535 snd_hda_codec_write(codec, codec->afg, 0, 4901 4536 AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x02); 4902 4537 snd_hda_codec_write_cache(codec, codec->afg, 0, 4903 4538 AC_VERB_SET_UNSOLICITED_ENABLE, 4904 AC_USRSP_EN | err); 4539 (AC_USRSP_EN | STAC_VREF_EVENT | codec->afg)); 4540 err = stac92xx_add_event(spec, codec->afg, 0x02); 4541 if (err < 0) 4542 return err; 4905 4543 spec->gpio_mask |= 0x02; 4906 4544 break; 4907 4545 } 4908 4546 if ((codec->revision_id & 0xf) == 0 || 4909 (codec->revision_id & 0xf) == 1) 4547 (codec->revision_id & 0xf) == 1) { 4548 #ifdef SND_HDA_NEEDS_RESUME 4549 codec->patch_ops = stac92hd71bxx_patch_ops; 4550 #endif 4910 4551 spec->stream_delay = 40; /* 40 milliseconds */ 4552 } 4911 4553 4912 4554 /* no output amps */ … … 4917 4559 /* disable VSW */ 4918 4560 spec->init = &stac92hd71bxx_analog_core_init[HD_DISABLE_PORTF]; 4919 stac _change_pin_config(codec, 0xf, 0x40f000f0);4561 stac92xx_set_config_reg(codec, 0xf, 0x40f000f0); 4920 4562 break; 4921 4563 case 0x111d7603: /* 6 Port with Analog Mixer */ 4922 if ((codec->revision_id & 0xf) == 1) 4564 if ((codec->revision_id & 0xf) == 1) { 4565 #ifdef SND_HDA_NEEDS_RESUME 4566 codec->patch_ops = stac92hd71bxx_patch_ops; 4567 #endif 4923 4568 spec->stream_delay = 40; /* 40 milliseconds */ 4569 } 4924 4570 4925 4571 /* no output amps */ … … 4936 4582 spec->aloopback_shift = 0; 4937 4583 4584 if (spec->board_config > STAC_92HD71BXX_REF) { 4585 /* GPIO0 = EAPD */ 4586 spec->gpio_mask = 0x01; 4587 spec->gpio_dir = 0x01; 4588 spec->gpio_data = 0x01; 4589 } 4590 4938 4591 spec->powerdown_adcs = 1; 4939 4592 spec->digbeep_nid = 0x26; … … 4950 4603 switch (spec->board_config) { 4951 4604 case STAC_HP_M4: 4952 /* enable internal microphone */4953 stac_change_pin_config(codec, 0x0e, 0x01813040);4954 stac92xx_auto_set_pinctl(codec, 0x0e,4955 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80);4956 /* fallthru */4957 case STAC_DELL_M4_2:4958 4605 spec->num_dmics = 0; 4959 4606 spec->num_smuxes = 0; 4960 4607 spec->num_dmuxes = 0; 4961 break; 4962 case STAC_DELL_M4_1: 4963 case STAC_DELL_M4_3: 4964 spec->num_dmics = 1; 4965 spec->num_smuxes = 0; 4966 spec->num_dmuxes = 0; 4608 4609 /* enable internal microphone */ 4610 stac92xx_set_config_reg(codec, 0x0e, 0x01813040); 4611 stac92xx_auto_set_pinctl(codec, 0x0e, 4612 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80); 4967 4613 break; 4968 4614 default: … … 4972 4618 }; 4973 4619 4974 spec->multiout.dac_nids = spec->dac_nids; 4620 spec->multiout.num_dacs = 1; 4621 spec->multiout.hp_nid = 0x11; 4622 spec->multiout.dac_nids = stac92hd71bxx_dac_nids; 4975 4623 if (spec->dinput_mux) 4976 4624 spec->private_dimux.num_items += … … 4993 4641 return err; 4994 4642 } 4995 4996 codec->proc_widget_hook = stac92hd7x_proc_hook;4997 4643 4998 4644 return 0; … … 5057 4703 "using BIOS defaults\n"); 5058 4704 err = stac92xx_save_bios_config_regs(codec); 5059 } else 5060 err = stac_save_pin_cfgs(codec, 5061 stac922x_brd_tbl[spec->board_config]); 5062 if (err < 0) { 5063 stac92xx_free(codec); 5064 return err; 4705 if (err < 0) { 4706 stac92xx_free(codec); 4707 return err; 4708 } 4709 spec->pin_configs = spec->bios_pin_configs; 4710 } else if (stac922x_brd_tbl[spec->board_config] != NULL) { 4711 spec->pin_configs = stac922x_brd_tbl[spec->board_config]; 4712 stac92xx_set_config_regs(codec); 5065 4713 } 5066 4714 … … 5125 4773 "STAC927x, using BIOS defaults\n"); 5126 4774 err = stac92xx_save_bios_config_regs(codec); 5127 } else 5128 err = stac_save_pin_cfgs(codec, 5129 stac927x_brd_tbl[spec->board_config]); 5130 if (err < 0) { 5131 stac92xx_free(codec); 5132 return err; 4775 if (err < 0) { 4776 stac92xx_free(codec); 4777 return err; 4778 } 4779 spec->pin_configs = spec->bios_pin_configs; 4780 } else { 4781 spec->pin_configs = stac927x_brd_tbl[spec->board_config]; 4782 stac92xx_set_config_regs(codec); 5133 4783 } 5134 4784 … … 5160 4810 case 0x1028022e: 5161 4811 /* correct the device field to SPDIF out */ 5162 stac _change_pin_config(codec, 0x21, 0x01442070);4812 stac92xx_set_config_reg(codec, 0x21, 0x01442070); 5163 4813 break; 5164 4814 }; 5165 4815 /* configure the analog microphone on some laptops */ 5166 stac _change_pin_config(codec, 0x0c, 0x90a79130);4816 stac92xx_set_config_reg(codec, 0x0c, 0x90a79130); 5167 4817 /* correct the front output jack as a hp out */ 5168 stac _change_pin_config(codec, 0x0f, 0x0227011f);4818 stac92xx_set_config_reg(codec, 0x0f, 0x0227011f); 5169 4819 /* correct the front input jack as a mic */ 5170 stac _change_pin_config(codec, 0x0e, 0x02a79130);4820 stac92xx_set_config_reg(codec, 0x0e, 0x02a79130); 5171 4821 /* fallthru */ 5172 4822 case STAC_DELL_3ST: … … 5197 4847 spec->aloopback_mask = 0x40; 5198 4848 spec->aloopback_shift = 0; 5199 spec->eapd_switch = 1;5200 4849 5201 4850 err = stac92xx_parse_auto_config(codec, 0x1e, 0x20); … … 5215 4864 5216 4865 codec->patch_ops = stac92xx_patch_ops; 5217 5218 codec->proc_widget_hook = stac927x_proc_hook;5219 4866 5220 4867 /* … … 5230 4877 codec->bus->needs_damn_long_delay = 1; 5231 4878 5232 /* no jack detecion for ref-no-jd model */5233 if (spec->board_config == STAC_D965_REF_NO_JD)5234 spec->hp_detect = 0;5235 5236 4879 return 0; 5237 4880 } … … 5256 4899 snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC9205, using BIOS defaults\n"); 5257 4900 err = stac92xx_save_bios_config_regs(codec); 5258 } else 5259 err = stac_save_pin_cfgs(codec, 5260 stac9205_brd_tbl[spec->board_config]); 5261 if (err < 0) { 5262 stac92xx_free(codec); 5263 return err; 4901 if (err < 0) { 4902 stac92xx_free(codec); 4903 return err; 4904 } 4905 spec->pin_configs = spec->bios_pin_configs; 4906 } else { 4907 spec->pin_configs = stac9205_brd_tbl[spec->board_config]; 4908 stac92xx_set_config_regs(codec); 5264 4909 } 5265 4910 … … 5282 4927 spec->aloopback_mask = 0x40; 5283 4928 spec->aloopback_shift = 0; 5284 spec->eapd_switch = 1;5285 4929 spec->multiout.dac_nids = spec->dac_nids; 5286 4930 … … 5288 4932 case STAC_9205_DELL_M43: 5289 4933 /* Enable SPDIF in/out */ 5290 stac _change_pin_config(codec, 0x1f, 0x01441030);5291 stac _change_pin_config(codec, 0x20, 0x1c410030);4934 stac92xx_set_config_reg(codec, 0x1f, 0x01441030); 4935 stac92xx_set_config_reg(codec, 0x20, 0x1c410030); 5292 4936 5293 4937 /* Enable unsol response for GPIO4/Dock HP connection */ 5294 err = stac_add_event(spec, codec->afg, STAC_VREF_EVENT, 0x01); 4938 snd_hda_codec_write(codec, codec->afg, 0, 4939 AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x10); 4940 snd_hda_codec_write_cache(codec, codec->afg, 0, 4941 AC_VERB_SET_UNSOLICITED_ENABLE, 4942 (AC_USRSP_EN | STAC_VREF_EVENT | codec->afg)); 4943 err = stac92xx_add_event(spec, codec->afg, 0x01); 5295 4944 if (err < 0) 5296 4945 return err; 5297 snd_hda_codec_write_cache(codec, codec->afg, 0,5298 AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x10);5299 snd_hda_codec_write_cache(codec, codec->afg, 0,5300 AC_VERB_SET_UNSOLICITED_ENABLE,5301 AC_USRSP_EN | err);5302 4946 5303 4947 spec->gpio_dir = 0x0b; … … 5337 4981 codec->patch_ops = stac92xx_patch_ops; 5338 4982 5339 codec->proc_widget_hook = stac9205_proc_hook;5340 5341 4983 return 0; 5342 4984 } … … 5395 5037 }; 5396 5038 5039 /* bind volumes of both NID 0x02 and 0x05 */ 5040 static struct hda_bind_ctls vaio_bind_master_vol = { 5041 .ops = &snd_hda_bind_vol, 5042 .values = { 5043 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), 5044 HDA_COMPOSE_AMP_VAL(0x05, 3, 0, HDA_OUTPUT), 5045 0 5046 }, 5047 }; 5048 5049 /* bind volumes of both NID 0x02 and 0x05 */ 5050 static struct hda_bind_ctls vaio_bind_master_sw = { 5051 .ops = &snd_hda_bind_sw, 5052 .values = { 5053 HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT), 5054 HDA_COMPOSE_AMP_VAL(0x05, 3, 0, HDA_OUTPUT), 5055 0, 5056 }, 5057 }; 5058 5397 5059 static struct snd_kcontrol_new vaio_mixer[] = { 5398 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x02, 0, HDA_OUTPUT), 5399 HDA_CODEC_MUTE("Headphone Playback Switch", 0x02, 0, HDA_OUTPUT), 5400 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x05, 0, HDA_OUTPUT), 5401 HDA_CODEC_MUTE("Speaker Playback Switch", 0x05, 0, HDA_OUTPUT), 5060 HDA_BIND_VOL("Master Playback Volume", &vaio_bind_master_vol), 5061 HDA_BIND_SW("Master Playback Switch", &vaio_bind_master_sw), 5402 5062 /* HDA_CODEC_VOLUME("CD Capture Volume", 0x07, 0, HDA_INPUT), */ 5403 5063 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_INPUT), … … 5415 5075 5416 5076 static struct snd_kcontrol_new vaio_ar_mixer[] = { 5417 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x02, 0, HDA_OUTPUT), 5418 HDA_CODEC_MUTE("Headphone Playback Switch", 0x02, 0, HDA_OUTPUT), 5419 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x05, 0, HDA_OUTPUT), 5420 HDA_CODEC_MUTE("Speaker Playback Switch", 0x05, 0, HDA_OUTPUT), 5077 HDA_BIND_VOL("Master Playback Volume", &vaio_bind_master_vol), 5078 HDA_BIND_SW("Master Playback Switch", &vaio_bind_master_sw), 5421 5079 /* HDA_CODEC_VOLUME("CD Capture Volume", 0x07, 0, HDA_INPUT), */ 5422 5080 HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_INPUT), … … 5459 5117 static void stac9872_vaio_hp_detect(struct hda_codec *codec, unsigned int res) 5460 5118 { 5461 if (get_ pin_presence(codec, 0x0a)) {5119 if (get_hp_pin_presence(codec, 0x0a)) { 5462 5120 stac92xx_reset_pinctl(codec, 0x0f, AC_PINCTL_OUT_EN); 5463 5121 stac92xx_set_pinctl(codec, 0x0a, AC_PINCTL_OUT_EN); … … 5570 5228 * patch entries 5571 5229 */ 5572 st atic struct hda_codec_preset snd_hda_preset_sigmatel[] = {5230 struct hda_codec_preset snd_hda_preset_sigmatel[] = { 5573 5231 { .id = 0x83847690, .name = "STAC9200", .patch = patch_stac9200 }, 5574 5232 { .id = 0x83847882, .name = "STAC9220 A1", .patch = patch_stac922x }, … … 5634 5292 {0} /* terminator */ 5635 5293 }; 5636 5637 MODULE_ALIAS("snd-hda-codec-id:8384*");5638 MODULE_ALIAS("snd-hda-codec-id:111d*");5639 5640 MODULE_LICENSE("GPL");5641 MODULE_DESCRIPTION("IDT/Sigmatel HD-audio codec");5642 5643 static struct hda_codec_preset_list sigmatel_list = {5644 .preset = snd_hda_preset_sigmatel,5645 .owner = THIS_MODULE,5646 };5647 5648 static int __init patch_sigmatel_init(void)5649 {5650 return snd_hda_add_codec_preset(&sigmatel_list);5651 }5652 5653 static void __exit patch_sigmatel_exit(void)5654 {5655 snd_hda_delete_codec_preset(&sigmatel_list);5656 }5657 5658 module_init(patch_sigmatel_init)5659 module_exit(patch_sigmatel_exit) -
GPL/branches/uniaud32-2.0/alsa-kernel/pci/hda/patch_via.c
r410 r417 48 48 #include "hda_codec.h" 49 49 #include "hda_local.h" 50 #include "hda_patch.h" 50 51 51 52 /* amp values */ … … 141 142 AUTO_SEQ_SIDE 142 143 }; 144 145 #define get_amp_nid(kc) ((kc)->private_value & 0xffff) 143 146 144 147 /* Some VT1708S based boards gets the micboost setting wrong, so we have … … 3250 3253 * patch entries 3251 3254 */ 3252 st atic struct hda_codec_preset snd_hda_preset_via[] = {3253 { .id = 0x11061708, .name = "V T1708", .patch = patch_vt1708},3254 { .id = 0x11061709, .name = "V T1708", .patch = patch_vt1708},3255 { .id = 0x1106170 a, .name = "VT1708", .patch = patch_vt1708},3256 { .id = 0x1106170 b, .name = "VT1708", .patch = patch_vt1708},3257 { .id = 0x1106 e710, .name = "VT1709 10-Ch",3255 struct hda_codec_preset snd_hda_preset_via[] = { 3256 { .id = 0x11061708, .name = "VIA VT1708", .patch = patch_vt1708}, 3257 { .id = 0x11061709, .name = "VIA VT1708", .patch = patch_vt1708}, 3258 { .id = 0x1106170A, .name = "VIA VT1708", .patch = patch_vt1708}, 3259 { .id = 0x1106170B, .name = "VIA VT1708", .patch = patch_vt1708}, 3260 { .id = 0x1106E710, .name = "VIA VT1709 10-Ch", 3258 3261 .patch = patch_vt1709_10ch}, 3259 { .id = 0x1106 e711, .name = "VT1709 10-Ch",3262 { .id = 0x1106E711, .name = "VIA VT1709 10-Ch", 3260 3263 .patch = patch_vt1709_10ch}, 3261 { .id = 0x1106 e712, .name = "VT1709 10-Ch",3264 { .id = 0x1106E712, .name = "VIA VT1709 10-Ch", 3262 3265 .patch = patch_vt1709_10ch}, 3263 { .id = 0x1106 e713, .name = "VT1709 10-Ch",3266 { .id = 0x1106E713, .name = "VIA VT1709 10-Ch", 3264 3267 .patch = patch_vt1709_10ch}, 3265 { .id = 0x1106 e714, .name = "VT1709 6-Ch",3268 { .id = 0x1106E714, .name = "VIA VT1709 6-Ch", 3266 3269 .patch = patch_vt1709_6ch}, 3267 { .id = 0x1106 e715, .name = "VT1709 6-Ch",3270 { .id = 0x1106E715, .name = "VIA VT1709 6-Ch", 3268 3271 .patch = patch_vt1709_6ch}, 3269 { .id = 0x1106 e716, .name = "VT1709 6-Ch",3272 { .id = 0x1106E716, .name = "VIA VT1709 6-Ch", 3270 3273 .patch = patch_vt1709_6ch}, 3271 { .id = 0x1106 e717, .name = "VT1709 6-Ch",3274 { .id = 0x1106E717, .name = "VIA VT1709 6-Ch", 3272 3275 .patch = patch_vt1709_6ch}, 3273 { .id = 0x1106 e720, .name = "VT1708B 8-Ch",3276 { .id = 0x1106E720, .name = "VIA VT1708B 8-Ch", 3274 3277 .patch = patch_vt1708B_8ch}, 3275 { .id = 0x1106 e721, .name = "VT1708B 8-Ch",3278 { .id = 0x1106E721, .name = "VIA VT1708B 8-Ch", 3276 3279 .patch = patch_vt1708B_8ch}, 3277 { .id = 0x1106 e722, .name = "VT1708B 8-Ch",3280 { .id = 0x1106E722, .name = "VIA VT1708B 8-Ch", 3278 3281 .patch = patch_vt1708B_8ch}, 3279 { .id = 0x1106 e723, .name = "VT1708B 8-Ch",3282 { .id = 0x1106E723, .name = "VIA VT1708B 8-Ch", 3280 3283 .patch = patch_vt1708B_8ch}, 3281 { .id = 0x1106 e724, .name = "VT1708B 4-Ch",3284 { .id = 0x1106E724, .name = "VIA VT1708B 4-Ch", 3282 3285 .patch = patch_vt1708B_4ch}, 3283 { .id = 0x1106 e725, .name = "VT1708B 4-Ch",3286 { .id = 0x1106E725, .name = "VIA VT1708B 4-Ch", 3284 3287 .patch = patch_vt1708B_4ch}, 3285 { .id = 0x1106 e726, .name = "VT1708B 4-Ch",3288 { .id = 0x1106E726, .name = "VIA VT1708B 4-Ch", 3286 3289 .patch = patch_vt1708B_4ch}, 3287 { .id = 0x1106 e727, .name = "VT1708B 4-Ch",3290 { .id = 0x1106E727, .name = "VIA VT1708B 4-Ch", 3288 3291 .patch = patch_vt1708B_4ch}, 3289 { .id = 0x11060397, .name = "V T1708S",3292 { .id = 0x11060397, .name = "VIA VT1708S", 3290 3293 .patch = patch_vt1708S}, 3291 { .id = 0x11061397, .name = "V T1708S",3294 { .id = 0x11061397, .name = "VIA VT1708S", 3292 3295 .patch = patch_vt1708S}, 3293 { .id = 0x11062397, .name = "V T1708S",3296 { .id = 0x11062397, .name = "VIA VT1708S", 3294 3297 .patch = patch_vt1708S}, 3295 { .id = 0x11063397, .name = "V T1708S",3298 { .id = 0x11063397, .name = "VIA VT1708S", 3296 3299 .patch = patch_vt1708S}, 3297 { .id = 0x11064397, .name = "V T1708S",3300 { .id = 0x11064397, .name = "VIA VT1708S", 3298 3301 .patch = patch_vt1708S}, 3299 { .id = 0x11065397, .name = "V T1708S",3302 { .id = 0x11065397, .name = "VIA VT1708S", 3300 3303 .patch = patch_vt1708S}, 3301 { .id = 0x11066397, .name = "V T1708S",3304 { .id = 0x11066397, .name = "VIA VT1708S", 3302 3305 .patch = patch_vt1708S}, 3303 { .id = 0x11067397, .name = "V T1708S",3306 { .id = 0x11067397, .name = "VIA VT1708S", 3304 3307 .patch = patch_vt1708S}, 3305 { .id = 0x11060398, .name = "V T1702",3308 { .id = 0x11060398, .name = "VIA VT1702", 3306 3309 .patch = patch_vt1702}, 3307 { .id = 0x11061398, .name = "V T1702",3310 { .id = 0x11061398, .name = "VIA VT1702", 3308 3311 .patch = patch_vt1702}, 3309 { .id = 0x11062398, .name = "V T1702",3312 { .id = 0x11062398, .name = "VIA VT1702", 3310 3313 .patch = patch_vt1702}, 3311 { .id = 0x11063398, .name = "V T1702",3314 { .id = 0x11063398, .name = "VIA VT1702", 3312 3315 .patch = patch_vt1702}, 3313 { .id = 0x11064398, .name = "V T1702",3316 { .id = 0x11064398, .name = "VIA VT1702", 3314 3317 .patch = patch_vt1702}, 3315 { .id = 0x11065398, .name = "V T1702",3318 { .id = 0x11065398, .name = "VIA VT1702", 3316 3319 .patch = patch_vt1702}, 3317 { .id = 0x11066398, .name = "V T1702",3320 { .id = 0x11066398, .name = "VIA VT1702", 3318 3321 .patch = patch_vt1702}, 3319 { .id = 0x11067398, .name = "V T1702",3322 { .id = 0x11067398, .name = "VIA VT1702", 3320 3323 .patch = patch_vt1702}, 3321 3324 {0} /* terminator */ 3322 3325 }; 3323 3324 MODULE_ALIAS("snd-hda-codec-id:1106*");3325 3326 static struct hda_codec_preset_list via_list = {3327 .preset = snd_hda_preset_via,3328 .owner = THIS_MODULE,3329 };3330 3331 MODULE_LICENSE("GPL");3332 MODULE_DESCRIPTION("VIA HD-audio codec");3333 3334 static int __init patch_via_init(void)3335 {3336 return snd_hda_add_codec_preset(&via_list);3337 }3338 3339 static void __exit patch_via_exit(void)3340 {3341 snd_hda_delete_codec_preset(&via_list);3342 }3343 3344 module_init(patch_via_init)3345 module_exit(patch_via_exit)
Note:
See TracChangeset
for help on using the changeset viewer.