diff options
Diffstat (limited to 'sound/pci')
-rw-r--r-- | sound/pci/hda/hda_codec.c | 61 | ||||
-rw-r--r-- | sound/pci/hda/hda_local.h | 3 | ||||
-rw-r--r-- | sound/pci/hda/patch_sigmatel.c | 127 |
3 files changed, 161 insertions, 30 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index fdad6ae7aad4..b7bba7dc7cf1 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c | |||
@@ -2724,6 +2724,67 @@ int snd_hda_check_board_config(struct hda_codec *codec, | |||
2724 | EXPORT_SYMBOL_HDA(snd_hda_check_board_config); | 2724 | EXPORT_SYMBOL_HDA(snd_hda_check_board_config); |
2725 | 2725 | ||
2726 | /** | 2726 | /** |
2727 | * snd_hda_check_board_codec_sid_config - compare the current codec | ||
2728 | subsystem ID with the | ||
2729 | config table | ||
2730 | |||
2731 | This is important for Gateway notebooks with SB450 HDA Audio | ||
2732 | where the vendor ID of the PCI device is: | ||
2733 | ATI Technologies Inc SB450 HDA Audio [1002:437b] | ||
2734 | and the vendor/subvendor are found only at the codec. | ||
2735 | |||
2736 | * @codec: the HDA codec | ||
2737 | * @num_configs: number of config enums | ||
2738 | * @models: array of model name strings | ||
2739 | * @tbl: configuration table, terminated by null entries | ||
2740 | * | ||
2741 | * Compares the modelname or PCI subsystem id of the current codec with the | ||
2742 | * given configuration table. If a matching entry is found, returns its | ||
2743 | * config value (supposed to be 0 or positive). | ||
2744 | * | ||
2745 | * If no entries are matching, the function returns a negative value. | ||
2746 | */ | ||
2747 | int snd_hda_check_board_codec_sid_config(struct hda_codec *codec, | ||
2748 | int num_configs, const char **models, | ||
2749 | const struct snd_pci_quirk *tbl) | ||
2750 | { | ||
2751 | const struct snd_pci_quirk *q; | ||
2752 | |||
2753 | /* Search for codec ID */ | ||
2754 | for (q = tbl; q->subvendor; q++) { | ||
2755 | unsigned long vendorid = (q->subdevice) | (q->subvendor << 16); | ||
2756 | |||
2757 | if (vendorid == codec->subsystem_id) | ||
2758 | break; | ||
2759 | } | ||
2760 | |||
2761 | if (!q->subvendor) | ||
2762 | return -1; | ||
2763 | |||
2764 | tbl = q; | ||
2765 | |||
2766 | if (tbl->value >= 0 && tbl->value < num_configs) { | ||
2767 | #ifdef CONFIG_SND_DEBUG_DETECT | ||
2768 | char tmp[10]; | ||
2769 | const char *model = NULL; | ||
2770 | if (models) | ||
2771 | model = models[tbl->value]; | ||
2772 | if (!model) { | ||
2773 | sprintf(tmp, "#%d", tbl->value); | ||
2774 | model = tmp; | ||
2775 | } | ||
2776 | snd_printdd(KERN_INFO "hda_codec: model '%s' is selected " | ||
2777 | "for config %x:%x (%s)\n", | ||
2778 | model, tbl->subvendor, tbl->subdevice, | ||
2779 | (tbl->name ? tbl->name : "Unknown device")); | ||
2780 | #endif | ||
2781 | return tbl->value; | ||
2782 | } | ||
2783 | return -1; | ||
2784 | } | ||
2785 | EXPORT_SYMBOL_HDA(snd_hda_check_board_codec_sid_config); | ||
2786 | |||
2787 | /** | ||
2727 | * snd_hda_add_new_ctls - create controls from the array | 2788 | * snd_hda_add_new_ctls - create controls from the array |
2728 | * @codec: the HDA codec | 2789 | * @codec: the HDA codec |
2729 | * @knew: the array of struct snd_kcontrol_new | 2790 | * @knew: the array of struct snd_kcontrol_new |
diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h index 6f2fe0f9fdd8..1dd8716c387f 100644 --- a/sound/pci/hda/hda_local.h +++ b/sound/pci/hda/hda_local.h | |||
@@ -296,6 +296,9 @@ void snd_print_pcm_bits(int pcm, char *buf, int buflen); | |||
296 | int snd_hda_check_board_config(struct hda_codec *codec, int num_configs, | 296 | int snd_hda_check_board_config(struct hda_codec *codec, int num_configs, |
297 | const char **modelnames, | 297 | const char **modelnames, |
298 | const struct snd_pci_quirk *pci_list); | 298 | const struct snd_pci_quirk *pci_list); |
299 | int snd_hda_check_board_codec_sid_config(struct hda_codec *codec, | ||
300 | int num_configs, const char **models, | ||
301 | const struct snd_pci_quirk *tbl); | ||
299 | int snd_hda_add_new_ctls(struct hda_codec *codec, | 302 | int snd_hda_add_new_ctls(struct hda_codec *codec, |
300 | struct snd_kcontrol_new *knew); | 303 | struct snd_kcontrol_new *knew); |
301 | 304 | ||
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 9acf2f0a2df9..0e6fc56fa378 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c | |||
@@ -55,7 +55,8 @@ enum { | |||
55 | STAC_9200_DELL_M25, | 55 | STAC_9200_DELL_M25, |
56 | STAC_9200_DELL_M26, | 56 | STAC_9200_DELL_M26, |
57 | STAC_9200_DELL_M27, | 57 | STAC_9200_DELL_M27, |
58 | STAC_9200_GATEWAY, | 58 | STAC_9200_M4, |
59 | STAC_9200_M4_2, | ||
59 | STAC_9200_PANASONIC, | 60 | STAC_9200_PANASONIC, |
60 | STAC_9200_MODELS | 61 | STAC_9200_MODELS |
61 | }; | 62 | }; |
@@ -94,9 +95,13 @@ enum { | |||
94 | 95 | ||
95 | enum { | 96 | enum { |
96 | STAC_925x_REF, | 97 | STAC_925x_REF, |
98 | STAC_M1, | ||
99 | STAC_M1_2, | ||
100 | STAC_M2, | ||
97 | STAC_M2_2, | 101 | STAC_M2_2, |
98 | STAC_MA6, | 102 | STAC_M3, |
99 | STAC_PA6, | 103 | STAC_M5, |
104 | STAC_M6, | ||
100 | STAC_925x_MODELS | 105 | STAC_925x_MODELS |
101 | }; | 106 | }; |
102 | 107 | ||
@@ -1334,7 +1339,16 @@ static unsigned int ref9200_pin_configs[8] = { | |||
1334 | 0x02a19020, 0x01a19021, 0x90100140, 0x01813122, | 1339 | 0x02a19020, 0x01a19021, 0x90100140, 0x01813122, |
1335 | }; | 1340 | }; |
1336 | 1341 | ||
1337 | /* | 1342 | static unsigned int gateway9200_m4_pin_configs[8] = { |
1343 | 0x400000fe, 0x404500f4, 0x400100f0, 0x90110010, | ||
1344 | 0x400100f1, 0x02a1902e, 0x500000f2, 0x500000f3, | ||
1345 | }; | ||
1346 | static unsigned int gateway9200_m4_2_pin_configs[8] = { | ||
1347 | 0x400000fe, 0x404500f4, 0x400100f0, 0x90110010, | ||
1348 | 0x400100f1, 0x02a1902e, 0x500000f2, 0x500000f3, | ||
1349 | }; | ||
1350 | |||
1351 | /* | ||
1338 | STAC 9200 pin configs for | 1352 | STAC 9200 pin configs for |
1339 | 102801A8 | 1353 | 102801A8 |
1340 | 102801DE | 1354 | 102801DE |
@@ -1464,6 +1478,8 @@ static unsigned int *stac9200_brd_tbl[STAC_9200_MODELS] = { | |||
1464 | [STAC_9200_DELL_M25] = dell9200_m25_pin_configs, | 1478 | [STAC_9200_DELL_M25] = dell9200_m25_pin_configs, |
1465 | [STAC_9200_DELL_M26] = dell9200_m26_pin_configs, | 1479 | [STAC_9200_DELL_M26] = dell9200_m26_pin_configs, |
1466 | [STAC_9200_DELL_M27] = dell9200_m27_pin_configs, | 1480 | [STAC_9200_DELL_M27] = dell9200_m27_pin_configs, |
1481 | [STAC_9200_M4] = gateway9200_m4_pin_configs, | ||
1482 | [STAC_9200_M4_2] = gateway9200_m4_2_pin_configs, | ||
1467 | [STAC_9200_PANASONIC] = ref9200_pin_configs, | 1483 | [STAC_9200_PANASONIC] = ref9200_pin_configs, |
1468 | }; | 1484 | }; |
1469 | 1485 | ||
@@ -1480,7 +1496,8 @@ static const char *stac9200_models[STAC_9200_MODELS] = { | |||
1480 | [STAC_9200_DELL_M25] = "dell-m25", | 1496 | [STAC_9200_DELL_M25] = "dell-m25", |
1481 | [STAC_9200_DELL_M26] = "dell-m26", | 1497 | [STAC_9200_DELL_M26] = "dell-m26", |
1482 | [STAC_9200_DELL_M27] = "dell-m27", | 1498 | [STAC_9200_DELL_M27] = "dell-m27", |
1483 | [STAC_9200_GATEWAY] = "gateway", | 1499 | [STAC_9200_M4] = "gateway-m4", |
1500 | [STAC_9200_M4_2] = "gateway-m4-2", | ||
1484 | [STAC_9200_PANASONIC] = "panasonic", | 1501 | [STAC_9200_PANASONIC] = "panasonic", |
1485 | }; | 1502 | }; |
1486 | 1503 | ||
@@ -1550,11 +1567,9 @@ static struct snd_pci_quirk stac9200_cfg_tbl[] = { | |||
1550 | /* Panasonic */ | 1567 | /* Panasonic */ |
1551 | SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-74", STAC_9200_PANASONIC), | 1568 | SND_PCI_QUIRK(0x10f7, 0x8338, "Panasonic CF-74", STAC_9200_PANASONIC), |
1552 | /* Gateway machines needs EAPD to be set on resume */ | 1569 | /* Gateway machines needs EAPD to be set on resume */ |
1553 | SND_PCI_QUIRK(0x107b, 0x0205, "Gateway S-7110M", STAC_9200_GATEWAY), | 1570 | SND_PCI_QUIRK(0x107b, 0x0205, "Gateway S-7110M", STAC_9200_M4), |
1554 | SND_PCI_QUIRK(0x107b, 0x0317, "Gateway MT3423, MX341*", | 1571 | SND_PCI_QUIRK(0x107b, 0x0317, "Gateway MT3423, MX341*", STAC_9200_M4_2), |
1555 | STAC_9200_GATEWAY), | 1572 | SND_PCI_QUIRK(0x107b, 0x0318, "Gateway ML3019, MT3707", STAC_9200_M4_2), |
1556 | SND_PCI_QUIRK(0x107b, 0x0318, "Gateway ML3019, MT3707", | ||
1557 | STAC_9200_GATEWAY), | ||
1558 | /* OQO Mobile */ | 1573 | /* OQO Mobile */ |
1559 | SND_PCI_QUIRK(0x1106, 0x3288, "OQO Model 2", STAC_9200_OQO), | 1574 | SND_PCI_QUIRK(0x1106, 0x3288, "OQO Model 2", STAC_9200_OQO), |
1560 | {} /* terminator */ | 1575 | {} /* terminator */ |
@@ -1565,44 +1580,85 @@ static unsigned int ref925x_pin_configs[8] = { | |||
1565 | 0x90a70320, 0x02214210, 0x01019020, 0x9033032e, | 1580 | 0x90a70320, 0x02214210, 0x01019020, 0x9033032e, |
1566 | }; | 1581 | }; |
1567 | 1582 | ||
1568 | static unsigned int stac925x_MA6_pin_configs[8] = { | 1583 | static unsigned int stac925xM1_pin_configs[8] = { |
1569 | 0x40c003f0, 0x424503f2, 0x01813022, 0x02a19021, | 1584 | 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020, |
1570 | 0x90a70320, 0x90100211, 0x400003f1, 0x9033032e, | 1585 | 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e, |
1571 | }; | 1586 | }; |
1572 | 1587 | ||
1573 | static unsigned int stac925x_PA6_pin_configs[8] = { | 1588 | static unsigned int stac925xM1_2_pin_configs[8] = { |
1574 | 0x40c003f0, 0x424503f2, 0x01813022, 0x02a19021, | 1589 | 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020, |
1575 | 0x50a103f0, 0x90100211, 0x400003f1, 0x9033032e, | 1590 | 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e, |
1591 | }; | ||
1592 | |||
1593 | static unsigned int stac925xM2_pin_configs[8] = { | ||
1594 | 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020, | ||
1595 | 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e, | ||
1576 | }; | 1596 | }; |
1577 | 1597 | ||
1578 | static unsigned int stac925xM2_2_pin_configs[8] = { | 1598 | static unsigned int stac925xM2_2_pin_configs[8] = { |
1579 | 0x40c003f3, 0x424503f2, 0x04180011, 0x02a19020, | 1599 | 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020, |
1580 | 0x50a103f0, 0x90100212, 0x400003f1, 0x9033032e, | 1600 | 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e, |
1601 | }; | ||
1602 | |||
1603 | static unsigned int stac925xM3_pin_configs[8] = { | ||
1604 | 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020, | ||
1605 | 0x40a000f0, 0x90100210, 0x400003f1, 0x503303f3, | ||
1606 | }; | ||
1607 | |||
1608 | static unsigned int stac925xM5_pin_configs[8] = { | ||
1609 | 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020, | ||
1610 | 0x40a000f0, 0x90100210, 0x400003f1, 0x9033032e, | ||
1611 | }; | ||
1612 | |||
1613 | static unsigned int stac925xM6_pin_configs[8] = { | ||
1614 | 0x40c003f4, 0x424503f2, 0x400000f3, 0x02a19020, | ||
1615 | 0x40a000f0, 0x90100210, 0x400003f1, 0x90330320, | ||
1581 | }; | 1616 | }; |
1582 | 1617 | ||
1583 | static unsigned int *stac925x_brd_tbl[STAC_925x_MODELS] = { | 1618 | static unsigned int *stac925x_brd_tbl[STAC_925x_MODELS] = { |
1584 | [STAC_REF] = ref925x_pin_configs, | 1619 | [STAC_REF] = ref925x_pin_configs, |
1620 | [STAC_M1] = stac925xM1_pin_configs, | ||
1621 | [STAC_M1_2] = stac925xM1_2_pin_configs, | ||
1622 | [STAC_M2] = stac925xM2_pin_configs, | ||
1585 | [STAC_M2_2] = stac925xM2_2_pin_configs, | 1623 | [STAC_M2_2] = stac925xM2_2_pin_configs, |
1586 | [STAC_MA6] = stac925x_MA6_pin_configs, | 1624 | [STAC_M3] = stac925xM3_pin_configs, |
1587 | [STAC_PA6] = stac925x_PA6_pin_configs, | 1625 | [STAC_M5] = stac925xM5_pin_configs, |
1626 | [STAC_M6] = stac925xM6_pin_configs, | ||
1588 | }; | 1627 | }; |
1589 | 1628 | ||
1590 | static const char *stac925x_models[STAC_925x_MODELS] = { | 1629 | static const char *stac925x_models[STAC_925x_MODELS] = { |
1591 | [STAC_REF] = "ref", | 1630 | [STAC_REF] = "ref", |
1631 | [STAC_M1] = "m1", | ||
1632 | [STAC_M1_2] = "m1-2", | ||
1633 | [STAC_M2] = "m2", | ||
1592 | [STAC_M2_2] = "m2-2", | 1634 | [STAC_M2_2] = "m2-2", |
1593 | [STAC_MA6] = "m6", | 1635 | [STAC_M3] = "m3", |
1594 | [STAC_PA6] = "pa6", | 1636 | [STAC_M5] = "m5", |
1637 | [STAC_M6] = "m6", | ||
1638 | }; | ||
1639 | |||
1640 | static struct snd_pci_quirk stac925x_codec_id_cfg_tbl[] = { | ||
1641 | SND_PCI_QUIRK(0x107b, 0x0316, "Gateway M255", STAC_M2), | ||
1642 | SND_PCI_QUIRK(0x107b, 0x0366, "Gateway MP6954", STAC_M5), | ||
1643 | SND_PCI_QUIRK(0x107b, 0x0461, "Gateway NX560XL", STAC_M1), | ||
1644 | SND_PCI_QUIRK(0x107b, 0x0681, "Gateway NX860", STAC_M2), | ||
1645 | SND_PCI_QUIRK(0x107b, 0x0367, "Gateway MX6453", STAC_M1_2), | ||
1646 | /* Not sure about the brand name for those */ | ||
1647 | SND_PCI_QUIRK(0x107b, 0x0281, "Gateway mobile", STAC_M1), | ||
1648 | SND_PCI_QUIRK(0x107b, 0x0507, "Gateway mobile", STAC_M3), | ||
1649 | SND_PCI_QUIRK(0x107b, 0x0281, "Gateway mobile", STAC_M6), | ||
1650 | SND_PCI_QUIRK(0x107b, 0x0685, "Gateway mobile", STAC_M2_2), | ||
1651 | {} /* terminator */ | ||
1595 | }; | 1652 | }; |
1596 | 1653 | ||
1597 | static struct snd_pci_quirk stac925x_cfg_tbl[] = { | 1654 | static struct snd_pci_quirk stac925x_cfg_tbl[] = { |
1598 | /* SigmaTel reference board */ | 1655 | /* SigmaTel reference board */ |
1599 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, "DFI LanParty", STAC_REF), | 1656 | SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, "DFI LanParty", STAC_REF), |
1600 | SND_PCI_QUIRK(0x8384, 0x7632, "Stac9202 Reference Board", STAC_REF), | 1657 | SND_PCI_QUIRK(0x8384, 0x7632, "Stac9202 Reference Board", STAC_REF), |
1601 | SND_PCI_QUIRK(0x107b, 0x0316, "Gateway M255", STAC_REF), | 1658 | |
1602 | SND_PCI_QUIRK(0x107b, 0x0366, "Gateway MP6954", STAC_REF), | 1659 | /* Default table for unknown ID */ |
1603 | SND_PCI_QUIRK(0x107b, 0x0461, "Gateway NX560XL", STAC_MA6), | 1660 | SND_PCI_QUIRK(0x1002, 0x437b, "Gateway mobile", STAC_M2_2), |
1604 | SND_PCI_QUIRK(0x107b, 0x0681, "Gateway NX860", STAC_PA6), | 1661 | |
1605 | SND_PCI_QUIRK(0x1002, 0x437b, "Gateway MX6453", STAC_M2_2), | ||
1606 | {} /* terminator */ | 1662 | {} /* terminator */ |
1607 | }; | 1663 | }; |
1608 | 1664 | ||
@@ -4392,7 +4448,8 @@ static int patch_stac9200(struct hda_codec *codec) | |||
4392 | spec->num_adcs = 1; | 4448 | spec->num_adcs = 1; |
4393 | spec->num_pwrs = 0; | 4449 | spec->num_pwrs = 0; |
4394 | 4450 | ||
4395 | if (spec->board_config == STAC_9200_GATEWAY || | 4451 | if (spec->board_config == STAC_9200_M4 || |
4452 | spec->board_config == STAC_9200_M4_2 || | ||
4396 | spec->board_config == STAC_9200_OQO) | 4453 | spec->board_config == STAC_9200_OQO) |
4397 | spec->init = stac9200_eapd_init; | 4454 | spec->init = stac9200_eapd_init; |
4398 | else | 4455 | else |
@@ -4427,12 +4484,22 @@ static int patch_stac925x(struct hda_codec *codec) | |||
4427 | codec->spec = spec; | 4484 | codec->spec = spec; |
4428 | spec->num_pins = ARRAY_SIZE(stac925x_pin_nids); | 4485 | spec->num_pins = ARRAY_SIZE(stac925x_pin_nids); |
4429 | spec->pin_nids = stac925x_pin_nids; | 4486 | spec->pin_nids = stac925x_pin_nids; |
4430 | spec->board_config = snd_hda_check_board_config(codec, STAC_925x_MODELS, | 4487 | |
4488 | /* Check first for codec ID */ | ||
4489 | spec->board_config = snd_hda_check_board_codec_sid_config(codec, | ||
4490 | STAC_925x_MODELS, | ||
4491 | stac925x_models, | ||
4492 | stac925x_codec_id_cfg_tbl); | ||
4493 | |||
4494 | /* Now checks for PCI ID, if codec ID is not found */ | ||
4495 | if (spec->board_config < 0) | ||
4496 | spec->board_config = snd_hda_check_board_config(codec, | ||
4497 | STAC_925x_MODELS, | ||
4431 | stac925x_models, | 4498 | stac925x_models, |
4432 | stac925x_cfg_tbl); | 4499 | stac925x_cfg_tbl); |
4433 | again: | 4500 | again: |
4434 | if (spec->board_config < 0) { | 4501 | if (spec->board_config < 0) { |
4435 | snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC925x," | 4502 | snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC925x," |
4436 | "using BIOS defaults\n"); | 4503 | "using BIOS defaults\n"); |
4437 | err = stac92xx_save_bios_config_regs(codec); | 4504 | err = stac92xx_save_bios_config_regs(codec); |
4438 | } else | 4505 | } else |