Commit 79d7d533 authored by Takashi Iwai's avatar Takashi Iwai

ALSA: hda - Fix HP dv6736 mic input

Fix the mic input of HP dv6736 with Conexant 5051 codec chip.
This laptop seems have no mic-switching per jack connection.
A new model hp-dv6736 is introduced to match with the h/w implementation.

Reference: Novell bnc#480753
	https://bugzilla.novell.com/show_bug.cgi?id=480753Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 82ad39f9
...@@ -262,6 +262,7 @@ Conexant 5051 ...@@ -262,6 +262,7 @@ Conexant 5051
============= =============
laptop Basic Laptop config (default) laptop Basic Laptop config (default)
hp HP Spartan laptop hp HP Spartan laptop
hp-dv6736 HP dv6736
lenovo-x200 Lenovo X200 laptop lenovo-x200 Lenovo X200 laptop
STAC9200 STAC9200
......
...@@ -72,6 +72,7 @@ struct conexant_spec { ...@@ -72,6 +72,7 @@ struct conexant_spec {
*/ */
unsigned int cur_eapd; unsigned int cur_eapd;
unsigned int hp_present; unsigned int hp_present;
unsigned int no_auto_mic;
unsigned int need_dac_fix; unsigned int need_dac_fix;
/* capture */ /* capture */
...@@ -1665,8 +1666,11 @@ static int cxt5051_hp_master_sw_put(struct snd_kcontrol *kcontrol, ...@@ -1665,8 +1666,11 @@ static int cxt5051_hp_master_sw_put(struct snd_kcontrol *kcontrol,
/* toggle input of built-in and mic jack appropriately */ /* toggle input of built-in and mic jack appropriately */
static void cxt5051_portb_automic(struct hda_codec *codec) static void cxt5051_portb_automic(struct hda_codec *codec)
{ {
struct conexant_spec *spec = codec->spec;
unsigned int present; unsigned int present;
if (spec->no_auto_mic)
return;
present = snd_hda_codec_read(codec, 0x17, 0, present = snd_hda_codec_read(codec, 0x17, 0,
AC_VERB_GET_PIN_SENSE, 0) & AC_VERB_GET_PIN_SENSE, 0) &
AC_PINSENSE_PRESENCE; AC_PINSENSE_PRESENCE;
...@@ -1682,6 +1686,8 @@ static void cxt5051_portc_automic(struct hda_codec *codec) ...@@ -1682,6 +1686,8 @@ static void cxt5051_portc_automic(struct hda_codec *codec)
unsigned int present; unsigned int present;
hda_nid_t new_adc; hda_nid_t new_adc;
if (spec->no_auto_mic)
return;
present = snd_hda_codec_read(codec, 0x18, 0, present = snd_hda_codec_read(codec, 0x18, 0,
AC_VERB_GET_PIN_SENSE, 0) & AC_VERB_GET_PIN_SENSE, 0) &
AC_PINSENSE_PRESENCE; AC_PINSENSE_PRESENCE;
...@@ -1768,6 +1774,22 @@ static struct snd_kcontrol_new cxt5051_hp_mixers[] = { ...@@ -1768,6 +1774,22 @@ static struct snd_kcontrol_new cxt5051_hp_mixers[] = {
{} {}
}; };
static struct snd_kcontrol_new cxt5051_hp_dv6736_mixers[] = {
HDA_CODEC_VOLUME("Mic Volume", 0x14, 0x00, HDA_INPUT),
HDA_CODEC_MUTE("Mic Switch", 0x14, 0x00, HDA_INPUT),
HDA_CODEC_VOLUME("Master Playback Volume", 0x10, 0x00, HDA_OUTPUT),
{
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "Master Playback Switch",
.info = cxt_eapd_info,
.get = cxt_eapd_get,
.put = cxt5051_hp_master_sw_put,
.private_value = 0x1a,
},
{}
};
static struct hda_verb cxt5051_init_verbs[] = { static struct hda_verb cxt5051_init_verbs[] = {
/* Line in, Mic */ /* Line in, Mic */
{0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) | 0x03}, {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) | 0x03},
...@@ -1798,6 +1820,32 @@ static struct hda_verb cxt5051_init_verbs[] = { ...@@ -1798,6 +1820,32 @@ static struct hda_verb cxt5051_init_verbs[] = {
{ } /* end */ { } /* end */
}; };
static struct hda_verb cxt5051_hp_dv6736_init_verbs[] = {
/* Line in, Mic */
{0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) | 0x03},
{0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
{0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0},
{0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x0},
/* SPK */
{0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
{0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
/* HP, Amp */
{0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
{0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
/* DAC1 */
{0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
/* Record selector: Int mic */
{0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1) | 0x44},
{0x14, AC_VERB_SET_CONNECT_SEL, 0x1},
/* SPDIF route: PCM */
{0x1c, AC_VERB_SET_CONNECT_SEL, 0x0},
/* EAPD */
{0x1a, AC_VERB_SET_EAPD_BTLENABLE, 0x2}, /* default on */
{0x16, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|CONEXANT_HP_EVENT},
{0x17, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|CXT5051_PORTB_EVENT},
{ } /* end */
};
static struct hda_verb cxt5051_lenovo_x200_init_verbs[] = { static struct hda_verb cxt5051_lenovo_x200_init_verbs[] = {
/* Line in, Mic */ /* Line in, Mic */
{0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) | 0x03}, {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) | 0x03},
...@@ -1849,6 +1897,7 @@ static int cxt5051_init(struct hda_codec *codec) ...@@ -1849,6 +1897,7 @@ static int cxt5051_init(struct hda_codec *codec)
enum { enum {
CXT5051_LAPTOP, /* Laptops w/ EAPD support */ CXT5051_LAPTOP, /* Laptops w/ EAPD support */
CXT5051_HP, /* no docking */ CXT5051_HP, /* no docking */
CXT5051_HP_DV6736, /* HP without mic switch */
CXT5051_LENOVO_X200, /* Lenovo X200 laptop */ CXT5051_LENOVO_X200, /* Lenovo X200 laptop */
CXT5051_MODELS CXT5051_MODELS
}; };
...@@ -1856,10 +1905,12 @@ enum { ...@@ -1856,10 +1905,12 @@ enum {
static const char *cxt5051_models[CXT5051_MODELS] = { static const char *cxt5051_models[CXT5051_MODELS] = {
[CXT5051_LAPTOP] = "laptop", [CXT5051_LAPTOP] = "laptop",
[CXT5051_HP] = "hp", [CXT5051_HP] = "hp",
[CXT5051_HP_DV6736] = "hp-dv6736",
[CXT5051_LENOVO_X200] = "lenovo-x200", [CXT5051_LENOVO_X200] = "lenovo-x200",
}; };
static struct snd_pci_quirk cxt5051_cfg_tbl[] = { static struct snd_pci_quirk cxt5051_cfg_tbl[] = {
SND_PCI_QUIRK(0x103c, 0x30cf, "HP DV6736", CXT5051_HP_DV6736),
SND_PCI_QUIRK(0x14f1, 0x0101, "Conexant Reference board", SND_PCI_QUIRK(0x14f1, 0x0101, "Conexant Reference board",
CXT5051_LAPTOP), CXT5051_LAPTOP),
SND_PCI_QUIRK(0x14f1, 0x5051, "HP Spartan 1.1", CXT5051_HP), SND_PCI_QUIRK(0x14f1, 0x5051, "HP Spartan 1.1", CXT5051_HP),
...@@ -1896,20 +1947,22 @@ static int patch_cxt5051(struct hda_codec *codec) ...@@ -1896,20 +1947,22 @@ static int patch_cxt5051(struct hda_codec *codec)
spec->cur_adc = 0; spec->cur_adc = 0;
spec->cur_adc_idx = 0; spec->cur_adc_idx = 0;
codec->patch_ops.unsol_event = cxt5051_hp_unsol_event;
board_config = snd_hda_check_board_config(codec, CXT5051_MODELS, board_config = snd_hda_check_board_config(codec, CXT5051_MODELS,
cxt5051_models, cxt5051_models,
cxt5051_cfg_tbl); cxt5051_cfg_tbl);
switch (board_config) { switch (board_config) {
case CXT5051_HP: case CXT5051_HP:
codec->patch_ops.unsol_event = cxt5051_hp_unsol_event;
spec->mixers[0] = cxt5051_hp_mixers; spec->mixers[0] = cxt5051_hp_mixers;
break; break;
case CXT5051_HP_DV6736:
spec->init_verbs[0] = cxt5051_hp_dv6736_init_verbs;
spec->mixers[0] = cxt5051_hp_dv6736_mixers;
spec->no_auto_mic = 1;
break;
case CXT5051_LENOVO_X200: case CXT5051_LENOVO_X200:
spec->init_verbs[0] = cxt5051_lenovo_x200_init_verbs; spec->init_verbs[0] = cxt5051_lenovo_x200_init_verbs;
/* fallthru */
default:
case CXT5051_LAPTOP:
codec->patch_ops.unsol_event = cxt5051_hp_unsol_event;
break; break;
} }
......
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