Commit b5bfbc67 authored by Takashi Iwai's avatar Takashi Iwai

ALSA: hda - Reorganize fixup structure for Realtek

Instead of keeping various data types in a single record, put the
type field and keep a single value in each entry, but allows chaining
multiple fixup entries.  This allows more flexible data management
(see ALC275_FIXUP_SONY_HWEQ for example).
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 9fb1ef25
...@@ -303,6 +303,8 @@ struct alc_customize_define { ...@@ -303,6 +303,8 @@ struct alc_customize_define {
unsigned int fixup:1; /* Means that this sku is set by driver, not read from hw */ unsigned int fixup:1; /* Means that this sku is set by driver, not read from hw */
}; };
struct alc_fixup;
struct alc_spec { struct alc_spec {
/* codec parameterization */ /* codec parameterization */
struct snd_kcontrol_new *mixers[5]; /* mixer arrays */ struct snd_kcontrol_new *mixers[5]; /* mixer arrays */
...@@ -404,6 +406,11 @@ struct alc_spec { ...@@ -404,6 +406,11 @@ struct alc_spec {
/* for PLL fix */ /* for PLL fix */
hda_nid_t pll_nid; hda_nid_t pll_nid;
unsigned int pll_coef_idx, pll_coef_bit; unsigned int pll_coef_idx, pll_coef_bit;
/* fix-up list */
int fixup_id;
const struct alc_fixup *fixup_list;
const char *fixup_name;
}; };
/* /*
...@@ -1683,88 +1690,130 @@ struct alc_model_fixup { ...@@ -1683,88 +1690,130 @@ struct alc_model_fixup {
}; };
struct alc_fixup { struct alc_fixup {
int type;
union {
unsigned int sku; unsigned int sku;
const struct alc_pincfg *pins; const struct alc_pincfg *pins;
const struct hda_verb *verbs; const struct hda_verb *verbs;
void (*func)(struct hda_codec *codec, const struct alc_fixup *fix, void (*func)(struct hda_codec *codec,
int pre_init); const struct alc_fixup *fix,
int action);
} v;
bool chained;
int chain_id;
}; };
static void __alc_pick_fixup(struct hda_codec *codec, enum {
const struct alc_fixup *fix, ALC_FIXUP_INVALID,
const char *modelname, ALC_FIXUP_SKU,
int pre_init) ALC_FIXUP_PINS,
ALC_FIXUP_VERBS,
ALC_FIXUP_FUNC,
};
enum {
ALC_FIXUP_ACT_PRE_PROBE,
ALC_FIXUP_ACT_PROBE,
};
static void alc_apply_fixup(struct hda_codec *codec, int action)
{ {
struct alc_spec *spec = codec->spec;
int id = spec->fixup_id;
const char *modelname = spec->fixup_name;
int depth = 0;
if (!spec->fixup_list)
return;
while (id >= 0) {
const struct alc_fixup *fix = spec->fixup_list + id;
const struct alc_pincfg *cfg; const struct alc_pincfg *cfg;
struct alc_spec *spec;
cfg = fix->pins; switch (fix->type) {
if (pre_init && fix->sku) { case ALC_FIXUP_SKU:
#ifdef CONFIG_SND_DEBUG_VERBOSE if (action != ALC_FIXUP_ACT_PRE_PROBE || !fix->v.sku)
snd_printdd(KERN_INFO "hda_codec: %s: Apply sku override for %s\n", break;;
snd_printdd(KERN_INFO "hda_codec: %s: "
"Apply sku override for %s\n",
codec->chip_name, modelname); codec->chip_name, modelname);
#endif spec->cdefine.sku_cfg = fix->v.sku;
spec = codec->spec;
spec->cdefine.sku_cfg = fix->sku;
spec->cdefine.fixup = 1; spec->cdefine.fixup = 1;
} break;
if (pre_init && cfg) { case ALC_FIXUP_PINS:
#ifdef CONFIG_SND_DEBUG_VERBOSE cfg = fix->v.pins;
snd_printdd(KERN_INFO "hda_codec: %s: Apply pincfg for %s\n", if (action != ALC_FIXUP_ACT_PRE_PROBE || !cfg)
break;
snd_printdd(KERN_INFO "hda_codec: %s: "
"Apply pincfg for %s\n",
codec->chip_name, modelname); codec->chip_name, modelname);
#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 (!pre_init && fix->verbs) { break;
#ifdef CONFIG_SND_DEBUG_VERBOSE case ALC_FIXUP_VERBS:
snd_printdd(KERN_INFO "hda_codec: %s: Apply fix-verbs for %s\n", if (action != ALC_FIXUP_ACT_PROBE || !fix->v.verbs)
break;
snd_printdd(KERN_INFO "hda_codec: %s: "
"Apply fix-verbs for %s\n",
codec->chip_name, modelname); codec->chip_name, modelname);
#endif add_verb(codec->spec, fix->v.verbs);
add_verb(codec->spec, fix->verbs); break;
} case ALC_FIXUP_FUNC:
if (fix->func) { if (!fix->v.func)
#ifdef CONFIG_SND_DEBUG_VERBOSE break;
snd_printdd(KERN_INFO "hda_codec: %s: Apply fix-func for %s\n", snd_printdd(KERN_INFO "hda_codec: %s: "
"Apply fix-func for %s\n",
codec->chip_name, modelname); codec->chip_name, modelname);
#endif fix->v.func(codec, fix, action);
fix->func(codec, fix, pre_init); break;
default:
snd_printk(KERN_ERR "hda_codec: %s: "
"Invalid fixup type %d\n",
codec->chip_name, fix->type);
break;
} }
} if (!fix[id].chained)
break;
static void alc_pick_fixup(struct hda_codec *codec, if (++depth > 10)
const struct snd_pci_quirk *quirk, break;
const struct alc_fixup *fix, id = fix[id].chain_id;
int pre_init)
{
quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
if (quirk) {
fix += quirk->value;
#ifdef CONFIG_SND_DEBUG_VERBOSE
__alc_pick_fixup(codec, fix, quirk->name, pre_init);
#else
__alc_pick_fixup(codec, fix, NULL, pre_init);
#endif
} }
} }
static void alc_pick_fixup_model(struct hda_codec *codec, static void alc_pick_fixup(struct hda_codec *codec,
const struct alc_model_fixup *models, const struct alc_model_fixup *models,
const struct snd_pci_quirk *quirk, const struct snd_pci_quirk *quirk,
const struct alc_fixup *fix, const struct alc_fixup *fixlist)
int pre_init)
{ {
struct alc_spec *spec = codec->spec;
int id = -1;
const char *name = NULL;
if (codec->modelname && models) { if (codec->modelname && models) {
while (models->name) { while (models->name) {
if (!strcmp(codec->modelname, models->name)) { if (!strcmp(codec->modelname, models->name)) {
fix += models->id; id = models->id;
name = models->name;
break; break;
} }
models++; models++;
} }
__alc_pick_fixup(codec, fix, codec->modelname, pre_init); }
} else { if (id < 0) {
alc_pick_fixup(codec, quirk, fix, pre_init); quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk);
if (quirk) {
id = quirk->value;
#ifdef CONFIG_SND_DEBUG_VERBOSE
name = quirk->name;
#endif
}
}
spec->fixup_id = id;
if (id >= 0) {
spec->fixup_list = fixlist;
spec->fixup_name = name;
} }
} }
...@@ -7090,7 +7139,8 @@ enum { ...@@ -7090,7 +7139,8 @@ enum {
static const struct alc_fixup alc260_fixups[] = { static const struct alc_fixup alc260_fixups[] = {
[PINFIX_HP_DC5750] = { [PINFIX_HP_DC5750] = {
.pins = (const struct alc_pincfg[]) { .type = ALC_FIXUP_PINS,
.v.pins = (const struct alc_pincfg[]) {
{ 0x11, 0x90130110 }, /* speaker */ { 0x11, 0x90130110 }, /* speaker */
{ } { }
} }
...@@ -7301,8 +7351,10 @@ static int patch_alc260(struct hda_codec *codec) ...@@ -7301,8 +7351,10 @@ static int patch_alc260(struct hda_codec *codec)
board_config = ALC260_AUTO; board_config = ALC260_AUTO;
} }
if (board_config == ALC260_AUTO) if (board_config == ALC260_AUTO) {
alc_pick_fixup(codec, alc260_fixup_tbl, alc260_fixups, 1); alc_pick_fixup(codec, NULL, alc260_fixup_tbl, alc260_fixups);
alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
}
if (board_config == ALC260_AUTO) { if (board_config == ALC260_AUTO) {
/* automatic parse from the BIOS config */ /* automatic parse from the BIOS config */
...@@ -7350,8 +7402,7 @@ static int patch_alc260(struct hda_codec *codec) ...@@ -7350,8 +7402,7 @@ static int patch_alc260(struct hda_codec *codec)
set_capture_mixer(codec); set_capture_mixer(codec);
set_beep_amp(spec, 0x07, 0x05, HDA_INPUT); set_beep_amp(spec, 0x07, 0x05, HDA_INPUT);
if (board_config == ALC260_AUTO) alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
alc_pick_fixup(codec, alc260_fixup_tbl, alc260_fixups, 0);
spec->vmaster_nid = 0x08; spec->vmaster_nid = 0x08;
...@@ -10678,7 +10729,8 @@ enum { ...@@ -10678,7 +10729,8 @@ enum {
static const struct alc_fixup alc882_fixups[] = { static const struct alc_fixup alc882_fixups[] = {
[PINFIX_ABIT_AW9D_MAX] = { [PINFIX_ABIT_AW9D_MAX] = {
.pins = (const struct alc_pincfg[]) { .type = ALC_FIXUP_PINS,
.v.pins = (const struct alc_pincfg[]) {
{ 0x15, 0x01080104 }, /* side */ { 0x15, 0x01080104 }, /* side */
{ 0x16, 0x01011012 }, /* rear */ { 0x16, 0x01011012 }, /* rear */
{ 0x17, 0x01016011 }, /* clfe */ { 0x17, 0x01016011 }, /* clfe */
...@@ -10686,13 +10738,15 @@ static const struct alc_fixup alc882_fixups[] = { ...@@ -10686,13 +10738,15 @@ static const struct alc_fixup alc882_fixups[] = {
} }
}, },
[PINFIX_PB_M5210] = { [PINFIX_PB_M5210] = {
.verbs = (const struct hda_verb[]) { .type = ALC_FIXUP_VERBS,
.v.verbs = (const struct hda_verb[]) {
{ 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50 }, { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50 },
{} {}
} }
}, },
[PINFIX_ACER_ASPIRE_7736] = { [PINFIX_ACER_ASPIRE_7736] = {
.sku = ALC_FIXUP_SKU_IGNORE, .type = ALC_FIXUP_SKU,
.v.sku = ALC_FIXUP_SKU_IGNORE,
}, },
}; };
...@@ -10978,8 +11032,10 @@ static int patch_alc882(struct hda_codec *codec) ...@@ -10978,8 +11032,10 @@ static int patch_alc882(struct hda_codec *codec)
board_config = ALC882_AUTO; board_config = ALC882_AUTO;
} }
if (board_config == ALC882_AUTO) if (board_config == ALC882_AUTO) {
alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups, 1); alc_pick_fixup(codec, NULL, alc882_fixup_tbl, alc882_fixups);
alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
}
alc_auto_parse_customize_define(codec); alc_auto_parse_customize_define(codec);
...@@ -11055,8 +11111,7 @@ static int patch_alc882(struct hda_codec *codec) ...@@ -11055,8 +11111,7 @@ static int patch_alc882(struct hda_codec *codec)
if (has_cdefine_beep(codec)) if (has_cdefine_beep(codec))
set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
if (board_config == ALC882_AUTO) alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups, 0);
spec->vmaster_nid = 0x0c; spec->vmaster_nid = 0x0c;
...@@ -12446,7 +12501,8 @@ enum { ...@@ -12446,7 +12501,8 @@ enum {
static const struct alc_fixup alc262_fixups[] = { static const struct alc_fixup alc262_fixups[] = {
[PINFIX_FSC_H270] = { [PINFIX_FSC_H270] = {
.pins = (const struct alc_pincfg[]) { .type = ALC_FIXUP_PINS,
.v.pins = (const struct alc_pincfg[]) {
{ 0x14, 0x99130110 }, /* speaker */ { 0x14, 0x99130110 }, /* speaker */
{ 0x15, 0x0221142f }, /* front HP */ { 0x15, 0x0221142f }, /* front HP */
{ 0x1b, 0x0121141f }, /* rear HP */ { 0x1b, 0x0121141f }, /* rear HP */
...@@ -12883,8 +12939,10 @@ static int patch_alc262(struct hda_codec *codec) ...@@ -12883,8 +12939,10 @@ static int patch_alc262(struct hda_codec *codec)
board_config = ALC262_AUTO; board_config = ALC262_AUTO;
} }
if (board_config == ALC262_AUTO) if (board_config == ALC262_AUTO) {
alc_pick_fixup(codec, alc262_fixup_tbl, alc262_fixups, 1); alc_pick_fixup(codec, NULL, alc262_fixup_tbl, alc262_fixups);
alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
}
if (board_config == ALC262_AUTO) { if (board_config == ALC262_AUTO) {
/* automatic parse from the BIOS config */ /* automatic parse from the BIOS config */
...@@ -12954,8 +13012,7 @@ static int patch_alc262(struct hda_codec *codec) ...@@ -12954,8 +13012,7 @@ static int patch_alc262(struct hda_codec *codec)
if (!spec->no_analog && has_cdefine_beep(codec)) if (!spec->no_analog && has_cdefine_beep(codec))
set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
if (board_config == ALC262_AUTO) alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
alc_pick_fixup(codec, alc262_fixup_tbl, alc262_fixups, 0);
spec->vmaster_nid = 0x0c; spec->vmaster_nid = 0x0c;
...@@ -14810,11 +14867,11 @@ static int alc269_resume(struct hda_codec *codec) ...@@ -14810,11 +14867,11 @@ static int alc269_resume(struct hda_codec *codec)
#endif /* SND_HDA_NEEDS_RESUME */ #endif /* SND_HDA_NEEDS_RESUME */
static void alc269_fixup_hweq(struct hda_codec *codec, static void alc269_fixup_hweq(struct hda_codec *codec,
const struct alc_fixup *fix, int pre_init) const struct alc_fixup *fix, int action)
{ {
int coef; int coef;
if (pre_init) if (action != ALC_FIXUP_ACT_PROBE)
return; return;
coef = alc_read_coef_idx(codec, 0x1e); coef = alc_read_coef_idx(codec, 0x1e);
alc_write_coef_idx(codec, 0x1e, coef | 0x80); alc_write_coef_idx(codec, 0x1e, coef | 0x80);
...@@ -14832,22 +14889,26 @@ enum { ...@@ -14832,22 +14889,26 @@ enum {
static const struct alc_fixup alc269_fixups[] = { static const struct alc_fixup alc269_fixups[] = {
[ALC269_FIXUP_SONY_VAIO] = { [ALC269_FIXUP_SONY_VAIO] = {
.verbs = (const struct hda_verb[]) { .type = ALC_FIXUP_VERBS,
.v.verbs = (const struct hda_verb[]) {
{0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREFGRD}, {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREFGRD},
{} {}
} }
}, },
[ALC275_FIXUP_SONY_VAIO_GPIO2] = { [ALC275_FIXUP_SONY_VAIO_GPIO2] = {
.verbs = (const struct hda_verb[]) { .type = ALC_FIXUP_VERBS,
.v.verbs = (const struct hda_verb[]) {
{0x01, AC_VERB_SET_GPIO_MASK, 0x04}, {0x01, AC_VERB_SET_GPIO_MASK, 0x04},
{0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04}, {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04},
{0x01, AC_VERB_SET_GPIO_DATA, 0x00}, {0x01, AC_VERB_SET_GPIO_DATA, 0x00},
{0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREFGRD},
{ } { }
} },
.chained = true,
.chain_id = ALC269_FIXUP_SONY_VAIO
}, },
[ALC269_FIXUP_DELL_M101Z] = { [ALC269_FIXUP_DELL_M101Z] = {
.verbs = (const struct hda_verb[]) { .type = ALC_FIXUP_VERBS,
.v.verbs = (const struct hda_verb[]) {
/* Enables internal speaker */ /* Enables internal speaker */
{0x20, AC_VERB_SET_COEF_INDEX, 13}, {0x20, AC_VERB_SET_COEF_INDEX, 13},
{0x20, AC_VERB_SET_PROC_COEF, 0x4040}, {0x20, AC_VERB_SET_PROC_COEF, 0x4040},
...@@ -14855,29 +14916,28 @@ static const struct alc_fixup alc269_fixups[] = { ...@@ -14855,29 +14916,28 @@ static const struct alc_fixup alc269_fixups[] = {
} }
}, },
[ALC269_FIXUP_SKU_IGNORE] = { [ALC269_FIXUP_SKU_IGNORE] = {
.sku = ALC_FIXUP_SKU_IGNORE, .type = ALC_FIXUP_SKU,
.v.sku = ALC_FIXUP_SKU_IGNORE,
}, },
[ALC269_FIXUP_ASUS_G73JW] = { [ALC269_FIXUP_ASUS_G73JW] = {
.pins = (const struct alc_pincfg[]) { .type = ALC_FIXUP_PINS,
.v.pins = (const struct alc_pincfg[]) {
{ 0x17, 0x99130111 }, /* subwoofer */ { 0x17, 0x99130111 }, /* subwoofer */
{ } { }
} }
}, },
[ALC269_FIXUP_LENOVO_EAPD] = { [ALC269_FIXUP_LENOVO_EAPD] = {
.verbs = (const struct hda_verb[]) { .type = ALC_FIXUP_VERBS,
.v.verbs = (const struct hda_verb[]) {
{0x14, AC_VERB_SET_EAPD_BTLENABLE, 0}, {0x14, AC_VERB_SET_EAPD_BTLENABLE, 0},
{} {}
} }
}, },
[ALC275_FIXUP_SONY_HWEQ] = { [ALC275_FIXUP_SONY_HWEQ] = {
.func = alc269_fixup_hweq, .type = ALC_FIXUP_FUNC,
.verbs = (const struct hda_verb[]) { .v.func = alc269_fixup_hweq,
{0x01, AC_VERB_SET_GPIO_MASK, 0x04}, .chained = true,
{0x01, AC_VERB_SET_GPIO_DIRECTION, 0x04}, .chain_id = ALC275_FIXUP_SONY_VAIO_GPIO2
{0x01, AC_VERB_SET_GPIO_DATA, 0x00},
{0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREFGRD},
{ }
}
} }
}; };
...@@ -15174,8 +15234,10 @@ static int patch_alc269(struct hda_codec *codec) ...@@ -15174,8 +15234,10 @@ static int patch_alc269(struct hda_codec *codec)
board_config = ALC269_AUTO; board_config = ALC269_AUTO;
} }
if (board_config == ALC269_AUTO) if (board_config == ALC269_AUTO) {
alc_pick_fixup(codec, alc269_fixup_tbl, alc269_fixups, 1); alc_pick_fixup(codec, NULL, alc269_fixup_tbl, alc269_fixups);
alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
}
if (board_config == ALC269_AUTO) { if (board_config == ALC269_AUTO) {
/* automatic parse from the BIOS config */ /* automatic parse from the BIOS config */
...@@ -15236,8 +15298,7 @@ static int patch_alc269(struct hda_codec *codec) ...@@ -15236,8 +15298,7 @@ static int patch_alc269(struct hda_codec *codec)
if (has_cdefine_beep(codec)) if (has_cdefine_beep(codec))
set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT);
if (board_config == ALC269_AUTO) alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
alc_pick_fixup(codec, alc269_fixup_tbl, alc269_fixups, 0);
spec->vmaster_nid = 0x02; spec->vmaster_nid = 0x02;
...@@ -16296,7 +16357,8 @@ enum { ...@@ -16296,7 +16357,8 @@ enum {
static const struct alc_fixup alc861_fixups[] = { static const struct alc_fixup alc861_fixups[] = {
[PINFIX_FSC_AMILO_PI1505] = { [PINFIX_FSC_AMILO_PI1505] = {
.pins = (const struct alc_pincfg[]) { .type = ALC_FIXUP_PINS,
.v.pins = (const struct alc_pincfg[]) {
{ 0x0b, 0x0221101f }, /* HP */ { 0x0b, 0x0221101f }, /* HP */
{ 0x0f, 0x90170310 }, /* speaker */ { 0x0f, 0x90170310 }, /* speaker */
{ } { }
...@@ -16331,8 +16393,10 @@ static int patch_alc861(struct hda_codec *codec) ...@@ -16331,8 +16393,10 @@ static int patch_alc861(struct hda_codec *codec)
board_config = ALC861_AUTO; board_config = ALC861_AUTO;
} }
if (board_config == ALC861_AUTO) if (board_config == ALC861_AUTO) {
alc_pick_fixup(codec, alc861_fixup_tbl, alc861_fixups, 1); alc_pick_fixup(codec, NULL, alc861_fixup_tbl, alc861_fixups);
alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
}
if (board_config == ALC861_AUTO) { if (board_config == ALC861_AUTO) {
/* automatic parse from the BIOS config */ /* automatic parse from the BIOS config */
...@@ -16369,8 +16433,7 @@ static int patch_alc861(struct hda_codec *codec) ...@@ -16369,8 +16433,7 @@ static int patch_alc861(struct hda_codec *codec)
spec->vmaster_nid = 0x03; spec->vmaster_nid = 0x03;
if (board_config == ALC861_AUTO) alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
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) {
...@@ -17252,7 +17315,8 @@ enum { ...@@ -17252,7 +17315,8 @@ enum {
/* reset GPIO1 */ /* reset GPIO1 */
static const struct alc_fixup alc861vd_fixups[] = { static const struct alc_fixup alc861vd_fixups[] = {
[ALC660VD_FIX_ASUS_GPIO1] = { [ALC660VD_FIX_ASUS_GPIO1] = {
.verbs = (const struct hda_verb[]) { .type = ALC_FIXUP_VERBS,
.v.verbs = (const struct hda_verb[]) {
{0x01, AC_VERB_SET_GPIO_MASK, 0x03}, {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
{0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01}, {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
{0x01, AC_VERB_SET_GPIO_DATA, 0x01}, {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
...@@ -17287,8 +17351,10 @@ static int patch_alc861vd(struct hda_codec *codec) ...@@ -17287,8 +17351,10 @@ static int patch_alc861vd(struct hda_codec *codec)
board_config = ALC861VD_AUTO; board_config = ALC861VD_AUTO;
} }
if (board_config == ALC861VD_AUTO) if (board_config == ALC861VD_AUTO) {
alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups, 1); alc_pick_fixup(codec, NULL, alc861vd_fixup_tbl, alc861vd_fixups);
alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
}
if (board_config == ALC861VD_AUTO) { if (board_config == ALC861VD_AUTO) {
/* automatic parse from the BIOS config */ /* automatic parse from the BIOS config */
...@@ -17336,8 +17402,7 @@ static int patch_alc861vd(struct hda_codec *codec) ...@@ -17336,8 +17402,7 @@ static int patch_alc861vd(struct hda_codec *codec)
spec->vmaster_nid = 0x02; spec->vmaster_nid = 0x02;
if (board_config == ALC861VD_AUTO) alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups, 0);
codec->patch_ops = alc_patch_ops; codec->patch_ops = alc_patch_ops;
...@@ -19368,9 +19433,9 @@ static void alc662_auto_init(struct hda_codec *codec) ...@@ -19368,9 +19433,9 @@ static void alc662_auto_init(struct hda_codec *codec)
} }
static void alc272_fixup_mario(struct hda_codec *codec, static void alc272_fixup_mario(struct hda_codec *codec,
const struct alc_fixup *fix, int pre_init) const struct alc_fixup *fix, int action)
{ {
if (!pre_init) if (action != ALC_FIXUP_ACT_PROBE)
return; return;
if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT, if (snd_hda_override_amp_caps(codec, 0x2, HDA_OUTPUT,
(0x3b << AC_AMPCAP_OFFSET_SHIFT) | (0x3b << AC_AMPCAP_OFFSET_SHIFT) |
...@@ -19389,19 +19454,22 @@ enum { ...@@ -19389,19 +19454,22 @@ enum {
static const struct alc_fixup alc662_fixups[] = { static const struct alc_fixup alc662_fixups[] = {
[ALC662_FIXUP_ASPIRE] = { [ALC662_FIXUP_ASPIRE] = {
.pins = (const struct alc_pincfg[]) { .type = ALC_FIXUP_PINS,
.v.pins = (const struct alc_pincfg[]) {
{ 0x15, 0x99130112 }, /* subwoofer */ { 0x15, 0x99130112 }, /* subwoofer */
{ } { }
} }
}, },
[ALC662_FIXUP_IDEAPAD] = { [ALC662_FIXUP_IDEAPAD] = {
.pins = (const struct alc_pincfg[]) { .type = ALC_FIXUP_PINS,
.v.pins = (const struct alc_pincfg[]) {
{ 0x17, 0x99130112 }, /* subwoofer */ { 0x17, 0x99130112 }, /* subwoofer */
{ } { }
} }
}, },
[ALC272_FIXUP_MARIO] = { [ALC272_FIXUP_MARIO] = {
.func = alc272_fixup_mario, .type = ALC_FIXUP_FUNC,
.v.func = alc272_fixup_mario,
} }
}; };
...@@ -19455,7 +19523,9 @@ static int patch_alc662(struct hda_codec *codec) ...@@ -19455,7 +19523,9 @@ static int patch_alc662(struct hda_codec *codec)
} }
if (board_config == ALC662_AUTO) { if (board_config == ALC662_AUTO) {
alc_pick_fixup(codec, alc662_fixup_tbl, alc662_fixups, 1); alc_pick_fixup(codec, alc662_fixup_models,
alc662_fixup_tbl, alc662_fixups);
alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
/* automatic parse from the BIOS config */ /* automatic parse from the BIOS config */
err = alc662_parse_auto_config(codec); err = alc662_parse_auto_config(codec);
if (err < 0) { if (err < 0) {
...@@ -19513,12 +19583,11 @@ static int patch_alc662(struct hda_codec *codec) ...@@ -19513,12 +19583,11 @@ static int patch_alc662(struct hda_codec *codec)
} }
spec->vmaster_nid = 0x02; spec->vmaster_nid = 0x02;
alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
codec->patch_ops = alc_patch_ops; codec->patch_ops = alc_patch_ops;
if (board_config == ALC662_AUTO) { if (board_config == ALC662_AUTO)
spec->init_hook = alc662_auto_init; spec->init_hook = alc662_auto_init;
alc_pick_fixup_model(codec, alc662_fixup_models,
alc662_fixup_tbl, alc662_fixups, 0);
}
alc_init_jacks(codec); alc_init_jacks(codec);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment