Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6:
ALSA: hda - Fix mute control with some ALC262 models
ALSA: snd_usb_caiaq: add support for Audio2DJ
ALSA: pcm - Fix hwptr buffer-size overlap bug
ALSA: pcm - Fix warnings in debug loggings
ALSA: pcm - Add logging of hwptr updates and interrupt updates
ASoC: tlv320aic3x: Enable PLL when not bypassed
ALSA: hda - Restore GPIO1 properly at resume with AD1984A
ALSA: ctxfi - Fix uninitialized error checks
ALSA: hda - Use snprintf() to be safer
ALSA: usb-audio - Volume control quirk for QuickCam E 3500
ALSA: pcm - Fix regressions with VMware

+107 -39
+5
Documentation/sound/alsa/Procfile.txt
··· 101 101 bit 0 = Enable XRUN/jiffies debug messages 102 102 bit 1 = Show stack trace at XRUN / jiffies check 103 103 bit 2 = Enable additional jiffies check 104 + bit 3 = Log hwptr update at each period interrupt 105 + bit 4 = Log hwptr update at each snd_pcm_update_hw_ptr() 104 106 105 107 When the bit 0 is set, the driver will show the messages to 106 108 kernel log when an xrun is detected. The debug message is ··· 118 116 values, but can be lead to too much corrections for a (mostly 119 117 buggy) hardware that doesn't give smooth pointer updates. 120 118 This feature is enabled via the bit 2. 119 + 120 + Bits 3 and 4 are for logging the hwptr records. Note that 121 + these will give flood of kernel messages. 121 122 122 123 card*/pcm*/sub*/info 123 124 The general information of this PCM sub-stream.
+35 -1
sound/core/pcm_lib.c
··· 233 233 xrun(substream); 234 234 return -EPIPE; 235 235 } 236 + if (xrun_debug(substream, 8)) { 237 + char name[16]; 238 + pcm_debug_name(substream, name, sizeof(name)); 239 + snd_printd("period_update: %s: pos=0x%x/0x%x/0x%x, " 240 + "hwptr=0x%lx, hw_base=0x%lx, hw_intr=0x%lx\n", 241 + name, (unsigned int)pos, 242 + (unsigned int)runtime->period_size, 243 + (unsigned int)runtime->buffer_size, 244 + (unsigned long)old_hw_ptr, 245 + (unsigned long)runtime->hw_ptr_base, 246 + (unsigned long)runtime->hw_ptr_interrupt); 247 + } 236 248 hw_base = runtime->hw_ptr_base; 237 249 new_hw_ptr = hw_base + pos; 238 250 hw_ptr_interrupt = runtime->hw_ptr_interrupt + runtime->period_size; ··· 256 244 delta = new_hw_ptr - hw_ptr_interrupt; 257 245 } 258 246 if (delta < 0) { 259 - delta += runtime->buffer_size; 247 + if (runtime->periods == 1 || new_hw_ptr < old_hw_ptr) 248 + delta += runtime->buffer_size; 260 249 if (delta < 0) { 261 250 hw_ptr_error(substream, 262 251 "Unexpected hw_pointer value " 263 252 "(stream=%i, pos=%ld, intr_ptr=%ld)\n", 264 253 substream->stream, (long)pos, 265 254 (long)hw_ptr_interrupt); 255 + #if 1 256 + /* simply skipping the hwptr update seems more 257 + * robust in some cases, e.g. on VMware with 258 + * inaccurate timer source 259 + */ 260 + return 0; /* skip this update */ 261 + #else 266 262 /* rebase to interrupt position */ 267 263 hw_base = new_hw_ptr = hw_ptr_interrupt; 268 264 /* align hw_base to buffer_size */ 269 265 hw_base -= hw_base % runtime->buffer_size; 270 266 delta = 0; 267 + #endif 271 268 } else { 272 269 hw_base += runtime->buffer_size; 273 270 if (hw_base >= runtime->boundary) ··· 365 344 xrun(substream); 366 345 return -EPIPE; 367 346 } 347 + if (xrun_debug(substream, 16)) { 348 + char name[16]; 349 + pcm_debug_name(substream, name, sizeof(name)); 350 + snd_printd("hw_update: %s: pos=0x%x/0x%x/0x%x, " 351 + "hwptr=0x%lx, hw_base=0x%lx, hw_intr=0x%lx\n", 352 + name, (unsigned int)pos, 353 + (unsigned int)runtime->period_size, 354 + (unsigned int)runtime->buffer_size, 355 + (unsigned long)old_hw_ptr, 356 + (unsigned long)runtime->hw_ptr_base, 357 + (unsigned long)runtime->hw_ptr_interrupt); 358 + } 359 + 368 360 hw_base = runtime->hw_ptr_base; 369 361 new_hw_ptr = hw_base + pos; 370 362
+6 -8
sound/pci/ctxfi/ctamixer.c
··· 242 242 243 243 /* Allocate mem for amixer resource */ 244 244 amixer = kzalloc(sizeof(*amixer), GFP_KERNEL); 245 - if (NULL == amixer) { 246 - err = -ENOMEM; 247 - return err; 248 - } 245 + if (!amixer) 246 + return -ENOMEM; 249 247 250 248 /* Check whether there are sufficient 251 249 * amixer resources to meet request. */ 250 + err = 0; 252 251 spin_lock_irqsave(&mgr->mgr_lock, flags); 253 252 for (i = 0; i < desc->msr; i++) { 254 253 err = mgr_get_resource(&mgr->mgr, 1, &idx); ··· 396 397 397 398 /* Allocate mem for sum resource */ 398 399 sum = kzalloc(sizeof(*sum), GFP_KERNEL); 399 - if (NULL == sum) { 400 - err = -ENOMEM; 401 - return err; 402 - } 400 + if (!sum) 401 + return -ENOMEM; 403 402 404 403 /* Check whether there are sufficient sum resources to meet request. */ 404 + err = 0; 405 405 spin_lock_irqsave(&mgr->mgr_lock, flags); 406 406 for (i = 0; i < desc->msr; i++) { 407 407 err = mgr_get_resource(&mgr->mgr, 1, &idx);
+3 -4
sound/pci/ctxfi/ctsrc.c
··· 724 724 725 725 /* Allocate mem for SRCIMP resource */ 726 726 srcimp = kzalloc(sizeof(*srcimp), GFP_KERNEL); 727 - if (NULL == srcimp) { 728 - err = -ENOMEM; 729 - return err; 730 - } 727 + if (!srcimp) 728 + return -ENOMEM; 731 729 732 730 /* Check whether there are sufficient SRCIMP resources. */ 731 + err = 0; 733 732 spin_lock_irqsave(&mgr->mgr_lock, flags); 734 733 for (i = 0; i < desc->msr; i++) { 735 734 err = mgr_get_resource(&mgr->mgr, 1, &idx);
+1 -1
sound/pci/hda/patch_analog.c
··· 3754 3754 int mute = (!ucontrol->value.integer.value[0] && 3755 3755 !ucontrol->value.integer.value[1]); 3756 3756 /* toggle GPIO1 according to the mute state */ 3757 - snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 3757 + snd_hda_codec_write_cache(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 3758 3758 mute ? 0x02 : 0x0); 3759 3759 return ret; 3760 3760 }
+16 -17
sound/pci/hda/patch_realtek.c
··· 10631 10631 alc262_lenovo_3000_automute(codec, 1); 10632 10632 } 10633 10633 10634 + static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid, 10635 + int dir, int idx, long *valp) 10636 + { 10637 + int i, change = 0; 10638 + 10639 + for (i = 0; i < 2; i++, valp++) 10640 + change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx, 10641 + HDA_AMP_MUTE, 10642 + *valp ? 0 : HDA_AMP_MUTE); 10643 + return change; 10644 + } 10645 + 10634 10646 /* bind hp and internal speaker mute (with plug check) */ 10635 10647 static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, 10636 10648 struct snd_ctl_elem_value *ucontrol) ··· 10651 10639 long *valp = ucontrol->value.integer.value; 10652 10640 int change; 10653 10641 10654 - change = snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, 10655 - HDA_AMP_MUTE, 10656 - valp ? 0 : HDA_AMP_MUTE); 10657 - change |= snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, 10658 - HDA_AMP_MUTE, 10659 - valp ? 0 : HDA_AMP_MUTE); 10660 - 10642 + change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp); 10643 + change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp); 10661 10644 if (change) 10662 10645 alc262_fujitsu_automute(codec, 0); 10663 10646 return change; ··· 10687 10680 long *valp = ucontrol->value.integer.value; 10688 10681 int change; 10689 10682 10690 - change = snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, 10691 - HDA_AMP_MUTE, 10692 - valp ? 0 : HDA_AMP_MUTE); 10693 - 10683 + change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp); 10694 10684 if (change) 10695 10685 alc262_lenovo_3000_automute(codec, 0); 10696 10686 return change; ··· 11858 11854 long *valp = ucontrol->value.integer.value; 11859 11855 int change; 11860 11856 11861 - change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, 11862 - HDA_AMP_MUTE, 11863 - valp[0] ? 0 : HDA_AMP_MUTE); 11864 - change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, 11865 - HDA_AMP_MUTE, 11866 - valp[1] ? 0 : HDA_AMP_MUTE); 11857 + change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp); 11867 11858 if (change) 11868 11859 alc268_acer_automute(codec, 0); 11869 11860 return change;
+1 -1
sound/pci/hda/patch_sigmatel.c
··· 4066 4066 jack->nid = nid; 4067 4067 jack->type = type; 4068 4068 4069 - sprintf(name, "%s at %s %s Jack", 4069 + snprintf(name, sizeof(name), "%s at %s %s Jack", 4070 4070 snd_hda_get_jack_type(def_conf), 4071 4071 snd_hda_get_jack_connectivity(def_conf), 4072 4072 snd_hda_get_jack_location(def_conf));
+10 -1
sound/soc/codecs/tlv320aic3x.c
··· 767 767 int codec_clk = 0, bypass_pll = 0, fsref, last_clk = 0; 768 768 u8 data, r, p, pll_q, pll_p = 1, pll_r = 1, pll_j = 1; 769 769 u16 pll_d = 1; 770 + u8 reg; 770 771 771 772 /* select data word length */ 772 773 data = ··· 802 801 pll_q &= 0xf; 803 802 aic3x_write(codec, AIC3X_PLL_PROGA_REG, pll_q << PLLQ_SHIFT); 804 803 aic3x_write(codec, AIC3X_GPIOB_REG, CODEC_CLKIN_CLKDIV); 805 - } else 804 + /* disable PLL if it is bypassed */ 805 + reg = aic3x_read_reg_cache(codec, AIC3X_PLL_PROGA_REG); 806 + aic3x_write(codec, AIC3X_PLL_PROGA_REG, reg & ~PLL_ENABLE); 807 + 808 + } else { 806 809 aic3x_write(codec, AIC3X_GPIOB_REG, CODEC_CLKIN_PLLDIV); 810 + /* enable PLL when it is used */ 811 + reg = aic3x_read_reg_cache(codec, AIC3X_PLL_PROGA_REG); 812 + aic3x_write(codec, AIC3X_PLL_PROGA_REG, reg | PLL_ENABLE); 813 + } 807 814 808 815 /* Route Left DAC to left channel input and 809 816 * right DAC to right channel input */
+1
sound/usb/Kconfig
··· 48 48 * Native Instruments Kore Controller 49 49 * Native Instruments Kore Controller 2 50 50 * Native Instruments Audio Kontrol 1 51 + * Native Instruments Audio 2 DJ 51 52 * Native Instruments Audio 4 DJ 52 53 * Native Instruments Audio 8 DJ 53 54 * Native Instruments Guitar Rig Session I/O
+1
sound/usb/caiaq/audio.c
··· 646 646 case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_GUITARRIGMOBILE): 647 647 dev->samplerates |= SNDRV_PCM_RATE_192000; 648 648 /* fall thru */ 649 + case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO2DJ): 649 650 case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO4DJ): 650 651 case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_AUDIO8DJ): 651 652 dev->samplerates |= SNDRV_PCM_RATE_88200;
+7 -1
sound/usb/caiaq/device.c
··· 35 35 #include "input.h" 36 36 37 37 MODULE_AUTHOR("Daniel Mack <daniel@caiaq.de>"); 38 - MODULE_DESCRIPTION("caiaq USB audio, version 1.3.18"); 38 + MODULE_DESCRIPTION("caiaq USB audio, version 1.3.19"); 39 39 MODULE_LICENSE("GPL"); 40 40 MODULE_SUPPORTED_DEVICE("{{Native Instruments, RigKontrol2}," 41 41 "{Native Instruments, RigKontrol3}," 42 42 "{Native Instruments, Kore Controller}," 43 43 "{Native Instruments, Kore Controller 2}," 44 44 "{Native Instruments, Audio Kontrol 1}," 45 + "{Native Instruments, Audio 2 DJ}," 45 46 "{Native Instruments, Audio 4 DJ}," 46 47 "{Native Instruments, Audio 8 DJ}," 47 48 "{Native Instruments, Session I/O}," ··· 121 120 .match_flags = USB_DEVICE_ID_MATCH_DEVICE, 122 121 .idVendor = USB_VID_NATIVEINSTRUMENTS, 123 122 .idProduct = USB_PID_AUDIO4DJ 123 + }, 124 + { 125 + .match_flags = USB_DEVICE_ID_MATCH_DEVICE, 126 + .idVendor = USB_VID_NATIVEINSTRUMENTS, 127 + .idProduct = USB_PID_AUDIO2DJ 124 128 }, 125 129 { /* terminator */ } 126 130 };
+1
sound/usb/caiaq/device.h
··· 10 10 #define USB_PID_KORECONTROLLER 0x4711 11 11 #define USB_PID_KORECONTROLLER2 0x4712 12 12 #define USB_PID_AK1 0x0815 13 + #define USB_PID_AUDIO2DJ 0x041c 13 14 #define USB_PID_AUDIO4DJ 0x0839 14 15 #define USB_PID_AUDIO8DJ 0x1978 15 16 #define USB_PID_SESSIONIO 0x1915
+20 -5
sound/usb/usbmixer.c
··· 990 990 break; 991 991 } 992 992 993 - /* quirk for UDA1321/N101 */ 994 - /* note that detection between firmware 2.1.1.7 (N101) and later 2.1.1.21 */ 995 - /* is not very clear from datasheets */ 996 - /* I hope that the min value is -15360 for newer firmware --jk */ 993 + /* volume control quirks */ 997 994 switch (state->chip->usb_id) { 998 995 case USB_ID(0x0471, 0x0101): 999 996 case USB_ID(0x0471, 0x0104): 1000 997 case USB_ID(0x0471, 0x0105): 1001 998 case USB_ID(0x0672, 0x1041): 999 + /* quirk for UDA1321/N101. 1000 + * note that detection between firmware 2.1.1.7 (N101) 1001 + * and later 2.1.1.21 is not very clear from datasheets. 1002 + * I hope that the min value is -15360 for newer firmware --jk 1003 + */ 1002 1004 if (!strcmp(kctl->id.name, "PCM Playback Volume") && 1003 1005 cval->min == -15616) { 1004 - snd_printk(KERN_INFO "using volume control quirk for the UDA1321/N101 chip\n"); 1006 + snd_printk(KERN_INFO 1007 + "set volume quirk for UDA1321/N101 chip\n"); 1005 1008 cval->max = -256; 1006 1009 } 1010 + break; 1011 + 1012 + case USB_ID(0x046d, 0x09a4): 1013 + if (!strcmp(kctl->id.name, "Mic Capture Volume")) { 1014 + snd_printk(KERN_INFO 1015 + "set volume quirk for QuickCam E3500\n"); 1016 + cval->min = 6080; 1017 + cval->max = 8768; 1018 + cval->res = 192; 1019 + } 1020 + break; 1021 + 1007 1022 } 1008 1023 1009 1024 snd_printdd(KERN_INFO "[%d] FU [%s] ch = %d, val = %d/%d/%d\n",