aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/patch_realtek.c
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2009-11-06 10:46:18 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2009-11-06 10:46:18 -0500
commit330f28f691e9b349e34adcaf82b273cf061bb491 (patch)
treefca3bfe41eff25ef19f576cef1979c68f6521af5 /sound/pci/hda/patch_realtek.c
parentfe3e78e073d25308756f38019956061153267769 (diff)
parent6fc786d5034ed7ce2d43c459211137de6d99dd28 (diff)
Merge branch 'for-2.6.32' into for-2.6.33
Diffstat (limited to 'sound/pci/hda/patch_realtek.c')
-rw-r--r--sound/pci/hda/patch_realtek.c98
1 files changed, 73 insertions, 25 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 7810d3dcad83..ff20048504b6 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -275,7 +275,7 @@ struct alc_spec {
275 struct snd_kcontrol_new *cap_mixer; /* capture mixer */ 275 struct snd_kcontrol_new *cap_mixer; /* capture mixer */
276 unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */ 276 unsigned int beep_amp; /* beep amp value, set via set_beep_amp() */
277 277
278 const struct hda_verb *init_verbs[5]; /* initialization verbs 278 const struct hda_verb *init_verbs[10]; /* initialization verbs
279 * don't forget NULL 279 * don't forget NULL
280 * termination! 280 * termination!
281 */ 281 */
@@ -965,6 +965,8 @@ static void alc_automute_pin(struct hda_codec *codec)
965 unsigned int nid = spec->autocfg.hp_pins[0]; 965 unsigned int nid = spec->autocfg.hp_pins[0];
966 int i; 966 int i;
967 967
968 if (!nid)
969 return;
968 pincap = snd_hda_query_pin_caps(codec, nid); 970 pincap = snd_hda_query_pin_caps(codec, nid);
969 if (pincap & AC_PINCAP_TRIG_REQ) /* need trigger? */ 971 if (pincap & AC_PINCAP_TRIG_REQ) /* need trigger? */
970 snd_hda_codec_read(codec, nid, 0, AC_VERB_SET_PIN_SENSE, 0); 972 snd_hda_codec_read(codec, nid, 0, AC_VERB_SET_PIN_SENSE, 0);
@@ -1332,15 +1334,20 @@ do_sku:
1332 * when the external headphone out jack is plugged" 1334 * when the external headphone out jack is plugged"
1333 */ 1335 */
1334 if (!spec->autocfg.hp_pins[0]) { 1336 if (!spec->autocfg.hp_pins[0]) {
1337 hda_nid_t nid;
1335 tmp = (ass >> 11) & 0x3; /* HP to chassis */ 1338 tmp = (ass >> 11) & 0x3; /* HP to chassis */
1336 if (tmp == 0) 1339 if (tmp == 0)
1337 spec->autocfg.hp_pins[0] = porta; 1340 nid = porta;
1338 else if (tmp == 1) 1341 else if (tmp == 1)
1339 spec->autocfg.hp_pins[0] = porte; 1342 nid = porte;
1340 else if (tmp == 2) 1343 else if (tmp == 2)
1341 spec->autocfg.hp_pins[0] = portd; 1344 nid = portd;
1342 else 1345 else
1343 return 1; 1346 return 1;
1347 for (i = 0; i < spec->autocfg.line_outs; i++)
1348 if (spec->autocfg.line_out_pins[i] == nid)
1349 return 1;
1350 spec->autocfg.hp_pins[0] = nid;
1344 } 1351 }
1345 1352
1346 alc_init_auto_hp(codec); 1353 alc_init_auto_hp(codec);
@@ -1362,7 +1369,7 @@ static void alc_ssid_check(struct hda_codec *codec,
1362} 1369}
1363 1370
1364/* 1371/*
1365 * Fix-up pin default configurations 1372 * Fix-up pin default configurations and add default verbs
1366 */ 1373 */
1367 1374
1368struct alc_pincfg { 1375struct alc_pincfg {
@@ -1370,9 +1377,14 @@ struct alc_pincfg {
1370 u32 val; 1377 u32 val;
1371}; 1378};
1372 1379
1373static void alc_fix_pincfg(struct hda_codec *codec, 1380struct alc_fixup {
1381 const struct alc_pincfg *pins;
1382 const struct hda_verb *verbs;
1383};
1384
1385static void alc_pick_fixup(struct hda_codec *codec,
1374 const struct snd_pci_quirk *quirk, 1386 const struct snd_pci_quirk *quirk,
1375 const struct alc_pincfg **pinfix) 1387 const struct alc_fixup *fix)
1376{ 1388{
1377 const struct alc_pincfg *cfg; 1389 const struct alc_pincfg *cfg;
1378 1390
@@ -1380,9 +1392,14 @@ static void alc_fix_pincfg(struct hda_codec *codec,
1380 if (!quirk) 1392 if (!quirk)
1381 return; 1393 return;
1382 1394
1383 cfg = pinfix[quirk->value]; 1395 fix += quirk->value;
1384 for (; cfg->nid; cfg++) 1396 cfg = fix->pins;
1385 snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val); 1397 if (cfg) {
1398 for (; cfg->nid; cfg++)
1399 snd_hda_codec_set_pincfg(codec, cfg->nid, cfg->val);
1400 }
1401 if (fix->verbs)
1402 add_verb(codec->spec, fix->verbs);
1386} 1403}
1387 1404
1388/* 1405/*
@@ -9593,11 +9610,13 @@ static struct alc_pincfg alc882_abit_aw9d_pinfix[] = {
9593 { } 9610 { }
9594}; 9611};
9595 9612
9596static const struct alc_pincfg *alc882_pin_fixes[] = { 9613static const struct alc_fixup alc882_fixups[] = {
9597 [PINFIX_ABIT_AW9D_MAX] = alc882_abit_aw9d_pinfix, 9614 [PINFIX_ABIT_AW9D_MAX] = {
9615 .pins = alc882_abit_aw9d_pinfix
9616 },
9598}; 9617};
9599 9618
9600static struct snd_pci_quirk alc882_pinfix_tbl[] = { 9619static struct snd_pci_quirk alc882_fixup_tbl[] = {
9601 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), 9620 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX),
9602 {} 9621 {}
9603}; 9622};
@@ -9869,7 +9888,7 @@ static int patch_alc882(struct hda_codec *codec)
9869 board_config = ALC882_AUTO; 9888 board_config = ALC882_AUTO;
9870 } 9889 }
9871 9890
9872 alc_fix_pincfg(codec, alc882_pinfix_tbl, alc882_pin_fixes); 9891 alc_pick_fixup(codec, alc882_fixup_tbl, alc882_fixups);
9873 9892
9874 if (board_config == ALC882_AUTO) { 9893 if (board_config == ALC882_AUTO) {
9875 /* automatic parse from the BIOS config */ 9894 /* automatic parse from the BIOS config */
@@ -12585,7 +12604,8 @@ static struct snd_pci_quirk alc268_cfg_tbl[] = {
12585 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One", 12604 SND_PCI_QUIRK(0x1025, 0x015b, "Acer Aspire One",
12586 ALC268_ACER_ASPIRE_ONE), 12605 ALC268_ACER_ASPIRE_ONE),
12587 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL), 12606 SND_PCI_QUIRK(0x1028, 0x0253, "Dell OEM", ALC268_DELL),
12588 SND_PCI_QUIRK(0x1028, 0x02b0, "Dell Inspiron Mini9", ALC268_DELL), 12607 SND_PCI_QUIRK_MASK(0x1028, 0xfff0, 0x02b0,
12608 "Dell Inspiron Mini9/Vostro A90", ALC268_DELL),
12589 /* almost compatible with toshiba but with optional digital outs; 12609 /* almost compatible with toshiba but with optional digital outs;
12590 * auto-probing seems working fine 12610 * auto-probing seems working fine
12591 */ 12611 */
@@ -12842,12 +12862,15 @@ static int patch_alc268(struct hda_codec *codec)
12842 unsigned int wcap = get_wcaps(codec, 0x07); 12862 unsigned int wcap = get_wcaps(codec, 0x07);
12843 int i; 12863 int i;
12844 12864
12865 spec->capsrc_nids = alc268_capsrc_nids;
12845 /* get type */ 12866 /* get type */
12846 wcap = get_wcaps_type(wcap); 12867 wcap = get_wcaps_type(wcap);
12847 if (spec->auto_mic || 12868 if (spec->auto_mic ||
12848 wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) { 12869 wcap != AC_WID_AUD_IN || spec->input_mux->num_items == 1) {
12849 spec->adc_nids = alc268_adc_nids_alt; 12870 spec->adc_nids = alc268_adc_nids_alt;
12850 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt); 12871 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids_alt);
12872 if (spec->auto_mic)
12873 fixup_automic_adc(codec);
12851 if (spec->auto_mic || spec->input_mux->num_items == 1) 12874 if (spec->auto_mic || spec->input_mux->num_items == 1)
12852 add_mixer(spec, alc268_capture_nosrc_mixer); 12875 add_mixer(spec, alc268_capture_nosrc_mixer);
12853 else 12876 else
@@ -12857,7 +12880,6 @@ static int patch_alc268(struct hda_codec *codec)
12857 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids); 12880 spec->num_adc_nids = ARRAY_SIZE(alc268_adc_nids);
12858 add_mixer(spec, alc268_capture_mixer); 12881 add_mixer(spec, alc268_capture_mixer);
12859 } 12882 }
12860 spec->capsrc_nids = alc268_capsrc_nids;
12861 /* set default input source */ 12883 /* set default input source */
12862 for (i = 0; i < spec->num_adc_nids; i++) 12884 for (i = 0; i < spec->num_adc_nids; i++)
12863 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i], 12885 snd_hda_codec_write_cache(codec, alc268_capsrc_nids[i],
@@ -14357,15 +14379,16 @@ static void alc861_auto_init_multi_out(struct hda_codec *codec)
14357static void alc861_auto_init_hp_out(struct hda_codec *codec) 14379static void alc861_auto_init_hp_out(struct hda_codec *codec)
14358{ 14380{
14359 struct alc_spec *spec = codec->spec; 14381 struct alc_spec *spec = codec->spec;
14360 hda_nid_t pin;
14361 14382
14362 pin = spec->autocfg.hp_pins[0]; 14383 if (spec->autocfg.hp_outs)
14363 if (pin) 14384 alc861_auto_set_output_and_unmute(codec,
14364 alc861_auto_set_output_and_unmute(codec, pin, PIN_HP, 14385 spec->autocfg.hp_pins[0],
14386 PIN_HP,
14365 spec->multiout.hp_nid); 14387 spec->multiout.hp_nid);
14366 pin = spec->autocfg.speaker_pins[0]; 14388 if (spec->autocfg.speaker_outs)
14367 if (pin) 14389 alc861_auto_set_output_and_unmute(codec,
14368 alc861_auto_set_output_and_unmute(codec, pin, PIN_OUT, 14390 spec->autocfg.speaker_pins[0],
14391 PIN_OUT,
14369 spec->multiout.dac_nids[0]); 14392 spec->multiout.dac_nids[0]);
14370} 14393}
14371 14394
@@ -15158,7 +15181,7 @@ static struct snd_pci_quirk alc861vd_cfg_tbl[] = {
15158 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST), 15181 SND_PCI_QUIRK(0x1019, 0xa88d, "Realtek ALC660 demo", ALC660VD_3ST),
15159 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP), 15182 SND_PCI_QUIRK(0x103c, 0x30bf, "HP TX1000", ALC861VD_HP),
15160 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST), 15183 SND_PCI_QUIRK(0x1043, 0x12e2, "Asus z35m", ALC660VD_3ST),
15161 SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST), 15184 /*SND_PCI_QUIRK(0x1043, 0x1339, "Asus G1", ALC660VD_3ST),*/ /* auto */
15162 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S), 15185 SND_PCI_QUIRK(0x1043, 0x1633, "Asus V1Sn", ALC660VD_ASUS_V1S),
15163 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG), 15186 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS", ALC660VD_3ST_DIG),
15164 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST), 15187 SND_PCI_QUIRK(0x10de, 0x03f0, "Realtek ALC660 demo", ALC660VD_3ST),
@@ -15551,6 +15574,29 @@ static void alc861vd_auto_init(struct hda_codec *codec)
15551 alc_inithook(codec); 15574 alc_inithook(codec);
15552} 15575}
15553 15576
15577enum {
15578 ALC660VD_FIX_ASUS_GPIO1
15579};
15580
15581/* reset GPIO1 */
15582static const struct hda_verb alc660vd_fix_asus_gpio1_verbs[] = {
15583 {0x01, AC_VERB_SET_GPIO_MASK, 0x03},
15584 {0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},
15585 {0x01, AC_VERB_SET_GPIO_DATA, 0x01},
15586 { }
15587};
15588
15589static const struct alc_fixup alc861vd_fixups[] = {
15590 [ALC660VD_FIX_ASUS_GPIO1] = {
15591 .verbs = alc660vd_fix_asus_gpio1_verbs,
15592 },
15593};
15594
15595static struct snd_pci_quirk alc861vd_fixup_tbl[] = {
15596 SND_PCI_QUIRK(0x1043, 0x1339, "ASUS A7-K", ALC660VD_FIX_ASUS_GPIO1),
15597 {}
15598};
15599
15554static int patch_alc861vd(struct hda_codec *codec) 15600static int patch_alc861vd(struct hda_codec *codec)
15555{ 15601{
15556 struct alc_spec *spec; 15602 struct alc_spec *spec;
@@ -15572,6 +15618,8 @@ static int patch_alc861vd(struct hda_codec *codec)
15572 board_config = ALC861VD_AUTO; 15618 board_config = ALC861VD_AUTO;
15573 } 15619 }
15574 15620
15621 alc_pick_fixup(codec, alc861vd_fixup_tbl, alc861vd_fixups);
15622
15575 if (board_config == ALC861VD_AUTO) { 15623 if (board_config == ALC861VD_AUTO) {
15576 /* automatic parse from the BIOS config */ 15624 /* automatic parse from the BIOS config */
15577 err = alc861vd_parse_auto_config(codec); 15625 err = alc861vd_parse_auto_config(codec);
@@ -17329,7 +17377,7 @@ static int alc662_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin,
17329 17377
17330/* create playback/capture controls for input pins */ 17378/* create playback/capture controls for input pins */
17331#define alc662_auto_create_input_ctls \ 17379#define alc662_auto_create_input_ctls \
17332 alc880_auto_create_input_ctls 17380 alc882_auto_create_input_ctls
17333 17381
17334static void alc662_auto_set_output_and_unmute(struct hda_codec *codec, 17382static void alc662_auto_set_output_and_unmute(struct hda_codec *codec,
17335 hda_nid_t nid, int pin_type, 17383 hda_nid_t nid, int pin_type,