Commit fd108215 authored by Takashi Iwai's avatar Takashi Iwai

ALSA: hda - Add a new fixup type to override pinctl values

Add a new fixup type, HDA_FIXUP_PINCTLS, for overriding the pinctl
values of the given pins.  It takes the same array of struct pintbl
like HDA_FIXUP_PINS, but each entry contains the pinctl value instead
of the pin default config value.

This patch also replaces the corresponding codes in patch_realtek.c.
Without this change, the direct call of verbs may be overridden again
by the later call of pinctl restoration by the driver.
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent d3f02d60
...@@ -655,6 +655,13 @@ void snd_hda_apply_pincfgs(struct hda_codec *codec, ...@@ -655,6 +655,13 @@ void snd_hda_apply_pincfgs(struct hda_codec *codec,
} }
EXPORT_SYMBOL_HDA(snd_hda_apply_pincfgs); EXPORT_SYMBOL_HDA(snd_hda_apply_pincfgs);
static void set_pin_targets(struct hda_codec *codec,
const struct hda_pintbl *cfg)
{
for (; cfg->nid; cfg++)
snd_hda_set_pin_ctl_cache(codec, cfg->nid, cfg->val);
}
void snd_hda_apply_fixup(struct hda_codec *codec, int action) void snd_hda_apply_fixup(struct hda_codec *codec, int action)
{ {
int id = codec->fixup_id; int id = codec->fixup_id;
...@@ -694,6 +701,14 @@ void snd_hda_apply_fixup(struct hda_codec *codec, int action) ...@@ -694,6 +701,14 @@ void snd_hda_apply_fixup(struct hda_codec *codec, int action)
codec->chip_name, modelname); codec->chip_name, modelname);
fix->v.func(codec, fix, action); fix->v.func(codec, fix, action);
break; break;
case HDA_FIXUP_PINCTLS:
if (action != HDA_FIXUP_ACT_PROBE || !fix->v.pins)
break;
snd_printdd(KERN_INFO SFX
"%s: Apply pinctl for %s\n",
codec->chip_name, modelname);
set_pin_targets(codec, fix->v.pins);
break;
default: default:
snd_printk(KERN_ERR SFX snd_printk(KERN_ERR SFX
"%s: Invalid fixup type %d\n", "%s: Invalid fixup type %d\n",
......
...@@ -422,6 +422,7 @@ enum { ...@@ -422,6 +422,7 @@ enum {
HDA_FIXUP_PINS, HDA_FIXUP_PINS,
HDA_FIXUP_VERBS, HDA_FIXUP_VERBS,
HDA_FIXUP_FUNC, HDA_FIXUP_FUNC,
HDA_FIXUP_PINCTLS,
}; };
/* fixup action definitions */ /* fixup action definitions */
......
...@@ -1794,9 +1794,9 @@ static const struct hda_fixup alc882_fixups[] = { ...@@ -1794,9 +1794,9 @@ static const struct hda_fixup alc882_fixups[] = {
} }
}, },
[ALC882_FIXUP_PB_M5210] = { [ALC882_FIXUP_PB_M5210] = {
.type = HDA_FIXUP_VERBS, .type = HDA_FIXUP_PINCTLS,
.v.verbs = (const struct hda_verb[]) { .v.pins = (const struct hda_pintbl[]) {
{ 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50 }, { 0x19, PIN_VREF50 },
{} {}
} }
}, },
...@@ -2158,9 +2158,9 @@ static const struct hda_fixup alc262_fixups[] = { ...@@ -2158,9 +2158,9 @@ static const struct hda_fixup alc262_fixups[] = {
} }
}, },
[ALC262_FIXUP_LENOVO_3000] = { [ALC262_FIXUP_LENOVO_3000] = {
.type = HDA_FIXUP_VERBS, .type = HDA_FIXUP_PINCTLS,
.v.verbs = (const struct hda_verb[]) { .v.pins = (const struct hda_pintbl[]) {
{ 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50 }, { 0x19, PIN_VREF50 },
{} {}
}, },
.chained = true, .chained = true,
...@@ -2715,9 +2715,9 @@ enum { ...@@ -2715,9 +2715,9 @@ enum {
static const struct hda_fixup alc269_fixups[] = { static const struct hda_fixup alc269_fixups[] = {
[ALC269_FIXUP_SONY_VAIO] = { [ALC269_FIXUP_SONY_VAIO] = {
.type = HDA_FIXUP_VERBS, .type = HDA_FIXUP_PINCTLS,
.v.verbs = (const struct hda_verb[]) { .v.pins = (const struct hda_pintbl[]) {
{0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREFGRD}, {0x19, PIN_VREFGRD},
{} {}
} }
}, },
......
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