aboutsummaryrefslogtreecommitdiffstats
path: root/sound/isa/sb/sb_mixer.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/isa/sb/sb_mixer.c')
-rw-r--r--sound/isa/sb/sb_mixer.c156
1 files changed, 118 insertions, 38 deletions
diff --git a/sound/isa/sb/sb_mixer.c b/sound/isa/sb/sb_mixer.c
index 406a431af91e..475220bbcc96 100644
--- a/sound/isa/sb/sb_mixer.c
+++ b/sound/isa/sb/sb_mixer.c
@@ -182,7 +182,7 @@ static int snd_sbmixer_put_double(struct snd_kcontrol *kcontrol, struct snd_ctl_
182 182
183static int snd_dt019x_input_sw_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) 183static int snd_dt019x_input_sw_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
184{ 184{
185 static char *texts[5] = { 185 static const char *texts[5] = {
186 "CD", "Mic", "Line", "Synth", "Master" 186 "CD", "Mic", "Line", "Synth", "Master"
187 }; 187 };
188 188
@@ -269,12 +269,73 @@ static int snd_dt019x_input_sw_put(struct snd_kcontrol *kcontrol, struct snd_ctl
269} 269}
270 270
271/* 271/*
272 * ALS4000 mono recording control switch
273 */
274
275static int snd_als4k_mono_capture_route_info(struct snd_kcontrol *kcontrol,
276 struct snd_ctl_elem_info *uinfo)
277{
278 static const char *texts[3] = {
279 "L chan only", "R chan only", "L ch/2 + R ch/2"
280 };
281
282 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
283 uinfo->count = 1;
284 uinfo->value.enumerated.items = 3;
285 if (uinfo->value.enumerated.item > 2)
286 uinfo->value.enumerated.item = 2;
287 strcpy(uinfo->value.enumerated.name,
288 texts[uinfo->value.enumerated.item]);
289 return 0;
290}
291
292static int snd_als4k_mono_capture_route_get(struct snd_kcontrol *kcontrol,
293 struct snd_ctl_elem_value *ucontrol)
294{
295 struct snd_sb *sb = snd_kcontrol_chip(kcontrol);
296 unsigned long flags;
297 unsigned char oval;
298
299 spin_lock_irqsave(&sb->mixer_lock, flags);
300 oval = snd_sbmixer_read(sb, SB_ALS4000_MONO_IO_CTRL);
301 spin_unlock_irqrestore(&sb->mixer_lock, flags);
302 oval >>= 6;
303 if (oval > 2)
304 oval = 2;
305
306 ucontrol->value.enumerated.item[0] = oval;
307 return 0;
308}
309
310static int snd_als4k_mono_capture_route_put(struct snd_kcontrol *kcontrol,
311 struct snd_ctl_elem_value *ucontrol)
312{
313 struct snd_sb *sb = snd_kcontrol_chip(kcontrol);
314 unsigned long flags;
315 int change;
316 unsigned char nval, oval;
317
318 if (ucontrol->value.enumerated.item[0] > 2)
319 return -EINVAL;
320 spin_lock_irqsave(&sb->mixer_lock, flags);
321 oval = snd_sbmixer_read(sb, SB_ALS4000_MONO_IO_CTRL);
322
323 nval = (oval & ~(3 << 6))
324 | (ucontrol->value.enumerated.item[0] << 6);
325 change = nval != oval;
326 if (change)
327 snd_sbmixer_write(sb, SB_ALS4000_MONO_IO_CTRL, nval);
328 spin_unlock_irqrestore(&sb->mixer_lock, flags);
329 return change;
330}
331
332/*
272 * SBPRO input multiplexer 333 * SBPRO input multiplexer
273 */ 334 */
274 335
275static int snd_sb8mixer_info_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) 336static int snd_sb8mixer_info_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
276{ 337{
277 static char *texts[3] = { 338 static const char *texts[3] = {
278 "Mic", "CD", "Line" 339 "Mic", "CD", "Line"
279 }; 340 };
280 341
@@ -442,6 +503,12 @@ int snd_sbmixer_add_ctl(struct snd_sb *chip, const char *name, int index, int ty
442 .get = snd_dt019x_input_sw_get, 503 .get = snd_dt019x_input_sw_get,
443 .put = snd_dt019x_input_sw_put, 504 .put = snd_dt019x_input_sw_put,
444 }, 505 },
506 [SB_MIX_MONO_CAPTURE_ALS4K] = {
507 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
508 .info = snd_als4k_mono_capture_route_info,
509 .get = snd_als4k_mono_capture_route_get,
510 .put = snd_als4k_mono_capture_route_put,
511 },
445 }; 512 };
446 struct snd_kcontrol *ctl; 513 struct snd_kcontrol *ctl;
447 int err; 514 int err;
@@ -636,6 +703,8 @@ static struct sbmix_elem snd_dt019x_ctl_capture_source =
636 }; 703 };
637 704
638static struct sbmix_elem *snd_dt019x_controls[] = { 705static struct sbmix_elem *snd_dt019x_controls[] = {
706 /* ALS4000 below has some parts which we might be lacking,
707 * e.g. snd_als4000_ctl_mono_playback_switch - check it! */
639 &snd_dt019x_ctl_master_play_vol, 708 &snd_dt019x_ctl_master_play_vol,
640 &snd_dt019x_ctl_pcm_play_vol, 709 &snd_dt019x_ctl_pcm_play_vol,
641 &snd_dt019x_ctl_synth_play_vol, 710 &snd_dt019x_ctl_synth_play_vol,
@@ -666,18 +735,21 @@ static unsigned char snd_dt019x_init_values[][2] = {
666/* 735/*
667 * ALS4000 specific mixer elements 736 * ALS4000 specific mixer elements
668 */ 737 */
669/* FIXME: SB_ALS4000_MONO_IO_CTRL needs output select ctrl! */
670static struct sbmix_elem snd_als4000_ctl_master_mono_playback_switch = 738static struct sbmix_elem snd_als4000_ctl_master_mono_playback_switch =
671 SB_SINGLE("Master Mono Playback Switch", SB_ALS4000_MONO_IO_CTRL, 5, 1); 739 SB_SINGLE("Master Mono Playback Switch", SB_ALS4000_MONO_IO_CTRL, 5, 1);
672static struct sbmix_elem snd_als4000_ctl_master_mono_capture_route = 740static struct sbmix_elem snd_als4k_ctl_master_mono_capture_route = {
673 SB_SINGLE("Master Mono Capture Route", SB_ALS4000_MONO_IO_CTRL, 6, 0x03); 741 .name = "Master Mono Capture Route",
674/* FIXME: mono playback switch also available on DT019X? */ 742 .type = SB_MIX_MONO_CAPTURE_ALS4K
743 };
675static struct sbmix_elem snd_als4000_ctl_mono_playback_switch = 744static struct sbmix_elem snd_als4000_ctl_mono_playback_switch =
676 SB_SINGLE("Mono Playback Switch", SB_DT019X_OUTPUT_SW2, 0, 1); 745 SB_SINGLE("Mono Playback Switch", SB_DT019X_OUTPUT_SW2, 0, 1);
677static struct sbmix_elem snd_als4000_ctl_mic_20db_boost = 746static struct sbmix_elem snd_als4000_ctl_mic_20db_boost =
678 SB_SINGLE("Mic Boost (+20dB)", SB_ALS4000_MIC_IN_GAIN, 0, 0x03); 747 SB_SINGLE("Mic Boost (+20dB)", SB_ALS4000_MIC_IN_GAIN, 0, 0x03);
679static struct sbmix_elem snd_als4000_ctl_mixer_loopback = 748static struct sbmix_elem snd_als4000_ctl_mixer_analog_loopback =
680 SB_SINGLE("Analog Loopback", SB_ALS4000_MIC_IN_GAIN, 7, 0x01); 749 SB_SINGLE("Analog Loopback Switch", SB_ALS4000_MIC_IN_GAIN, 7, 0x01);
750static struct sbmix_elem snd_als4000_ctl_mixer_digital_loopback =
751 SB_SINGLE("Digital Loopback Switch",
752 SB_ALS4000_CR3_CONFIGURATION, 7, 0x01);
681/* FIXME: functionality of 3D controls might be swapped, I didn't find 753/* FIXME: functionality of 3D controls might be swapped, I didn't find
682 * a description of how to identify what is supposed to be what */ 754 * a description of how to identify what is supposed to be what */
683static struct sbmix_elem snd_als4000_3d_control_switch = 755static struct sbmix_elem snd_als4000_3d_control_switch =
@@ -694,6 +766,9 @@ static struct sbmix_elem snd_als4000_3d_control_delay =
694 SB_SINGLE("3D Control - Wide", SB_ALS4000_3D_TIME_DELAY, 0, 0x0f); 766 SB_SINGLE("3D Control - Wide", SB_ALS4000_3D_TIME_DELAY, 0, 0x0f);
695static struct sbmix_elem snd_als4000_3d_control_poweroff_switch = 767static struct sbmix_elem snd_als4000_3d_control_poweroff_switch =
696 SB_SINGLE("3D PowerOff Switch", SB_ALS4000_3D_TIME_DELAY, 4, 0x01); 768 SB_SINGLE("3D PowerOff Switch", SB_ALS4000_3D_TIME_DELAY, 4, 0x01);
769static struct sbmix_elem snd_als4000_ctl_3db_freq_control_switch =
770 SB_SINGLE("Master Playback 8kHz / 20kHz LPF Switch",
771 SB_ALS4000_FMDAC, 5, 0x01);
697#ifdef NOT_AVAILABLE 772#ifdef NOT_AVAILABLE
698static struct sbmix_elem snd_als4000_ctl_fmdac = 773static struct sbmix_elem snd_als4000_ctl_fmdac =
699 SB_SINGLE("FMDAC Switch (Option ?)", SB_ALS4000_FMDAC, 0, 0x01); 774 SB_SINGLE("FMDAC Switch (Option ?)", SB_ALS4000_FMDAC, 0, 0x01);
@@ -702,35 +777,37 @@ static struct sbmix_elem snd_als4000_ctl_qsound =
702#endif 777#endif
703 778
704static struct sbmix_elem *snd_als4000_controls[] = { 779static struct sbmix_elem *snd_als4000_controls[] = {
705 &snd_sb16_ctl_master_play_vol, 780 /* ALS4000a.PDF regs page */
706 &snd_dt019x_ctl_pcm_play_switch, 781 &snd_sb16_ctl_master_play_vol, /* MX30/31 12 */
707 &snd_sb16_ctl_pcm_play_vol, 782 &snd_dt019x_ctl_pcm_play_switch, /* MX4C 16 */
708 &snd_sb16_ctl_synth_capture_route, 783 &snd_sb16_ctl_pcm_play_vol, /* MX32/33 12 */
709 &snd_dt019x_ctl_synth_play_switch, 784 &snd_sb16_ctl_synth_capture_route, /* MX3D/3E 14 */
710 &snd_sb16_ctl_synth_play_vol, 785 &snd_dt019x_ctl_synth_play_switch, /* MX4C 16 */
711 &snd_sb16_ctl_cd_capture_route, 786 &snd_sb16_ctl_synth_play_vol, /* MX34/35 12/13 */
712 &snd_sb16_ctl_cd_play_switch, 787 &snd_sb16_ctl_cd_capture_route, /* MX3D/3E 14 */
713 &snd_sb16_ctl_cd_play_vol, 788 &snd_sb16_ctl_cd_play_switch, /* MX3C 14 */
714 &snd_sb16_ctl_line_capture_route, 789 &snd_sb16_ctl_cd_play_vol, /* MX36/37 13 */
715 &snd_sb16_ctl_line_play_switch, 790 &snd_sb16_ctl_line_capture_route, /* MX3D/3E 14 */
716 &snd_sb16_ctl_line_play_vol, 791 &snd_sb16_ctl_line_play_switch, /* MX3C 14 */
717 &snd_sb16_ctl_mic_capture_route, 792 &snd_sb16_ctl_line_play_vol, /* MX38/39 13 */
718 &snd_als4000_ctl_mic_20db_boost, 793 &snd_sb16_ctl_mic_capture_route, /* MX3D/3E 14 */
719 &snd_sb16_ctl_auto_mic_gain, 794 &snd_als4000_ctl_mic_20db_boost, /* MX4D 16 */
720 &snd_sb16_ctl_mic_play_switch, 795 &snd_sb16_ctl_mic_play_switch, /* MX3C 14 */
721 &snd_sb16_ctl_mic_play_vol, 796 &snd_sb16_ctl_mic_play_vol, /* MX3A 13 */
722 &snd_sb16_ctl_pc_speaker_vol, 797 &snd_sb16_ctl_pc_speaker_vol, /* MX3B 14 */
723 &snd_sb16_ctl_capture_vol, 798 &snd_sb16_ctl_capture_vol, /* MX3F/40 15 */
724 &snd_sb16_ctl_play_vol, 799 &snd_sb16_ctl_play_vol, /* MX41/42 15 */
725 &snd_als4000_ctl_master_mono_playback_switch, 800 &snd_als4000_ctl_master_mono_playback_switch, /* MX4C 16 */
726 &snd_als4000_ctl_master_mono_capture_route, 801 &snd_als4k_ctl_master_mono_capture_route, /* MX4B 16 */
727 &snd_als4000_ctl_mono_playback_switch, 802 &snd_als4000_ctl_mono_playback_switch, /* MX4C 16 */
728 &snd_als4000_ctl_mixer_loopback, 803 &snd_als4000_ctl_mixer_analog_loopback, /* MX4D 16 */
729 &snd_als4000_3d_control_switch, 804 &snd_als4000_ctl_mixer_digital_loopback, /* CR3 21 */
730 &snd_als4000_3d_control_ratio, 805 &snd_als4000_3d_control_switch, /* MX50 17 */
731 &snd_als4000_3d_control_freq, 806 &snd_als4000_3d_control_ratio, /* MX50 17 */
732 &snd_als4000_3d_control_delay, 807 &snd_als4000_3d_control_freq, /* MX50 17 */
733 &snd_als4000_3d_control_poweroff_switch, 808 &snd_als4000_3d_control_delay, /* MX51 18 */
809 &snd_als4000_3d_control_poweroff_switch, /* MX51 18 */
810 &snd_als4000_ctl_3db_freq_control_switch, /* MX4F 17 */
734#ifdef NOT_AVAILABLE 811#ifdef NOT_AVAILABLE
735 &snd_als4000_ctl_fmdac, 812 &snd_als4000_ctl_fmdac,
736 &snd_als4000_ctl_qsound, 813 &snd_als4000_ctl_qsound,
@@ -905,13 +982,14 @@ static unsigned char dt019x_saved_regs[] = {
905}; 982};
906 983
907static unsigned char als4000_saved_regs[] = { 984static unsigned char als4000_saved_regs[] = {
985 /* please verify in dsheet whether regs to be added
986 are actually real H/W or just dummy */
908 SB_DSP4_MASTER_DEV, SB_DSP4_MASTER_DEV + 1, 987 SB_DSP4_MASTER_DEV, SB_DSP4_MASTER_DEV + 1,
909 SB_DSP4_OUTPUT_SW, 988 SB_DSP4_OUTPUT_SW,
910 SB_DSP4_PCM_DEV, SB_DSP4_PCM_DEV + 1, 989 SB_DSP4_PCM_DEV, SB_DSP4_PCM_DEV + 1,
911 SB_DSP4_INPUT_LEFT, SB_DSP4_INPUT_RIGHT, 990 SB_DSP4_INPUT_LEFT, SB_DSP4_INPUT_RIGHT,
912 SB_DSP4_SYNTH_DEV, SB_DSP4_SYNTH_DEV + 1, 991 SB_DSP4_SYNTH_DEV, SB_DSP4_SYNTH_DEV + 1,
913 SB_DSP4_CD_DEV, SB_DSP4_CD_DEV + 1, 992 SB_DSP4_CD_DEV, SB_DSP4_CD_DEV + 1,
914 SB_DSP4_MIC_AGC,
915 SB_DSP4_MIC_DEV, 993 SB_DSP4_MIC_DEV,
916 SB_DSP4_SPEAKER_DEV, 994 SB_DSP4_SPEAKER_DEV,
917 SB_DSP4_IGAIN_DEV, SB_DSP4_IGAIN_DEV + 1, 995 SB_DSP4_IGAIN_DEV, SB_DSP4_IGAIN_DEV + 1,
@@ -919,8 +997,10 @@ static unsigned char als4000_saved_regs[] = {
919 SB_DT019X_OUTPUT_SW2, 997 SB_DT019X_OUTPUT_SW2,
920 SB_ALS4000_MONO_IO_CTRL, 998 SB_ALS4000_MONO_IO_CTRL,
921 SB_ALS4000_MIC_IN_GAIN, 999 SB_ALS4000_MIC_IN_GAIN,
1000 SB_ALS4000_FMDAC,
922 SB_ALS4000_3D_SND_FX, 1001 SB_ALS4000_3D_SND_FX,
923 SB_ALS4000_3D_TIME_DELAY, 1002 SB_ALS4000_3D_TIME_DELAY,
1003 SB_ALS4000_CR3_CONFIGURATION,
924}; 1004};
925 1005
926static void save_mixer(struct snd_sb *chip, unsigned char *regs, int num_regs) 1006static void save_mixer(struct snd_sb *chip, unsigned char *regs, int num_regs)