Commit 4b33c767 authored by Matthew Ranostay's avatar Matthew Ranostay Committed by Takashi Iwai

ALSA: hda: add mixers for analog mixer on 92hd75xx codecs

Add support for mixers on the analog mixer on some 92hd75xx codecs,
along with adding a 'Mixer' entry for it's connection on the dmux.
Signed-off-by: default avatarMatthew Ranostay <mranostay@embeddedalley.com>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 72474be6
...@@ -322,8 +322,8 @@ static hda_nid_t stac92hd71bxx_mux_nids[2] = { ...@@ -322,8 +322,8 @@ static hda_nid_t stac92hd71bxx_mux_nids[2] = {
0x1a, 0x1b 0x1a, 0x1b
}; };
static hda_nid_t stac92hd71bxx_dmux_nids[1] = { static hda_nid_t stac92hd71bxx_dmux_nids[2] = {
0x1c, 0x1c, 0x1d,
}; };
static hda_nid_t stac92hd71bxx_smux_nids[2] = { static hda_nid_t stac92hd71bxx_smux_nids[2] = {
...@@ -861,20 +861,18 @@ static struct hda_verb stac92hd71bxx_core_init[] = { ...@@ -861,20 +861,18 @@ static struct hda_verb stac92hd71bxx_core_init[] = {
{ 0x28, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, { 0x28, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
/* connect headphone jack to dac1 */ /* connect headphone jack to dac1 */
{ 0x0a, AC_VERB_SET_CONNECT_SEL, 0x01}, { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x01},
{ 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Speaker */
/* unmute right and left channels for nodes 0x0a, 0xd, 0x0f */ /* unmute right and left channels for nodes 0x0a, 0xd, 0x0f */
{ 0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, { 0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
{ 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
{ 0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, { 0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
}; };
#define HD_DISABLE_PORTF 3 #define HD_DISABLE_PORTF 2
static struct hda_verb stac92hd71bxx_analog_core_init[] = { static struct hda_verb stac92hd71bxx_analog_core_init[] = {
/* start of config #1 */ /* start of config #1 */
/* connect port 0f to audio mixer */ /* connect port 0f to audio mixer */
{ 0x0f, AC_VERB_SET_CONNECT_SEL, 0x2}, { 0x0f, AC_VERB_SET_CONNECT_SEL, 0x2},
{ 0x0f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* Speaker */
/* unmute right and left channels for node 0x0f */ /* unmute right and left channels for node 0x0f */
{ 0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, { 0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
/* start of config #2 */ /* start of config #2 */
...@@ -883,10 +881,6 @@ static struct hda_verb stac92hd71bxx_analog_core_init[] = { ...@@ -883,10 +881,6 @@ static struct hda_verb stac92hd71bxx_analog_core_init[] = {
{ 0x28, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff}, { 0x28, AC_VERB_SET_VOLUME_KNOB_CONTROL, 0xff},
/* connect headphone jack to dac1 */ /* connect headphone jack to dac1 */
{ 0x0a, AC_VERB_SET_CONNECT_SEL, 0x01}, { 0x0a, AC_VERB_SET_CONNECT_SEL, 0x01},
/* connect port 0d to audio mixer */
{ 0x0d, AC_VERB_SET_CONNECT_SEL, 0x2},
/* unmute dac0 input in audio mixer */
{ 0x17, AC_VERB_SET_AMP_GAIN_MUTE, 0x701f},
/* unmute right and left channels for nodes 0x0a, 0xd */ /* unmute right and left channels for nodes 0x0a, 0xd */
{ 0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, { 0x0a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
{ 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, { 0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
...@@ -1107,6 +1101,7 @@ static struct snd_kcontrol_new stac92hd83xxx_mixer[] = { ...@@ -1107,6 +1101,7 @@ static struct snd_kcontrol_new stac92hd83xxx_mixer[] = {
static struct snd_kcontrol_new stac92hd71bxx_analog_mixer[] = { static struct snd_kcontrol_new stac92hd71bxx_analog_mixer[] = {
STAC_INPUT_SOURCE(2), STAC_INPUT_SOURCE(2),
STAC_ANALOG_LOOPBACK(0xFA0, 0x7A0, 2),
HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1c, 0x0, HDA_OUTPUT), HDA_CODEC_VOLUME_IDX("Capture Volume", 0x0, 0x1c, 0x0, HDA_OUTPUT),
HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1c, 0x0, HDA_OUTPUT), HDA_CODEC_MUTE_IDX("Capture Switch", 0x0, 0x1c, 0x0, HDA_OUTPUT),
...@@ -1119,8 +1114,17 @@ static struct snd_kcontrol_new stac92hd71bxx_analog_mixer[] = { ...@@ -1119,8 +1114,17 @@ static struct snd_kcontrol_new stac92hd71bxx_analog_mixer[] = {
HDA_CODEC_MUTE("PC Beep Switch", 0x17, 0x2, HDA_INPUT), HDA_CODEC_MUTE("PC Beep Switch", 0x17, 0x2, HDA_INPUT),
*/ */
HDA_CODEC_MUTE("Analog Loopback 1", 0x17, 0x3, HDA_INPUT), HDA_CODEC_MUTE("Import0 Mux Capture Switch", 0x17, 0x3, HDA_INPUT),
HDA_CODEC_MUTE("Analog Loopback 2", 0x17, 0x4, HDA_INPUT), HDA_CODEC_VOLUME("Import0 Mux Capture Volume", 0x17, 0x3, HDA_INPUT),
HDA_CODEC_MUTE("Import1 Mux Capture Switch", 0x17, 0x3, HDA_INPUT),
HDA_CODEC_VOLUME("Import1 Mux Capture Volume", 0x17, 0x3, HDA_INPUT),
HDA_CODEC_MUTE("DAC0 Capture Switch", 0x17, 0x3, HDA_INPUT),
HDA_CODEC_VOLUME("DAC0 Capture Volume", 0x17, 0x3, HDA_INPUT),
HDA_CODEC_MUTE("DAC1 Capture Switch", 0x17, 0x4, HDA_INPUT),
HDA_CODEC_VOLUME("DAC1 Capture Volume", 0x17, 0x4, HDA_INPUT),
{ } /* end */ { } /* end */
}; };
...@@ -1649,7 +1653,7 @@ static struct snd_pci_quirk stac92hd83xxx_cfg_tbl[] = { ...@@ -1649,7 +1653,7 @@ static struct snd_pci_quirk stac92hd83xxx_cfg_tbl[] = {
static unsigned int ref92hd71bxx_pin_configs[11] = { static unsigned int ref92hd71bxx_pin_configs[11] = {
0x02214030, 0x02a19040, 0x01a19020, 0x01014010, 0x02214030, 0x02a19040, 0x01a19020, 0x01014010,
0x0181302e, 0x01114010, 0x01019020, 0x90a000f0, 0x0181302e, 0x01014010, 0x01019020, 0x90a000f0,
0x90a000f0, 0x01452050, 0x01452050, 0x90a000f0, 0x01452050, 0x01452050,
}; };
...@@ -3000,7 +3004,7 @@ static int stac92xx_auto_create_mono_output_ctls(struct hda_codec *codec) ...@@ -3000,7 +3004,7 @@ static int stac92xx_auto_create_mono_output_ctls(struct hda_codec *codec)
/* labels for amp mux outputs */ /* labels for amp mux outputs */
static const char *stac92xx_amp_labels[3] = { static const char *stac92xx_amp_labels[3] = {
"Front Microphone", "Microphone", "Line In" "Front Microphone", "Microphone", "Line In",
}; };
/* create amp out controls mux on capable codecs */ /* create amp out controls mux on capable codecs */
...@@ -4327,6 +4331,16 @@ static struct hda_codec_ops stac92hd71bxx_patch_ops = { ...@@ -4327,6 +4331,16 @@ static struct hda_codec_ops stac92hd71bxx_patch_ops = {
#endif #endif
}; };
static struct hda_input_mux stac92hd71bxx_dmux = {
.num_items = 4,
.items = {
{ "Analog Inputs", 0x00 },
{ "Mixer", 0x01 },
{ "Digital Mic 1", 0x02 },
{ "Digital Mic 2", 0x03 },
}
};
static int patch_stac92hd71bxx(struct hda_codec *codec) static int patch_stac92hd71bxx(struct hda_codec *codec)
{ {
struct sigmatel_spec *spec; struct sigmatel_spec *spec;
...@@ -4341,6 +4355,8 @@ static int patch_stac92hd71bxx(struct hda_codec *codec) ...@@ -4341,6 +4355,8 @@ static int patch_stac92hd71bxx(struct hda_codec *codec)
spec->num_pins = ARRAY_SIZE(stac92hd71bxx_pin_nids); spec->num_pins = ARRAY_SIZE(stac92hd71bxx_pin_nids);
spec->num_pwrs = ARRAY_SIZE(stac92hd71bxx_pwr_nids); spec->num_pwrs = ARRAY_SIZE(stac92hd71bxx_pwr_nids);
spec->pin_nids = stac92hd71bxx_pin_nids; spec->pin_nids = stac92hd71bxx_pin_nids;
memcpy(&spec->private_dimux, &stac92hd71bxx_dmux,
sizeof(stac92hd71bxx_dmux));
spec->board_config = snd_hda_check_board_config(codec, spec->board_config = snd_hda_check_board_config(codec,
STAC_92HD71BXX_MODELS, STAC_92HD71BXX_MODELS,
stac92hd71bxx_models, stac92hd71bxx_models,
...@@ -4392,6 +4408,7 @@ again: ...@@ -4392,6 +4408,7 @@ again:
/* no output amps */ /* no output amps */
spec->num_pwrs = 0; spec->num_pwrs = 0;
spec->mixer = stac92hd71bxx_analog_mixer; spec->mixer = stac92hd71bxx_analog_mixer;
spec->dinput_mux = &spec->private_dimux;
/* disable VSW */ /* disable VSW */
spec->init = &stac92hd71bxx_analog_core_init[HD_DISABLE_PORTF]; spec->init = &stac92hd71bxx_analog_core_init[HD_DISABLE_PORTF];
...@@ -4409,12 +4426,13 @@ again: ...@@ -4409,12 +4426,13 @@ again:
spec->num_pwrs = 0; spec->num_pwrs = 0;
/* fallthru */ /* fallthru */
default: default:
spec->dinput_mux = &spec->private_dimux;
spec->mixer = stac92hd71bxx_analog_mixer; spec->mixer = stac92hd71bxx_analog_mixer;
spec->init = stac92hd71bxx_analog_core_init; spec->init = stac92hd71bxx_analog_core_init;
codec->slave_dig_outs = stac92hd71bxx_slave_dig_outs; codec->slave_dig_outs = stac92hd71bxx_slave_dig_outs;
} }
spec->aloopback_mask = 0x20; spec->aloopback_mask = 0x50;
spec->aloopback_shift = 0; spec->aloopback_shift = 0;
if (spec->board_config > STAC_92HD71BXX_REF) { if (spec->board_config > STAC_92HD71BXX_REF) {
...@@ -4456,6 +4474,10 @@ again: ...@@ -4456,6 +4474,10 @@ again:
spec->multiout.num_dacs = 1; spec->multiout.num_dacs = 1;
spec->multiout.hp_nid = 0x11; spec->multiout.hp_nid = 0x11;
spec->multiout.dac_nids = stac92hd71bxx_dac_nids; spec->multiout.dac_nids = stac92hd71bxx_dac_nids;
if (spec->dinput_mux)
spec->private_dimux.num_items +=
spec->num_dmics -
(ARRAY_SIZE(stac92hd71bxx_dmic_nids) - 1);
err = stac92xx_parse_auto_config(codec, 0x21, 0x23); err = stac92xx_parse_auto_config(codec, 0x21, 0x23);
if (!err) { if (!err) {
......
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