Changeset 426 for GPL/trunk/alsa-kernel/isa/sb
- Timestamp:
- May 9, 2009, 11:45:26 AM (17 years ago)
- Location:
- GPL/trunk/alsa-kernel/isa/sb
- Files:
-
- 2 edited
-
sb16_csp.c (modified) (1 diff)
-
sb_mixer.c (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
GPL/trunk/alsa-kernel/isa/sb/sb16_csp.c
r399 r426 685 685 static int snd_sb_csp_load_user(struct snd_sb_csp * p, const unsigned char __user *buf, int size, int load_flags) 686 686 { 687 int err = -ENOMEM; 688 unsigned char *kbuf = kmalloc(size, GFP_KERNEL); 689 if (kbuf) { 690 if (copy_from_user(kbuf, buf, size)) 691 err = -EFAULT; 692 else 693 err = snd_sb_csp_load(p, kbuf, size, load_flags); 694 kfree(kbuf); 695 } 687 int err; 688 unsigned char *kbuf; 689 690 kbuf = memdup_user(buf, size); 691 if (IS_ERR(kbuf)) 692 return PTR_ERR(kbuf); 693 694 err = snd_sb_csp_load(p, kbuf, size, load_flags); 695 696 kfree(kbuf); 696 697 return err; 697 698 } -
GPL/trunk/alsa-kernel/isa/sb/sb_mixer.c
r399 r426 183 183 static int snd_dt019x_input_sw_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) 184 184 { 185 static c har *texts[5] = {185 static const char *texts[5] = { 186 186 "CD", "Mic", "Line", "Synth", "Master" 187 187 }; … … 270 270 271 271 /* 272 * ALS4000 mono recording control switch 273 */ 274 275 static 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 292 static 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 310 static 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 333 * SBPRO input multiplexer 273 334 */ … … 275 336 static int snd_sb8mixer_info_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) 276 337 { 277 static c har *texts[3] = {338 static const char *texts[3] = { 278 339 "Mic", "CD", "Line" 279 340 }; … … 442 503 .get = snd_dt019x_input_sw_get, 443 504 .put = snd_dt019x_input_sw_put, 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, 444 511 }, 445 512 }; … … 637 704 638 705 static 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 708 &snd_dt019x_ctl_master_play_vol, 640 709 &snd_dt019x_ctl_pcm_play_vol, … … 667 736 * ALS4000 specific mixer elements 668 737 */ 669 /* FIXME: SB_ALS4000_MONO_IO_CTRL needs output select ctrl! */670 738 static struct sbmix_elem snd_als4000_ctl_master_mono_playback_switch = 671 739 SB_SINGLE("Master Mono Playback Switch", SB_ALS4000_MONO_IO_CTRL, 5, 1); 672 static struct sbmix_elem snd_als4000_ctl_master_mono_capture_route = 673 SB_SINGLE("Master Mono Capture Route", SB_ALS4000_MONO_IO_CTRL, 6, 0x03); 674 /* FIXME: mono playback switch also available on DT019X? */ 740 static struct sbmix_elem snd_als4k_ctl_master_mono_capture_route = { 741 .name = "Master Mono Capture Route", 742 .type = SB_MIX_MONO_CAPTURE_ALS4K 743 }; 675 744 static struct sbmix_elem snd_als4000_ctl_mono_playback_switch = 676 745 SB_SINGLE("Mono Playback Switch", SB_DT019X_OUTPUT_SW2, 0, 1); 677 746 static struct sbmix_elem snd_als4000_ctl_mic_20db_boost = 678 747 SB_SINGLE("Mic Boost (+20dB)", SB_ALS4000_MIC_IN_GAIN, 0, 0x03); 679 static struct sbmix_elem snd_als4000_ctl_mixer_loopback = 680 SB_SINGLE("Analog Loopback", SB_ALS4000_MIC_IN_GAIN, 7, 0x01); 748 static struct sbmix_elem snd_als4000_ctl_mixer_analog_loopback = 749 SB_SINGLE("Analog Loopback Switch", SB_ALS4000_MIC_IN_GAIN, 7, 0x01); 750 static struct sbmix_elem snd_als4000_ctl_mixer_digital_loopback = 751 SB_SINGLE("Digital Loopback Switch", 752 SB_ALS4000_CR3_CONFIGURATION, 7, 0x01); 681 753 /* FIXME: functionality of 3D controls might be swapped, I didn't find 682 754 * a description of how to identify what is supposed to be what */ … … 695 767 static struct sbmix_elem snd_als4000_3d_control_poweroff_switch = 696 768 SB_SINGLE("3D PowerOff Switch", SB_ALS4000_3D_TIME_DELAY, 4, 0x01); 769 static 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 772 #ifdef NOT_AVAILABLE 698 773 static struct sbmix_elem snd_als4000_ctl_fmdac = … … 703 778 704 779 static struct sbmix_elem *snd_als4000_controls[] = { 705 &snd_sb16_ctl_master_play_vol, 706 &snd_dt019x_ctl_pcm_play_switch, 707 &snd_sb16_ctl_pcm_play_vol, 708 &snd_sb16_ctl_synth_capture_route, 709 &snd_dt019x_ctl_synth_play_switch, 710 &snd_sb16_ctl_synth_play_vol, 711 &snd_sb16_ctl_cd_capture_route, 712 &snd_sb16_ctl_cd_play_switch, 713 &snd_sb16_ctl_cd_play_vol, 714 &snd_sb16_ctl_line_capture_route, 715 &snd_sb16_ctl_line_play_switch, 716 &snd_sb16_ctl_line_play_vol, 717 &snd_sb16_ctl_mic_capture_route, 718 &snd_als4000_ctl_mic_20db_boost, 719 &snd_sb16_ctl_auto_mic_gain, 720 &snd_sb16_ctl_mic_play_switch, 721 &snd_sb16_ctl_mic_play_vol, 722 &snd_sb16_ctl_pc_speaker_vol, 723 &snd_sb16_ctl_capture_vol, 724 &snd_sb16_ctl_play_vol, 725 &snd_als4000_ctl_master_mono_playback_switch, 726 &snd_als4000_ctl_master_mono_capture_route, 727 &snd_als4000_ctl_mono_playback_switch, 728 &snd_als4000_ctl_mixer_loopback, 729 &snd_als4000_3d_control_switch, 730 &snd_als4000_3d_control_ratio, 731 &snd_als4000_3d_control_freq, 732 &snd_als4000_3d_control_delay, 733 &snd_als4000_3d_control_poweroff_switch, 780 /* ALS4000a.PDF regs page */ 781 &snd_sb16_ctl_master_play_vol, /* MX30/31 12 */ 782 &snd_dt019x_ctl_pcm_play_switch, /* MX4C 16 */ 783 &snd_sb16_ctl_pcm_play_vol, /* MX32/33 12 */ 784 &snd_sb16_ctl_synth_capture_route, /* MX3D/3E 14 */ 785 &snd_dt019x_ctl_synth_play_switch, /* MX4C 16 */ 786 &snd_sb16_ctl_synth_play_vol, /* MX34/35 12/13 */ 787 &snd_sb16_ctl_cd_capture_route, /* MX3D/3E 14 */ 788 &snd_sb16_ctl_cd_play_switch, /* MX3C 14 */ 789 &snd_sb16_ctl_cd_play_vol, /* MX36/37 13 */ 790 &snd_sb16_ctl_line_capture_route, /* MX3D/3E 14 */ 791 &snd_sb16_ctl_line_play_switch, /* MX3C 14 */ 792 &snd_sb16_ctl_line_play_vol, /* MX38/39 13 */ 793 &snd_sb16_ctl_mic_capture_route, /* MX3D/3E 14 */ 794 &snd_als4000_ctl_mic_20db_boost, /* MX4D 16 */ 795 &snd_sb16_ctl_mic_play_switch, /* MX3C 14 */ 796 &snd_sb16_ctl_mic_play_vol, /* MX3A 13 */ 797 &snd_sb16_ctl_pc_speaker_vol, /* MX3B 14 */ 798 &snd_sb16_ctl_capture_vol, /* MX3F/40 15 */ 799 &snd_sb16_ctl_play_vol, /* MX41/42 15 */ 800 &snd_als4000_ctl_master_mono_playback_switch, /* MX4C 16 */ 801 &snd_als4k_ctl_master_mono_capture_route, /* MX4B 16 */ 802 &snd_als4000_ctl_mono_playback_switch, /* MX4C 16 */ 803 &snd_als4000_ctl_mixer_analog_loopback, /* MX4D 16 */ 804 &snd_als4000_ctl_mixer_digital_loopback, /* CR3 21 */ 805 &snd_als4000_3d_control_switch, /* MX50 17 */ 806 &snd_als4000_3d_control_ratio, /* MX50 17 */ 807 &snd_als4000_3d_control_freq, /* MX50 17 */ 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 811 #ifdef NOT_AVAILABLE 735 812 &snd_als4000_ctl_fmdac, … … 906 983 907 984 static 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 987 SB_DSP4_MASTER_DEV, SB_DSP4_MASTER_DEV + 1, 909 988 SB_DSP4_OUTPUT_SW, … … 912 991 SB_DSP4_SYNTH_DEV, SB_DSP4_SYNTH_DEV + 1, 913 992 SB_DSP4_CD_DEV, SB_DSP4_CD_DEV + 1, 914 SB_DSP4_MIC_AGC,915 993 SB_DSP4_MIC_DEV, 916 994 SB_DSP4_SPEAKER_DEV, … … 920 998 SB_ALS4000_MONO_IO_CTRL, 921 999 SB_ALS4000_MIC_IN_GAIN, 1000 SB_ALS4000_FMDAC, 922 1001 SB_ALS4000_3D_SND_FX, 923 1002 SB_ALS4000_3D_TIME_DELAY, 1003 SB_ALS4000_CR3_CONFIGURATION, 924 1004 }; 925 1005
Note:
See TracChangeset
for help on using the changeset viewer.
