Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7fa90e87 authored by Takashi Iwai's avatar Takashi Iwai
Browse files

ALSA: hda - Enhance fix-up table for Realtek codecs



A few enhancement / fixes for fix-up table of some Realtek codecs:
 - Apply fix-ups only for the auto model
 - Apply additional verbs after normal init verbs
 - Add a debug print to show the fix-up application

This is basically a preliminary work for the next fix for Sony VAIO.

Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 7f311a46
Loading
Loading
Loading
Loading
+28 −7
Original line number Original line Diff line number Diff line
@@ -1390,23 +1390,32 @@ struct alc_fixup {
static void alc_pick_fixup(struct hda_codec *codec,
static void alc_pick_fixup(struct hda_codec *codec,
			   const struct snd_pci_quirk *quirk,
			   const struct snd_pci_quirk *quirk,
			   const struct alc_fixup *fix)
			   const struct alc_fixup *fix,
			   int pre_init)
{
{
	const struct alc_pincfg *cfg;
	const struct alc_pincfg *cfg;
	quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
	quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
	if (!quirk)
	if (!quirk)
		return;
		return;
	fix += quirk->value;
	fix += quirk->value;
	cfg = fix->pins;
	cfg = fix->pins;
	if (cfg) {
	if (pre_init && cfg) {
#ifdef CONFIG_SND_DEBUG_VERBOSE
		snd_printdd(KERN_INFO "hda_codec: %s: Apply pincfg for %s\n",
			    codec->chip_name, quirk->name);
#endif
		for (; cfg->nid; cfg++)
		for (; cfg->nid; cfg++)
			snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val);
			snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val);
	}
	}
	if (fix->verbs)
	if (!pre_init && fix->verbs) {
#ifdef CONFIG_SND_DEBUG_VERBOSE
		snd_printdd(KERN_INFO "hda_codec: %s: Apply fix-verbs for %s\n",
			    codec->chip_name, quirk->name);
#endif
		add_verb(codec->spec, fix->verbs);
		add_verb(codec->spec, fix->verbs);
	}
	}
}
static int alc_read_coef_idx(struct hda_codec *codec,
static int alc_read_coef_idx(struct hda_codec *codec,
			unsigned int coef_idx)
			unsigned int coef_idx)
@@ -10439,7 +10448,8 @@ static int patch_alc882(struct hda_codec *codec)
		board_config = ALC882_AUTO;
		board_config = ALC882_AUTO;
	}
	}
	alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups);
	if (board_config == ALC882_AUTO)
		alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups, 1);
	if (board_config == ALC882_AUTO) {
	if (board_config == ALC882_AUTO) {
		/* automatic parse from the BIOS config */
		/* automatic parse from the BIOS config */
@@ -10512,6 +10522,9 @@ static int patch_alc882(struct hda_codec *codec)
	set_capture_mixer(codec);
	set_capture_mixer(codec);
	set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
	set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
	if (board_config == ALC882_AUTO)
		alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups, 0);
	spec->vmaster_nid = 0x0c;
	spec->vmaster_nid = 0x0c;
	codec->patch_ops = alc_patch_ops;
	codec->patch_ops = alc_patch_ops;
@@ -15417,7 +15430,8 @@ static int patch_alc861(struct hda_codec *codec)
		board_config = ALC861_AUTO;
		board_config = ALC861_AUTO;
	}
	}
	alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups);
	if (board_config == ALC861_AUTO)
		alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups, 1);
	if (board_config == ALC861_AUTO) {
	if (board_config == ALC861_AUTO) {
		/* automatic parse from the BIOS config */
		/* automatic parse from the BIOS config */
@@ -15454,6 +15468,9 @@ static int patch_alc861(struct hda_codec *codec)
	spec->vmaster_nid = 0x03;
	spec->vmaster_nid = 0x03;
	if (board_config == ALC861_AUTO)
		alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups, 0);
	codec->patch_ops = alc_patch_ops;
	codec->patch_ops = alc_patch_ops;
	if (board_config == ALC861_AUTO) {
	if (board_config == ALC861_AUTO) {
		spec->init_hook = alc861_auto_init;
		spec->init_hook = alc861_auto_init;
@@ -16388,7 +16405,8 @@ static int patch_alc861vd(struct hda_codec *codec)
		board_config = ALC861VD_AUTO;
		board_config = ALC861VD_AUTO;
	}
	}
	alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups);
	if (board_config == ALC861VD_AUTO)
		alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups, 1);
	if (board_config == ALC861VD_AUTO) {
	if (board_config == ALC861VD_AUTO) {
		/* automatic parse from the BIOS config */
		/* automatic parse from the BIOS config */
@@ -16436,6 +16454,9 @@ static int patch_alc861vd(struct hda_codec *codec)
	spec->vmaster_nid = 0x02;
	spec->vmaster_nid = 0x02;
	if (board_config == ALC861VD_AUTO)
		alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups, 0);
	codec->patch_ops = alc_patch_ops;
	codec->patch_ops = alc_patch_ops;
	if (board_config == ALC861VD_AUTO)
	if (board_config == ALC861VD_AUTO)