aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/patch_realtek.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/hda/patch_realtek.c')
-rw-r--r--sound/pci/hda/patch_realtek.c53
1 files changed, 45 insertions, 8 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 62e1bd882a57..6c8423dbace1 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -9507,6 +9507,22 @@ static struct snd_kcontrol_new alc268_base_mixer[] = {
9507 { } 9507 { }
9508}; 9508};
9509 9509
9510/* bind Beep switches of both NID 0x0f and 0x10 */
9511static struct hda_bind_ctls alc268_bind_beep_sw = {
9512 .ops = &snd_hda_bind_sw,
9513 .values = {
9514 HDA_COMPOSE_AMP_VAL(0x0f, 3, 1, HDA_INPUT),
9515 HDA_COMPOSE_AMP_VAL(0x10, 3, 1, HDA_INPUT),
9516 0
9517 },
9518};
9519
9520static struct snd_kcontrol_new alc268_beep_mixer[] = {
9521 HDA_CODEC_VOLUME("Beep Playback Volume", 0x1d, 0x0, HDA_INPUT),
9522 HDA_BIND_SW("Beep Playback Switch", &alc268_bind_beep_sw),
9523 { }
9524};
9525
9510static struct hda_verb alc268_eapd_verbs[] = { 9526static struct hda_verb alc268_eapd_verbs[] = {
9511 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, 9527 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
9512 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2}, 9528 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
@@ -9703,7 +9719,11 @@ static struct hda_verb alc268_base_init_verbs[] = {
9703 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 9719 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9704 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 9720 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9705 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 9721 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9706 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, 9722
9723 /* set PCBEEP vol = 0, mute connections */
9724 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9725 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9726 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9707 9727
9708 /* Unmute Selector 23h,24h and set the default input to mic-in */ 9728 /* Unmute Selector 23h,24h and set the default input to mic-in */
9709 9729
@@ -9742,8 +9762,10 @@ static struct hda_verb alc268_volume_init_verbs[] = {
9742 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 9762 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9743 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, 9763 {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
9744 9764
9745 /* set PCBEEP vol = 0 */ 9765 /* set PCBEEP vol = 0, mute connections */
9746 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, (0xb000 | (0x00 << 8))}, 9766 {0x1d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
9767 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9768 {0x10, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
9747 9769
9748 { } 9770 { }
9749}; 9771};
@@ -10032,6 +10054,9 @@ static int alc268_parse_auto_config(struct hda_codec *codec)
10032 if (spec->kctl_alloc) 10054 if (spec->kctl_alloc)
10033 spec->mixers[spec->num_mixers++] = spec->kctl_alloc; 10055 spec->mixers[spec->num_mixers++] = spec->kctl_alloc;
10034 10056
10057 if (spec->autocfg.speaker_pins[0] != 0x1d)
10058 spec->mixers[spec->num_mixers++] = alc268_beep_mixer;
10059
10035 spec->init_verbs[spec->num_init_verbs++] = alc268_volume_init_verbs; 10060 spec->init_verbs[spec->num_init_verbs++] = alc268_volume_init_verbs;
10036 spec->num_mux_defs = 1; 10061 spec->num_mux_defs = 1;
10037 spec->input_mux = &spec->private_imux; 10062 spec->input_mux = &spec->private_imux;
@@ -10091,7 +10116,8 @@ static struct snd_pci_quirk alc268_cfg_tbl[] = {
10091 10116
10092static struct alc_config_preset alc268_presets[] = { 10117static struct alc_config_preset alc268_presets[] = {
10093 [ALC268_3ST] = { 10118 [ALC268_3ST] = {
10094 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer }, 10119 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
10120 alc268_beep_mixer },
10095 .init_verbs = { alc268_base_init_verbs }, 10121 .init_verbs = { alc268_base_init_verbs },
10096 .num_dacs = ARRAY_SIZE(alc268_dac_nids), 10122 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
10097 .dac_nids = alc268_dac_nids, 10123 .dac_nids = alc268_dac_nids,
@@ -10105,7 +10131,8 @@ static struct alc_config_preset alc268_presets[] = {
10105 .input_mux = &alc268_capture_source, 10131 .input_mux = &alc268_capture_source,
10106 }, 10132 },
10107 [ALC268_TOSHIBA] = { 10133 [ALC268_TOSHIBA] = {
10108 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer }, 10134 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
10135 alc268_beep_mixer },
10109 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, 10136 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
10110 alc268_toshiba_verbs }, 10137 alc268_toshiba_verbs },
10111 .num_dacs = ARRAY_SIZE(alc268_dac_nids), 10138 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
@@ -10121,7 +10148,8 @@ static struct alc_config_preset alc268_presets[] = {
10121 .init_hook = alc268_toshiba_automute, 10148 .init_hook = alc268_toshiba_automute,
10122 }, 10149 },
10123 [ALC268_ACER] = { 10150 [ALC268_ACER] = {
10124 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer }, 10151 .mixers = { alc268_acer_mixer, alc268_capture_alt_mixer,
10152 alc268_beep_mixer },
10125 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, 10153 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
10126 alc268_acer_verbs }, 10154 alc268_acer_verbs },
10127 .num_dacs = ARRAY_SIZE(alc268_dac_nids), 10155 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
@@ -10137,7 +10165,7 @@ static struct alc_config_preset alc268_presets[] = {
10137 .init_hook = alc268_acer_init_hook, 10165 .init_hook = alc268_acer_init_hook,
10138 }, 10166 },
10139 [ALC268_DELL] = { 10167 [ALC268_DELL] = {
10140 .mixers = { alc268_dell_mixer }, 10168 .mixers = { alc268_dell_mixer, alc268_beep_mixer },
10141 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, 10169 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
10142 alc268_dell_verbs }, 10170 alc268_dell_verbs },
10143 .num_dacs = ARRAY_SIZE(alc268_dac_nids), 10171 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
@@ -10150,7 +10178,8 @@ static struct alc_config_preset alc268_presets[] = {
10150 .input_mux = &alc268_capture_source, 10178 .input_mux = &alc268_capture_source,
10151 }, 10179 },
10152 [ALC268_ZEPTO] = { 10180 [ALC268_ZEPTO] = {
10153 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer }, 10181 .mixers = { alc268_base_mixer, alc268_capture_alt_mixer,
10182 alc268_beep_mixer },
10154 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs, 10183 .init_verbs = { alc268_base_init_verbs, alc268_eapd_verbs,
10155 alc268_toshiba_verbs }, 10184 alc268_toshiba_verbs },
10156 .num_dacs = ARRAY_SIZE(alc268_dac_nids), 10185 .num_dacs = ARRAY_SIZE(alc268_dac_nids),
@@ -10232,6 +10261,14 @@ static int patch_alc268(struct hda_codec *codec)
10232 spec->stream_name_digital = "ALC268 Digital"; 10261 spec->stream_name_digital = "ALC268 Digital";
10233 spec->stream_digital_playback = &alc268_pcm_digital_playback; 10262 spec->stream_digital_playback = &alc268_pcm_digital_playback;
10234 10263
10264 if (!query_amp_caps(codec, 0x1d, HDA_INPUT))
10265 /* override the amp caps for beep generator */
10266 snd_hda_override_amp_caps(codec, 0x1d, HDA_INPUT,
10267 (0x0c << AC_AMPCAP_OFFSET_SHIFT) |
10268 (0x0c << AC_AMPCAP_NUM_STEPS_SHIFT) |
10269 (0x07 << AC_AMPCAP_STEP_SIZE_SHIFT) |
10270 (0 << AC_AMPCAP_MUTE_SHIFT));
10271
10235 if (!spec->adc_nids && spec->input_mux) { 10272 if (!spec->adc_nids && spec->input_mux) {
10236 /* check whether NID 0x07 is valid */ 10273 /* check whether NID 0x07 is valid */
10237 unsigned int wcap = get_wcaps(codec, 0x07); 10274 unsigned int wcap = get_wcaps(codec, 0x07);