aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Ranostay <mranostay@embeddedalley.com>2008-04-14 07:32:54 -0400
committerTakashi Iwai <tiwai@suse.de>2008-04-24 06:00:35 -0400
commit0fc9dec46fae19da9899c580a6b870202103f8bb (patch)
treee744a618b904a65969ee27fd3ed441e761bfbe60
parent780c8be4ab6c7baf5cdfa1102f56480acb8a2479 (diff)
[ALSA] hda: EAPD power management
Power management support for EAPD enabled laptops, when headphones are sensed it pulls the EAPD GPIO line low to power it down. Signed-off-by: Matthew Ranostay <mranostay@embeddedalley.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--sound/pci/hda/patch_sigmatel.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index d79580c29862..e1d07ab5cd15 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -129,6 +129,7 @@ struct sigmatel_spec {
129 unsigned int hp_detect: 1; 129 unsigned int hp_detect: 1;
130 130
131 /* gpio lines */ 131 /* gpio lines */
132 unsigned int eapd_mask;
132 unsigned int gpio_mask; 133 unsigned int gpio_mask;
133 unsigned int gpio_dir; 134 unsigned int gpio_dir;
134 unsigned int gpio_data; 135 unsigned int gpio_data;
@@ -3183,6 +3184,10 @@ static void stac92xx_hp_detect(struct hda_codec *codec, unsigned int res)
3183 for (i = 0; i < cfg->speaker_outs; i++) 3184 for (i = 0; i < cfg->speaker_outs; i++)
3184 stac92xx_reset_pinctl(codec, cfg->speaker_pins[i], 3185 stac92xx_reset_pinctl(codec, cfg->speaker_pins[i],
3185 AC_PINCTL_OUT_EN); 3186 AC_PINCTL_OUT_EN);
3187 if (spec->eapd_mask)
3188 stac_gpio_set(codec, spec->gpio_mask,
3189 spec->gpio_dir, spec->gpio_data &
3190 ~spec->eapd_mask);
3186 } else { 3191 } else {
3187 /* enable lineouts, disable hp */ 3192 /* enable lineouts, disable hp */
3188 for (i = 0; i < cfg->line_outs; i++) 3193 for (i = 0; i < cfg->line_outs; i++)
@@ -3191,6 +3196,10 @@ static void stac92xx_hp_detect(struct hda_codec *codec, unsigned int res)
3191 for (i = 0; i < cfg->speaker_outs; i++) 3196 for (i = 0; i < cfg->speaker_outs; i++)
3192 stac92xx_set_pinctl(codec, cfg->speaker_pins[i], 3197 stac92xx_set_pinctl(codec, cfg->speaker_pins[i],
3193 AC_PINCTL_OUT_EN); 3198 AC_PINCTL_OUT_EN);
3199 if (spec->eapd_mask)
3200 stac_gpio_set(codec, spec->gpio_mask,
3201 spec->gpio_dir, spec->gpio_data |
3202 spec->eapd_mask);
3194 } 3203 }
3195} 3204}
3196 3205
@@ -3478,7 +3487,7 @@ again:
3478 spec->num_dmuxes = ARRAY_SIZE(stac92hd73xx_dmux_nids); 3487 spec->num_dmuxes = ARRAY_SIZE(stac92hd73xx_dmux_nids);
3479 spec->dinput_mux = &stac92hd73xx_dmux; 3488 spec->dinput_mux = &stac92hd73xx_dmux;
3480 /* GPIO0 High = Enable EAPD */ 3489 /* GPIO0 High = Enable EAPD */
3481 spec->gpio_mask = spec->gpio_dir = 0x1; 3490 spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x1;
3482 spec->gpio_data = 0x01; 3491 spec->gpio_data = 0x01;
3483 3492
3484 switch (spec->board_config) { 3493 switch (spec->board_config) {
@@ -3584,7 +3593,10 @@ again:
3584 spec->aloopback_shift = 0; 3593 spec->aloopback_shift = 0;
3585 3594
3586 /* GPIO0 High = EAPD */ 3595 /* GPIO0 High = EAPD */
3587 spec->gpio_mask = spec->gpio_dir = spec->gpio_data = 0x1; 3596 spec->gpio_mask = 0x01;
3597 spec->gpio_dir = 0x01;
3598 spec->gpio_mask = 0x01;
3599 spec->gpio_data = 0x01;
3588 3600
3589 spec->mux_nids = stac92hd71bxx_mux_nids; 3601 spec->mux_nids = stac92hd71bxx_mux_nids;
3590 spec->adc_nids = stac92hd71bxx_adc_nids; 3602 spec->adc_nids = stac92hd71bxx_adc_nids;
@@ -3770,7 +3782,7 @@ static int patch_stac927x(struct hda_codec *codec)
3770 case STAC_D965_3ST: 3782 case STAC_D965_3ST:
3771 case STAC_D965_5ST: 3783 case STAC_D965_5ST:
3772 /* GPIO0 High = Enable EAPD */ 3784 /* GPIO0 High = Enable EAPD */
3773 spec->gpio_mask = spec->gpio_dir = 0x01; 3785 spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x01;
3774 spec->gpio_data = 0x01; 3786 spec->gpio_data = 0x01;
3775 spec->num_dmics = 0; 3787 spec->num_dmics = 0;
3776 3788
@@ -3794,7 +3806,7 @@ static int patch_stac927x(struct hda_codec *codec)
3794 /* fallthru */ 3806 /* fallthru */
3795 case STAC_DELL_3ST: 3807 case STAC_DELL_3ST:
3796 /* GPIO2 High = Enable EAPD */ 3808 /* GPIO2 High = Enable EAPD */
3797 spec->gpio_mask = spec->gpio_dir = 0x04; 3809 spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x04;
3798 spec->gpio_data = 0x04; 3810 spec->gpio_data = 0x04;
3799 spec->dmic_nids = stac927x_dmic_nids; 3811 spec->dmic_nids = stac927x_dmic_nids;
3800 spec->num_dmics = STAC927X_NUM_DMICS; 3812 spec->num_dmics = STAC927X_NUM_DMICS;
@@ -3806,7 +3818,7 @@ static int patch_stac927x(struct hda_codec *codec)
3806 break; 3818 break;
3807 default: 3819 default:
3808 /* GPIO0 High = Enable EAPD */ 3820 /* GPIO0 High = Enable EAPD */
3809 spec->gpio_mask = spec->gpio_dir = 0x1; 3821 spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x1;
3810 spec->gpio_data = 0x01; 3822 spec->gpio_data = 0x01;
3811 spec->num_dmics = 0; 3823 spec->num_dmics = 0;
3812 3824
@@ -3910,6 +3922,7 @@ static int patch_stac9205(struct hda_codec *codec)
3910 (AC_USRSP_EN | STAC_HP_EVENT)); 3922 (AC_USRSP_EN | STAC_HP_EVENT));
3911 3923
3912 spec->gpio_dir = 0x0b; 3924 spec->gpio_dir = 0x0b;
3925 spec->eapd_mask = 0x01;
3913 spec->gpio_mask = 0x1b; 3926 spec->gpio_mask = 0x1b;
3914 spec->gpio_mute = 0x10; 3927 spec->gpio_mute = 0x10;
3915 /* GPIO0 High = EAPD, GPIO1 Low = Headphone Mute, 3928 /* GPIO0 High = EAPD, GPIO1 Low = Headphone Mute,
@@ -3919,7 +3932,7 @@ static int patch_stac9205(struct hda_codec *codec)
3919 break; 3932 break;
3920 default: 3933 default:
3921 /* GPIO0 High = EAPD */ 3934 /* GPIO0 High = EAPD */
3922 spec->gpio_mask = spec->gpio_dir = 0x1; 3935 spec->eapd_mask = spec->gpio_mask = spec->gpio_dir = 0x1;
3923 spec->gpio_data = 0x01; 3936 spec->gpio_data = 0x01;
3924 break; 3937 break;
3925 } 3938 }