aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorOlof Johansson <olof@lixom.net>2013-02-09 19:41:37 -0500
committerOlof Johansson <olof@lixom.net>2013-02-09 19:41:37 -0500
commit94c16ea6ea75f8f5de92d10a647155ccf0d05436 (patch)
tree012d247bf686e1c49ef3ad0048b94de4970c066b /sound
parentcf55f672c325f234d96911571a775b2e7d9cf284 (diff)
parent88b62b915b0b7e25870eb0604ed9a92ba4bfc9f7 (diff)
Merge tag 'v3.8-rc6' into next/cleanup
Linux 3.8-rc6
Diffstat (limited to 'sound')
-rw-r--r--sound/pci/hda/hda_intel.c49
-rw-r--r--sound/pci/hda/patch_realtek.c2
-rw-r--r--sound/soc/codecs/arizona.c5
-rw-r--r--sound/soc/codecs/wm2200.c3
-rw-r--r--sound/soc/codecs/wm5102.c3
-rw-r--r--sound/soc/codecs/wm5110.c3
-rw-r--r--sound/soc/codecs/wm_adsp.c6
-rw-r--r--sound/soc/fsl/Kconfig9
-rw-r--r--sound/soc/fsl/Makefile5
-rw-r--r--sound/soc/fsl/imx-pcm.c3
-rw-r--r--sound/soc/soc-dapm.c12
-rw-r--r--sound/usb/mixer.c17
12 files changed, 69 insertions, 48 deletions
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index 0b6aebacc56b..c78286f6e5d8 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -656,29 +656,43 @@ static char *driver_short_names[] = {
656#define get_azx_dev(substream) (substream->runtime->private_data) 656#define get_azx_dev(substream) (substream->runtime->private_data)
657 657
658#ifdef CONFIG_X86 658#ifdef CONFIG_X86
659static void __mark_pages_wc(struct azx *chip, void *addr, size_t size, bool on) 659static void __mark_pages_wc(struct azx *chip, struct snd_dma_buffer *dmab, bool on)
660{ 660{
661 int pages;
662
661 if (azx_snoop(chip)) 663 if (azx_snoop(chip))
662 return; 664 return;
663 if (addr && size) { 665 if (!dmab || !dmab->area || !dmab->bytes)
664 int pages = (size + PAGE_SIZE - 1) >> PAGE_SHIFT; 666 return;
667
668#ifdef CONFIG_SND_DMA_SGBUF
669 if (dmab->dev.type == SNDRV_DMA_TYPE_DEV_SG) {
670 struct snd_sg_buf *sgbuf = dmab->private_data;
665 if (on) 671 if (on)
666 set_memory_wc((unsigned long)addr, pages); 672 set_pages_array_wc(sgbuf->page_table, sgbuf->pages);
667 else 673 else
668 set_memory_wb((unsigned long)addr, pages); 674 set_pages_array_wb(sgbuf->page_table, sgbuf->pages);
675 return;
669 } 676 }
677#endif
678
679 pages = (dmab->bytes + PAGE_SIZE - 1) >> PAGE_SHIFT;
680 if (on)
681 set_memory_wc((unsigned long)dmab->area, pages);
682 else
683 set_memory_wb((unsigned long)dmab->area, pages);
670} 684}
671 685
672static inline void mark_pages_wc(struct azx *chip, struct snd_dma_buffer *buf, 686static inline void mark_pages_wc(struct azx *chip, struct snd_dma_buffer *buf,
673 bool on) 687 bool on)
674{ 688{
675 __mark_pages_wc(chip, buf->area, buf->bytes, on); 689 __mark_pages_wc(chip, buf, on);
676} 690}
677static inline void mark_runtime_wc(struct azx *chip, struct azx_dev *azx_dev, 691static inline void mark_runtime_wc(struct azx *chip, struct azx_dev *azx_dev,
678 struct snd_pcm_runtime *runtime, bool on) 692 struct snd_pcm_substream *substream, bool on)
679{ 693{
680 if (azx_dev->wc_marked != on) { 694 if (azx_dev->wc_marked != on) {
681 __mark_pages_wc(chip, runtime->dma_area, runtime->dma_bytes, on); 695 __mark_pages_wc(chip, snd_pcm_get_dma_buf(substream), on);
682 azx_dev->wc_marked = on; 696 azx_dev->wc_marked = on;
683 } 697 }
684} 698}
@@ -689,7 +703,7 @@ static inline void mark_pages_wc(struct azx *chip, struct snd_dma_buffer *buf,
689{ 703{
690} 704}
691static inline void mark_runtime_wc(struct azx *chip, struct azx_dev *azx_dev, 705static inline void mark_runtime_wc(struct azx *chip, struct azx_dev *azx_dev,
692 struct snd_pcm_runtime *runtime, bool on) 706 struct snd_pcm_substream *substream, bool on)
693{ 707{
694} 708}
695#endif 709#endif
@@ -1968,11 +1982,10 @@ static int azx_pcm_hw_params(struct snd_pcm_substream *substream,
1968{ 1982{
1969 struct azx_pcm *apcm = snd_pcm_substream_chip(substream); 1983 struct azx_pcm *apcm = snd_pcm_substream_chip(substream);
1970 struct azx *chip = apcm->chip; 1984 struct azx *chip = apcm->chip;
1971 struct snd_pcm_runtime *runtime = substream->runtime;
1972 struct azx_dev *azx_dev = get_azx_dev(substream); 1985 struct azx_dev *azx_dev = get_azx_dev(substream);
1973 int ret; 1986 int ret;
1974 1987
1975 mark_runtime_wc(chip, azx_dev, runtime, false); 1988 mark_runtime_wc(chip, azx_dev, substream, false);
1976 azx_dev->bufsize = 0; 1989 azx_dev->bufsize = 0;
1977 azx_dev->period_bytes = 0; 1990 azx_dev->period_bytes = 0;
1978 azx_dev->format_val = 0; 1991 azx_dev->format_val = 0;
@@ -1980,7 +1993,7 @@ static int azx_pcm_hw_params(struct snd_pcm_substream *substream,
1980 params_buffer_bytes(hw_params)); 1993 params_buffer_bytes(hw_params));
1981 if (ret < 0) 1994 if (ret < 0)
1982 return ret; 1995 return ret;
1983 mark_runtime_wc(chip, azx_dev, runtime, true); 1996 mark_runtime_wc(chip, azx_dev, substream, true);
1984 return ret; 1997 return ret;
1985} 1998}
1986 1999
@@ -1989,7 +2002,6 @@ static int azx_pcm_hw_free(struct snd_pcm_substream *substream)
1989 struct azx_pcm *apcm = snd_pcm_substream_chip(substream); 2002 struct azx_pcm *apcm = snd_pcm_substream_chip(substream);
1990 struct azx_dev *azx_dev = get_azx_dev(substream); 2003 struct azx_dev *azx_dev = get_azx_dev(substream);
1991 struct azx *chip = apcm->chip; 2004 struct azx *chip = apcm->chip;
1992 struct snd_pcm_runtime *runtime = substream->runtime;
1993 struct hda_pcm_stream *hinfo = apcm->hinfo[substream->stream]; 2005 struct hda_pcm_stream *hinfo = apcm->hinfo[substream->stream];
1994 2006
1995 /* reset BDL address */ 2007 /* reset BDL address */
@@ -2002,7 +2014,7 @@ static int azx_pcm_hw_free(struct snd_pcm_substream *substream)
2002 2014
2003 snd_hda_codec_cleanup(apcm->codec, hinfo, substream); 2015 snd_hda_codec_cleanup(apcm->codec, hinfo, substream);
2004 2016
2005 mark_runtime_wc(chip, azx_dev, runtime, false); 2017 mark_runtime_wc(chip, azx_dev, substream, false);
2006 return snd_pcm_lib_free_pages(substream); 2018 return snd_pcm_lib_free_pages(substream);
2007} 2019}
2008 2020
@@ -3613,13 +3625,12 @@ static DEFINE_PCI_DEVICE_TABLE(azx_ids) = {
3613 /* 5 Series/3400 */ 3625 /* 5 Series/3400 */
3614 { PCI_DEVICE(0x8086, 0x3b56), 3626 { PCI_DEVICE(0x8086, 0x3b56),
3615 .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_INTEL_PCH }, 3627 .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_INTEL_PCH },
3616 /* SCH */ 3628 /* Poulsbo */
3617 { PCI_DEVICE(0x8086, 0x811b), 3629 { PCI_DEVICE(0x8086, 0x811b),
3618 .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_SCH_SNOOP | 3630 .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_INTEL_PCH_NOPM },
3619 AZX_DCAPS_BUFSIZE | AZX_DCAPS_POSFIX_LPIB }, /* Poulsbo */ 3631 /* Oaktrail */
3620 { PCI_DEVICE(0x8086, 0x080a), 3632 { PCI_DEVICE(0x8086, 0x080a),
3621 .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_SCH_SNOOP | 3633 .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_INTEL_PCH_NOPM },
3622 AZX_DCAPS_BUFSIZE | AZX_DCAPS_POSFIX_LPIB }, /* Oaktrail */
3623 /* ICH */ 3634 /* ICH */
3624 { PCI_DEVICE(0x8086, 0x2668), 3635 { PCI_DEVICE(0x8086, 0x2668),
3625 .driver_data = AZX_DRIVER_ICH | AZX_DCAPS_OLD_SSYNC | 3636 .driver_data = AZX_DRIVER_ICH | AZX_DCAPS_OLD_SSYNC |
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index cf3886171109..5faaad219a7f 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -4694,6 +4694,7 @@ static const struct snd_pci_quirk alc880_fixup_tbl[] = {
4694 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_FIXUP_VOL_KNOB), 4694 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_FIXUP_VOL_KNOB),
4695 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_FIXUP_W810), 4695 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_FIXUP_W810),
4696 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_FIXUP_MEDION_RIM), 4696 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_FIXUP_MEDION_RIM),
4697 SND_PCI_QUIRK(0x1631, 0xe011, "PB 13201056", ALC880_FIXUP_6ST),
4697 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_FIXUP_F1734), 4698 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_FIXUP_F1734),
4698 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FIXUP_FUJITSU), 4699 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FIXUP_FUJITSU),
4699 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_FIXUP_F1734), 4700 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_FIXUP_F1734),
@@ -5708,6 +5709,7 @@ static const struct alc_model_fixup alc268_fixup_models[] = {
5708}; 5709};
5709 5710
5710static const struct snd_pci_quirk alc268_fixup_tbl[] = { 5711static const struct snd_pci_quirk alc268_fixup_tbl[] = {
5712 SND_PCI_QUIRK(0x1025, 0x015b, "Acer AOA 150 (ZG5)", ALC268_FIXUP_INV_DMIC),
5711 /* below is codec SSID since multiple Toshiba laptops have the 5713 /* below is codec SSID since multiple Toshiba laptops have the
5712 * same PCI SSID 1179:ff00 5714 * same PCI SSID 1179:ff00
5713 */ 5715 */
diff --git a/sound/soc/codecs/arizona.c b/sound/soc/codecs/arizona.c
index 1d8bb5917594..ef62c435848e 100644
--- a/sound/soc/codecs/arizona.c
+++ b/sound/soc/codecs/arizona.c
@@ -685,7 +685,7 @@ static int arizona_hw_params(struct snd_pcm_substream *substream,
685 } 685 }
686 sr_val = i; 686 sr_val = i;
687 687
688 lrclk = snd_soc_params_to_bclk(params) / params_rate(params); 688 lrclk = rates[bclk] / params_rate(params);
689 689
690 arizona_aif_dbg(dai, "BCLK %dHz LRCLK %dHz\n", 690 arizona_aif_dbg(dai, "BCLK %dHz LRCLK %dHz\n",
691 rates[bclk], rates[bclk] / lrclk); 691 rates[bclk], rates[bclk] / lrclk);
@@ -1082,6 +1082,9 @@ int arizona_init_fll(struct arizona *arizona, int id, int base, int lock_irq,
1082 id, ret); 1082 id, ret);
1083 } 1083 }
1084 1084
1085 regmap_update_bits(arizona->regmap, fll->base + 1,
1086 ARIZONA_FLL1_FREERUN, 0);
1087
1085 return 0; 1088 return 0;
1086} 1089}
1087EXPORT_SYMBOL_GPL(arizona_init_fll); 1090EXPORT_SYMBOL_GPL(arizona_init_fll);
diff --git a/sound/soc/codecs/wm2200.c b/sound/soc/codecs/wm2200.c
index e6cefe1ac677..d8c65f574658 100644
--- a/sound/soc/codecs/wm2200.c
+++ b/sound/soc/codecs/wm2200.c
@@ -1019,8 +1019,6 @@ static const char *wm2200_mixer_texts[] = {
1019 "EQR", 1019 "EQR",
1020 "LHPF1", 1020 "LHPF1",
1021 "LHPF2", 1021 "LHPF2",
1022 "LHPF3",
1023 "LHPF4",
1024 "DSP1.1", 1022 "DSP1.1",
1025 "DSP1.2", 1023 "DSP1.2",
1026 "DSP1.3", 1024 "DSP1.3",
@@ -1053,7 +1051,6 @@ static int wm2200_mixer_values[] = {
1053 0x25, 1051 0x25,
1054 0x50, /* EQ */ 1052 0x50, /* EQ */
1055 0x51, 1053 0x51,
1056 0x52,
1057 0x60, /* LHPF1 */ 1054 0x60, /* LHPF1 */
1058 0x61, /* LHPF2 */ 1055 0x61, /* LHPF2 */
1059 0x68, /* DSP1 */ 1056 0x68, /* DSP1 */
diff --git a/sound/soc/codecs/wm5102.c b/sound/soc/codecs/wm5102.c
index 7a9048dad1cd..1440b3f9b7bb 100644
--- a/sound/soc/codecs/wm5102.c
+++ b/sound/soc/codecs/wm5102.c
@@ -896,8 +896,7 @@ static const unsigned int wm5102_aec_loopback_values[] = {
896 896
897static const struct soc_enum wm5102_aec_loopback = 897static const struct soc_enum wm5102_aec_loopback =
898 SOC_VALUE_ENUM_SINGLE(ARIZONA_DAC_AEC_CONTROL_1, 898 SOC_VALUE_ENUM_SINGLE(ARIZONA_DAC_AEC_CONTROL_1,
899 ARIZONA_AEC_LOOPBACK_SRC_SHIFT, 899 ARIZONA_AEC_LOOPBACK_SRC_SHIFT, 0xf,
900 ARIZONA_AEC_LOOPBACK_SRC_MASK,
901 ARRAY_SIZE(wm5102_aec_loopback_texts), 900 ARRAY_SIZE(wm5102_aec_loopback_texts),
902 wm5102_aec_loopback_texts, 901 wm5102_aec_loopback_texts,
903 wm5102_aec_loopback_values); 902 wm5102_aec_loopback_values);
diff --git a/sound/soc/codecs/wm5110.c b/sound/soc/codecs/wm5110.c
index ae80c8c28536..7a090968c4f7 100644
--- a/sound/soc/codecs/wm5110.c
+++ b/sound/soc/codecs/wm5110.c
@@ -344,8 +344,7 @@ static const unsigned int wm5110_aec_loopback_values[] = {
344 344
345static const struct soc_enum wm5110_aec_loopback = 345static const struct soc_enum wm5110_aec_loopback =
346 SOC_VALUE_ENUM_SINGLE(ARIZONA_DAC_AEC_CONTROL_1, 346 SOC_VALUE_ENUM_SINGLE(ARIZONA_DAC_AEC_CONTROL_1,
347 ARIZONA_AEC_LOOPBACK_SRC_SHIFT, 347 ARIZONA_AEC_LOOPBACK_SRC_SHIFT, 0xf,
348 ARIZONA_AEC_LOOPBACK_SRC_MASK,
349 ARRAY_SIZE(wm5110_aec_loopback_texts), 348 ARRAY_SIZE(wm5110_aec_loopback_texts),
350 wm5110_aec_loopback_texts, 349 wm5110_aec_loopback_texts,
351 wm5110_aec_loopback_values); 350 wm5110_aec_loopback_values);
diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c
index 7b198c38f3ef..b6b654837585 100644
--- a/sound/soc/codecs/wm_adsp.c
+++ b/sound/soc/codecs/wm_adsp.c
@@ -324,7 +324,7 @@ static int wm_adsp_load(struct wm_adsp *dsp)
324 324
325 if (reg) { 325 if (reg) {
326 buf = kmemdup(region->data, le32_to_cpu(region->len), 326 buf = kmemdup(region->data, le32_to_cpu(region->len),
327 GFP_KERNEL); 327 GFP_KERNEL | GFP_DMA);
328 if (!buf) { 328 if (!buf) {
329 adsp_err(dsp, "Out of memory\n"); 329 adsp_err(dsp, "Out of memory\n");
330 return -ENOMEM; 330 return -ENOMEM;
@@ -396,7 +396,7 @@ static int wm_adsp_load_coeff(struct wm_adsp *dsp)
396 hdr = (void*)&firmware->data[0]; 396 hdr = (void*)&firmware->data[0];
397 if (memcmp(hdr->magic, "WMDR", 4) != 0) { 397 if (memcmp(hdr->magic, "WMDR", 4) != 0) {
398 adsp_err(dsp, "%s: invalid magic\n", file); 398 adsp_err(dsp, "%s: invalid magic\n", file);
399 return -EINVAL; 399 goto out_fw;
400 } 400 }
401 401
402 adsp_dbg(dsp, "%s: v%d.%d.%d\n", file, 402 adsp_dbg(dsp, "%s: v%d.%d.%d\n", file,
@@ -439,7 +439,7 @@ static int wm_adsp_load_coeff(struct wm_adsp *dsp)
439 439
440 if (reg) { 440 if (reg) {
441 buf = kmemdup(blk->data, le32_to_cpu(blk->len), 441 buf = kmemdup(blk->data, le32_to_cpu(blk->len),
442 GFP_KERNEL); 442 GFP_KERNEL | GFP_DMA);
443 if (!buf) { 443 if (!buf) {
444 adsp_err(dsp, "Out of memory\n"); 444 adsp_err(dsp, "Out of memory\n");
445 return -ENOMEM; 445 return -ENOMEM;
diff --git a/sound/soc/fsl/Kconfig b/sound/soc/fsl/Kconfig
index 3b98159d9645..a210c8d7b4bc 100644
--- a/sound/soc/fsl/Kconfig
+++ b/sound/soc/fsl/Kconfig
@@ -108,18 +108,13 @@ if SND_IMX_SOC
108config SND_SOC_IMX_SSI 108config SND_SOC_IMX_SSI
109 tristate 109 tristate
110 110
111config SND_SOC_IMX_PCM
112 tristate
113
114config SND_SOC_IMX_PCM_FIQ 111config SND_SOC_IMX_PCM_FIQ
115 bool 112 tristate
116 select FIQ 113 select FIQ
117 select SND_SOC_IMX_PCM
118 114
119config SND_SOC_IMX_PCM_DMA 115config SND_SOC_IMX_PCM_DMA
120 bool 116 tristate
121 select SND_SOC_DMAENGINE_PCM 117 select SND_SOC_DMAENGINE_PCM
122 select SND_SOC_IMX_PCM
123 118
124config SND_SOC_IMX_AUDMUX 119config SND_SOC_IMX_AUDMUX
125 tristate 120 tristate
diff --git a/sound/soc/fsl/Makefile b/sound/soc/fsl/Makefile
index afd34794db53..ec1457915d7c 100644
--- a/sound/soc/fsl/Makefile
+++ b/sound/soc/fsl/Makefile
@@ -41,7 +41,10 @@ endif
41obj-$(CONFIG_SND_SOC_IMX_SSI) += snd-soc-imx-ssi.o 41obj-$(CONFIG_SND_SOC_IMX_SSI) += snd-soc-imx-ssi.o
42obj-$(CONFIG_SND_SOC_IMX_AUDMUX) += snd-soc-imx-audmux.o 42obj-$(CONFIG_SND_SOC_IMX_AUDMUX) += snd-soc-imx-audmux.o
43 43
44obj-$(CONFIG_SND_SOC_IMX_PCM) += snd-soc-imx-pcm.o 44obj-$(CONFIG_SND_SOC_IMX_PCM_FIQ) += snd-soc-imx-pcm-fiq.o
45snd-soc-imx-pcm-fiq-y := imx-pcm-fiq.o imx-pcm.o
46obj-$(CONFIG_SND_SOC_IMX_PCM_DMA) += snd-soc-imx-pcm-dma.o
47snd-soc-imx-pcm-dma-y := imx-pcm-dma.o imx-pcm.o
45 48
46# i.MX Machine Support 49# i.MX Machine Support
47snd-soc-eukrea-tlv320-objs := eukrea-tlv320.o 50snd-soc-eukrea-tlv320-objs := eukrea-tlv320.o
diff --git a/sound/soc/fsl/imx-pcm.c b/sound/soc/fsl/imx-pcm.c
index d5cd9eff3b48..0c9f188ddc68 100644
--- a/sound/soc/fsl/imx-pcm.c
+++ b/sound/soc/fsl/imx-pcm.c
@@ -31,7 +31,6 @@ int snd_imx_pcm_mmap(struct snd_pcm_substream *substream,
31 runtime->dma_bytes); 31 runtime->dma_bytes);
32 return ret; 32 return ret;
33} 33}
34EXPORT_SYMBOL_GPL(snd_imx_pcm_mmap);
35 34
36static int imx_pcm_preallocate_dma_buffer(struct snd_pcm *pcm, int stream) 35static int imx_pcm_preallocate_dma_buffer(struct snd_pcm *pcm, int stream)
37{ 36{
@@ -80,7 +79,6 @@ int imx_pcm_new(struct snd_soc_pcm_runtime *rtd)
80out: 79out:
81 return ret; 80 return ret;
82} 81}
83EXPORT_SYMBOL_GPL(imx_pcm_new);
84 82
85void imx_pcm_free(struct snd_pcm *pcm) 83void imx_pcm_free(struct snd_pcm *pcm)
86{ 84{
@@ -102,7 +100,6 @@ void imx_pcm_free(struct snd_pcm *pcm)
102 buf->area = NULL; 100 buf->area = NULL;
103 } 101 }
104} 102}
105EXPORT_SYMBOL_GPL(imx_pcm_free);
106 103
107MODULE_DESCRIPTION("Freescale i.MX PCM driver"); 104MODULE_DESCRIPTION("Freescale i.MX PCM driver");
108MODULE_AUTHOR("Sascha Hauer <s.hauer@pengutronix.de>"); 105MODULE_AUTHOR("Sascha Hauer <s.hauer@pengutronix.de>");
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 1e36bc81e5af..258acadb9e7d 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -1023,7 +1023,7 @@ int dapm_regulator_event(struct snd_soc_dapm_widget *w,
1023 1023
1024 if (SND_SOC_DAPM_EVENT_ON(event)) { 1024 if (SND_SOC_DAPM_EVENT_ON(event)) {
1025 if (w->invert & SND_SOC_DAPM_REGULATOR_BYPASS) { 1025 if (w->invert & SND_SOC_DAPM_REGULATOR_BYPASS) {
1026 ret = regulator_allow_bypass(w->regulator, true); 1026 ret = regulator_allow_bypass(w->regulator, false);
1027 if (ret != 0) 1027 if (ret != 0)
1028 dev_warn(w->dapm->dev, 1028 dev_warn(w->dapm->dev,
1029 "ASoC: Failed to bypass %s: %d\n", 1029 "ASoC: Failed to bypass %s: %d\n",
@@ -1033,7 +1033,7 @@ int dapm_regulator_event(struct snd_soc_dapm_widget *w,
1033 return regulator_enable(w->regulator); 1033 return regulator_enable(w->regulator);
1034 } else { 1034 } else {
1035 if (w->invert & SND_SOC_DAPM_REGULATOR_BYPASS) { 1035 if (w->invert & SND_SOC_DAPM_REGULATOR_BYPASS) {
1036 ret = regulator_allow_bypass(w->regulator, false); 1036 ret = regulator_allow_bypass(w->regulator, true);
1037 if (ret != 0) 1037 if (ret != 0)
1038 dev_warn(w->dapm->dev, 1038 dev_warn(w->dapm->dev,
1039 "ASoC: Failed to unbypass %s: %d\n", 1039 "ASoC: Failed to unbypass %s: %d\n",
@@ -3039,6 +3039,14 @@ snd_soc_dapm_new_control(struct snd_soc_dapm_context *dapm,
3039 w->name, ret); 3039 w->name, ret);
3040 return NULL; 3040 return NULL;
3041 } 3041 }
3042
3043 if (w->invert & SND_SOC_DAPM_REGULATOR_BYPASS) {
3044 ret = regulator_allow_bypass(w->regulator, true);
3045 if (ret != 0)
3046 dev_warn(w->dapm->dev,
3047 "ASoC: Failed to unbypass %s: %d\n",
3048 w->name, ret);
3049 }
3042 break; 3050 break;
3043 case snd_soc_dapm_clock_supply: 3051 case snd_soc_dapm_clock_supply:
3044#ifdef CONFIG_CLKDEV_LOOKUP 3052#ifdef CONFIG_CLKDEV_LOOKUP
diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
index ed4d89c8b52a..e90daf8cdaa8 100644
--- a/sound/usb/mixer.c
+++ b/sound/usb/mixer.c
@@ -1331,16 +1331,23 @@ static int parse_audio_feature_unit(struct mixer_build *state, int unitid, void
1331 } 1331 }
1332 channels = (hdr->bLength - 7) / csize - 1; 1332 channels = (hdr->bLength - 7) / csize - 1;
1333 bmaControls = hdr->bmaControls; 1333 bmaControls = hdr->bmaControls;
1334 if (hdr->bLength < 7 + csize) {
1335 snd_printk(KERN_ERR "usbaudio: unit %u: "
1336 "invalid UAC_FEATURE_UNIT descriptor\n",
1337 unitid);
1338 return -EINVAL;
1339 }
1334 } else { 1340 } else {
1335 struct uac2_feature_unit_descriptor *ftr = _ftr; 1341 struct uac2_feature_unit_descriptor *ftr = _ftr;
1336 csize = 4; 1342 csize = 4;
1337 channels = (hdr->bLength - 6) / 4 - 1; 1343 channels = (hdr->bLength - 6) / 4 - 1;
1338 bmaControls = ftr->bmaControls; 1344 bmaControls = ftr->bmaControls;
1339 } 1345 if (hdr->bLength < 6 + csize) {
1340 1346 snd_printk(KERN_ERR "usbaudio: unit %u: "
1341 if (hdr->bLength < 7 || !csize || hdr->bLength < 7 + csize) { 1347 "invalid UAC_FEATURE_UNIT descriptor\n",
1342 snd_printk(KERN_ERR "usbaudio: unit %u: invalid UAC_FEATURE_UNIT descriptor\n", unitid); 1348 unitid);
1343 return -EINVAL; 1349 return -EINVAL;
1350 }
1344 } 1351 }
1345 1352
1346 /* parse the source unit */ 1353 /* parse the source unit */