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:
ASoC: tpa6130a2: Get rid of compile warning from tpa6130a2_power
ALSA: hda - MacBookAir3,1(3,2) alsa support
ASoC: fix the building issue of missing codec field in 'struct snd_soc_card'
ALSA: usb-audio - Support for Power/Status LED on Creative USB X-Fi S51
ALSA: asihpi - Unsafe memory management when allocating control cache
ASoC: Update WARN uses in wm_hubs
ASoC: Include cx20442 to SND_SOC_ALL_CODECS
ASoC: Fix SND_SOC_ALL_CODECS typo for jz4740
ASoC: Remove volatility from WM8900 POWER1 register
ALSA: lx6464es - make 1 bit signed bitfield unsigned
ALSA: cs46xx memory management fixes for cs46xx_dsp_spos_create()
ALSA: usb - driver neglects kmalloc return value check and may deref NULL
ASoC: tpa6130a2: Fix unbalanced regulator disables
ASoC: tlv320dac33: Mode1 FIFO auto configuration fix
ASoC: tlv320dac33: Limit the US_TO_SAMPLES macro
ASoC: tlv320dac33: Error handling for broken chip
ASoC: Check return value of struct_strtoul() in pmdown_time_set()

+82 -55
+2
sound/pci/asihpi/hpi6000.c
··· 625 625 control_cache_size, (struct hpi_control_cache_info *) 626 626 &phw->control_cache[0] 627 627 ); 628 + if (!phw->p_cache) 629 + pao->has_control_cache = 0; 628 630 } else 629 631 pao->has_control_cache = 0; 630 632
+2
sound/pci/asihpi/hpi6205.c
··· 644 644 interface->control_cache.size_in_bytes, 645 645 (struct hpi_control_cache_info *) 646 646 p_control_cache_virtual); 647 + if (!phw->p_cache) 648 + err = HPI_ERROR_MEMORY_ALLOC; 647 649 } 648 650 if (!err) { 649 651 err = hpios_locked_mem_get_phys_addr(&phw->
+9 -3
sound/pci/asihpi/hpicmn.c
··· 571 571 { 572 572 struct hpi_control_cache *p_cache = 573 573 kmalloc(sizeof(*p_cache), GFP_KERNEL); 574 + if (!p_cache) 575 + return NULL; 576 + p_cache->p_info = 577 + kmalloc(sizeof(*p_cache->p_info) * number_of_controls, 578 + GFP_KERNEL); 579 + if (!p_cache->p_info) { 580 + kfree(p_cache); 581 + return NULL; 582 + } 574 583 p_cache->cache_size_in_bytes = size_in_bytes; 575 584 p_cache->control_count = number_of_controls; 576 585 p_cache->p_cache = 577 586 (struct hpi_control_cache_single *)pDSP_control_buffer; 578 587 p_cache->init = 0; 579 - p_cache->p_info = 580 - kmalloc(sizeof(*p_cache->p_info) * p_cache->control_count, 581 - GFP_KERNEL); 582 588 return p_cache; 583 589 } 584 590
+11 -22
sound/pci/cs46xx/dsp_spos.c
··· 225 225 { 226 226 struct dsp_spos_instance * ins = kzalloc(sizeof(struct dsp_spos_instance), GFP_KERNEL); 227 227 228 - if (ins == NULL) 228 + if (ins == NULL) 229 229 return NULL; 230 230 231 231 /* better to use vmalloc for this big table */ 232 - ins->symbol_table.nsymbols = 0; 233 232 ins->symbol_table.symbols = vmalloc(sizeof(struct dsp_symbol_entry) * 234 233 DSP_MAX_SYMBOLS); 235 - ins->symbol_table.highest_frag_index = 0; 236 - 237 - if (ins->symbol_table.symbols == NULL) { 234 + ins->code.data = kmalloc(DSP_CODE_BYTE_SIZE, GFP_KERNEL); 235 + ins->modules = kmalloc(sizeof(struct dsp_module_desc) * DSP_MAX_MODULES, GFP_KERNEL); 236 + if (!ins->symbol_table.symbols || !ins->code.data || !ins->modules) { 238 237 cs46xx_dsp_spos_destroy(chip); 239 238 goto error; 240 239 } 241 - 240 + ins->symbol_table.nsymbols = 0; 241 + ins->symbol_table.highest_frag_index = 0; 242 242 ins->code.offset = 0; 243 243 ins->code.size = 0; 244 - ins->code.data = kmalloc(DSP_CODE_BYTE_SIZE, GFP_KERNEL); 245 - 246 - if (ins->code.data == NULL) { 247 - cs46xx_dsp_spos_destroy(chip); 248 - goto error; 249 - } 250 - 251 244 ins->nscb = 0; 252 245 ins->ntask = 0; 253 - 254 246 ins->nmodules = 0; 255 - ins->modules = kmalloc(sizeof(struct dsp_module_desc) * DSP_MAX_MODULES, GFP_KERNEL); 256 - 257 - if (ins->modules == NULL) { 258 - cs46xx_dsp_spos_destroy(chip); 259 - goto error; 260 - } 261 247 262 248 /* default SPDIF input sample rate 263 249 to 48000 khz */ ··· 257 271 258 272 /* set left and right validity bits and 259 273 default channel status */ 260 - ins->spdif_csuv_default = 261 - ins->spdif_csuv_stream = 274 + ins->spdif_csuv_default = 275 + ins->spdif_csuv_stream = 262 276 /* byte 0 */ ((unsigned int)_wrap_all_bits( (SNDRV_PCM_DEFAULT_CON_SPDIF & 0xff)) << 24) | 263 277 /* byte 1 */ ((unsigned int)_wrap_all_bits( ((SNDRV_PCM_DEFAULT_CON_SPDIF >> 8) & 0xff)) << 16) | 264 278 /* byte 3 */ (unsigned int)_wrap_all_bits( (SNDRV_PCM_DEFAULT_CON_SPDIF >> 24) & 0xff) | ··· 267 281 return ins; 268 282 269 283 error: 284 + kfree(ins->modules); 285 + kfree(ins->code.data); 286 + vfree(ins->symbol_table.symbols); 270 287 kfree(ins); 271 288 return NULL; 272 289 }
+1
sound/pci/hda/patch_cirrus.c
··· 1166 1166 1167 1167 static struct snd_pci_quirk cs420x_cfg_tbl[] = { 1168 1168 SND_PCI_QUIRK(0x10de, 0x0ac0, "MacBookPro 5,3", CS420X_MBP53), 1169 + SND_PCI_QUIRK(0x10de, 0x0d94, "MacBookAir 3,1(2)", CS420X_MBP55), 1169 1170 SND_PCI_QUIRK(0x10de, 0xcb79, "MacBookPro 5,5", CS420X_MBP55), 1170 1171 SND_PCI_QUIRK(0x10de, 0xcb89, "MacBookPro 7,1", CS420X_MBP55), 1171 1172 SND_PCI_QUIRK(0x8086, 0x7270, "IMac 27 Inch", CS420X_IMAC27),
+2 -2
sound/pci/lx6464es/lx6464es.c
··· 425 425 static void lx_trigger_start(struct lx6464es *chip, struct lx_stream *lx_stream) 426 426 { 427 427 struct snd_pcm_substream *substream = lx_stream->stream; 428 - const int is_capture = lx_stream->is_capture; 428 + const unsigned int is_capture = lx_stream->is_capture; 429 429 430 430 int err; 431 431 ··· 473 473 474 474 static void lx_trigger_stop(struct lx6464es *chip, struct lx_stream *lx_stream) 475 475 { 476 - const int is_capture = lx_stream->is_capture; 476 + const unsigned int is_capture = lx_stream->is_capture; 477 477 int err; 478 478 479 479 snd_printd(LXP "stopping: stopping stream\n");
+1 -1
sound/pci/lx6464es/lx6464es.h
··· 60 60 snd_pcm_uframes_t frame_pos; 61 61 enum lx_stream_status status; /* free, open, running, draining 62 62 * pause */ 63 - int is_capture:1; 63 + unsigned int is_capture:1; 64 64 }; 65 65 66 66
+1 -1
sound/pci/lx6464es/lx_core.c
··· 1152 1152 struct lx_stream *lx_stream) 1153 1153 { 1154 1154 struct snd_pcm_substream *substream = lx_stream->stream; 1155 - int is_capture = lx_stream->is_capture; 1155 + const unsigned int is_capture = lx_stream->is_capture; 1156 1156 int err; 1157 1157 unsigned long flags; 1158 1158
+2 -1
sound/soc/codecs/Kconfig
··· 25 25 select SND_SOC_CQ0093VC if MFD_DAVINCI_VOICECODEC 26 26 select SND_SOC_CS42L51 if I2C 27 27 select SND_SOC_CS4270 if I2C 28 + select SND_SOC_CX20442 28 29 select SND_SOC_DA7210 if I2C 29 - select SND_SOC_JZ4740 if SOC_JZ4740 30 + select SND_SOC_JZ4740_CODEC if SOC_JZ4740 30 31 select SND_SOC_MAX98088 if I2C 31 32 select SND_SOC_MAX9877 if I2C 32 33 select SND_SOC_PCM3008
+26 -10
sound/soc/codecs/tlv320dac33.c
··· 58 58 (1000000000 / ((rate * 1000) / samples)) 59 59 60 60 #define US_TO_SAMPLES(rate, us) \ 61 - (rate / (1000000 / us)) 61 + (rate / (1000000 / (us < 1000000 ? us : 1000000))) 62 62 63 63 #define UTHR_FROM_PERIOD_SIZE(samples, playrate, burstrate) \ 64 64 ((samples * 5000) / ((burstrate * 5000) / (burstrate - playrate))) ··· 200 200 u8 *value) 201 201 { 202 202 struct tlv320dac33_priv *dac33 = snd_soc_codec_get_drvdata(codec); 203 - int val; 203 + int val, ret = 0; 204 204 205 205 *value = reg & 0xff; 206 206 ··· 210 210 if (val < 0) { 211 211 dev_err(codec->dev, "Read failed (%d)\n", val); 212 212 value[0] = dac33_read_reg_cache(codec, reg); 213 + ret = val; 213 214 } else { 214 215 value[0] = val; 215 216 dac33_write_reg_cache(codec, reg, val); ··· 219 218 value[0] = dac33_read_reg_cache(codec, reg); 220 219 } 221 220 222 - return 0; 221 + return ret; 223 222 } 224 223 225 224 static int dac33_write(struct snd_soc_codec *codec, unsigned int reg, ··· 330 329 dac33_read_reg_cache(codec, DAC33_LINER_TO_RLO_VOL)); 331 330 } 332 331 333 - static inline void dac33_read_id(struct snd_soc_codec *codec) 332 + static inline int dac33_read_id(struct snd_soc_codec *codec) 334 333 { 334 + int i, ret = 0; 335 335 u8 reg; 336 336 337 - dac33_read(codec, DAC33_DEVICE_ID_MSB, &reg); 338 - dac33_read(codec, DAC33_DEVICE_ID_LSB, &reg); 339 - dac33_read(codec, DAC33_DEVICE_REV_ID, &reg); 337 + for (i = 0; i < 3; i++) { 338 + ret = dac33_read(codec, DAC33_DEVICE_ID_MSB + i, &reg); 339 + if (ret < 0) 340 + break; 341 + } 342 + 343 + return ret; 340 344 } 341 345 342 346 static inline void dac33_soft_power(struct snd_soc_codec *codec, int power) ··· 1082 1076 /* Number of samples under i2c latency */ 1083 1077 dac33->alarm_threshold = US_TO_SAMPLES(rate, 1084 1078 dac33->mode1_latency); 1079 + nsample_limit = DAC33_BUFFER_SIZE_SAMPLES - 1080 + dac33->alarm_threshold; 1081 + 1085 1082 if (dac33->auto_fifo_config) { 1086 1083 if (period_size <= dac33->alarm_threshold) 1087 1084 /* ··· 1095 1086 ((dac33->alarm_threshold / period_size) + 1096 1087 (dac33->alarm_threshold % period_size ? 1097 1088 1 : 0)); 1089 + else if (period_size > nsample_limit) 1090 + dac33->nsample = nsample_limit; 1098 1091 else 1099 1092 dac33->nsample = period_size; 1100 1093 } else { ··· 1108 1097 */ 1109 1098 dac33->nsample_max = substream->runtime->buffer_size - 1110 1099 period_size; 1111 - nsample_limit = DAC33_BUFFER_SIZE_SAMPLES - 1112 - dac33->alarm_threshold; 1100 + 1113 1101 if (dac33->nsample_max > nsample_limit) 1114 1102 dac33->nsample_max = nsample_limit; 1115 1103 ··· 1424 1414 dev_err(codec->dev, "Failed to power up codec: %d\n", ret); 1425 1415 goto err_power; 1426 1416 } 1427 - dac33_read_id(codec); 1417 + ret = dac33_read_id(codec); 1428 1418 dac33_hard_power(codec, 0); 1419 + 1420 + if (ret < 0) { 1421 + dev_err(codec->dev, "Failed to read chip ID: %d\n", ret); 1422 + ret = -ENODEV; 1423 + goto err_power; 1424 + } 1429 1425 1430 1426 /* Check if the IRQ number is valid and request it */ 1431 1427 if (dac33->irq >= 0) {
+3 -3
sound/soc/codecs/tpa6130a2.c
··· 119 119 { 120 120 struct tpa6130a2_data *data; 121 121 u8 val; 122 - int ret; 122 + int ret = 0; 123 123 124 124 BUG_ON(tpa6130a2_client == NULL); 125 125 data = i2c_get_clientdata(tpa6130a2_client); 126 126 127 127 mutex_lock(&data->mutex); 128 - if (power) { 128 + if (power && !data->power_state) { 129 129 /* Power on */ 130 130 if (data->power_gpio >= 0) 131 131 gpio_set_value(data->power_gpio, 1); ··· 153 153 val = tpa6130a2_read(TPA6130A2_REG_CONTROL); 154 154 val &= ~TPA6130A2_SWS; 155 155 tpa6130a2_i2c_write(TPA6130A2_REG_CONTROL, val); 156 - } else { 156 + } else if (!power && data->power_state) { 157 157 /* set SWS */ 158 158 val = tpa6130a2_read(TPA6130A2_REG_CONTROL); 159 159 val |= TPA6130A2_SWS;
-6
sound/soc/codecs/wm8900.c
··· 186 186 { 187 187 switch (reg) { 188 188 case WM8900_REG_ID: 189 - case WM8900_REG_POWER1: 190 189 return 1; 191 190 default: 192 191 return 0; ··· 1198 1199 dev_err(codec->dev, "Device is not a WM8900 - ID %x\n", reg); 1199 1200 return -ENODEV; 1200 1201 } 1201 - 1202 - /* Read back from the chip */ 1203 - reg = snd_soc_read(codec, WM8900_REG_POWER1); 1204 - reg = (reg >> 12) & 0xf; 1205 - dev_info(codec->dev, "WM8900 revision %d\n", reg); 1206 1202 1207 1203 wm8900_reset(codec); 1208 1204
+1 -1
sound/soc/codecs/wm_hubs.c
··· 123 123 reg_r = reg & WM8993_DCS_DAC_WR_VAL_0_MASK; 124 124 break; 125 125 default: 126 - WARN(1, "Unknown DCS readback method"); 126 + WARN(1, "Unknown DCS readback method\n"); 127 127 break; 128 128 } 129 129
+1 -1
sound/soc/pxa/tosa.c
··· 79 79 static int tosa_startup(struct snd_pcm_substream *substream) 80 80 { 81 81 struct snd_soc_pcm_runtime *rtd = substream->private_data; 82 - struct snd_soc_codec *codec = rtd->card->codec; 82 + struct snd_soc_codec *codec = rtd->codec; 83 83 84 84 /* check the jack status at stream startup */ 85 85 tosa_ext_control(codec);
+4 -1
sound/soc/soc-core.c
··· 165 165 { 166 166 struct snd_soc_pcm_runtime *rtd = 167 167 container_of(dev, struct snd_soc_pcm_runtime, dev); 168 + int ret; 168 169 169 - strict_strtol(buf, 10, &rtd->pmdown_time); 170 + ret = strict_strtol(buf, 10, &rtd->pmdown_time); 171 + if (ret) 172 + return ret; 170 173 171 174 return count; 172 175 }
+13 -2
sound/usb/mixer_quirks.c
··· 60 60 { USB_ID(0x041e, 0x3000), 0, 1, 2, 1, 18, 0x0013 }, /* Extigy */ 61 61 { USB_ID(0x041e, 0x3020), 2, 1, 6, 6, 18, 0x0013 }, /* Audigy 2 NX */ 62 62 { USB_ID(0x041e, 0x3040), 2, 2, 6, 6, 2, 0x6e91 }, /* Live! 24-bit */ 63 - { USB_ID(0x041e, 0x3042), 0, 1, 1, 1, 1, 0x000d }, /* Usb X-Fi */ 63 + { USB_ID(0x041e, 0x3042), 0, 1, 1, 1, 1, 0x000d }, /* Usb X-Fi S51 */ 64 64 { USB_ID(0x041e, 0x3048), 2, 2, 6, 6, 2, 0x6e91 }, /* Toshiba SB0500 */ 65 65 }; 66 66 ··· 183 183 if (value > 1) 184 184 return -EINVAL; 185 185 changed = value != mixer->audigy2nx_leds[index]; 186 - err = snd_usb_ctl_msg(mixer->chip->dev, 186 + if (mixer->chip->usb_id == USB_ID(0x041e, 0x3042)) 187 + err = snd_usb_ctl_msg(mixer->chip->dev, 188 + usb_sndctrlpipe(mixer->chip->dev, 0), 0x24, 189 + USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_OTHER, 190 + !value, 0, NULL, 0, 100); 191 + else 192 + err = snd_usb_ctl_msg(mixer->chip->dev, 187 193 usb_sndctrlpipe(mixer->chip->dev, 0), 0x24, 188 194 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_OTHER, 189 195 value, index + 2, NULL, 0, 100); ··· 231 225 int i, err; 232 226 233 227 for (i = 0; i < ARRAY_SIZE(snd_audigy2nx_controls); ++i) { 228 + /* USB X-Fi S51 doesn't have a CMSS LED */ 229 + if ((mixer->chip->usb_id == USB_ID(0x041e, 0x3042)) && i == 0) 230 + continue; 234 231 if (i > 1 && /* Live24ext has 2 LEDs only */ 235 232 (mixer->chip->usb_id == USB_ID(0x041e, 0x3040) || 233 + mixer->chip->usb_id == USB_ID(0x041e, 0x3042) || 236 234 mixer->chip->usb_id == USB_ID(0x041e, 0x3048))) 237 235 break; 238 236 err = snd_ctl_add(mixer->chip->card, ··· 375 365 376 366 if (mixer->chip->usb_id == USB_ID(0x041e, 0x3020) || 377 367 mixer->chip->usb_id == USB_ID(0x041e, 0x3040) || 368 + mixer->chip->usb_id == USB_ID(0x041e, 0x3042) || 378 369 mixer->chip->usb_id == USB_ID(0x041e, 0x3048)) { 379 370 if ((err = snd_audigy2nx_controls_create(mixer)) < 0) 380 371 return err;
+3 -1
sound/usb/pcm.c
··· 676 676 if (!needs_knot) 677 677 return 0; 678 678 679 - subs->rate_list.count = count; 680 679 subs->rate_list.list = kmalloc(sizeof(int) * count, GFP_KERNEL); 680 + if (!subs->rate_list.list) 681 + return -ENOMEM; 682 + subs->rate_list.count = count; 681 683 subs->rate_list.mask = 0; 682 684 count = 0; 683 685 list_for_each_entry(fp, &subs->fmt_list, list) {