From: Chih-Chung Chang Date: Thu, 11 Oct 2012 02:24:30 +0000 (+0800) Subject: CHROMIUM: ALSA: hda/ca0132: Turn on headphone amp only when a headphone is plugged. X-Git-Url: http://git.cascardo.eti.br/?a=commitdiff_plain;h=119a1ff22fa98a3d97b439c6e1919309c5c2dd53;p=cascardo%2Flinux.git CHROMIUM: ALSA: hda/ca0132: Turn on headphone amp only when a headphone is plugged. The patch is provided by Creative. BUG=none TEST=plug/unplug a headphone and verify the AMP pin is high only when a headphone is plugged. Change-Id: I0d8a3113d9fcfe7ffddd69cfc7c0b0b9ce728ae3 Signed-off-by: Chih-Chung Chang Reviewed-on: https://gerrit.chromium.org/gerrit/35234 Reviewed-by: Dylan Reid --- diff --git a/sound/pci/hda/patch_ca0132.c b/sound/pci/hda/patch_ca0132.c index 959e53ac3c38..7e317efcff0f 100644 --- a/sound/pci/hda/patch_ca0132.c +++ b/sound/pci/hda/patch_ca0132.c @@ -3130,26 +3130,28 @@ static int ca0132_select_out(struct hda_codec *codec) if (err < 0) goto exit; + /* Setup EAPD */ + snd_hda_codec_write(codec, spec->out_pins[1], 0, + VENDOR_CHIPIO_EAPD_SEL_SET, 0x02); + snd_hda_codec_write(codec, spec->out_pins[0], 0, + AC_VERB_SET_EAPD_BTLENABLE, 0x00); + snd_hda_codec_write(codec, spec->out_pins[0], 0, + VENDOR_CHIPIO_EAPD_SEL_SET, 0x00); + snd_hda_codec_write(codec, spec->out_pins[0], 0, + AC_VERB_SET_EAPD_BTLENABLE, 0x02); + /* disable headphone node */ pin_ctl = snd_hda_codec_read(codec, spec->out_pins[1], 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0); snd_hda_codec_write(codec, spec->out_pins[1], 0, AC_VERB_SET_PIN_WIDGET_CONTROL, pin_ctl & 0xBF); - /* disable headphone EAPD */ - snd_hda_codec_write(codec, spec->out_pins[0], 0, - AC_VERB_SET_EAPD_BTLENABLE, 0x00); /* enable speaker node */ pin_ctl = snd_hda_codec_read(codec, spec->out_pins[0], 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0); snd_hda_codec_write(codec, spec->out_pins[0], 0, AC_VERB_SET_PIN_WIDGET_CONTROL, pin_ctl | 0x40); - /* enable speaker EAPD */ - snd_hda_codec_write(codec, spec->out_pins[0], 0, - VENDOR_CHIPIO_EAPD_SEL_SET, 0x00); - snd_hda_codec_write(codec, spec->out_pins[0], 0, - AC_VERB_SET_EAPD_BTLENABLE, 0x02); } else { CA0132_LOG("ca0132_select_out hp\n"); /*headphone out config*/ @@ -3165,26 +3167,28 @@ static int ca0132_select_out(struct hda_codec *codec) if (err < 0) goto exit; + /* Setup EAPD */ + snd_hda_codec_write(codec, spec->out_pins[0], 0, + VENDOR_CHIPIO_EAPD_SEL_SET, 0x00); + snd_hda_codec_write(codec, spec->out_pins[0], 0, + AC_VERB_SET_EAPD_BTLENABLE, 0x00); + snd_hda_codec_write(codec, spec->out_pins[1], 0, + VENDOR_CHIPIO_EAPD_SEL_SET, 0x02); + snd_hda_codec_write(codec, spec->out_pins[0], 0, + AC_VERB_SET_EAPD_BTLENABLE, 0x02); + /* disable speaker*/ pin_ctl = snd_hda_codec_read(codec, spec->out_pins[0], 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0); snd_hda_codec_write(codec, spec->out_pins[0], 0, AC_VERB_SET_PIN_WIDGET_CONTROL, pin_ctl & 0xBF); - /* disable speaker EAPD */ - snd_hda_codec_write(codec, spec->out_pins[0], 0, - AC_VERB_SET_EAPD_BTLENABLE, 0x00); /* enable headphone*/ pin_ctl = snd_hda_codec_read(codec, spec->out_pins[1], 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0); snd_hda_codec_write(codec, spec->out_pins[1], 0, AC_VERB_SET_PIN_WIDGET_CONTROL, pin_ctl | 0x40); - /* enable headphone EAPD */ - snd_hda_codec_write(codec, spec->out_pins[1], 0, - VENDOR_CHIPIO_EAPD_SEL_SET, 0x02); - snd_hda_codec_write(codec, spec->out_pins[0], 0, - AC_VERB_SET_EAPD_BTLENABLE, 0x02); } exit: