Commit 72e7b0dd authored by Takashi Iwai's avatar Takashi Iwai Committed by Jaroslav Kysela

[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: default avatarTakashi Iwai <tiwai@suse.de>
Signed-off-by: default avatarJaroslav Kysela <perex@suse.cz>
parent 64ca1c29
...@@ -2411,6 +2411,7 @@ static struct hda_input_mux vaio_mux = { ...@@ -2411,6 +2411,7 @@ static struct hda_input_mux vaio_mux = {
static struct hda_verb vaio_init[] = { static struct hda_verb vaio_init[] = {
{0x0a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP <- 0x2 */ {0x0a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP <- 0x2 */
{0x0a, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | STAC_HP_EVENT},
{0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Speaker <- 0x5 */ {0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Speaker <- 0x5 */
{0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Mic? (<- 0x2) */ {0x0d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Mic? (<- 0x2) */
{0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD */ {0x0e, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN }, /* CD */
...@@ -2507,6 +2508,49 @@ static struct hda_codec_ops stac9872_patch_ops = { ...@@ -2507,6 +2508,49 @@ static struct hda_codec_ops stac9872_patch_ops = {
#endif #endif
}; };
static int stac9872_vaio_init(struct hda_codec *codec)
{
int err;
err = stac92xx_init(codec);
if (err < 0)
return err;
if (codec->patch_ops.unsol_event)
codec->patch_ops.unsol_event(codec, STAC_HP_EVENT << 26);
return 0;
}
static void stac9872_vaio_hp_detect(struct hda_codec *codec, unsigned int res)
{
if (get_pin_presence(codec, 0x0a)) {
stac92xx_reset_pinctl(codec, 0x0f, AC_PINCTL_OUT_EN);
stac92xx_set_pinctl(codec, 0x0a, AC_PINCTL_OUT_EN);
} else {
stac92xx_reset_pinctl(codec, 0x0a, AC_PINCTL_OUT_EN);
stac92xx_set_pinctl(codec, 0x0f, AC_PINCTL_OUT_EN);
}
}
static void stac9872_vaio_unsol_event(struct hda_codec *codec, unsigned int res)
{
switch (res >> 26) {
case STAC_HP_EVENT:
stac9872_vaio_hp_detect(codec, res);
break;
}
}
static struct hda_codec_ops stac9872_vaio_patch_ops = {
.build_controls = stac92xx_build_controls,
.build_pcms = stac92xx_build_pcms,
.init = stac9872_vaio_init,
.free = stac92xx_free,
.unsol_event = stac9872_vaio_unsol_event,
#ifdef CONFIG_PM
.resume = stac92xx_resume,
#endif
};
enum { /* FE and SZ series. id=0x83847661 and subsys=0x104D0700 or 104D1000. */ enum { /* FE and SZ series. id=0x83847661 and subsys=0x104D0700 or 104D1000. */
CXD9872RD_VAIO, CXD9872RD_VAIO,
/* Unknown. id=0x83847662 and subsys=0x104D1200 or 104D1000. */ /* Unknown. id=0x83847662 and subsys=0x104D1200 or 104D1000. */
...@@ -2562,6 +2606,7 @@ static int patch_stac9872(struct hda_codec *codec) ...@@ -2562,6 +2606,7 @@ static int patch_stac9872(struct hda_codec *codec)
spec->adc_nids = vaio_adcs; spec->adc_nids = vaio_adcs;
spec->input_mux = &vaio_mux; spec->input_mux = &vaio_mux;
spec->mux_nids = vaio_mux_nids; spec->mux_nids = vaio_mux_nids;
codec->patch_ops = stac9872_vaio_patch_ops;
break; break;
case CXD9872AKD_VAIO: case CXD9872AKD_VAIO:
...@@ -2575,10 +2620,10 @@ static int patch_stac9872(struct hda_codec *codec) ...@@ -2575,10 +2620,10 @@ static int patch_stac9872(struct hda_codec *codec)
spec->adc_nids = vaio_adcs; spec->adc_nids = vaio_adcs;
spec->input_mux = &vaio_mux; spec->input_mux = &vaio_mux;
spec->mux_nids = vaio_mux_nids; spec->mux_nids = vaio_mux_nids;
codec->patch_ops = stac9872_patch_ops;
break; break;
} }
codec->patch_ops = stac9872_patch_ops;
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment