aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2010-07-08 12:39:00 -0400
committerTakashi Iwai <tiwai@suse.de>2010-07-09 04:08:56 -0400
commit3507e2a8f171f4322bf78f9d618a4e435de843ce (patch)
treedcd08b3cfba0b37064c57183caa80c88bbc7d9f3
parentd4a86d81944d3cccb3f4a309230e835823a61252 (diff)
ALSA: hda - Add beep mixer support to Conexant codecs
Added the beep mixer controls to Conexant codecs. They simply control the digital beep generator widget. For cx5047, I couldn't find any beep generator, so it's not implemented there. Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--sound/pci/hda/patch_conexant.c55
1 files changed, 51 insertions, 4 deletions
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
index 54f74191ebca..3b789ee548b4 100644
--- a/sound/pci/hda/patch_conexant.c
+++ b/sound/pci/hda/patch_conexant.c
@@ -131,6 +131,8 @@ struct conexant_spec {
131 unsigned int dc_enable; 131 unsigned int dc_enable;
132 unsigned int dc_input_bias; /* offset into cxt5066_olpc_dc_bias */ 132 unsigned int dc_input_bias; /* offset into cxt5066_olpc_dc_bias */
133 unsigned int mic_boost; /* offset into cxt5066_analog_mic_boost */ 133 unsigned int mic_boost; /* offset into cxt5066_analog_mic_boost */
134
135 unsigned int beep_amp;
134}; 136};
135 137
136static int conexant_playback_pcm_open(struct hda_pcm_stream *hinfo, 138static int conexant_playback_pcm_open(struct hda_pcm_stream *hinfo,
@@ -515,6 +517,15 @@ static struct snd_kcontrol_new cxt_capture_mixers[] = {
515 {} 517 {}
516}; 518};
517 519
520#ifdef CONFIG_SND_HDA_INPUT_BEEP
521/* additional beep mixers; the actual parameters are overwritten at build */
522static struct snd_kcontrol_new cxt_beep_mixer[] = {
523 HDA_CODEC_VOLUME_MONO("Beep Playback Volume", 0, 1, 0, HDA_OUTPUT),
524 HDA_CODEC_MUTE_BEEP_MONO("Beep Playback Switch", 0, 1, 0, HDA_OUTPUT),
525 { } /* end */
526};
527#endif
528
518static const char *slave_vols[] = { 529static const char *slave_vols[] = {
519 "Headphone Playback Volume", 530 "Headphone Playback Volume",
520 "Speaker Playback Volume", 531 "Speaker Playback Volume",
@@ -580,6 +591,23 @@ static int conexant_build_controls(struct hda_codec *codec)
580 return err; 591 return err;
581 } 592 }
582 593
594#ifdef CONFIG_SND_HDA_INPUT_BEEP
595 /* create beep controls if needed */
596 if (spec->beep_amp) {
597 struct snd_kcontrol_new *knew;
598 for (knew = cxt_beep_mixer; knew->name; knew++) {
599 struct snd_kcontrol *kctl;
600 kctl = snd_ctl_new1(knew, codec);
601 if (!kctl)
602 return -ENOMEM;
603 kctl->private_value = spec->beep_amp;
604 err = snd_hda_ctl_add(codec, 0, kctl);
605 if (err < 0)
606 return err;
607 }
608 }
609#endif
610
583 return 0; 611 return 0;
584} 612}
585 613
@@ -590,6 +618,13 @@ static struct hda_codec_ops conexant_patch_ops = {
590 .free = conexant_free, 618 .free = conexant_free,
591}; 619};
592 620
621#ifdef CONFIG_SND_HDA_INPUT_BEEP
622#define set_beep_amp(spec, nid, idx, dir) \
623 ((spec)->beep_amp = HDA_COMPOSE_AMP_VAL(nid, 1, idx, dir))
624#else
625#define set_beep_amp(spec, nid, idx, dir) /* NOP */
626#endif
627
593/* 628/*
594 * EAPD control 629 * EAPD control
595 * the private value = nid | (invert << 8) 630 * the private value = nid | (invert << 8)
@@ -1130,9 +1165,10 @@ static int patch_cxt5045(struct hda_codec *codec)
1130 spec->num_init_verbs = 1; 1165 spec->num_init_verbs = 1;
1131 spec->init_verbs[0] = cxt5045_init_verbs; 1166 spec->init_verbs[0] = cxt5045_init_verbs;
1132 spec->spdif_route = 0; 1167 spec->spdif_route = 0;
1133 spec->num_channel_mode = ARRAY_SIZE(cxt5045_modes), 1168 spec->num_channel_mode = ARRAY_SIZE(cxt5045_modes);
1134 spec->channel_mode = cxt5045_modes, 1169 spec->channel_mode = cxt5045_modes;
1135 1170
1171 set_beep_amp(spec, 0x16, 0, 1);
1136 1172
1137 codec->patch_ops = conexant_patch_ops; 1173 codec->patch_ops = conexant_patch_ops;
1138 1174
@@ -1211,6 +1247,9 @@ static int patch_cxt5045(struct hda_codec *codec)
1211 break; 1247 break;
1212 } 1248 }
1213 1249
1250 if (spec->beep_amp)
1251 snd_hda_attach_beep_device(codec, spec->beep_amp);
1252
1214 return 0; 1253 return 0;
1215} 1254}
1216 1255
@@ -1987,6 +2026,8 @@ static int patch_cxt5051(struct hda_codec *codec)
1987 spec->cur_adc = 0; 2026 spec->cur_adc = 0;
1988 spec->cur_adc_idx = 0; 2027 spec->cur_adc_idx = 0;
1989 2028
2029 set_beep_amp(spec, 0x13, 0, HDA_OUTPUT);
2030
1990 codec->patch_ops.unsol_event = cxt5051_hp_unsol_event; 2031 codec->patch_ops.unsol_event = cxt5051_hp_unsol_event;
1991 2032
1992 board_config = snd_hda_check_board_config(codec, CXT5051_MODELS, 2033 board_config = snd_hda_check_board_config(codec, CXT5051_MODELS,
@@ -2021,6 +2062,9 @@ static int patch_cxt5051(struct hda_codec *codec)
2021 break; 2062 break;
2022 } 2063 }
2023 2064
2065 if (spec->beep_amp)
2066 snd_hda_attach_beep_device(codec, spec->beep_amp);
2067
2024 return 0; 2068 return 0;
2025} 2069}
2026 2070
@@ -2636,7 +2680,6 @@ static struct snd_kcontrol_new cxt5066_vostro_mixers[] = {
2636 .put = cxt5066_mic_boost_mux_enum_put, 2680 .put = cxt5066_mic_boost_mux_enum_put,
2637 .private_value = 0x23 | 0x100, 2681 .private_value = 0x23 | 0x100,
2638 }, 2682 },
2639 HDA_CODEC_VOLUME_MONO("Beep Playback Volume", 0x13, 1, 0x0, HDA_OUTPUT),
2640 {} 2683 {}
2641}; 2684};
2642 2685
@@ -3034,6 +3077,8 @@ static int patch_cxt5066(struct hda_codec *codec)
3034 spec->cur_adc = 0; 3077 spec->cur_adc = 0;
3035 spec->cur_adc_idx = 0; 3078 spec->cur_adc_idx = 0;
3036 3079
3080 set_beep_amp(spec, 0x13, 0, HDA_OUTPUT);
3081
3037 board_config = snd_hda_check_board_config(codec, CXT5066_MODELS, 3082 board_config = snd_hda_check_board_config(codec, CXT5066_MODELS,
3038 cxt5066_models, cxt5066_cfg_tbl); 3083 cxt5066_models, cxt5066_cfg_tbl);
3039 switch (board_config) { 3084 switch (board_config) {
@@ -3082,7 +3127,6 @@ static int patch_cxt5066(struct hda_codec *codec)
3082 spec->port_d_mode = 0; 3127 spec->port_d_mode = 0;
3083 spec->dell_vostro = 1; 3128 spec->dell_vostro = 1;
3084 spec->mic_boost = 3; /* default 30dB gain */ 3129 spec->mic_boost = 3; /* default 30dB gain */
3085 snd_hda_attach_beep_device(codec, 0x13);
3086 3130
3087 /* no S/PDIF out */ 3131 /* no S/PDIF out */
3088 spec->multiout.dig_out_nid = 0; 3132 spec->multiout.dig_out_nid = 0;
@@ -3124,6 +3168,9 @@ static int patch_cxt5066(struct hda_codec *codec)
3124 break; 3168 break;
3125 } 3169 }
3126 3170
3171 if (spec->beep_amp)
3172 snd_hda_attach_beep_device(codec, spec->beep_amp);
3173
3127 return 0; 3174 return 0;
3128} 3175}
3129 3176