Commit 330ee995 authored by Takashi Iwai's avatar Takashi Iwai

ALSA: hda - Remove IDT codec-specific pin save/restore functions

Removed its own save/restore functions and replaced with the common code.
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 0e8a21b5
...@@ -229,7 +229,6 @@ struct sigmatel_spec { ...@@ -229,7 +229,6 @@ struct sigmatel_spec {
/* pin widgets */ /* pin widgets */
hda_nid_t *pin_nids; hda_nid_t *pin_nids;
unsigned int num_pins; unsigned int num_pins;
unsigned int *pin_configs;
/* codec specific stuff */ /* codec specific stuff */
struct hda_verb *init; struct hda_verb *init;
...@@ -2272,101 +2271,19 @@ static struct snd_pci_quirk stac9205_cfg_tbl[] = { ...@@ -2272,101 +2271,19 @@ static struct snd_pci_quirk stac9205_cfg_tbl[] = {
{} /* terminator */ {} /* terminator */
}; };
static int stac92xx_save_bios_config_regs(struct hda_codec *codec) static void stac92xx_set_config_regs(struct hda_codec *codec,
unsigned int *pincfgs)
{ {
int i; int i;
struct sigmatel_spec *spec = codec->spec; struct sigmatel_spec *spec = codec->spec;
kfree(spec->pin_configs); if (!pincfgs)
spec->pin_configs = kcalloc(spec->num_pins, sizeof(*spec->pin_configs),
GFP_KERNEL);
if (!spec->pin_configs)
return -ENOMEM;
for (i = 0; i < spec->num_pins; i++) {
hda_nid_t nid = spec->pin_nids[i];
unsigned int pin_cfg;
if (!nid)
continue;
pin_cfg = snd_hda_codec_read(codec, nid, 0,
AC_VERB_GET_CONFIG_DEFAULT, 0x00);
snd_printdd(KERN_INFO "hda_codec: pin nid %2.2x bios pin config %8.8x\n",
nid, pin_cfg);
spec->pin_configs[i] = pin_cfg;
}
return 0;
}
static void stac92xx_set_config_reg(struct hda_codec *codec,
hda_nid_t pin_nid, unsigned int pin_config)
{
int i;
snd_hda_codec_write(codec, pin_nid, 0,
AC_VERB_SET_CONFIG_DEFAULT_BYTES_0,
pin_config & 0x000000ff);
snd_hda_codec_write(codec, pin_nid, 0,
AC_VERB_SET_CONFIG_DEFAULT_BYTES_1,
(pin_config & 0x0000ff00) >> 8);
snd_hda_codec_write(codec, pin_nid, 0,
AC_VERB_SET_CONFIG_DEFAULT_BYTES_2,
(pin_config & 0x00ff0000) >> 16);
snd_hda_codec_write(codec, pin_nid, 0,
AC_VERB_SET_CONFIG_DEFAULT_BYTES_3,
pin_config >> 24);
i = snd_hda_codec_read(codec, pin_nid, 0,
AC_VERB_GET_CONFIG_DEFAULT,
0x00);
snd_printdd(KERN_INFO "hda_codec: pin nid %2.2x pin config %8.8x\n",
pin_nid, i);
}
static void stac92xx_set_config_regs(struct hda_codec *codec)
{
int i;
struct sigmatel_spec *spec = codec->spec;
if (!spec->pin_configs)
return; return;
for (i = 0; i < spec->num_pins; i++) for (i = 0; i < spec->num_pins; i++)
if (spec->pin_nids[i] && spec->pin_configs[i]) if (spec->pin_nids[i] && pincfgs[i])
stac92xx_set_config_reg(codec, spec->pin_nids[i], snd_hda_codec_set_pincfg(codec, spec->pin_nids[i],
spec->pin_configs[i]); pincfgs[i]);
}
static int stac_save_pin_cfgs(struct hda_codec *codec, unsigned int *pins)
{
struct sigmatel_spec *spec = codec->spec;
if (!pins)
return stac92xx_save_bios_config_regs(codec);
kfree(spec->pin_configs);
spec->pin_configs = kmemdup(pins,
spec->num_pins * sizeof(*pins),
GFP_KERNEL);
if (!spec->pin_configs)
return -ENOMEM;
stac92xx_set_config_regs(codec);
return 0;
}
static void stac_change_pin_config(struct hda_codec *codec, hda_nid_t nid,
unsigned int cfg)
{
struct sigmatel_spec *spec = codec->spec;
int i;
for (i = 0; i < spec->num_pins; i++) {
if (spec->pin_nids[i] == nid) {
spec->pin_configs[i] = cfg;
stac92xx_set_config_reg(codec, nid, cfg);
break;
}
}
} }
/* /*
...@@ -2853,8 +2770,7 @@ static hda_nid_t check_mic_out_switch(struct hda_codec *codec) ...@@ -2853,8 +2770,7 @@ static hda_nid_t check_mic_out_switch(struct hda_codec *codec)
mic_pin = AUTO_PIN_MIC; mic_pin = AUTO_PIN_MIC;
for (;;) { for (;;) {
hda_nid_t nid = cfg->input_pins[mic_pin]; hda_nid_t nid = cfg->input_pins[mic_pin];
def_conf = snd_hda_codec_read(codec, nid, 0, def_conf = snd_hda_codec_get_pincfg(codec, nid);
AC_VERB_GET_CONFIG_DEFAULT, 0);
/* some laptops have an internal analog microphone /* some laptops have an internal analog microphone
* which can't be used as a output */ * which can't be used as a output */
if (get_defcfg_connect(def_conf) != AC_JACK_PORT_FIXED) { if (get_defcfg_connect(def_conf) != AC_JACK_PORT_FIXED) {
...@@ -3426,11 +3342,7 @@ static int stac92xx_auto_create_dmic_input_ctls(struct hda_codec *codec, ...@@ -3426,11 +3342,7 @@ static int stac92xx_auto_create_dmic_input_ctls(struct hda_codec *codec,
unsigned int wcaps; unsigned int wcaps;
unsigned int def_conf; unsigned int def_conf;
def_conf = snd_hda_codec_read(codec, def_conf = snd_hda_codec_get_pincfg(codec, spec->dmic_nids[i]);
spec->dmic_nids[i],
0,
AC_VERB_GET_CONFIG_DEFAULT,
0);
if (get_defcfg_connect(def_conf) == AC_JACK_PORT_NONE) if (get_defcfg_connect(def_conf) == AC_JACK_PORT_NONE)
continue; continue;
...@@ -3779,9 +3691,7 @@ static int stac9200_auto_create_lfe_ctls(struct hda_codec *codec, ...@@ -3779,9 +3691,7 @@ static int stac9200_auto_create_lfe_ctls(struct hda_codec *codec,
for (i = 0; i < spec->autocfg.line_outs && lfe_pin == 0x0; i++) { for (i = 0; i < spec->autocfg.line_outs && lfe_pin == 0x0; i++) {
hda_nid_t pin = spec->autocfg.line_out_pins[i]; hda_nid_t pin = spec->autocfg.line_out_pins[i];
unsigned int defcfg; unsigned int defcfg;
defcfg = snd_hda_codec_read(codec, pin, 0, defcfg = snd_hda_codec_get_pincfg(codec, pin);
AC_VERB_GET_CONFIG_DEFAULT,
0x00);
if (get_defcfg_device(defcfg) == AC_JACK_SPEAKER) { if (get_defcfg_device(defcfg) == AC_JACK_SPEAKER) {
unsigned int wcaps = get_wcaps(codec, pin); unsigned int wcaps = get_wcaps(codec, pin);
wcaps &= (AC_WCAP_STEREO | AC_WCAP_OUT_AMP); wcaps &= (AC_WCAP_STEREO | AC_WCAP_OUT_AMP);
...@@ -3885,8 +3795,7 @@ static int stac92xx_add_jack(struct hda_codec *codec, ...@@ -3885,8 +3795,7 @@ static int stac92xx_add_jack(struct hda_codec *codec,
#ifdef CONFIG_SND_JACK #ifdef CONFIG_SND_JACK
struct sigmatel_spec *spec = codec->spec; struct sigmatel_spec *spec = codec->spec;
struct sigmatel_jack *jack; struct sigmatel_jack *jack;
int def_conf = snd_hda_codec_read(codec, nid, int def_conf = snd_hda_codec_get_pincfg(codec, nid);
0, AC_VERB_GET_CONFIG_DEFAULT, 0);
int connectivity = get_defcfg_connect(def_conf); int connectivity = get_defcfg_connect(def_conf);
char name[32]; char name[32];
...@@ -4066,8 +3975,7 @@ static int stac92xx_init(struct hda_codec *codec) ...@@ -4066,8 +3975,7 @@ static int stac92xx_init(struct hda_codec *codec)
pinctl); pinctl);
} }
} }
conf = snd_hda_codec_read(codec, nid, 0, conf = snd_hda_codec_get_pincfg(codec, nid);
AC_VERB_GET_CONFIG_DEFAULT, 0);
if (get_defcfg_connect(conf) != AC_JACK_PORT_FIXED) { if (get_defcfg_connect(conf) != AC_JACK_PORT_FIXED) {
enable_pin_detect(codec, nid, enable_pin_detect(codec, nid,
STAC_INSERT_EVENT); STAC_INSERT_EVENT);
...@@ -4108,8 +4016,7 @@ static int stac92xx_init(struct hda_codec *codec) ...@@ -4108,8 +4016,7 @@ static int stac92xx_init(struct hda_codec *codec)
stac_toggle_power_map(codec, nid, 1); stac_toggle_power_map(codec, nid, 1);
continue; continue;
} }
def_conf = snd_hda_codec_read(codec, nid, 0, def_conf = snd_hda_codec_get_pincfg(codec, nid);
AC_VERB_GET_CONFIG_DEFAULT, 0);
def_conf = get_defcfg_connect(def_conf); def_conf = get_defcfg_connect(def_conf);
/* skip any ports that don't have jacks since presence /* skip any ports that don't have jacks since presence
* detection is useless */ * detection is useless */
...@@ -4163,7 +4070,6 @@ static void stac92xx_free(struct hda_codec *codec) ...@@ -4163,7 +4070,6 @@ static void stac92xx_free(struct hda_codec *codec)
if (! spec) if (! spec)
return; return;
kfree(spec->pin_configs);
stac92xx_free_jacks(codec); stac92xx_free_jacks(codec);
snd_array_free(&spec->events); snd_array_free(&spec->events);
...@@ -4474,7 +4380,6 @@ static int stac92xx_resume(struct hda_codec *codec) ...@@ -4474,7 +4380,6 @@ static int stac92xx_resume(struct hda_codec *codec)
{ {
struct sigmatel_spec *spec = codec->spec; struct sigmatel_spec *spec = codec->spec;
stac92xx_set_config_regs(codec);
stac92xx_init(codec); stac92xx_init(codec);
snd_hda_codec_resume_amp(codec); snd_hda_codec_resume_amp(codec);
snd_hda_codec_resume_cache(codec); snd_hda_codec_resume_cache(codec);
...@@ -4523,16 +4428,11 @@ static int patch_stac9200(struct hda_codec *codec) ...@@ -4523,16 +4428,11 @@ static int patch_stac9200(struct hda_codec *codec)
spec->board_config = snd_hda_check_board_config(codec, STAC_9200_MODELS, spec->board_config = snd_hda_check_board_config(codec, STAC_9200_MODELS,
stac9200_models, stac9200_models,
stac9200_cfg_tbl); stac9200_cfg_tbl);
if (spec->board_config < 0) { if (spec->board_config < 0)
snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC9200, using BIOS defaults\n"); snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC9200, using BIOS defaults\n");
err = stac92xx_save_bios_config_regs(codec); else
} else stac92xx_set_config_regs(codec,
err = stac_save_pin_cfgs(codec,
stac9200_brd_tbl[spec->board_config]); stac9200_brd_tbl[spec->board_config]);
if (err < 0) {
stac92xx_free(codec);
return err;
}
spec->multiout.max_channels = 2; spec->multiout.max_channels = 2;
spec->multiout.num_dacs = 1; spec->multiout.num_dacs = 1;
...@@ -4600,17 +4500,12 @@ static int patch_stac925x(struct hda_codec *codec) ...@@ -4600,17 +4500,12 @@ static int patch_stac925x(struct hda_codec *codec)
stac925x_models, stac925x_models,
stac925x_cfg_tbl); stac925x_cfg_tbl);
again: again:
if (spec->board_config < 0) { if (spec->board_config < 0)
snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC925x," snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC925x,"
"using BIOS defaults\n"); "using BIOS defaults\n");
err = stac92xx_save_bios_config_regs(codec); else
} else stac92xx_set_config_regs(codec,
err = stac_save_pin_cfgs(codec,
stac925x_brd_tbl[spec->board_config]); stac925x_brd_tbl[spec->board_config]);
if (err < 0) {
stac92xx_free(codec);
return err;
}
spec->multiout.max_channels = 2; spec->multiout.max_channels = 2;
spec->multiout.num_dacs = 1; spec->multiout.num_dacs = 1;
...@@ -4688,17 +4583,12 @@ static int patch_stac92hd73xx(struct hda_codec *codec) ...@@ -4688,17 +4583,12 @@ static int patch_stac92hd73xx(struct hda_codec *codec)
stac92hd73xx_models, stac92hd73xx_models,
stac92hd73xx_cfg_tbl); stac92hd73xx_cfg_tbl);
again: again:
if (spec->board_config < 0) { if (spec->board_config < 0)
snd_printdd(KERN_INFO "hda_codec: Unknown model for" snd_printdd(KERN_INFO "hda_codec: Unknown model for"
" STAC92HD73XX, using BIOS defaults\n"); " STAC92HD73XX, using BIOS defaults\n");
err = stac92xx_save_bios_config_regs(codec); else
} else stac92xx_set_config_regs(codec,
err = stac_save_pin_cfgs(codec,
stac92hd73xx_brd_tbl[spec->board_config]); stac92hd73xx_brd_tbl[spec->board_config]);
if (err < 0) {
stac92xx_free(codec);
return err;
}
num_dacs = snd_hda_get_connections(codec, 0x0a, num_dacs = snd_hda_get_connections(codec, 0x0a,
conn, STAC92HD73_DAC_COUNT + 2) - 1; conn, STAC92HD73_DAC_COUNT + 2) - 1;
...@@ -4758,18 +4648,18 @@ again: ...@@ -4758,18 +4648,18 @@ again:
spec->init = dell_m6_core_init; spec->init = dell_m6_core_init;
switch (spec->board_config) { switch (spec->board_config) {
case STAC_DELL_M6_AMIC: /* Analog Mics */ case STAC_DELL_M6_AMIC: /* Analog Mics */
stac92xx_set_config_reg(codec, 0x0b, 0x90A70170); snd_hda_codec_set_pincfg(codec, 0x0b, 0x90A70170);
spec->num_dmics = 0; spec->num_dmics = 0;
spec->private_dimux.num_items = 1; spec->private_dimux.num_items = 1;
break; break;
case STAC_DELL_M6_DMIC: /* Digital Mics */ case STAC_DELL_M6_DMIC: /* Digital Mics */
stac92xx_set_config_reg(codec, 0x13, 0x90A60160); snd_hda_codec_set_pincfg(codec, 0x13, 0x90A60160);
spec->num_dmics = 1; spec->num_dmics = 1;
spec->private_dimux.num_items = 2; spec->private_dimux.num_items = 2;
break; break;
case STAC_DELL_M6_BOTH: /* Both */ case STAC_DELL_M6_BOTH: /* Both */
stac92xx_set_config_reg(codec, 0x0b, 0x90A70170); snd_hda_codec_set_pincfg(codec, 0x0b, 0x90A70170);
stac92xx_set_config_reg(codec, 0x13, 0x90A60160); snd_hda_codec_set_pincfg(codec, 0x13, 0x90A60160);
spec->num_dmics = 1; spec->num_dmics = 1;
spec->private_dimux.num_items = 2; spec->private_dimux.num_items = 2;
break; break;
...@@ -4865,17 +4755,12 @@ static int patch_stac92hd83xxx(struct hda_codec *codec) ...@@ -4865,17 +4755,12 @@ static int patch_stac92hd83xxx(struct hda_codec *codec)
stac92hd83xxx_models, stac92hd83xxx_models,
stac92hd83xxx_cfg_tbl); stac92hd83xxx_cfg_tbl);
again: again:
if (spec->board_config < 0) { if (spec->board_config < 0)
snd_printdd(KERN_INFO "hda_codec: Unknown model for" snd_printdd(KERN_INFO "hda_codec: Unknown model for"
" STAC92HD83XXX, using BIOS defaults\n"); " STAC92HD83XXX, using BIOS defaults\n");
err = stac92xx_save_bios_config_regs(codec); else
} else stac92xx_set_config_regs(codec,
err = stac_save_pin_cfgs(codec,
stac92hd83xxx_brd_tbl[spec->board_config]); stac92hd83xxx_brd_tbl[spec->board_config]);
if (err < 0) {
stac92xx_free(codec);
return err;
}
switch (codec->vendor_id) { switch (codec->vendor_id) {
case 0x111d7604: case 0x111d7604:
...@@ -4945,6 +4830,16 @@ static struct hda_input_mux stac92hd71bxx_dmux_amixer = { ...@@ -4945,6 +4830,16 @@ static struct hda_input_mux stac92hd71bxx_dmux_amixer = {
} }
}; };
/* get the pin connection (fixed, none, etc) */
static unsigned int stac_get_defcfg_connect(struct hda_codec *codec, int idx)
{
struct sigmatel_spec *spec = codec->spec;
unsigned int cfg;
cfg = snd_hda_codec_get_pincfg(codec, spec->pin_nids[idx]);
return get_defcfg_connect(cfg);
}
static int stac92hd71bxx_connected_ports(struct hda_codec *codec, static int stac92hd71bxx_connected_ports(struct hda_codec *codec,
hda_nid_t *nids, int num_nids) hda_nid_t *nids, int num_nids)
{ {
...@@ -4958,7 +4853,7 @@ static int stac92hd71bxx_connected_ports(struct hda_codec *codec, ...@@ -4958,7 +4853,7 @@ static int stac92hd71bxx_connected_ports(struct hda_codec *codec,
break; break;
if (idx >= spec->num_pins) if (idx >= spec->num_pins)
break; break;
def_conf = get_defcfg_connect(spec->pin_configs[idx]); def_conf = stac_get_defcfg_connect(codec, idx);
if (def_conf == AC_JACK_PORT_NONE) if (def_conf == AC_JACK_PORT_NONE)
break; break;
} }
...@@ -4978,13 +4873,13 @@ static int stac92hd71bxx_connected_smuxes(struct hda_codec *codec, ...@@ -4978,13 +4873,13 @@ static int stac92hd71bxx_connected_smuxes(struct hda_codec *codec,
return 0; return 0;
/* dig1pin case */ /* dig1pin case */
if (get_defcfg_connect(spec->pin_configs[idx+1]) != AC_JACK_PORT_NONE) if (stac_get_defcfg_connect(codec, idx + 1) != AC_JACK_PORT_NONE)
return 2; return 2;
/* dig0pin + dig2pin case */ /* dig0pin + dig2pin case */
if (get_defcfg_connect(spec->pin_configs[idx+2]) != AC_JACK_PORT_NONE) if (stac_get_defcfg_connect(codec, idx + 2) != AC_JACK_PORT_NONE)
return 2; return 2;
if (get_defcfg_connect(spec->pin_configs[idx]) != AC_JACK_PORT_NONE) if (stac_get_defcfg_connect(codec, idx) != AC_JACK_PORT_NONE)
return 1; return 1;
else else
return 0; return 0;
...@@ -5023,17 +4918,12 @@ static int patch_stac92hd71bxx(struct hda_codec *codec) ...@@ -5023,17 +4918,12 @@ static int patch_stac92hd71bxx(struct hda_codec *codec)
stac92hd71bxx_models, stac92hd71bxx_models,
stac92hd71bxx_cfg_tbl); stac92hd71bxx_cfg_tbl);
again: again:
if (spec->board_config < 0) { if (spec->board_config < 0)
snd_printdd(KERN_INFO "hda_codec: Unknown model for" snd_printdd(KERN_INFO "hda_codec: Unknown model for"
" STAC92HD71BXX, using BIOS defaults\n"); " STAC92HD71BXX, using BIOS defaults\n");
err = stac92xx_save_bios_config_regs(codec); else
} else stac92xx_set_config_regs(codec,
err = stac_save_pin_cfgs(codec,
stac92hd71bxx_brd_tbl[spec->board_config]); stac92hd71bxx_brd_tbl[spec->board_config]);
if (err < 0) {
stac92xx_free(codec);
return err;
}
if (spec->board_config > STAC_92HD71BXX_REF) { if (spec->board_config > STAC_92HD71BXX_REF) {
/* GPIO0 = EAPD */ /* GPIO0 = EAPD */
...@@ -5097,8 +4987,8 @@ again: ...@@ -5097,8 +4987,8 @@ again:
/* disable VSW */ /* disable VSW */
spec->init = &stac92hd71bxx_analog_core_init[HD_DISABLE_PORTF]; spec->init = &stac92hd71bxx_analog_core_init[HD_DISABLE_PORTF];
unmute_init++; unmute_init++;
stac_change_pin_config(codec, 0x0f, 0x40f000f0); snd_hda_codec_set_pincfg(codec, 0x0f, 0x40f000f0);
stac_change_pin_config(codec, 0x19, 0x40f000f3); snd_hda_codec_set_pincfg(codec, 0x19, 0x40f000f3);
stac92hd71bxx_dmic_nids[STAC92HD71BXX_NUM_DMICS - 1] = 0; stac92hd71bxx_dmic_nids[STAC92HD71BXX_NUM_DMICS - 1] = 0;
spec->num_dmics = stac92hd71bxx_connected_ports(codec, spec->num_dmics = stac92hd71bxx_connected_ports(codec,
stac92hd71bxx_dmic_nids, stac92hd71bxx_dmic_nids,
...@@ -5147,7 +5037,7 @@ again: ...@@ -5147,7 +5037,7 @@ again:
switch (spec->board_config) { switch (spec->board_config) {
case STAC_HP_M4: case STAC_HP_M4:
/* enable internal microphone */ /* enable internal microphone */
stac_change_pin_config(codec, 0x0e, 0x01813040); snd_hda_codec_set_pincfg(codec, 0x0e, 0x01813040);
stac92xx_auto_set_pinctl(codec, 0x0e, stac92xx_auto_set_pinctl(codec, 0x0e,
AC_PINCTL_IN_EN | AC_PINCTL_VREF_80); AC_PINCTL_IN_EN | AC_PINCTL_VREF_80);
/* fallthru */ /* fallthru */
...@@ -5163,7 +5053,7 @@ again: ...@@ -5163,7 +5053,7 @@ again:
spec->num_dmuxes = 0; spec->num_dmuxes = 0;
break; break;
case STAC_HP_DV5: case STAC_HP_DV5:
stac_change_pin_config(codec, 0x0d, 0x90170010); snd_hda_codec_set_pincfg(codec, 0x0d, 0x90170010);
stac92xx_auto_set_pinctl(codec, 0x0d, AC_PINCTL_OUT_EN); stac92xx_auto_set_pinctl(codec, 0x0d, AC_PINCTL_OUT_EN);
break; break;
}; };
...@@ -5247,17 +5137,12 @@ static int patch_stac922x(struct hda_codec *codec) ...@@ -5247,17 +5137,12 @@ static int patch_stac922x(struct hda_codec *codec)
} }
again: again:
if (spec->board_config < 0) { if (spec->board_config < 0)
snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC922x, " snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC922x, "
"using BIOS defaults\n"); "using BIOS defaults\n");
err = stac92xx_save_bios_config_regs(codec); else
} else stac92xx_set_config_regs(codec,
err = stac_save_pin_cfgs(codec,
stac922x_brd_tbl[spec->board_config]); stac922x_brd_tbl[spec->board_config]);
if (err < 0) {
stac92xx_free(codec);
return err;
}
spec->adc_nids = stac922x_adc_nids; spec->adc_nids = stac922x_adc_nids;
spec->mux_nids = stac922x_mux_nids; spec->mux_nids = stac922x_mux_nids;
...@@ -5315,17 +5200,12 @@ static int patch_stac927x(struct hda_codec *codec) ...@@ -5315,17 +5200,12 @@ static int patch_stac927x(struct hda_codec *codec)
stac927x_models, stac927x_models,
stac927x_cfg_tbl); stac927x_cfg_tbl);
again: again:
if (spec->board_config < 0) { if (spec->board_config < 0)
snd_printdd(KERN_INFO "hda_codec: Unknown model for" snd_printdd(KERN_INFO "hda_codec: Unknown model for"
"STAC927x, using BIOS defaults\n"); "STAC927x, using BIOS defaults\n");
err = stac92xx_save_bios_config_regs(codec); else
} else stac92xx_set_config_regs(codec,
err = stac_save_pin_cfgs(codec,
stac927x_brd_tbl[spec->board_config]); stac927x_brd_tbl[spec->board_config]);
if (err < 0) {
stac92xx_free(codec);
return err;
}
spec->digbeep_nid = 0x23; spec->digbeep_nid = 0x23;
spec->adc_nids = stac927x_adc_nids; spec->adc_nids = stac927x_adc_nids;
...@@ -5354,15 +5234,15 @@ static int patch_stac927x(struct hda_codec *codec) ...@@ -5354,15 +5234,15 @@ static int patch_stac927x(struct hda_codec *codec)
case 0x10280209: case 0x10280209:
case 0x1028022e: case 0x1028022e:
/* correct the device field to SPDIF out */ /* correct the device field to SPDIF out */
stac_change_pin_config(codec, 0x21, 0x01442070); snd_hda_codec_set_pincfg(codec, 0x21, 0x01442070);
break; break;
}; };
/* configure the analog microphone on some laptops */ /* configure the analog microphone on some laptops */
stac_change_pin_config(codec, 0x0c, 0x90a79130); snd_hda_codec_set_pincfg(codec, 0x0c, 0x90a79130);
/* correct the front output jack as a hp out */ /* correct the front output jack as a hp out */
stac_change_pin_config(codec, 0x0f, 0x0227011f); snd_hda_codec_set_pincfg(codec, 0x0f, 0x0227011f);
/* correct the front input jack as a mic */ /* correct the front input jack as a mic */
stac_change_pin_config(codec, 0x0e, 0x02a79130); snd_hda_codec_set_pincfg(codec, 0x0e, 0x02a79130);
/* fallthru */ /* fallthru */
case STAC_DELL_3ST: case STAC_DELL_3ST:
/* GPIO2 High = Enable EAPD */ /* GPIO2 High = Enable EAPD */
...@@ -5447,16 +5327,11 @@ static int patch_stac9205(struct hda_codec *codec) ...@@ -5447,16 +5327,11 @@ static int patch_stac9205(struct hda_codec *codec)
stac9205_models, stac9205_models,
stac9205_cfg_tbl); stac9205_cfg_tbl);
again: again:
if (spec->board_config < 0) { if (spec->board_config < 0)
snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC9205, using BIOS defaults\n"); snd_printdd(KERN_INFO "hda_codec: Unknown model for STAC9205, using BIOS defaults\n");
err = stac92xx_save_bios_config_regs(codec); else
} else stac92xx_set_config_regs(codec,
err = stac_save_pin_cfgs(codec,
stac9205_brd_tbl[spec->board_config]); stac9205_brd_tbl[spec->board_config]);
if (err < 0) {
stac92xx_free(codec);
return err;
}
spec->digbeep_nid = 0x23; spec->digbeep_nid = 0x23;
spec->adc_nids = stac9205_adc_nids; spec->adc_nids = stac9205_adc_nids;
...@@ -5484,8 +5359,8 @@ static int patch_stac9205(struct hda_codec *codec) ...@@ -5484,8 +5359,8 @@ static int patch_stac9205(struct hda_codec *codec)
switch (spec->board_config){ switch (spec->board_config){
case STAC_9205_DELL_M43: case STAC_9205_DELL_M43:
/* Enable SPDIF in/out */ /* Enable SPDIF in/out */
stac_change_pin_config(codec, 0x1f, 0x01441030); snd_hda_codec_set_pincfg(codec, 0x1f, 0x01441030);
stac_change_pin_config(codec, 0x20, 0x1c410030); snd_hda_codec_set_pincfg(codec, 0x20, 0x1c410030);
/* Enable unsol response for GPIO4/Dock HP connection */ /* Enable unsol response for GPIO4/Dock HP connection */
err = stac_add_event(spec, codec->afg, STAC_VREF_EVENT, 0x01); err = stac_add_event(spec, codec->afg, STAC_VREF_EVENT, 0x01);
......
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