提交 bb9f76cd 编写于 作者: T Takashi Iwai

[ALSA] hda-codec - Improve ALC262 ultra model

Improved ALC262 ultra model for Samsung Q1 Ultra series.

- clean up mixers
- support of input from HP jack as a mic
- add quirk for Q1 EL
Signed-off-by: NTakashi Iwai <tiwai@suse.de>
上级 9f2f0f7c
...@@ -8870,59 +8870,72 @@ static struct hda_verb alc262_benq_t31_EAPD_verbs[] = { ...@@ -8870,59 +8870,72 @@ static struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
/* Samsung Q1 Ultra Vista model setup */ /* Samsung Q1 Ultra Vista model setup */
static struct snd_kcontrol_new alc262_ultra_mixer[] = { static struct snd_kcontrol_new alc262_ultra_mixer[] = {
HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT), HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT), HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT), HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT), HDA_CODEC_VOLUME("Mic Boost", 0x19, 0, HDA_INPUT),
HDA_CODEC_VOLUME("Headphone Mic Boost", 0x15, 0, HDA_INPUT),
{ } /* end */ { } /* end */
}; };
static struct hda_verb alc262_ultra_verbs[] = { static struct hda_verb alc262_ultra_verbs[] = {
{0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, /* output mixer */
{0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
{0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
{0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
/* speaker */
{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
{0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
{0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
{0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
/* HP */
{0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
{0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
/* Mic is on Node 0x19 */ {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
{0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
{0x22, AC_VERB_SET_CONNECT_SEL, 0x01}, {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
{0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, /* internal mic */
{0x23, AC_VERB_SET_CONNECT_SEL, 0x01}, {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
{0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
{0x24, AC_VERB_SET_CONNECT_SEL, 0x01}, /* ADC, choose mic */
{0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))}, {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
{0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
{0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
{0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
{0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
{0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
{0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
{0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
{0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
{0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
{} {}
}; };
static struct hda_input_mux alc262_ultra_capture_source = {
.num_items = 1,
.items = {
{ "Mic", 0x1 },
},
};
/* mute/unmute internal speaker according to the hp jack and mute state */ /* mute/unmute internal speaker according to the hp jack and mute state */
static void alc262_ultra_automute(struct hda_codec *codec) static void alc262_ultra_automute(struct hda_codec *codec)
{ {
struct alc_spec *spec = codec->spec; struct alc_spec *spec = codec->spec;
unsigned int mute; unsigned int mute;
unsigned int present;
/* need to execute and sync at first */ mute = 0;
snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0); /* auto-mute only when HP is used as HP */
present = snd_hda_codec_read(codec, 0x15, 0, if (!spec->cur_mux[0]) {
AC_VERB_GET_PIN_SENSE, 0); unsigned int present;
spec->jack_present = (present & 0x80000000) != 0; /* need to execute and sync at first */
if (spec->jack_present) { snd_hda_codec_read(codec, 0x15, 0, AC_VERB_SET_PIN_SENSE, 0);
/* mute internal speaker */ present = snd_hda_codec_read(codec, 0x15, 0,
snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, AC_VERB_GET_PIN_SENSE, 0);
HDA_AMP_MUTE, HDA_AMP_MUTE); spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
} else { if (spec->jack_present)
/* unmute internal speaker if necessary */ mute = HDA_AMP_MUTE;
mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
HDA_AMP_MUTE, mute);
} }
/* mute/unmute internal speaker */
snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
HDA_AMP_MUTE, mute);
/* mute/unmute HP */
snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
} }
/* unsolicited event for HP jack sensing */ /* unsolicited event for HP jack sensing */
...@@ -8934,6 +8947,45 @@ static void alc262_ultra_unsol_event(struct hda_codec *codec, ...@@ -8934,6 +8947,45 @@ static void alc262_ultra_unsol_event(struct hda_codec *codec,
alc262_ultra_automute(codec); alc262_ultra_automute(codec);
} }
static struct hda_input_mux alc262_ultra_capture_source = {
.num_items = 2,
.items = {
{ "Mic", 0x1 },
{ "Headphone", 0x7 },
},
};
static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
struct alc_spec *spec = codec->spec;
int ret;
ret = alc882_mux_enum_put(kcontrol, ucontrol);
if (!ret)
return 0;
/* reprogram the HP pin as mic or HP according to the input source */
snd_hda_codec_write_cache(codec, 0x15, 0,
AC_VERB_SET_PIN_WIDGET_CONTROL,
spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
alc262_ultra_automute(codec); /* mute/unmute HP */
return ret;
}
static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
{
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "Capture Source",
.info = alc882_mux_enum_info,
.get = alc882_mux_enum_get,
.put = alc262_ultra_mux_enum_put,
},
{ } /* end */
};
/* add playback controls from the parsed DAC table */ /* add playback controls from the parsed DAC table */
static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
const struct auto_pin_cfg *cfg) const struct auto_pin_cfg *cfg)
...@@ -9384,6 +9436,7 @@ static struct snd_pci_quirk alc262_cfg_tbl[] = { ...@@ -9384,6 +9436,7 @@ static struct snd_pci_quirk alc262_cfg_tbl[] = {
SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU), SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU), SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA), SND_PCI_QUIRK(0x144d, 0xc032, "Samsung Q1 Ultra", ALC262_ULTRA),
SND_PCI_QUIRK(0x144d, 0xc039, "Samsung Q1U EL", ALC262_ULTRA),
SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8), SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31), SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1), SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
...@@ -9533,15 +9586,16 @@ static struct alc_config_preset alc262_presets[] = { ...@@ -9533,15 +9586,16 @@ static struct alc_config_preset alc262_presets[] = {
.init_hook = alc262_hippo_automute, .init_hook = alc262_hippo_automute,
}, },
[ALC262_ULTRA] = { [ALC262_ULTRA] = {
.mixers = { alc262_ultra_mixer }, .mixers = { alc262_ultra_mixer, alc262_ultra_capture_mixer },
.init_verbs = { alc262_init_verbs, alc262_ultra_verbs }, .init_verbs = { alc262_ultra_verbs },
.num_dacs = ARRAY_SIZE(alc262_dac_nids), .num_dacs = ARRAY_SIZE(alc262_dac_nids),
.dac_nids = alc262_dac_nids, .dac_nids = alc262_dac_nids,
.hp_nid = 0x03,
.dig_out_nid = ALC262_DIGOUT_NID,
.num_channel_mode = ARRAY_SIZE(alc262_modes), .num_channel_mode = ARRAY_SIZE(alc262_modes),
.channel_mode = alc262_modes, .channel_mode = alc262_modes,
.input_mux = &alc262_ultra_capture_source, .input_mux = &alc262_ultra_capture_source,
.adc_nids = alc262_adc_nids, /* ADC0 */
.capsrc_nids = alc262_capsrc_nids,
.num_adc_nids = 1, /* single ADC */
.unsol_event = alc262_ultra_unsol_event, .unsol_event = alc262_ultra_unsol_event,
.init_hook = alc262_ultra_automute, .init_hook = alc262_ultra_automute,
}, },
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册