diff options
author | Takashi Iwai <tiwai@suse.de> | 2007-08-16 11:33:55 -0400 |
---|---|---|
committer | Jaroslav Kysela <perex@perex.cz> | 2007-10-16 09:59:09 -0400 |
commit | 72e7b0ddf52d334939778fc71e9d013519a3ee8c (patch) | |
tree | 16e19af9edce3fa70983fe610d99e0054d455c88 /sound/pci/hda/patch_sigmatel.c | |
parent | 64ca1c294c94579af68197d5f4af6911236b5a51 (diff) |
[ALSA] hda-codec - Add auto-mute function to Sony VAIO with STAC9872
Added auto-mute function with HP jack to Sony VAIO laptop with STAC9872
codec. The patch taken from ALSA bug#3275.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
Diffstat (limited to 'sound/pci/hda/patch_sigmatel.c')
-rw-r--r-- | sound/pci/hda/patch_sigmatel.c | 47 |
1 files changed, 46 insertions, 1 deletions
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index e096a48899c8..76ec32a375c0 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c | |||
@@ -2411,6 +2411,7 @@ static struct hda_input_mux vaio_mux = { | |||
2411 | 2411 | ||
2412 | static struct hda_verb vaio_init[] = { | 2412 | static struct hda_verb vaio_init[] = { |
2413 | {0x0a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP <- 0x2 */ | 2413 | {0x0a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP <- 0x2 */ |
2414 | {0x0a, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | STAC_HP_EVENT}, | ||
2414 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Speaker <- 0x5 */ | 2415 | {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Speaker <- 0x5 */ |
2415 | {0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Mic? (<- 0x2) */ | 2416 | {0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Mic? (<- 0x2) */ |
2416 | {0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD */ | 2417 | {0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD */ |
@@ -2507,6 +2508,49 @@ static struct hda_codec_ops stac9872_patch_ops = { | |||
2507 | #endif | 2508 | #endif |
2508 | }; | 2509 | }; |
2509 | 2510 | ||
2511 | static int stac9872_vaio_init(struct hda_codec *codec) | ||
2512 | { | ||
2513 | int err; | ||
2514 | |||
2515 | err = stac92xx_init(codec); | ||
2516 | if (err < 0) | ||
2517 | return err; | ||
2518 | if (codec->patch_ops.unsol_event) | ||
2519 | codec->patch_ops.unsol_event(codec, STAC_HP_EVENT << 26); | ||
2520 | return 0; | ||
2521 | } | ||
2522 | |||
2523 | static void stac9872_vaio_hp_detect(struct hda_codec *codec, unsigned int res) | ||
2524 | { | ||
2525 | if (get_pin_presence(codec, 0x0a)) { | ||
2526 | stac92xx_reset_pinctl(codec, 0x0f, AC_PINCTL_OUT_EN); | ||
2527 | stac92xx_set_pinctl(codec, 0x0a, AC_PINCTL_OUT_EN); | ||
2528 | } else { | ||
2529 | stac92xx_reset_pinctl(codec, 0x0a, AC_PINCTL_OUT_EN); | ||
2530 | stac92xx_set_pinctl(codec, 0x0f, AC_PINCTL_OUT_EN); | ||
2531 | } | ||
2532 | } | ||
2533 | |||
2534 | static void stac9872_vaio_unsol_event(struct hda_codec *codec, unsigned int res) | ||
2535 | { | ||
2536 | switch (res >> 26) { | ||
2537 | case STAC_HP_EVENT: | ||
2538 | stac9872_vaio_hp_detect(codec, res); | ||
2539 | break; | ||
2540 | } | ||
2541 | } | ||
2542 | |||
2543 | static struct hda_codec_ops stac9872_vaio_patch_ops = { | ||
2544 | .build_controls = stac92xx_build_controls, | ||
2545 | .build_pcms = stac92xx_build_pcms, | ||
2546 | .init = stac9872_vaio_init, | ||
2547 | .free = stac92xx_free, | ||
2548 | .unsol_event = stac9872_vaio_unsol_event, | ||
2549 | #ifdef CONFIG_PM | ||
2550 | .resume = stac92xx_resume, | ||
2551 | #endif | ||
2552 | }; | ||
2553 | |||
2510 | enum { /* FE and SZ series. id=0x83847661 and subsys=0x104D0700 or 104D1000. */ | 2554 | enum { /* FE and SZ series. id=0x83847661 and subsys=0x104D0700 or 104D1000. */ |
2511 | CXD9872RD_VAIO, | 2555 | CXD9872RD_VAIO, |
2512 | /* Unknown. id=0x83847662 and subsys=0x104D1200 or 104D1000. */ | 2556 | /* Unknown. id=0x83847662 and subsys=0x104D1200 or 104D1000. */ |
@@ -2562,6 +2606,7 @@ static int patch_stac9872(struct hda_codec *codec) | |||
2562 | spec->adc_nids = vaio_adcs; | 2606 | spec->adc_nids = vaio_adcs; |
2563 | spec->input_mux = &vaio_mux; | 2607 | spec->input_mux = &vaio_mux; |
2564 | spec->mux_nids = vaio_mux_nids; | 2608 | spec->mux_nids = vaio_mux_nids; |
2609 | codec->patch_ops = stac9872_vaio_patch_ops; | ||
2565 | break; | 2610 | break; |
2566 | 2611 | ||
2567 | case CXD9872AKD_VAIO: | 2612 | case CXD9872AKD_VAIO: |
@@ -2575,10 +2620,10 @@ static int patch_stac9872(struct hda_codec *codec) | |||
2575 | spec->adc_nids = vaio_adcs; | 2620 | spec->adc_nids = vaio_adcs; |
2576 | spec->input_mux = &vaio_mux; | 2621 | spec->input_mux = &vaio_mux; |
2577 | spec->mux_nids = vaio_mux_nids; | 2622 | spec->mux_nids = vaio_mux_nids; |
2623 | codec->patch_ops = stac9872_patch_ops; | ||
2578 | break; | 2624 | break; |
2579 | } | 2625 | } |
2580 | 2626 | ||
2581 | codec->patch_ops = stac9872_patch_ops; | ||
2582 | return 0; | 2627 | return 0; |
2583 | } | 2628 | } |
2584 | 2629 | ||