Commit 6d8590650eb81d2c869c7adf4b469071cec11eee

Authored by Guillaume Munch
Committed by Jaroslav Kysela
1 parent 7b89190cf6

[ALSA] hda-codec - Support for SigmaTel 9872

- AR11M and AR11S uses the same chip hence we claim to support the AR Series.
- Added commentary about STAC9225s which shares the same id as CXD9872RD.
- Added entry for 7662 but won't work automatically until pci_subdevice
  is known.
- 'vaio' model now corresponds to CXD9872RD_VAIO for backward compat.
- Replaced STAC766x_VAIO with CXD9872RD_VAIO, STAC9872AK_VAIO, STAC9872K_VAIO
  and CXD9872AKD_VAIO
- Added 'vaio-ar' model for potential future modifications.

Signed-off-by: Guillaume Munch <diabo@free.fr>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>

Showing 2 changed files with 97 additions and 17 deletions Side-by-side Diff

Documentation/sound/alsa/ALSA-Configuration.txt
... ... @@ -859,8 +859,9 @@
859 859 laptop-dig ditto with SPDIF
860 860 auto auto-config reading BIOS (default)
861 861  
862   - STAC7664/7661(?)
863   - vaio Setup for VAIO FE550G/SZ110/AR11B
  862 + STAC9872
  863 + vaio Setup for VAIO FE550G/SZ110
  864 + vaio-ar Setup for VAIO AR
864 865  
865 866 If the default configuration doesn't work and one of the above
866 867 matches with your device, report it together with the PCI
sound/pci/hda/patch_sigmatel.c
... ... @@ -1563,7 +1563,7 @@
1563 1563 }
1564 1564  
1565 1565 /*
1566   - * STAC 7661(?) and 7664 hack
  1566 + * STAC9872 hack
1567 1567 */
1568 1568  
1569 1569 /* static config for Sony VAIO FE550G and Sony VAIO AR */
... ... @@ -1597,6 +1597,23 @@
1597 1597 {}
1598 1598 };
1599 1599  
  1600 +static struct hda_verb vaio_ar_init[] = {
  1601 + {0x0a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP <- 0x2 */
  1602 + {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Speaker <- 0x5 */
  1603 + {0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Mic? (<- 0x2) */
  1604 + {0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD */
  1605 +/* {0x11, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },*/ /* Optical Out */
  1606 + {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Mic? */
  1607 + {0x15, AC_VERB_SET_CONNECT_SEL, 0x2}, /* mic-sel: 0a,0d,14,02 */
  1608 + {0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* HP */
  1609 + {0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, /* Speaker */
  1610 +/* {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},*/ /* Optical Out */
  1611 + {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, /* capture sw/vol -> 0x8 */
  1612 + {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, /* CD-in -> 0x6 */
  1613 + {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* Mic-in -> 0x9 */
  1614 + {}
  1615 +};
  1616 +
1600 1617 /* bind volumes of both NID 0x02 and 0x05 */
1601 1618 static int vaio_master_vol_put(struct snd_kcontrol *kcontrol,
1602 1619 struct snd_ctl_elem_value *ucontrol)
... ... @@ -1667,7 +1684,40 @@
1667 1684 {}
1668 1685 };
1669 1686  
1670   -static struct hda_codec_ops stac766x_patch_ops = {
  1687 +static struct snd_kcontrol_new vaio_ar_mixer[] = {
  1688 + {
  1689 + .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
  1690 + .name = "Master Playback Volume",
  1691 + .info = snd_hda_mixer_amp_volume_info,
  1692 + .get = snd_hda_mixer_amp_volume_get,
  1693 + .put = vaio_master_vol_put,
  1694 + .private_value = HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
  1695 + },
  1696 + {
  1697 + .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
  1698 + .name = "Master Playback Switch",
  1699 + .info = snd_hda_mixer_amp_switch_info,
  1700 + .get = snd_hda_mixer_amp_switch_get,
  1701 + .put = vaio_master_sw_put,
  1702 + .private_value = HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT),
  1703 + },
  1704 + /* HDA_CODEC_VOLUME("CD Capture Volume", 0x07, 0, HDA_INPUT), */
  1705 + HDA_CODEC_VOLUME("Capture Volume", 0x09, 0, HDA_INPUT),
  1706 + HDA_CODEC_MUTE("Capture Switch", 0x09, 0, HDA_INPUT),
  1707 + /*HDA_CODEC_MUTE("Optical Out Switch", 0x10, 0, HDA_OUTPUT),
  1708 + HDA_CODEC_VOLUME("Optical Out Volume", 0x10, 0, HDA_OUTPUT),*/
  1709 + {
  1710 + .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
  1711 + .name = "Capture Source",
  1712 + .count = 1,
  1713 + .info = stac92xx_mux_enum_info,
  1714 + .get = stac92xx_mux_enum_get,
  1715 + .put = stac92xx_mux_enum_put,
  1716 + },
  1717 + {}
  1718 +};
  1719 +
  1720 +static struct hda_codec_ops stac9872_patch_ops = {
1671 1721 .build_controls = stac92xx_build_controls,
1672 1722 .build_pcms = stac92xx_build_pcms,
1673 1723 .init = stac92xx_init,
1674 1724  
1675 1725  
1676 1726  
1677 1727  
1678 1728  
1679 1729  
... ... @@ -1677,25 +1727,34 @@
1677 1727 #endif
1678 1728 };
1679 1729  
1680   -enum { STAC766x_VAIO };
  1730 +enum { /* FE and SZ series. id=0x83847661 and subsys=0x104D0700 or 104D1000. */
  1731 + CXD9872RD_VAIO,
  1732 + /* Unknown. id=0x83847662 and subsys=0x104D1200 or 104D1000. */
  1733 + STAC9872AK_VAIO,
  1734 + /* Unknown. id=0x83847661 and subsys=0x104D1200. */
  1735 + STAC9872K_VAIO,
  1736 + /* AR Series. id=0x83847664 and subsys=104D1300 */
  1737 + CXD9872AKD_VAIO
  1738 + };
1681 1739  
1682   -static struct hda_board_config stac766x_cfg_tbl[] = {
1683   - { .modelname = "vaio", .config = STAC766x_VAIO },
  1740 +static struct hda_board_config stac9872_cfg_tbl[] = {
  1741 + { .modelname = "vaio", .config = CXD9872RD_VAIO },
  1742 + { .modelname = "vaio-ar", .config = CXD9872AKD_VAIO },
1684 1743 { .pci_subvendor = 0x104d, .pci_subdevice = 0x81e6,
1685   - .config = STAC766x_VAIO },
  1744 + .config = CXD9872RD_VAIO },
1686 1745 { .pci_subvendor = 0x104d, .pci_subdevice = 0x81ef,
1687   - .config = STAC766x_VAIO },
  1746 + .config = CXD9872RD_VAIO },
1688 1747 { .pci_subvendor = 0x104d, .pci_subdevice = 0x81fd,
1689   - .config = STAC766x_VAIO },
  1748 + .config = CXD9872AKD_VAIO },
1690 1749 {}
1691 1750 };
1692 1751  
1693   -static int patch_stac766x(struct hda_codec *codec)
  1752 +static int patch_stac9872(struct hda_codec *codec)
1694 1753 {
1695 1754 struct sigmatel_spec *spec;
1696 1755 int board_config;
1697 1756  
1698   - board_config = snd_hda_check_board_config(codec, stac766x_cfg_tbl);
  1757 + board_config = snd_hda_check_board_config(codec, stac9872_cfg_tbl);
1699 1758 if (board_config < 0)
1700 1759 /* unknown config, let generic-parser do its job... */
1701 1760 return snd_hda_parse_generic_codec(codec);
... ... @@ -1706,7 +1765,9 @@
1706 1765  
1707 1766 codec->spec = spec;
1708 1767 switch (board_config) {
1709   - case STAC766x_VAIO:
  1768 + case CXD9872RD_VAIO:
  1769 + case STAC9872AK_VAIO:
  1770 + case STAC9872K_VAIO:
1710 1771 spec->mixer = vaio_mixer;
1711 1772 spec->init = vaio_init;
1712 1773 spec->multiout.max_channels = 2;
1713 1774  
... ... @@ -1718,9 +1779,22 @@
1718 1779 spec->input_mux = &vaio_mux;
1719 1780 spec->mux_nids = vaio_mux_nids;
1720 1781 break;
  1782 +
  1783 + case CXD9872AKD_VAIO:
  1784 + spec->mixer = vaio_ar_mixer;
  1785 + spec->init = vaio_ar_init;
  1786 + spec->multiout.max_channels = 2;
  1787 + spec->multiout.num_dacs = ARRAY_SIZE(vaio_dacs);
  1788 + spec->multiout.dac_nids = vaio_dacs;
  1789 + spec->multiout.hp_nid = VAIO_HP_DAC;
  1790 + spec->num_adcs = ARRAY_SIZE(vaio_adcs);
  1791 + spec->adc_nids = vaio_adcs;
  1792 + spec->input_mux = &vaio_mux;
  1793 + spec->mux_nids = vaio_mux_nids;
  1794 + break;
1721 1795 }
1722 1796  
1723   - codec->patch_ops = stac766x_patch_ops;
  1797 + codec->patch_ops = stac9872_patch_ops;
1724 1798 return 0;
1725 1799 }
1726 1800  
... ... @@ -1752,7 +1826,13 @@
1752 1826 { .id = 0x83847627, .name = "STAC9271D", .patch = patch_stac927x },
1753 1827 { .id = 0x83847628, .name = "STAC9274X5NH", .patch = patch_stac927x },
1754 1828 { .id = 0x83847629, .name = "STAC9274D5NH", .patch = patch_stac927x },
1755   - { .id = 0x83847661, .name = "STAC7661", .patch = patch_stac766x },
  1829 + /* The following does not take into account .id=0x83847661 when subsys =
  1830 + * 104D0C00 which is STAC9225s. Because of this, some SZ Notebooks are
  1831 + * currently not fully supported.
  1832 + */
  1833 + { .id = 0x83847661, .name = "CXD9872RD/K", .patch = patch_stac9872 },
  1834 + { .id = 0x83847662, .name = "STAC9872AK", .patch = patch_stac9872 },
  1835 + { .id = 0x83847664, .name = "CXD9872AKD", .patch = patch_stac9872 },
1756 1836 { .id = 0x838476a0, .name = "STAC9205", .patch = patch_stac9205 },
1757 1837 { .id = 0x838476a1, .name = "STAC9205D", .patch = patch_stac9205 },
1758 1838 { .id = 0x838476a2, .name = "STAC9204", .patch = patch_stac9205 },
... ... @@ -1761,7 +1841,6 @@
1761 1841 { .id = 0x838476a5, .name = "STAC9255D", .patch = patch_stac9205 },
1762 1842 { .id = 0x838476a6, .name = "STAC9254", .patch = patch_stac9205 },
1763 1843 { .id = 0x838476a7, .name = "STAC9254D", .patch = patch_stac9205 },
1764   - { .id = 0x83847664, .name = "STAC7664", .patch = patch_stac766x },
1765 1844 {} /* terminator */
1766 1845 };