Commit 55e30141 authored by Takashi Iwai's avatar Takashi Iwai

ALSA: hda - Use standard fixup table for IDT92HD73xx

This one is rather a simple conversion.  The fixups for Dell machines
are implemented by fixup functions in the end.
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 0f6fcb73
...@@ -79,7 +79,6 @@ enum { ...@@ -79,7 +79,6 @@ enum {
}; };
enum { enum {
STAC_92HD73XX_AUTO,
STAC_92HD73XX_NO_JD, /* no jack-detection */ STAC_92HD73XX_NO_JD, /* no jack-detection */
STAC_92HD73XX_REF, STAC_92HD73XX_REF,
STAC_92HD73XX_INTEL, STAC_92HD73XX_INTEL,
...@@ -1783,55 +1782,217 @@ static const struct snd_pci_quirk stac925x_fixup_tbl[] = { ...@@ -1783,55 +1782,217 @@ static const struct snd_pci_quirk stac925x_fixup_tbl[] = {
{} /* terminator */ {} /* terminator */
}; };
static const unsigned int ref92hd73xx_pin_configs[13] = { static const struct hda_pintbl ref92hd73xx_pin_configs[] = {
0x02214030, 0x02a19040, 0x01a19020, 0x02214030, { 0x0a, 0x02214030 },
0x0181302e, 0x01014010, 0x01014020, 0x01014030, { 0x0b, 0x02a19040 },
0x02319040, 0x90a000f0, 0x90a000f0, 0x01452050, { 0x0c, 0x01a19020 },
0x01452050, { 0x0d, 0x02214030 },
{ 0x0e, 0x0181302e },
{ 0x0f, 0x01014010 },
{ 0x10, 0x01014020 },
{ 0x11, 0x01014030 },
{ 0x12, 0x02319040 },
{ 0x13, 0x90a000f0 },
{ 0x14, 0x90a000f0 },
{ 0x22, 0x01452050 },
{ 0x23, 0x01452050 },
{}
}; };
static const unsigned int dell_m6_pin_configs[13] = { static const struct hda_pintbl dell_m6_pin_configs[] = {
0x0321101f, 0x4f00000f, 0x4f0000f0, 0x90170110, { 0x0a, 0x0321101f },
0x03a11020, 0x0321101f, 0x4f0000f0, 0x4f0000f0, { 0x0b, 0x4f00000f },
0x4f0000f0, 0x90a60160, 0x4f0000f0, 0x4f0000f0, { 0x0c, 0x4f0000f0 },
0x4f0000f0, { 0x0d, 0x90170110 },
{ 0x0e, 0x03a11020 },
{ 0x0f, 0x0321101f },
{ 0x10, 0x4f0000f0 },
{ 0x11, 0x4f0000f0 },
{ 0x12, 0x4f0000f0 },
{ 0x13, 0x90a60160 },
{ 0x14, 0x4f0000f0 },
{ 0x22, 0x4f0000f0 },
{ 0x23, 0x4f0000f0 },
{}
}; };
static const unsigned int alienware_m17x_pin_configs[13] = { static const struct hda_pintbl alienware_m17x_pin_configs[] = {
0x0321101f, 0x0321101f, 0x03a11020, 0x03014020, { 0x0a, 0x0321101f },
0x90170110, 0x4f0000f0, 0x4f0000f0, 0x4f0000f0, { 0x0b, 0x0321101f },
0x4f0000f0, 0x90a60160, 0x4f0000f0, 0x4f0000f0, { 0x0c, 0x03a11020 },
0x904601b0, { 0x0d, 0x03014020 },
{ 0x0e, 0x90170110 },
{ 0x0f, 0x4f0000f0 },
{ 0x10, 0x4f0000f0 },
{ 0x11, 0x4f0000f0 },
{ 0x12, 0x4f0000f0 },
{ 0x13, 0x90a60160 },
{ 0x14, 0x4f0000f0 },
{ 0x22, 0x4f0000f0 },
{ 0x23, 0x904601b0 },
{}
}; };
static const unsigned int intel_dg45id_pin_configs[13] = { static const struct hda_pintbl intel_dg45id_pin_configs[] = {
0x02214230, 0x02A19240, 0x01013214, 0x01014210, { 0x0a, 0x02214230 },
0x01A19250, 0x01011212, 0x01016211 { 0x0b, 0x02A19240 },
{ 0x0c, 0x01013214 },
{ 0x0d, 0x01014210 },
{ 0x0e, 0x01A19250 },
{ 0x0f, 0x01011212 },
{ 0x10, 0x01016211 },
{}
}; };
static const unsigned int *stac92hd73xx_brd_tbl[STAC_92HD73XX_MODELS] = { static void stac92hd73xx_fixup_ref(struct hda_codec *codec,
[STAC_92HD73XX_REF] = ref92hd73xx_pin_configs, const struct hda_fixup *fix, int action)
[STAC_DELL_M6_AMIC] = dell_m6_pin_configs, {
[STAC_DELL_M6_DMIC] = dell_m6_pin_configs, struct sigmatel_spec *spec = codec->spec;
[STAC_DELL_M6_BOTH] = dell_m6_pin_configs,
[STAC_DELL_EQ] = dell_m6_pin_configs, if (action != HDA_FIXUP_ACT_PRE_PROBE)
[STAC_ALIENWARE_M17X] = alienware_m17x_pin_configs, return;
[STAC_92HD73XX_INTEL] = intel_dg45id_pin_configs,
snd_hda_apply_pincfgs(codec, ref92hd73xx_pin_configs);
spec->gpio_mask = spec->gpio_dir = spec->gpio_data = 0;
}
static void stac92hd73xx_fixup_dell(struct hda_codec *codec)
{
struct sigmatel_spec *spec = codec->spec;
snd_hda_apply_pincfgs(codec, dell_m6_pin_configs);
spec->num_smuxes = 0;
spec->eapd_switch = 0;
}
static void stac92hd73xx_fixup_dell_eq(struct hda_codec *codec,
const struct hda_fixup *fix, int action)
{
struct sigmatel_spec *spec = codec->spec;
if (action != HDA_FIXUP_ACT_PRE_PROBE)
return;
stac92hd73xx_fixup_dell(codec);
snd_hda_add_verbs(codec, dell_eq_core_init);
spec->volknob_init = 1;
}
/* Analog Mics */
static void stac92hd73xx_fixup_dell_m6_amic(struct hda_codec *codec,
const struct hda_fixup *fix, int action)
{
struct sigmatel_spec *spec = codec->spec;
if (action != HDA_FIXUP_ACT_PRE_PROBE)
return;
stac92hd73xx_fixup_dell(codec);
snd_hda_codec_set_pincfg(codec, 0x0b, 0x90A70170);
spec->num_dmics = 0;
}
/* Digital Mics */
static void stac92hd73xx_fixup_dell_m6_dmic(struct hda_codec *codec,
const struct hda_fixup *fix, int action)
{
struct sigmatel_spec *spec = codec->spec;
if (action != HDA_FIXUP_ACT_PRE_PROBE)
return;
stac92hd73xx_fixup_dell(codec);
snd_hda_codec_set_pincfg(codec, 0x13, 0x90A60160);
spec->num_dmics = 1;
}
/* Both */
static void stac92hd73xx_fixup_dell_m6_both(struct hda_codec *codec,
const struct hda_fixup *fix, int action)
{
struct sigmatel_spec *spec = codec->spec;
if (action != HDA_FIXUP_ACT_PRE_PROBE)
return;
stac92hd73xx_fixup_dell(codec);
snd_hda_codec_set_pincfg(codec, 0x0b, 0x90A70170);
snd_hda_codec_set_pincfg(codec, 0x13, 0x90A60160);
spec->num_dmics = 1;
}
static void stac92hd73xx_fixup_alienware_m17x(struct hda_codec *codec,
const struct hda_fixup *fix, int action)
{
struct sigmatel_spec *spec = codec->spec;
if (action != HDA_FIXUP_ACT_PRE_PROBE)
return;
snd_hda_apply_pincfgs(codec, alienware_m17x_pin_configs);
spec->num_dmics = STAC92HD73XX_NUM_DMICS;
spec->num_smuxes = ARRAY_SIZE(stac92hd73xx_smux_nids);
spec->eapd_switch = 0;
}
static void stac92hd73xx_fixup_no_jd(struct hda_codec *codec,
const struct hda_fixup *fix, int action)
{
struct sigmatel_spec *spec = codec->spec;
if (action != HDA_FIXUP_ACT_PRE_PROBE)
return;
spec->hp_detect = 0;
}
static const struct hda_fixup stac92hd73xx_fixups[] = {
[STAC_92HD73XX_REF] = {
.type = HDA_FIXUP_FUNC,
.v.func = stac92hd73xx_fixup_ref,
},
[STAC_DELL_M6_AMIC] = {
.type = HDA_FIXUP_FUNC,
.v.func = stac92hd73xx_fixup_dell_m6_amic,
},
[STAC_DELL_M6_DMIC] = {
.type = HDA_FIXUP_FUNC,
.v.func = stac92hd73xx_fixup_dell_m6_dmic,
},
[STAC_DELL_M6_BOTH] = {
.type = HDA_FIXUP_FUNC,
.v.func = stac92hd73xx_fixup_dell_m6_both,
},
[STAC_DELL_EQ] = {
.type = HDA_FIXUP_FUNC,
.v.func = stac92hd73xx_fixup_dell_eq,
},
[STAC_ALIENWARE_M17X] = {
.type = HDA_FIXUP_FUNC,
.v.func = stac92hd73xx_fixup_alienware_m17x,
},
[STAC_92HD73XX_INTEL] = {
.type = HDA_FIXUP_PINS,
.v.pins = intel_dg45id_pin_configs,
},
[STAC_92HD73XX_NO_JD] = {
.type = HDA_FIXUP_FUNC,
.v.func = stac92hd73xx_fixup_no_jd,
}
}; };
static const char * const stac92hd73xx_models[STAC_92HD73XX_MODELS] = { static const struct hda_model_fixup stac92hd73xx_models[] = {
[STAC_92HD73XX_AUTO] = "auto", { .id = STAC_92HD73XX_NO_JD, .name = "no-jd" },
[STAC_92HD73XX_NO_JD] = "no-jd", { .id = STAC_92HD73XX_REF, .name = "ref" },
[STAC_92HD73XX_REF] = "ref", { .id = STAC_92HD73XX_INTEL, .name = "intel" },
[STAC_92HD73XX_INTEL] = "intel", { .id = STAC_DELL_M6_AMIC, .name = "dell-m6-amic" },
[STAC_DELL_M6_AMIC] = "dell-m6-amic", { .id = STAC_DELL_M6_DMIC, .name = "dell-m6-dmic" },
[STAC_DELL_M6_DMIC] = "dell-m6-dmic", { .id = STAC_DELL_M6_BOTH, .name = "dell-m6" },
[STAC_DELL_M6_BOTH] = "dell-m6", { .id = STAC_DELL_EQ, .name = "dell-eq" },
[STAC_DELL_EQ] = "dell-eq", { .id = STAC_ALIENWARE_M17X, .name = "alienware" },
[STAC_ALIENWARE_M17X] = "alienware", {}
}; };
static const struct snd_pci_quirk stac92hd73xx_cfg_tbl[] = { static const struct snd_pci_quirk stac92hd73xx_fixup_tbl[] = {
/* SigmaTel reference board */ /* SigmaTel reference board */
SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
"DFI LanParty", STAC_92HD73XX_REF), "DFI LanParty", STAC_92HD73XX_REF),
...@@ -1869,10 +2030,7 @@ static const struct snd_pci_quirk stac92hd73xx_cfg_tbl[] = { ...@@ -1869,10 +2030,7 @@ static const struct snd_pci_quirk stac92hd73xx_cfg_tbl[] = {
"Dell Studio XPS 1645", STAC_DELL_M6_DMIC), "Dell Studio XPS 1645", STAC_DELL_M6_DMIC),
SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0413, SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0413,
"Dell Studio 1558", STAC_DELL_M6_DMIC), "Dell Studio 1558", STAC_DELL_M6_DMIC),
{} /* terminator */ /* codec SSID matching */
};
static const struct snd_pci_quirk stac92hd73xx_codec_id_cfg_tbl[] = {
SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02a1, SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02a1,
"Alienware M17x", STAC_ALIENWARE_M17X), "Alienware M17x", STAC_ALIENWARE_M17X),
SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x043a, SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x043a,
...@@ -6262,23 +6420,9 @@ static int patch_stac92hd73xx(struct hda_codec *codec) ...@@ -6262,23 +6420,9 @@ static int patch_stac92hd73xx(struct hda_codec *codec)
spec = codec->spec; spec = codec->spec;
spec->linear_tone_beep = 0; spec->linear_tone_beep = 0;
codec->slave_dig_outs = stac92hd73xx_slave_dig_outs; codec->slave_dig_outs = stac92hd73xx_slave_dig_outs;
spec->board_config = snd_hda_check_board_config(codec,
STAC_92HD73XX_MODELS, snd_hda_pick_fixup(codec, stac92hd73xx_models, stac92hd73xx_fixup_tbl,
stac92hd73xx_models, stac92hd73xx_fixups);
stac92hd73xx_cfg_tbl);
/* check codec subsystem id if not found */
if (spec->board_config < 0)
spec->board_config =
snd_hda_check_board_codec_sid_config(codec,
STAC_92HD73XX_MODELS, stac92hd73xx_models,
stac92hd73xx_codec_id_cfg_tbl);
again:
if (spec->board_config < 0)
snd_printdd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
codec->chip_name);
else
stac92xx_set_config_regs(codec,
stac92hd73xx_brd_tbl[spec->board_config]);
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;
...@@ -6288,7 +6432,7 @@ static int patch_stac92hd73xx(struct hda_codec *codec) ...@@ -6288,7 +6432,7 @@ static int patch_stac92hd73xx(struct hda_codec *codec)
"number of channels defaulting to DAC count\n"); "number of channels defaulting to DAC count\n");
num_dacs = STAC92HD73_DAC_COUNT; num_dacs = STAC92HD73_DAC_COUNT;
} }
spec->init = stac92hd73xx_core_init;
switch (num_dacs) { switch (num_dacs) {
case 0x3: /* 6 Channel */ case 0x3: /* 6 Channel */
spec->aloopback_ctl = stac92hd73xx_6ch_loopback; spec->aloopback_ctl = stac92hd73xx_6ch_loopback;
...@@ -6320,76 +6464,37 @@ static int patch_stac92hd73xx(struct hda_codec *codec) ...@@ -6320,76 +6464,37 @@ static int patch_stac92hd73xx(struct hda_codec *codec)
spec->capvols = stac92hd73xx_capvols; spec->capvols = stac92hd73xx_capvols;
spec->capsws = stac92hd73xx_capsws; spec->capsws = stac92hd73xx_capsws;
switch (spec->board_config) { /* GPIO0 High = Enable EAPD */
case STAC_DELL_EQ: spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x1;
spec->init = dell_eq_core_init; spec->gpio_data = 0x01;
/* fallthru */
case STAC_DELL_M6_AMIC:
case STAC_DELL_M6_DMIC:
case STAC_DELL_M6_BOTH:
spec->num_smuxes = 0;
spec->eapd_switch = 0;
switch (spec->board_config) { spec->num_dmics = STAC92HD73XX_NUM_DMICS;
case STAC_DELL_M6_AMIC: /* Analog Mics */ spec->num_smuxes = ARRAY_SIZE(stac92hd73xx_smux_nids);
snd_hda_codec_set_pincfg(codec, 0x0b, 0x90A70170); spec->eapd_switch = 1;
spec->num_dmics = 0;
break;
case STAC_DELL_M6_DMIC: /* Digital Mics */
snd_hda_codec_set_pincfg(codec, 0x13, 0x90A60160);
spec->num_dmics = 1;
break;
case STAC_DELL_M6_BOTH: /* Both */
snd_hda_codec_set_pincfg(codec, 0x0b, 0x90A70170);
snd_hda_codec_set_pincfg(codec, 0x13, 0x90A60160);
spec->num_dmics = 1;
break;
}
break;
case STAC_ALIENWARE_M17X:
spec->num_dmics = STAC92HD73XX_NUM_DMICS;
spec->num_smuxes = ARRAY_SIZE(stac92hd73xx_smux_nids);
spec->eapd_switch = 0;
break;
default:
spec->num_dmics = STAC92HD73XX_NUM_DMICS;
spec->num_smuxes = ARRAY_SIZE(stac92hd73xx_smux_nids);
spec->eapd_switch = 1;
break;
}
if (spec->board_config != STAC_92HD73XX_REF) {
/* GPIO0 High = Enable EAPD */
spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x1;
spec->gpio_data = 0x01;
}
spec->num_pwrs = ARRAY_SIZE(stac92hd73xx_pwr_nids); spec->num_pwrs = ARRAY_SIZE(stac92hd73xx_pwr_nids);
spec->pwr_nids = stac92hd73xx_pwr_nids; spec->pwr_nids = stac92hd73xx_pwr_nids;
snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
if (!spec->volknob_init)
snd_hda_add_verbs(codec, stac92hd73xx_core_init);
err = stac92xx_parse_auto_config(codec); err = stac92xx_parse_auto_config(codec);
if (!err) { if (!err)
if (spec->board_config < 0) {
printk(KERN_WARNING "hda_codec: No auto-config is "
"available, default to model=ref\n");
spec->board_config = STAC_92HD73XX_REF;
goto again;
}
err = -EINVAL; err = -EINVAL;
}
if (err < 0) { if (err < 0) {
stac92xx_free(codec); stac92xx_free(codec);
return err; return err;
} }
if (spec->board_config == STAC_92HD73XX_NO_JD)
spec->hp_detect = 0;
codec->patch_ops = stac92xx_patch_ops; codec->patch_ops = stac92xx_patch_ops;
codec->proc_widget_hook = stac92hd7x_proc_hook; codec->proc_widget_hook = stac92hd7x_proc_hook;
snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
return 0; return 0;
} }
......
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