aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2017-04-10 12:05:52 -0400
committerTakashi Iwai <tiwai@suse.de>2017-04-21 04:52:46 -0400
commit7beb3a6e9335d13872f24566b451f8371edd238f (patch)
treef74dfced431462d18091ef1e0754a47093db8738
parent7480316c265c9fcdbf73b1b8dec061b893b7e987 (diff)
ALSA: hda - Support Gigabyte Gaming board with dual Realtek codecs
This patch adds some workarounds to make Gigabyte GA-AX370 Gaming 5 board working without the conflicts of kctls, etc. In general, the dual codec configs result in the conflicts of the following stuff: - Master controls - Capture controls - Analog loopback controls In addition, the auto-mute and the auto-mic can't work well among multiple codecs. The current "solution" is to disable all these features, and use UCM for a better PulseAudio management. For a dedicated UCM profile, the patch overrides the card longname so that the system an get a unique profile path. Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=195305 Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--sound/pci/hda/patch_realtek.c61
1 files changed, 61 insertions, 0 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 9371f1a95b33..e81cf83d2afd 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -1800,6 +1800,7 @@ enum {
1800 ALC882_FIXUP_NO_PRIMARY_HP, 1800 ALC882_FIXUP_NO_PRIMARY_HP,
1801 ALC887_FIXUP_ASUS_BASS, 1801 ALC887_FIXUP_ASUS_BASS,
1802 ALC887_FIXUP_BASS_CHMAP, 1802 ALC887_FIXUP_BASS_CHMAP,
1803 ALC1220_FIXUP_GB_DUAL_CODECS,
1803}; 1804};
1804 1805
1805static void alc889_fixup_coef(struct hda_codec *codec, 1806static void alc889_fixup_coef(struct hda_codec *codec,
@@ -1962,6 +1963,61 @@ static void alc882_fixup_no_primary_hp(struct hda_codec *codec,
1962static void alc_fixup_bass_chmap(struct hda_codec *codec, 1963static void alc_fixup_bass_chmap(struct hda_codec *codec,
1963 const struct hda_fixup *fix, int action); 1964 const struct hda_fixup *fix, int action);
1964 1965
1966/* For dual-codec configuration, we need to disable some features to avoid
1967 * conflicts of kctls and PCM streams
1968 */
1969static void alc_fixup_dual_codecs(struct hda_codec *codec,
1970 const struct hda_fixup *fix, int action)
1971{
1972 struct alc_spec *spec = codec->spec;
1973
1974 if (action != HDA_FIXUP_ACT_PRE_PROBE)
1975 return;
1976 /* disable vmaster */
1977 spec->gen.suppress_vmaster = 1;
1978 /* auto-mute and auto-mic switch don't work with multiple codecs */
1979 spec->gen.suppress_auto_mute = 1;
1980 spec->gen.suppress_auto_mic = 1;
1981 /* disable aamix as well */
1982 spec->gen.mixer_nid = 0;
1983 /* add location prefix to avoid conflicts */
1984 codec->force_pin_prefix = 1;
1985}
1986
1987static void rename_ctl(struct hda_codec *codec, const char *oldname,
1988 const char *newname)
1989{
1990 struct snd_kcontrol *kctl;
1991
1992 kctl = snd_hda_find_mixer_ctl(codec, oldname);
1993 if (kctl)
1994 strcpy(kctl->id.name, newname);
1995}
1996
1997static void alc1220_fixup_gb_dual_codecs(struct hda_codec *codec,
1998 const struct hda_fixup *fix,
1999 int action)
2000{
2001 alc_fixup_dual_codecs(codec, fix, action);
2002 switch (action) {
2003 case HDA_FIXUP_ACT_PRE_PROBE:
2004 /* override card longname to provide a unique UCM profile */
2005 strcpy(codec->card->longname, "HDAudio-Gigabyte-ALC1220DualCodecs");
2006 break;
2007 case HDA_FIXUP_ACT_BUILD:
2008 /* rename Capture controls depending on the codec */
2009 rename_ctl(codec, "Capture Volume",
2010 codec->addr == 0 ?
2011 "Rear-Panel Capture Volume" :
2012 "Front-Panel Capture Volume");
2013 rename_ctl(codec, "Capture Switch",
2014 codec->addr == 0 ?
2015 "Rear-Panel Capture Switch" :
2016 "Front-Panel Capture Switch");
2017 break;
2018 }
2019}
2020
1965static const struct hda_fixup alc882_fixups[] = { 2021static const struct hda_fixup alc882_fixups[] = {
1966 [ALC882_FIXUP_ABIT_AW9D_MAX] = { 2022 [ALC882_FIXUP_ABIT_AW9D_MAX] = {
1967 .type = HDA_FIXUP_PINS, 2023 .type = HDA_FIXUP_PINS,
@@ -2198,6 +2254,10 @@ static const struct hda_fixup alc882_fixups[] = {
2198 .type = HDA_FIXUP_FUNC, 2254 .type = HDA_FIXUP_FUNC,
2199 .v.func = alc_fixup_bass_chmap, 2255 .v.func = alc_fixup_bass_chmap,
2200 }, 2256 },
2257 [ALC1220_FIXUP_GB_DUAL_CODECS] = {
2258 .type = HDA_FIXUP_FUNC,
2259 .v.func = alc1220_fixup_gb_dual_codecs,
2260 },
2201}; 2261};
2202 2262
2203static const struct snd_pci_quirk alc882_fixup_tbl[] = { 2263static const struct snd_pci_quirk alc882_fixup_tbl[] = {
@@ -2267,6 +2327,7 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = {
2267 SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD), 2327 SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD),
2268 SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3), 2328 SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3),
2269 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE), 2329 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE),
2330 SND_PCI_QUIRK(0x1458, 0xa0b8, "Gigabyte AZ370-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
2270 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX), 2331 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX),
2271 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD), 2332 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD),
2272 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD), 2333 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD),