Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'sound-3.9' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound

Pull sound fixes from Takashi Iwai:
"This contains slightly more volumes than usual at this stage, mostly
because of my vacation in the last week. Nothing to scare, all small
and/or trivial fixes:

- Fix loop path handling in ASoC DAPM
- Some memory handling fixes in ASoC core
- Fix spear_pcm to adapt to the updated API
- HD-audio HDMI ELD handling fixes
- Fix for CM6331 USB-audio SRC change bugs
- Revert power_save_controller option change due to user-space usage
- A few other small ASoC and HD-audio fixes"

* tag 'sound-3.9' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
ALSA: hda/generic - fix uninitialized variable
Revert "ALSA: hda - Allow power_save_controller option override DCAPS"
ALSA: hda - fix typo in proc output
ALSA: hda - Enabling Realtek ALC 671 codec
ALSA: usb: Work around CM6631 sample rate change bug
ALSA: hda - bug fix on HDMI ELD debug message
ALSA: hda - bug fix on return value when getting HDMI ELD info
ASoC: dma-sh7760: Fix compile error
ASoC: core: fix invalid free of devm_ allocated data
ASoC: spear_pcm: Update to new pcm_new() API
ASoC:: max98090: Remove executable bit
ASoC: dapm: Fix pointer dereference in is_connected_output_ep()
ASoC: pcm030 audio fabric: remove __init from probe
ASoC: imx-ssi: Fix occasional AC97 reset failure
ASoC: core: fix possible memory leak in snd_soc_bytes_put()
ASoC: wm_adsp: fix possible memory leak in wm_adsp_load_coeff()
ASoC: dapm: Fix handling of loops
ASoC: si476x: Add missing break for SNDRV_PCM_FORMAT_S8 switch case

+83 -37
+2 -3
Documentation/sound/alsa/ALSA-Configuration.txt
··· 890 890 enable_msi - Enable Message Signaled Interrupt (MSI) (default = off) 891 891 power_save - Automatic power-saving timeout (in second, 0 = 892 892 disable) 893 - power_save_controller - Support runtime D3 of HD-audio controller 894 - (-1 = on for supported chip (default), false = off, 895 - true = force to on even for unsupported hardware) 893 + power_save_controller - Reset HD-audio controller in power-saving mode 894 + (default = on) 896 895 align_buffer_size - Force rounding of buffer/period sizes to multiples 897 896 of 128 bytes. This is more efficient in terms of memory 898 897 access but isn't required by the HDA spec and prevents
include/sound/max98090.h
+1
include/sound/soc-dapm.h
··· 488 488 /* status */ 489 489 u32 connect:1; /* source and sink widgets are connected */ 490 490 u32 walked:1; /* path has been walked */ 491 + u32 walking:1; /* path is in the process of being walked */ 491 492 u32 weak:1; /* path ignored for power management */ 492 493 493 494 int (*connected)(struct snd_soc_dapm_widget *source,
+1 -1
sound/pci/hda/hda_codec.c
··· 173 173 "Line Out", "Speaker", "HP Out", "CD", 174 174 "SPDIF Out", "Digital Out", "Modem Line", "Modem Hand", 175 175 "Line In", "Aux", "Mic", "Telephony", 176 - "SPDIF In", "Digitial In", "Reserved", "Other" 176 + "SPDIF In", "Digital In", "Reserved", "Other" 177 177 }; 178 178 179 179 return jack_types[(cfg & AC_DEFCFG_DEVICE)
+1 -1
sound/pci/hda/hda_eld.c
··· 320 320 unsigned char *buf, int *eld_size) 321 321 { 322 322 int i; 323 - int ret; 323 + int ret = 0; 324 324 int size; 325 325 326 326 /*
+1 -1
sound/pci/hda/hda_generic.c
··· 740 740 static void path_power_down_sync(struct hda_codec *codec, struct nid_path *path) 741 741 { 742 742 struct hda_gen_spec *spec = codec->spec; 743 - bool changed; 743 + bool changed = false; 744 744 int i; 745 745 746 746 if (!spec->power_down_unused || path->active)
+2 -4
sound/pci/hda/hda_intel.c
··· 134 134 * this may give more power-saving, but will take longer time to 135 135 * wake up. 136 136 */ 137 - static int power_save_controller = -1; 138 - module_param(power_save_controller, bint, 0644); 137 + static bool power_save_controller = 1; 138 + module_param(power_save_controller, bool, 0644); 139 139 MODULE_PARM_DESC(power_save_controller, "Reset controller in power save mode."); 140 140 #endif /* CONFIG_PM */ 141 141 ··· 2931 2931 struct snd_card *card = dev_get_drvdata(dev); 2932 2932 struct azx *chip = card->private_data; 2933 2933 2934 - if (power_save_controller > 0) 2935 - return 0; 2936 2934 if (!power_save_controller || 2937 2935 !(chip->driver_caps & AZX_DCAPS_PM_RUNTIME)) 2938 2936 return -EBUSY;
+1 -1
sound/pci/hda/patch_hdmi.c
··· 1196 1196 1197 1197 _snd_printd(SND_PR_VERBOSE, 1198 1198 "HDMI status: Codec=%d Pin=%d Presence_Detect=%d ELD_Valid=%d\n", 1199 - codec->addr, pin_nid, eld->monitor_present, eld->eld_valid); 1199 + codec->addr, pin_nid, pin_eld->monitor_present, eld->eld_valid); 1200 1200 1201 1201 if (eld->eld_valid) { 1202 1202 if (snd_hdmi_get_eld(codec, pin_nid, eld->eld_buffer,
+3 -1
sound/pci/hda/patch_realtek.c
··· 3440 3440 const hda_nid_t *ssids; 3441 3441 3442 3442 if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 || 3443 - codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670) 3443 + codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670 || 3444 + codec->vendor_id == 0x10ec0671) 3444 3445 ssids = alc663_ssids; 3445 3446 else 3446 3447 ssids = alc662_ssids; ··· 3895 3894 { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 }, 3896 3895 { .id = 0x10ec0668, .name = "ALC668", .patch = patch_alc662 }, 3897 3896 { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 }, 3897 + { .id = 0x10ec0671, .name = "ALC671", .patch = patch_alc662 }, 3898 3898 { .id = 0x10ec0680, .name = "ALC680", .patch = patch_alc680 }, 3899 3899 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 }, 3900 3900 { .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },
sound/soc/codecs/max98090.c
sound/soc/codecs/max98090.h
+1
sound/soc/codecs/si476x.c
··· 159 159 switch (params_format(params)) { 160 160 case SNDRV_PCM_FORMAT_S8: 161 161 width = SI476X_PCM_FORMAT_S8; 162 + break; 162 163 case SNDRV_PCM_FORMAT_S16_LE: 163 164 width = SI476X_PCM_FORMAT_S16_LE; 164 165 break;
+3 -2
sound/soc/codecs/wm_adsp.c
··· 828 828 &buf_list); 829 829 if (!buf) { 830 830 adsp_err(dsp, "Out of memory\n"); 831 - return -ENOMEM; 831 + ret = -ENOMEM; 832 + goto out_fw; 832 833 } 833 834 834 835 adsp_dbg(dsp, "%s.%d: Writing %d bytes at %x\n", ··· 866 865 wm_adsp_buf_free(&buf_list); 867 866 out: 868 867 kfree(file); 869 - return 0; 868 + return ret; 870 869 } 871 870 872 871 int wm_adsp1_init(struct wm_adsp *adsp)
+5
sound/soc/fsl/imx-ssi.c
··· 496 496 497 497 if (imx_ssi->ac97_reset) 498 498 imx_ssi->ac97_reset(ac97); 499 + /* First read sometimes fails, do a dummy read */ 500 + imx_ssi_ac97_read(ac97, 0); 499 501 } 500 502 501 503 static void imx_ssi_ac97_warm_reset(struct snd_ac97 *ac97) ··· 506 504 507 505 if (imx_ssi->ac97_warm_reset) 508 506 imx_ssi->ac97_warm_reset(ac97); 507 + 508 + /* First read sometimes fails, do a dummy read */ 509 + imx_ssi_ac97_read(ac97, 0); 509 510 } 510 511 511 512 struct snd_ac97_bus_ops soc_ac97_ops = {
+1 -1
sound/soc/fsl/pcm030-audio-fabric.c
··· 51 51 .num_links = ARRAY_SIZE(pcm030_fabric_dai), 52 52 }; 53 53 54 - static int __init pcm030_fabric_probe(struct platform_device *op) 54 + static int pcm030_fabric_probe(struct platform_device *op) 55 55 { 56 56 struct device_node *np = op->dev.of_node; 57 57 struct device_node *platform_np;
+2 -2
sound/soc/sh/dma-sh7760.c
··· 342 342 return 0; 343 343 } 344 344 345 - static struct snd_soc_platform sh7760_soc_platform = { 346 - .pcm_ops = &camelot_pcm_ops, 345 + static struct snd_soc_platform_driver sh7760_soc_platform = { 346 + .ops = &camelot_pcm_ops, 347 347 .pcm_new = camelot_pcm_new, 348 348 .pcm_free = camelot_pcm_free, 349 349 };
+4 -4
sound/soc/soc-core.c
··· 3140 3140 if (params->mask) { 3141 3141 ret = regmap_read(codec->control_data, params->base, &val); 3142 3142 if (ret != 0) 3143 - return ret; 3143 + goto out; 3144 3144 3145 3145 val &= params->mask; 3146 3146 ··· 3158 3158 ((u32 *)data)[0] |= cpu_to_be32(val); 3159 3159 break; 3160 3160 default: 3161 - return -EINVAL; 3161 + ret = -EINVAL; 3162 + goto out; 3162 3163 } 3163 3164 } 3164 3165 3165 3166 ret = regmap_raw_write(codec->control_data, params->base, 3166 3167 data, len); 3167 3168 3169 + out: 3168 3170 kfree(data); 3169 3171 3170 3172 return ret; ··· 4199 4197 dev_err(card->dev, 4200 4198 "ASoC: Property '%s' index %d could not be read: %d\n", 4201 4199 propname, 2 * i, ret); 4202 - kfree(routes); 4203 4200 return -EINVAL; 4204 4201 } 4205 4202 ret = of_property_read_string_index(np, propname, ··· 4207 4206 dev_err(card->dev, 4208 4207 "ASoC: Property '%s' index %d could not be read: %d\n", 4209 4208 propname, (2 * i) + 1, ret); 4210 - kfree(routes); 4211 4209 return -EINVAL; 4212 4210 } 4213 4211 }
+14
sound/soc/soc-dapm.c
··· 831 831 if (path->weak) 832 832 continue; 833 833 834 + if (path->walking) 835 + return 1; 836 + 834 837 if (path->walked) 835 838 continue; 836 839 ··· 841 838 842 839 if (path->sink && path->connect) { 843 840 path->walked = 1; 841 + path->walking = 1; 844 842 845 843 /* do we need to add this widget to the list ? */ 846 844 if (list) { ··· 851 847 dev_err(widget->dapm->dev, 852 848 "ASoC: could not add widget %s\n", 853 849 widget->name); 850 + path->walking = 0; 854 851 return con; 855 852 } 856 853 } 857 854 858 855 con += is_connected_output_ep(path->sink, list); 856 + 857 + path->walking = 0; 859 858 } 860 859 } 861 860 ··· 938 931 if (path->weak) 939 932 continue; 940 933 934 + if (path->walking) 935 + return 1; 936 + 941 937 if (path->walked) 942 938 continue; 943 939 ··· 948 938 949 939 if (path->source && path->connect) { 950 940 path->walked = 1; 941 + path->walking = 1; 951 942 952 943 /* do we need to add this widget to the list ? */ 953 944 if (list) { ··· 958 947 dev_err(widget->dapm->dev, 959 948 "ASoC: could not add widget %s\n", 960 949 widget->name); 950 + path->walking = 0; 961 951 return con; 962 952 } 963 953 } 964 954 965 955 con += is_connected_input_ep(path->source, list); 956 + 957 + path->walking = 0; 966 958 } 967 959 } 968 960
+6 -6
sound/soc/spear/spear_pcm.c
··· 149 149 150 150 static u64 spear_pcm_dmamask = DMA_BIT_MASK(32); 151 151 152 - static int spear_pcm_new(struct snd_card *card, 153 - struct snd_soc_dai *dai, struct snd_pcm *pcm) 152 + static int spear_pcm_new(struct snd_soc_pcm_runtime *rtd) 154 153 { 154 + struct snd_card *card = rtd->card->snd_card; 155 155 int ret; 156 156 157 157 if (!card->dev->dma_mask) ··· 159 159 if (!card->dev->coherent_dma_mask) 160 160 card->dev->coherent_dma_mask = DMA_BIT_MASK(32); 161 161 162 - if (dai->driver->playback.channels_min) { 163 - ret = spear_pcm_preallocate_dma_buffer(pcm, 162 + if (rtd->cpu_dai->driver->playback.channels_min) { 163 + ret = spear_pcm_preallocate_dma_buffer(rtd->pcm, 164 164 SNDRV_PCM_STREAM_PLAYBACK, 165 165 spear_pcm_hardware.buffer_bytes_max); 166 166 if (ret) 167 167 return ret; 168 168 } 169 169 170 - if (dai->driver->capture.channels_min) { 171 - ret = spear_pcm_preallocate_dma_buffer(pcm, 170 + if (rtd->cpu_dai->driver->capture.channels_min) { 171 + ret = spear_pcm_preallocate_dma_buffer(rtd->pcm, 172 172 SNDRV_PCM_STREAM_CAPTURE, 173 173 spear_pcm_hardware.buffer_bytes_max); 174 174 if (ret)
+35 -10
sound/usb/clock.c
··· 253 253 { 254 254 struct usb_device *dev = chip->dev; 255 255 unsigned char data[4]; 256 - int err, crate; 256 + int err, cur_rate, prev_rate; 257 257 int clock = snd_usb_clock_find_source(chip, fmt->clock); 258 258 259 259 if (clock < 0) ··· 264 264 snd_printk(KERN_ERR "%d:%d:%d: clock source %d is not valid, cannot use\n", 265 265 dev->devnum, iface, fmt->altsetting, clock); 266 266 return -ENXIO; 267 + } 268 + 269 + err = snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0), UAC2_CS_CUR, 270 + USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_IN, 271 + UAC2_CS_CONTROL_SAM_FREQ << 8, 272 + snd_usb_ctrl_intf(chip) | (clock << 8), 273 + data, sizeof(data)); 274 + if (err < 0) { 275 + snd_printk(KERN_WARNING "%d:%d:%d: cannot get freq (v2)\n", 276 + dev->devnum, iface, fmt->altsetting); 277 + prev_rate = 0; 278 + } else { 279 + prev_rate = data[0] | (data[1] << 8) | (data[2] << 16) | (data[3] << 24); 267 280 } 268 281 269 282 data[0] = rate; ··· 293 280 return err; 294 281 } 295 282 296 - if ((err = snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0), UAC2_CS_CUR, 297 - USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_IN, 298 - UAC2_CS_CONTROL_SAM_FREQ << 8, 299 - snd_usb_ctrl_intf(chip) | (clock << 8), 300 - data, sizeof(data))) < 0) { 283 + err = snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0), UAC2_CS_CUR, 284 + USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_IN, 285 + UAC2_CS_CONTROL_SAM_FREQ << 8, 286 + snd_usb_ctrl_intf(chip) | (clock << 8), 287 + data, sizeof(data)); 288 + if (err < 0) { 301 289 snd_printk(KERN_WARNING "%d:%d:%d: cannot get freq (v2)\n", 302 290 dev->devnum, iface, fmt->altsetting); 303 - return err; 291 + cur_rate = 0; 292 + } else { 293 + cur_rate = data[0] | (data[1] << 8) | (data[2] << 16) | (data[3] << 24); 304 294 } 305 295 306 - crate = data[0] | (data[1] << 8) | (data[2] << 16) | (data[3] << 24); 307 - if (crate != rate) 308 - snd_printd(KERN_WARNING "current rate %d is different from the runtime rate %d\n", crate, rate); 296 + if (cur_rate != rate) { 297 + snd_printd(KERN_WARNING 298 + "current rate %d is different from the runtime rate %d\n", 299 + cur_rate, rate); 300 + } 301 + 302 + /* Some devices doesn't respond to sample rate changes while the 303 + * interface is active. */ 304 + if (rate != prev_rate) { 305 + usb_set_interface(dev, iface, 0); 306 + usb_set_interface(dev, iface, fmt->altsetting); 307 + } 309 308 310 309 return 0; 311 310 }