aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/patch_sigmatel.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2013-01-14 11:05:25 -0500
committerTakashi Iwai <tiwai@suse.de>2013-01-15 05:09:16 -0500
commit0f6fcb73c02759085dbf5cf5a0afb5f0e9f832e5 (patch)
tree15492108e32d0fa318b28161aaa0849203688eaa /sound/pci/hda/patch_sigmatel.c
parent29ac83635fcf244a7178f9fc8f918cd7ddf799d5 (diff)
ALSA: hda - Use standard fixup table for IDT92HD71Bxx
This time, the only intrusive changes are for HP machines. As the mute LED fixup and the bass speaker switch are required only for HP machines, we can move these checks into the fixup entries; the former is applied generically to all HP machines while the latter for only certain models. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/hda/patch_sigmatel.c')
-rw-r--r--sound/pci/hda/patch_sigmatel.c481
1 files changed, 312 insertions, 169 deletions
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 796dfd1ca235..4a2594a7f02c 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -108,7 +108,6 @@ enum {
108}; 108};
109 109
110enum { 110enum {
111 STAC_92HD71BXX_AUTO,
112 STAC_92HD71BXX_REF, 111 STAC_92HD71BXX_REF,
113 STAC_DELL_M4_1, 112 STAC_DELL_M4_1,
114 STAC_DELL_M4_2, 113 STAC_DELL_M4_2,
@@ -118,6 +117,9 @@ enum {
118 STAC_HP_DV5, 117 STAC_HP_DV5,
119 STAC_HP_HDX, 118 STAC_HP_HDX,
120 STAC_HP_DV4_1222NR, 119 STAC_HP_DV4_1222NR,
120 STAC_92HD71BXX_HP,
121 STAC_92HD71BXX_NO_DMIC,
122 STAC_92HD71BXX_NO_SMUX,
121 STAC_92HD71BXX_MODELS 123 STAC_92HD71BXX_MODELS
122}; 124};
123 125
@@ -589,6 +591,14 @@ static const hda_nid_t stac9205_pin_nids[12] = {
589 0x21, 0x22, 591 0x21, 0x22,
590}; 592};
591 593
594static int stac_add_event(struct hda_codec *codec, hda_nid_t nid,
595 unsigned char type, int data);
596static int stac_add_hp_bass_switch(struct hda_codec *codec);
597static void stac92xx_auto_set_pinctl(struct hda_codec *codec,
598 hda_nid_t nid, int pin_type);
599static int hp_blike_system(u32 subsystem_id);
600static int find_mute_led_cfg(struct hda_codec *codec, int default_polarity);
601
592static int stac92xx_dmux_enum_info(struct snd_kcontrol *kcontrol, 602static int stac92xx_dmux_enum_info(struct snd_kcontrol *kcontrol,
593 struct snd_ctl_elem_info *uinfo) 603 struct snd_ctl_elem_info *uinfo)
594{ 604{
@@ -2018,60 +2028,305 @@ static const struct snd_pci_quirk stac92hd83xxx_codec_id_cfg_tbl[] = {
2018 {} /* terminator */ 2028 {} /* terminator */
2019}; 2029};
2020 2030
2021static const unsigned int ref92hd71bxx_pin_configs[STAC92HD71BXX_NUM_PINS] = { 2031static const struct hda_pintbl ref92hd71bxx_pin_configs[] = {
2022 0x02214030, 0x02a19040, 0x01a19020, 0x01014010, 2032 { 0x0a, 0x02214030 },
2023 0x0181302e, 0x01014010, 0x01019020, 0x90a000f0, 2033 { 0x0b, 0x02a19040 },
2024 0x90a000f0, 0x01452050, 0x01452050, 0x00000000, 2034 { 0x0c, 0x01a19020 },
2025 0x00000000 2035 { 0x0d, 0x01014010 },
2036 { 0x0e, 0x0181302e },
2037 { 0x0f, 0x01014010 },
2038 { 0x14, 0x01019020 },
2039 { 0x18, 0x90a000f0 },
2040 { 0x19, 0x90a000f0 },
2041 { 0x1e, 0x01452050 },
2042 { 0x1f, 0x01452050 },
2043 {}
2026}; 2044};
2027 2045
2028static const unsigned int dell_m4_1_pin_configs[STAC92HD71BXX_NUM_PINS] = { 2046static const struct hda_pintbl dell_m4_1_pin_configs[] = {
2029 0x0421101f, 0x04a11221, 0x40f000f0, 0x90170110, 2047 { 0x0a, 0x0421101f },
2030 0x23a1902e, 0x23014250, 0x40f000f0, 0x90a000f0, 2048 { 0x0b, 0x04a11221 },
2031 0x40f000f0, 0x4f0000f0, 0x4f0000f0, 0x00000000, 2049 { 0x0c, 0x40f000f0 },
2032 0x00000000 2050 { 0x0d, 0x90170110 },
2051 { 0x0e, 0x23a1902e },
2052 { 0x0f, 0x23014250 },
2053 { 0x14, 0x40f000f0 },
2054 { 0x18, 0x90a000f0 },
2055 { 0x19, 0x40f000f0 },
2056 { 0x1e, 0x4f0000f0 },
2057 { 0x1f, 0x4f0000f0 },
2058 {}
2033}; 2059};
2034 2060
2035static const unsigned int dell_m4_2_pin_configs[STAC92HD71BXX_NUM_PINS] = { 2061static const struct hda_pintbl dell_m4_2_pin_configs[] = {
2036 0x0421101f, 0x04a11221, 0x90a70330, 0x90170110, 2062 { 0x0a, 0x0421101f },
2037 0x23a1902e, 0x23014250, 0x40f000f0, 0x40f000f0, 2063 { 0x0b, 0x04a11221 },
2038 0x40f000f0, 0x044413b0, 0x044413b0, 0x00000000, 2064 { 0x0c, 0x90a70330 },
2039 0x00000000 2065 { 0x0d, 0x90170110 },
2066 { 0x0e, 0x23a1902e },
2067 { 0x0f, 0x23014250 },
2068 { 0x14, 0x40f000f0 },
2069 { 0x18, 0x40f000f0 },
2070 { 0x19, 0x40f000f0 },
2071 { 0x1e, 0x044413b0 },
2072 { 0x1f, 0x044413b0 },
2073 {}
2040}; 2074};
2041 2075
2042static const unsigned int dell_m4_3_pin_configs[STAC92HD71BXX_NUM_PINS] = { 2076static const struct hda_pintbl dell_m4_3_pin_configs[] = {
2043 0x0421101f, 0x04a11221, 0x90a70330, 0x90170110, 2077 { 0x0a, 0x0421101f },
2044 0x40f000f0, 0x40f000f0, 0x40f000f0, 0x90a000f0, 2078 { 0x0b, 0x04a11221 },
2045 0x40f000f0, 0x044413b0, 0x044413b0, 0x00000000, 2079 { 0x0c, 0x90a70330 },
2046 0x00000000 2080 { 0x0d, 0x90170110 },
2081 { 0x0e, 0x40f000f0 },
2082 { 0x0f, 0x40f000f0 },
2083 { 0x14, 0x40f000f0 },
2084 { 0x18, 0x90a000f0 },
2085 { 0x19, 0x40f000f0 },
2086 { 0x1e, 0x044413b0 },
2087 { 0x1f, 0x044413b0 },
2088 {}
2047}; 2089};
2048 2090
2049static const unsigned int *stac92hd71bxx_brd_tbl[STAC_92HD71BXX_MODELS] = { 2091static void stac92hd71bxx_fixup_ref(struct hda_codec *codec,
2050 [STAC_92HD71BXX_REF] = ref92hd71bxx_pin_configs, 2092 const struct hda_fixup *fix, int action)
2051 [STAC_DELL_M4_1] = dell_m4_1_pin_configs, 2093{
2052 [STAC_DELL_M4_2] = dell_m4_2_pin_configs, 2094 struct sigmatel_spec *spec = codec->spec;
2053 [STAC_DELL_M4_3] = dell_m4_3_pin_configs, 2095
2054 [STAC_HP_M4] = NULL, 2096 if (action != HDA_FIXUP_ACT_PRE_PROBE)
2055 [STAC_HP_DV4] = NULL, 2097 return;
2056 [STAC_HP_DV5] = NULL, 2098
2057 [STAC_HP_HDX] = NULL, 2099 snd_hda_apply_pincfgs(codec, ref92hd71bxx_pin_configs);
2058 [STAC_HP_DV4_1222NR] = NULL, 2100 spec->gpio_mask = spec->gpio_dir = spec->gpio_data = 0;
2101}
2102
2103static void stac92hd71bxx_fixup_no_dmic(struct hda_codec *codec,
2104 const struct hda_fixup *fix, int action)
2105{
2106 struct sigmatel_spec *spec = codec->spec;
2107
2108 if (action != HDA_FIXUP_ACT_PRE_PROBE)
2109 return;
2110 spec->num_dmics = 0;
2111 spec->num_smuxes = 0;
2112 spec->num_dmuxes = 0;
2113}
2114
2115static void stac92hd71bxx_fixup_no_smux(struct hda_codec *codec,
2116 const struct hda_fixup *fix, int action)
2117{
2118 struct sigmatel_spec *spec = codec->spec;
2119
2120 if (action != HDA_FIXUP_ACT_PRE_PROBE)
2121 return;
2122 spec->num_dmics = 1;
2123 spec->num_smuxes = 0;
2124 spec->num_dmuxes = 1;
2125}
2126
2127static void stac92hd71bxx_fixup_hp_m4(struct hda_codec *codec,
2128 const struct hda_fixup *fix, int action)
2129{
2130 struct sigmatel_spec *spec = codec->spec;
2131
2132 if (action != HDA_FIXUP_ACT_PRE_PROBE)
2133 return;
2134
2135 /* Enable VREF power saving on GPIO1 detect */
2136 stac_add_event(codec, codec->afg, STAC_VREF_EVENT, 0x02);
2137 snd_hda_codec_write_cache(codec, codec->afg, 0,
2138 AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x02);
2139 snd_hda_jack_detect_enable(codec, codec->afg, 0);
2140 spec->gpio_mask |= 0x02;
2141
2142 /* enable internal microphone */
2143 snd_hda_codec_set_pincfg(codec, 0x0e, 0x01813040);
2144 stac92xx_auto_set_pinctl(codec, 0x0e,
2145 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80);
2146
2147 stac92hd71bxx_fixup_no_dmic(codec, fix, action);
2148}
2149
2150static void stac92hd71bxx_fixup_hp_dv4_1222nr(struct hda_codec *codec,
2151 const struct hda_fixup *fix, int action)
2152{
2153 struct sigmatel_spec *spec = codec->spec;
2154
2155 if (action != HDA_FIXUP_ACT_PRE_PROBE)
2156 return;
2157 spec->num_dmics = 1;
2158 /* I don't know if it needs 1 or 2 smuxes - will wait for
2159 * bug reports to fix if needed
2160 */
2161 spec->num_smuxes = 1;
2162 spec->num_dmuxes = 1;
2163}
2164
2165static void stac92hd71bxx_fixup_hp_dv4(struct hda_codec *codec,
2166 const struct hda_fixup *fix, int action)
2167{
2168 struct sigmatel_spec *spec = codec->spec;
2169
2170 if (action != HDA_FIXUP_ACT_PRE_PROBE)
2171 return;
2172 spec->gpio_led = 0x01;
2173}
2174
2175static void stac92hd71bxx_fixup_hp_dv5(struct hda_codec *codec,
2176 const struct hda_fixup *fix, int action)
2177{
2178 struct sigmatel_spec *spec = codec->spec;
2179 unsigned int cap;
2180
2181 switch (action) {
2182 case HDA_FIXUP_ACT_PRE_PROBE:
2183 snd_hda_codec_set_pincfg(codec, 0x0d, 0x90170010);
2184 stac92xx_auto_set_pinctl(codec, 0x0d, AC_PINCTL_OUT_EN);
2185 /* HP dv6 gives the headphone pin as a line-out. Thus we
2186 * need to set hp_detect flag here to force to enable HP
2187 * detection.
2188 */
2189 spec->hp_detect = 1;
2190 break;
2191
2192 case HDA_FIXUP_ACT_PROBE:
2193 /* enable bass on HP dv7 */
2194 cap = snd_hda_param_read(codec, 0x1, AC_PAR_GPIO_CAP);
2195 cap &= AC_GPIO_IO_COUNT;
2196 if (cap >= 6)
2197 stac_add_hp_bass_switch(codec);
2198 break;
2199 }
2200}
2201
2202static void stac92hd71bxx_fixup_hp_hdx(struct hda_codec *codec,
2203 const struct hda_fixup *fix, int action)
2204{
2205 struct sigmatel_spec *spec = codec->spec;
2206
2207 if (action != HDA_FIXUP_ACT_PRE_PROBE)
2208 return;
2209 spec->gpio_led = 0x08;
2210 spec->num_dmics = 1;
2211 spec->num_smuxes = 1;
2212 spec->num_dmuxes = 1;
2213}
2214
2215
2216static void stac92hd71bxx_fixup_hp(struct hda_codec *codec,
2217 const struct hda_fixup *fix, int action)
2218{
2219 struct sigmatel_spec *spec = codec->spec;
2220
2221 if (action != HDA_FIXUP_ACT_PRE_PROBE)
2222 return;
2223
2224 if (hp_blike_system(codec->subsystem_id)) {
2225 unsigned int pin_cfg = snd_hda_codec_get_pincfg(codec, 0x0f);
2226 if (get_defcfg_device(pin_cfg) == AC_JACK_LINE_OUT ||
2227 get_defcfg_device(pin_cfg) == AC_JACK_SPEAKER ||
2228 get_defcfg_device(pin_cfg) == AC_JACK_HP_OUT) {
2229 /* It was changed in the BIOS to just satisfy MS DTM.
2230 * Lets turn it back into slaved HP
2231 */
2232 pin_cfg = (pin_cfg & (~AC_DEFCFG_DEVICE))
2233 | (AC_JACK_HP_OUT <<
2234 AC_DEFCFG_DEVICE_SHIFT);
2235 pin_cfg = (pin_cfg & (~(AC_DEFCFG_DEF_ASSOC
2236 | AC_DEFCFG_SEQUENCE)))
2237 | 0x1f;
2238 snd_hda_codec_set_pincfg(codec, 0x0f, pin_cfg);
2239 }
2240 }
2241
2242 if (find_mute_led_cfg(codec, 1))
2243 snd_printd("mute LED gpio %d polarity %d\n",
2244 spec->gpio_led,
2245 spec->gpio_led_polarity);
2246
2247}
2248
2249static const struct hda_fixup stac92hd71bxx_fixups[] = {
2250 [STAC_92HD71BXX_REF] = {
2251 .type = HDA_FIXUP_FUNC,
2252 .v.func = stac92hd71bxx_fixup_ref,
2253 },
2254 [STAC_DELL_M4_1] = {
2255 .type = HDA_FIXUP_PINS,
2256 .v.pins = dell_m4_1_pin_configs,
2257 .chained = true,
2258 .chain_id = STAC_92HD71BXX_NO_SMUX,
2259 },
2260 [STAC_DELL_M4_2] = {
2261 .type = HDA_FIXUP_PINS,
2262 .v.pins = dell_m4_2_pin_configs,
2263 .chained = true,
2264 .chain_id = STAC_92HD71BXX_NO_DMIC,
2265 },
2266 [STAC_DELL_M4_3] = {
2267 .type = HDA_FIXUP_PINS,
2268 .v.pins = dell_m4_3_pin_configs,
2269 .chained = true,
2270 .chain_id = STAC_92HD71BXX_NO_SMUX,
2271 },
2272 [STAC_HP_M4] = {
2273 .type = HDA_FIXUP_FUNC,
2274 .v.func = stac92hd71bxx_fixup_hp_m4,
2275 .chained = true,
2276 .chain_id = STAC_92HD71BXX_HP,
2277 },
2278 [STAC_HP_DV4] = {
2279 .type = HDA_FIXUP_FUNC,
2280 .v.func = stac92hd71bxx_fixup_hp_dv4,
2281 .chained = true,
2282 .chain_id = STAC_HP_DV5,
2283 },
2284 [STAC_HP_DV5] = {
2285 .type = HDA_FIXUP_FUNC,
2286 .v.func = stac92hd71bxx_fixup_hp_dv5,
2287 .chained = true,
2288 .chain_id = STAC_92HD71BXX_HP,
2289 },
2290 [STAC_HP_HDX] = {
2291 .type = HDA_FIXUP_FUNC,
2292 .v.func = stac92hd71bxx_fixup_hp_hdx,
2293 .chained = true,
2294 .chain_id = STAC_92HD71BXX_HP,
2295 },
2296 [STAC_HP_DV4_1222NR] = {
2297 .type = HDA_FIXUP_FUNC,
2298 .v.func = stac92hd71bxx_fixup_hp_dv4_1222nr,
2299 .chained = true,
2300 .chain_id = STAC_HP_DV4,
2301 },
2302 [STAC_92HD71BXX_NO_DMIC] = {
2303 .type = HDA_FIXUP_FUNC,
2304 .v.func = stac92hd71bxx_fixup_no_dmic,
2305 },
2306 [STAC_92HD71BXX_NO_SMUX] = {
2307 .type = HDA_FIXUP_FUNC,
2308 .v.func = stac92hd71bxx_fixup_no_smux,
2309 },
2310 [STAC_92HD71BXX_HP] = {
2311 .type = HDA_FIXUP_FUNC,
2312 .v.func = stac92hd71bxx_fixup_hp,
2313 },
2059}; 2314};
2060 2315
2061static const char * const stac92hd71bxx_models[STAC_92HD71BXX_MODELS] = { 2316static const struct hda_model_fixup stac92hd71bxx_models[] = {
2062 [STAC_92HD71BXX_AUTO] = "auto", 2317 { .id = STAC_92HD71BXX_REF, .name = "ref" },
2063 [STAC_92HD71BXX_REF] = "ref", 2318 { .id = STAC_DELL_M4_1, .name = "dell-m4-1" },
2064 [STAC_DELL_M4_1] = "dell-m4-1", 2319 { .id = STAC_DELL_M4_2, .name = "dell-m4-2" },
2065 [STAC_DELL_M4_2] = "dell-m4-2", 2320 { .id = STAC_DELL_M4_3, .name = "dell-m4-3" },
2066 [STAC_DELL_M4_3] = "dell-m4-3", 2321 { .id = STAC_HP_M4, .name = "hp-m4" },
2067 [STAC_HP_M4] = "hp-m4", 2322 { .id = STAC_HP_DV4, .name = "hp-dv4" },
2068 [STAC_HP_DV4] = "hp-dv4", 2323 { .id = STAC_HP_DV5, .name = "hp-dv5" },
2069 [STAC_HP_DV5] = "hp-dv5", 2324 { .id = STAC_HP_HDX, .name = "hp-hdx" },
2070 [STAC_HP_HDX] = "hp-hdx", 2325 { .id = STAC_HP_DV4_1222NR, .name = "hp-dv4-1222nr" },
2071 [STAC_HP_DV4_1222NR] = "hp-dv4-1222nr", 2326 {}
2072}; 2327};
2073 2328
2074static const struct snd_pci_quirk stac92hd71bxx_cfg_tbl[] = { 2329static const struct snd_pci_quirk stac92hd71bxx_fixup_tbl[] = {
2075 /* SigmaTel reference board */ 2330 /* SigmaTel reference board */
2076 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668, 2331 SND_PCI_QUIRK(PCI_VENDOR_ID_INTEL, 0x2668,
2077 "DFI LanParty", STAC_92HD71BXX_REF), 2332 "DFI LanParty", STAC_92HD71BXX_REF),
@@ -2101,6 +2356,7 @@ static const struct snd_pci_quirk stac92hd71bxx_cfg_tbl[] = {
2101 "HP DV6", STAC_HP_DV5), 2356 "HP DV6", STAC_HP_DV5),
2102 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x7010, 2357 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xfff0, 0x7010,
2103 "HP", STAC_HP_DV5), 2358 "HP", STAC_HP_DV5),
2359 SND_PCI_QUIRK_VENDOR(PCI_VENDOR_ID_HP, "HP", STAC_92HD71BXX_HP),
2104 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0233, 2360 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0233,
2105 "unknown Dell", STAC_DELL_M4_1), 2361 "unknown Dell", STAC_DELL_M4_1),
2106 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0234, 2362 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0234,
@@ -2931,9 +3187,6 @@ static void stac9205_fixup_ref(struct hda_codec *codec,
2931 } 3187 }
2932} 3188}
2933 3189
2934static int stac_add_event(struct hda_codec *codec, hda_nid_t nid,
2935 unsigned char type, int data);
2936
2937static void stac9205_fixup_dell_m43(struct hda_codec *codec, 3190static void stac9205_fixup_dell_m43(struct hda_codec *codec,
2938 const struct hda_fixup *fix, int action) 3191 const struct hda_fixup *fix, int action)
2939{ 3192{
@@ -5615,8 +5868,6 @@ static void stac_issue_unsol_event(struct hda_codec *codec, hda_nid_t nid)
5615 handle_unsol_event(codec, event); 5868 handle_unsol_event(codec, event);
5616} 5869}
5617 5870
5618static int hp_blike_system(u32 subsystem_id);
5619
5620static void set_hp_led_gpio(struct hda_codec *codec) 5871static void set_hp_led_gpio(struct hda_codec *codec)
5621{ 5872{
5622 struct sigmatel_spec *spec = codec->spec; 5873 struct sigmatel_spec *spec = codec->spec;
@@ -5663,6 +5914,7 @@ static int find_mute_led_cfg(struct hda_codec *codec, int default_polarity)
5663 &spec->gpio_led_polarity); 5914 &spec->gpio_led_polarity);
5664 return 1; 5915 return 1;
5665 } 5916 }
5917
5666 if ((codec->subsystem_id >> 16) == PCI_VENDOR_ID_HP) { 5918 if ((codec->subsystem_id >> 16) == PCI_VENDOR_ID_HP) {
5667 while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING, 5919 while ((dev = dmi_find_device(DMI_DEV_TYPE_OEM_STRING,
5668 NULL, dev))) { 5920 NULL, dev))) {
@@ -6466,7 +6718,6 @@ static int patch_stac92hd71bxx(struct hda_codec *codec)
6466{ 6718{
6467 struct sigmatel_spec *spec; 6719 struct sigmatel_spec *spec;
6468 const struct hda_verb *unmute_init = stac92hd71bxx_unmute_core_init; 6720 const struct hda_verb *unmute_init = stac92hd71bxx_unmute_core_init;
6469 unsigned int pin_cfg;
6470 int err; 6721 int err;
6471 6722
6472 err = alloc_stac_spec(codec, STAC92HD71BXX_NUM_PINS, 6723 err = alloc_stac_spec(codec, STAC92HD71BXX_NUM_PINS,
@@ -6490,24 +6741,14 @@ static int patch_stac92hd71bxx(struct hda_codec *codec)
6490 spec->pin_nids = stac92hd71bxx_pin_nids_6port; 6741 spec->pin_nids = stac92hd71bxx_pin_nids_6port;
6491 } 6742 }
6492 spec->num_pwrs = ARRAY_SIZE(stac92hd71bxx_pwr_nids); 6743 spec->num_pwrs = ARRAY_SIZE(stac92hd71bxx_pwr_nids);
6493 spec->board_config = snd_hda_check_board_config(codec,
6494 STAC_92HD71BXX_MODELS,
6495 stac92hd71bxx_models,
6496 stac92hd71bxx_cfg_tbl);
6497again:
6498 if (spec->board_config < 0)
6499 snd_printdd(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
6500 codec->chip_name);
6501 else
6502 stac92xx_set_config_regs(codec,
6503 stac92hd71bxx_brd_tbl[spec->board_config]);
6504 6744
6505 if (spec->board_config != STAC_92HD71BXX_REF) { 6745 snd_hda_pick_fixup(codec, stac92hd71bxx_models, stac92hd71bxx_fixup_tbl,
6506 /* GPIO0 = EAPD */ 6746 stac92hd71bxx_fixups);
6507 spec->gpio_mask = 0x01; 6747
6508 spec->gpio_dir = 0x01; 6748 /* GPIO0 = EAPD */
6509 spec->gpio_data = 0x01; 6749 spec->gpio_mask = 0x01;
6510 } 6750 spec->gpio_dir = 0x01;
6751 spec->gpio_data = 0x01;
6511 6752
6512 spec->dmic_nids = stac92hd71bxx_dmic_nids; 6753 spec->dmic_nids = stac92hd71bxx_dmic_nids;
6513 spec->dmux_nids = stac92hd71bxx_dmux_nids; 6754 spec->dmux_nids = stac92hd71bxx_dmux_nids;
@@ -6529,19 +6770,6 @@ again:
6529 STAC92HD71BXX_NUM_DMICS); 6770 STAC92HD71BXX_NUM_DMICS);
6530 break; 6771 break;
6531 case 0x111d7608: /* 5 Port with Analog Mixer */ 6772 case 0x111d7608: /* 5 Port with Analog Mixer */
6532 switch (spec->board_config) {
6533 case STAC_HP_M4:
6534 /* Enable VREF power saving on GPIO1 detect */
6535 err = stac_add_event(codec, codec->afg,
6536 STAC_VREF_EVENT, 0x02);
6537 if (err < 0)
6538 return err;
6539 snd_hda_codec_write_cache(codec, codec->afg, 0,
6540 AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x02);
6541 snd_hda_jack_detect_enable(codec, codec->afg, 0);
6542 spec->gpio_mask |= 0x02;
6543 break;
6544 }
6545 if ((codec->revision_id & 0xf) == 0 || 6773 if ((codec->revision_id & 0xf) == 0 ||
6546 (codec->revision_id & 0xf) == 1) 6774 (codec->revision_id & 0xf) == 1)
6547 spec->stream_delay = 40; /* 40 milliseconds */ 6775 spec->stream_delay = 40; /* 40 milliseconds */
@@ -6569,7 +6797,7 @@ again:
6569 } 6797 }
6570 6798
6571 if (get_wcaps_type(get_wcaps(codec, 0x28)) == AC_WID_VOL_KNB) 6799 if (get_wcaps_type(get_wcaps(codec, 0x28)) == AC_WID_VOL_KNB)
6572 spec->init = stac92hd71bxx_core_init; 6800 snd_hda_add_verbs(codec, stac92hd71bxx_core_init);
6573 6801
6574 if (get_wcaps(codec, 0xa) & AC_WCAP_IN_AMP) 6802 if (get_wcaps(codec, 0xa) & AC_WCAP_IN_AMP)
6575 snd_hda_sequence_write_cache(codec, unmute_init); 6803 snd_hda_sequence_write_cache(codec, unmute_init);
@@ -6590,76 +6818,7 @@ again:
6590 spec->num_dmuxes = ARRAY_SIZE(stac92hd71bxx_dmux_nids); 6818 spec->num_dmuxes = ARRAY_SIZE(stac92hd71bxx_dmux_nids);
6591 spec->num_smuxes = stac92hd71bxx_connected_smuxes(codec, 0x1e); 6819 spec->num_smuxes = stac92hd71bxx_connected_smuxes(codec, 0x1e);
6592 6820
6593 snd_printdd("Found board config: %d\n", spec->board_config); 6821 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PRE_PROBE);
6594
6595 switch (spec->board_config) {
6596 case STAC_HP_M4:
6597 /* enable internal microphone */
6598 snd_hda_codec_set_pincfg(codec, 0x0e, 0x01813040);
6599 stac92xx_auto_set_pinctl(codec, 0x0e,
6600 AC_PINCTL_IN_EN | AC_PINCTL_VREF_80);
6601 /* fallthru */
6602 case STAC_DELL_M4_2:
6603 spec->num_dmics = 0;
6604 spec->num_smuxes = 0;
6605 spec->num_dmuxes = 0;
6606 break;
6607 case STAC_DELL_M4_1:
6608 case STAC_DELL_M4_3:
6609 spec->num_dmics = 1;
6610 spec->num_smuxes = 0;
6611 spec->num_dmuxes = 1;
6612 break;
6613 case STAC_HP_DV4_1222NR:
6614 spec->num_dmics = 1;
6615 /* I don't know if it needs 1 or 2 smuxes - will wait for
6616 * bug reports to fix if needed
6617 */
6618 spec->num_smuxes = 1;
6619 spec->num_dmuxes = 1;
6620 /* fallthrough */
6621 case STAC_HP_DV4:
6622 spec->gpio_led = 0x01;
6623 /* fallthrough */
6624 case STAC_HP_DV5:
6625 snd_hda_codec_set_pincfg(codec, 0x0d, 0x90170010);
6626 stac92xx_auto_set_pinctl(codec, 0x0d, AC_PINCTL_OUT_EN);
6627 /* HP dv6 gives the headphone pin as a line-out. Thus we
6628 * need to set hp_detect flag here to force to enable HP
6629 * detection.
6630 */
6631 spec->hp_detect = 1;
6632 break;
6633 case STAC_HP_HDX:
6634 spec->num_dmics = 1;
6635 spec->num_dmuxes = 1;
6636 spec->num_smuxes = 1;
6637 spec->gpio_led = 0x08;
6638 break;
6639 }
6640
6641 if (hp_blike_system(codec->subsystem_id)) {
6642 pin_cfg = snd_hda_codec_get_pincfg(codec, 0x0f);
6643 if (get_defcfg_device(pin_cfg) == AC_JACK_LINE_OUT ||
6644 get_defcfg_device(pin_cfg) == AC_JACK_SPEAKER ||
6645 get_defcfg_device(pin_cfg) == AC_JACK_HP_OUT) {
6646 /* It was changed in the BIOS to just satisfy MS DTM.
6647 * Lets turn it back into slaved HP
6648 */
6649 pin_cfg = (pin_cfg & (~AC_DEFCFG_DEVICE))
6650 | (AC_JACK_HP_OUT <<
6651 AC_DEFCFG_DEVICE_SHIFT);
6652 pin_cfg = (pin_cfg & (~(AC_DEFCFG_DEF_ASSOC
6653 | AC_DEFCFG_SEQUENCE)))
6654 | 0x1f;
6655 snd_hda_codec_set_pincfg(codec, 0x0f, pin_cfg);
6656 }
6657 }
6658
6659 if (find_mute_led_cfg(codec, 1))
6660 snd_printd("mute LED gpio %d polarity %d\n",
6661 spec->gpio_led,
6662 spec->gpio_led_polarity);
6663 6822
6664 if (spec->gpio_led) { 6823 if (spec->gpio_led) {
6665 if (!spec->vref_mute_led_nid) { 6824 if (!spec->vref_mute_led_nid) {
@@ -6675,33 +6834,17 @@ again:
6675 spec->multiout.dac_nids = spec->dac_nids; 6834 spec->multiout.dac_nids = spec->dac_nids;
6676 6835
6677 err = stac92xx_parse_auto_config(codec); 6836 err = stac92xx_parse_auto_config(codec);
6678 if (!err) { 6837 if (!err)
6679 if (spec->board_config < 0) {
6680 printk(KERN_WARNING "hda_codec: No auto-config is "
6681 "available, default to model=ref\n");
6682 spec->board_config = STAC_92HD71BXX_REF;
6683 goto again;
6684 }
6685 err = -EINVAL; 6838 err = -EINVAL;
6686 }
6687
6688 if (err < 0) { 6839 if (err < 0) {
6689 stac92xx_free(codec); 6840 stac92xx_free(codec);
6690 return err; 6841 return err;
6691 } 6842 }
6692 6843
6693 /* enable bass on HP dv7 */
6694 if (spec->board_config == STAC_HP_DV4 ||
6695 spec->board_config == STAC_HP_DV5) {
6696 unsigned int cap;
6697 cap = snd_hda_param_read(codec, 0x1, AC_PAR_GPIO_CAP);
6698 cap &= AC_GPIO_IO_COUNT;
6699 if (cap >= 6)
6700 stac_add_hp_bass_switch(codec);
6701 }
6702
6703 codec->proc_widget_hook = stac92hd7x_proc_hook; 6844 codec->proc_widget_hook = stac92hd7x_proc_hook;
6704 6845
6846 snd_hda_apply_fixup(codec, HDA_FIXUP_ACT_PROBE);
6847
6705 return 0; 6848 return 0;
6706} 6849}
6707 6850