aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorOlof Johansson <olof@lixom.net>2013-02-05 01:56:41 -0500
committerOlof Johansson <olof@lixom.net>2013-02-05 01:56:41 -0500
commit469da62096e23adc755c1268b00b5fc7a214151b (patch)
treefefd055fdae584e38d551f44d1339eb22cee4ed9 /sound
parent4227961650884a06757f80877d5dce0bddc723d4 (diff)
parent88b62b915b0b7e25870eb0604ed9a92ba4bfc9f7 (diff)
Merge tag 'v3.8-rc6' into next/soc
Linux 3.8-rc6
Diffstat (limited to 'sound')
-rw-r--r--sound/arm/pxa2xx-ac97-lib.c26
-rw-r--r--sound/pci/hda/hda_codec.c5
-rw-r--r--sound/pci/hda/hda_intel.c62
-rw-r--r--sound/pci/hda/patch_conexant.c25
-rw-r--r--sound/pci/hda/patch_hdmi.c2
-rw-r--r--sound/pci/hda/patch_realtek.c28
-rw-r--r--sound/pci/rme9652/hdspm.c17
-rw-r--r--sound/soc/codecs/arizona.c14
-rw-r--r--sound/soc/codecs/arizona.h18
-rw-r--r--sound/soc/codecs/cs4271.c6
-rw-r--r--sound/soc/codecs/cs42l52.c4
-rw-r--r--sound/soc/codecs/lm49453.c106
-rw-r--r--sound/soc/codecs/sgtl5000.c4
-rw-r--r--sound/soc/codecs/sta529.c9
-rw-r--r--sound/soc/codecs/wm2000.c4
-rw-r--r--sound/soc/codecs/wm2200.c11
-rw-r--r--sound/soc/codecs/wm5100.c6
-rw-r--r--sound/soc/codecs/wm5102.c51
-rw-r--r--sound/soc/codecs/wm5110.c3
-rw-r--r--sound/soc/codecs/wm_adsp.c25
-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-core.c35
-rw-r--r--sound/soc/soc-dapm.c12
-rw-r--r--sound/soc/soc-pcm.c1
-rw-r--r--sound/usb/mixer.c17
-rw-r--r--sound/usb/mixer_maps.c13
-rw-r--r--sound/usb/mixer_quirks.c2
-rw-r--r--sound/usb/pcm.c10
-rw-r--r--sound/usb/quirks-table.h4
-rw-r--r--sound/usb/quirks.c19
32 files changed, 355 insertions, 201 deletions
diff --git a/sound/arm/pxa2xx-ac97-lib.c b/sound/arm/pxa2xx-ac97-lib.c
index 6fc0ae90e5b1..fff7753e35c1 100644
--- a/sound/arm/pxa2xx-ac97-lib.c
+++ b/sound/arm/pxa2xx-ac97-lib.c
@@ -18,6 +18,7 @@
18#include <linux/delay.h> 18#include <linux/delay.h>
19#include <linux/module.h> 19#include <linux/module.h>
20#include <linux/io.h> 20#include <linux/io.h>
21#include <linux/gpio.h>
21 22
22#include <sound/ac97_codec.h> 23#include <sound/ac97_codec.h>
23#include <sound/pxa2xx-lib.h> 24#include <sound/pxa2xx-lib.h>
@@ -148,6 +149,8 @@ static inline void pxa_ac97_warm_pxa27x(void)
148 149
149static inline void pxa_ac97_cold_pxa27x(void) 150static inline void pxa_ac97_cold_pxa27x(void)
150{ 151{
152 unsigned int timeout;
153
151 GCR &= GCR_COLD_RST; /* clear everything but nCRST */ 154 GCR &= GCR_COLD_RST; /* clear everything but nCRST */
152 GCR &= ~GCR_COLD_RST; /* then assert nCRST */ 155 GCR &= ~GCR_COLD_RST; /* then assert nCRST */
153 156
@@ -157,8 +160,10 @@ static inline void pxa_ac97_cold_pxa27x(void)
157 clk_enable(ac97conf_clk); 160 clk_enable(ac97conf_clk);
158 udelay(5); 161 udelay(5);
159 clk_disable(ac97conf_clk); 162 clk_disable(ac97conf_clk);
160 GCR = GCR_COLD_RST; 163 GCR = GCR_COLD_RST | GCR_WARM_RST;
161 udelay(50); 164 timeout = 100; /* wait for the codec-ready bit to be set */
165 while (!((GSR | gsr_bits) & (GSR_PCR | GSR_SCR)) && timeout--)
166 mdelay(1);
162} 167}
163#endif 168#endif
164 169
@@ -340,8 +345,21 @@ int pxa2xx_ac97_hw_probe(struct platform_device *dev)
340 } 345 }
341 346
342 if (cpu_is_pxa27x()) { 347 if (cpu_is_pxa27x()) {
343 /* Use GPIO 113 as AC97 Reset on Bulverde */ 348 /*
349 * This gpio is needed for a work-around to a bug in the ac97
350 * controller during warm reset. The direction and level is set
351 * here so that it is an output driven high when switching from
352 * AC97_nRESET alt function to generic gpio.
353 */
354 ret = gpio_request_one(reset_gpio, GPIOF_OUT_INIT_HIGH,
355 "pxa27x ac97 reset");
356 if (ret < 0) {
357 pr_err("%s: gpio_request_one() failed: %d\n",
358 __func__, ret);
359 goto err_conf;
360 }
344 pxa27x_assert_ac97reset(reset_gpio, 0); 361 pxa27x_assert_ac97reset(reset_gpio, 0);
362
345 ac97conf_clk = clk_get(&dev->dev, "AC97CONFCLK"); 363 ac97conf_clk = clk_get(&dev->dev, "AC97CONFCLK");
346 if (IS_ERR(ac97conf_clk)) { 364 if (IS_ERR(ac97conf_clk)) {
347 ret = PTR_ERR(ac97conf_clk); 365 ret = PTR_ERR(ac97conf_clk);
@@ -384,6 +402,8 @@ EXPORT_SYMBOL_GPL(pxa2xx_ac97_hw_probe);
384 402
385void pxa2xx_ac97_hw_remove(struct platform_device *dev) 403void pxa2xx_ac97_hw_remove(struct platform_device *dev)
386{ 404{
405 if (cpu_is_pxa27x())
406 gpio_free(reset_gpio);
387 GCR |= GCR_ACLINK_OFF; 407 GCR |= GCR_ACLINK_OFF;
388 free_irq(IRQ_AC97, NULL); 408 free_irq(IRQ_AC97, NULL);
389 if (ac97conf_clk) { 409 if (ac97conf_clk) {
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index b8fb0a5adb9b..822df971972c 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -3654,6 +3654,7 @@ static void hda_call_codec_resume(struct hda_codec *codec)
3654 hda_set_power_state(codec, AC_PWRST_D0); 3654 hda_set_power_state(codec, AC_PWRST_D0);
3655 restore_shutup_pins(codec); 3655 restore_shutup_pins(codec);
3656 hda_exec_init_verbs(codec); 3656 hda_exec_init_verbs(codec);
3657 snd_hda_jack_set_dirty_all(codec);
3657 if (codec->patch_ops.resume) 3658 if (codec->patch_ops.resume)
3658 codec->patch_ops.resume(codec); 3659 codec->patch_ops.resume(codec);
3659 else { 3660 else {
@@ -3665,10 +3666,8 @@ static void hda_call_codec_resume(struct hda_codec *codec)
3665 3666
3666 if (codec->jackpoll_interval) 3667 if (codec->jackpoll_interval)
3667 hda_jackpoll_work(&codec->jackpoll_work.work); 3668 hda_jackpoll_work(&codec->jackpoll_work.work);
3668 else { 3669 else
3669 snd_hda_jack_set_dirty_all(codec);
3670 snd_hda_jack_report_sync(codec); 3670 snd_hda_jack_report_sync(codec);
3671 }
3672 3671
3673 codec->in_pm = 0; 3672 codec->in_pm = 0;
3674 snd_hda_power_down(codec); /* flag down before returning */ 3673 snd_hda_power_down(codec); /* flag down before returning */
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index cca87277baf0..c78286f6e5d8 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -573,9 +573,12 @@ enum {
573#define AZX_DCAPS_PM_RUNTIME (1 << 26) /* runtime PM support */ 573#define AZX_DCAPS_PM_RUNTIME (1 << 26) /* runtime PM support */
574 574
575/* quirks for Intel PCH */ 575/* quirks for Intel PCH */
576#define AZX_DCAPS_INTEL_PCH \ 576#define AZX_DCAPS_INTEL_PCH_NOPM \
577 (AZX_DCAPS_SCH_SNOOP | AZX_DCAPS_BUFSIZE | \ 577 (AZX_DCAPS_SCH_SNOOP | AZX_DCAPS_BUFSIZE | \
578 AZX_DCAPS_COUNT_LPIB_DELAY | AZX_DCAPS_PM_RUNTIME) 578 AZX_DCAPS_COUNT_LPIB_DELAY)
579
580#define AZX_DCAPS_INTEL_PCH \
581 (AZX_DCAPS_INTEL_PCH_NOPM | AZX_DCAPS_PM_RUNTIME)
579 582
580/* quirks for ATI SB / AMD Hudson */ 583/* quirks for ATI SB / AMD Hudson */
581#define AZX_DCAPS_PRESET_ATI_SB \ 584#define AZX_DCAPS_PRESET_ATI_SB \
@@ -653,29 +656,43 @@ static char *driver_short_names[] = {
653#define get_azx_dev(substream) (substream->runtime->private_data) 656#define get_azx_dev(substream) (substream->runtime->private_data)
654 657
655#ifdef CONFIG_X86 658#ifdef CONFIG_X86
656static 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)
657{ 660{
661 int pages;
662
658 if (azx_snoop(chip)) 663 if (azx_snoop(chip))
659 return; 664 return;
660 if (addr && size) { 665 if (!dmab || !dmab->area || !dmab->bytes)
661 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;
662 if (on) 671 if (on)
663 set_memory_wc((unsigned long)addr, pages); 672 set_pages_array_wc(sgbuf->page_table, sgbuf->pages);
664 else 673 else
665 set_memory_wb((unsigned long)addr, pages); 674 set_pages_array_wb(sgbuf->page_table, sgbuf->pages);
675 return;
666 } 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);
667} 684}
668 685
669static 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,
670 bool on) 687 bool on)
671{ 688{
672 __mark_pages_wc(chip, buf->area, buf->bytes, on); 689 __mark_pages_wc(chip, buf, on);
673} 690}
674static 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,
675 struct snd_pcm_runtime *runtime, bool on) 692 struct snd_pcm_substream *substream, bool on)
676{ 693{
677 if (azx_dev->wc_marked != on) { 694 if (azx_dev->wc_marked != on) {
678 __mark_pages_wc(chip, runtime->dma_area, runtime->dma_bytes, on); 695 __mark_pages_wc(chip, snd_pcm_get_dma_buf(substream), on);
679 azx_dev->wc_marked = on; 696 azx_dev->wc_marked = on;
680 } 697 }
681} 698}
@@ -686,7 +703,7 @@ static inline void mark_pages_wc(struct azx *chip, struct snd_dma_buffer *buf,
686{ 703{
687} 704}
688static 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,
689 struct snd_pcm_runtime *runtime, bool on) 706 struct snd_pcm_substream *substream, bool on)
690{ 707{
691} 708}
692#endif 709#endif
@@ -1965,11 +1982,10 @@ static int azx_pcm_hw_params(struct snd_pcm_substream *substream,
1965{ 1982{
1966 struct azx_pcm *apcm = snd_pcm_substream_chip(substream); 1983 struct azx_pcm *apcm = snd_pcm_substream_chip(substream);
1967 struct azx *chip = apcm->chip; 1984 struct azx *chip = apcm->chip;
1968 struct snd_pcm_runtime *runtime = substream->runtime;
1969 struct azx_dev *azx_dev = get_azx_dev(substream); 1985 struct azx_dev *azx_dev = get_azx_dev(substream);
1970 int ret; 1986 int ret;
1971 1987
1972 mark_runtime_wc(chip, azx_dev, runtime, false); 1988 mark_runtime_wc(chip, azx_dev, substream, false);
1973 azx_dev->bufsize = 0; 1989 azx_dev->bufsize = 0;
1974 azx_dev->period_bytes = 0; 1990 azx_dev->period_bytes = 0;
1975 azx_dev->format_val = 0; 1991 azx_dev->format_val = 0;
@@ -1977,7 +1993,7 @@ static int azx_pcm_hw_params(struct snd_pcm_substream *substream,
1977 params_buffer_bytes(hw_params)); 1993 params_buffer_bytes(hw_params));
1978 if (ret < 0) 1994 if (ret < 0)
1979 return ret; 1995 return ret;
1980 mark_runtime_wc(chip, azx_dev, runtime, true); 1996 mark_runtime_wc(chip, azx_dev, substream, true);
1981 return ret; 1997 return ret;
1982} 1998}
1983 1999
@@ -1986,7 +2002,6 @@ static int azx_pcm_hw_free(struct snd_pcm_substream *substream)
1986 struct azx_pcm *apcm = snd_pcm_substream_chip(substream); 2002 struct azx_pcm *apcm = snd_pcm_substream_chip(substream);
1987 struct azx_dev *azx_dev = get_azx_dev(substream); 2003 struct azx_dev *azx_dev = get_azx_dev(substream);
1988 struct azx *chip = apcm->chip; 2004 struct azx *chip = apcm->chip;
1989 struct snd_pcm_runtime *runtime = substream->runtime;
1990 struct hda_pcm_stream *hinfo = apcm->hinfo[substream->stream]; 2005 struct hda_pcm_stream *hinfo = apcm->hinfo[substream->stream];
1991 2006
1992 /* reset BDL address */ 2007 /* reset BDL address */
@@ -1999,7 +2014,7 @@ static int azx_pcm_hw_free(struct snd_pcm_substream *substream)
1999 2014
2000 snd_hda_codec_cleanup(apcm->codec, hinfo, substream); 2015 snd_hda_codec_cleanup(apcm->codec, hinfo, substream);
2001 2016
2002 mark_runtime_wc(chip, azx_dev, runtime, false); 2017 mark_runtime_wc(chip, azx_dev, substream, false);
2003 return snd_pcm_lib_free_pages(substream); 2018 return snd_pcm_lib_free_pages(substream);
2004} 2019}
2005 2020
@@ -3586,13 +3601,13 @@ static void azx_remove(struct pci_dev *pci)
3586static DEFINE_PCI_DEVICE_TABLE(azx_ids) = { 3601static DEFINE_PCI_DEVICE_TABLE(azx_ids) = {
3587 /* CPT */ 3602 /* CPT */
3588 { PCI_DEVICE(0x8086, 0x1c20), 3603 { PCI_DEVICE(0x8086, 0x1c20),
3589 .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH }, 3604 .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH_NOPM },
3590 /* PBG */ 3605 /* PBG */
3591 { PCI_DEVICE(0x8086, 0x1d20), 3606 { PCI_DEVICE(0x8086, 0x1d20),
3592 .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH }, 3607 .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH_NOPM },
3593 /* Panther Point */ 3608 /* Panther Point */
3594 { PCI_DEVICE(0x8086, 0x1e20), 3609 { PCI_DEVICE(0x8086, 0x1e20),
3595 .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH }, 3610 .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH_NOPM },
3596 /* Lynx Point */ 3611 /* Lynx Point */
3597 { PCI_DEVICE(0x8086, 0x8c20), 3612 { PCI_DEVICE(0x8086, 0x8c20),
3598 .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH }, 3613 .driver_data = AZX_DRIVER_PCH | AZX_DCAPS_INTEL_PCH },
@@ -3610,13 +3625,12 @@ static DEFINE_PCI_DEVICE_TABLE(azx_ids) = {
3610 /* 5 Series/3400 */ 3625 /* 5 Series/3400 */
3611 { PCI_DEVICE(0x8086, 0x3b56), 3626 { PCI_DEVICE(0x8086, 0x3b56),
3612 .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_INTEL_PCH }, 3627 .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_INTEL_PCH },
3613 /* SCH */ 3628 /* Poulsbo */
3614 { PCI_DEVICE(0x8086, 0x811b), 3629 { PCI_DEVICE(0x8086, 0x811b),
3615 .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_SCH_SNOOP | 3630 .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_INTEL_PCH_NOPM },
3616 AZX_DCAPS_BUFSIZE | AZX_DCAPS_POSFIX_LPIB }, /* Poulsbo */ 3631 /* Oaktrail */
3617 { PCI_DEVICE(0x8086, 0x080a), 3632 { PCI_DEVICE(0x8086, 0x080a),
3618 .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_SCH_SNOOP | 3633 .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_INTEL_PCH_NOPM },
3619 AZX_DCAPS_BUFSIZE | AZX_DCAPS_POSFIX_LPIB }, /* Oaktrail */
3620 /* ICH */ 3634 /* ICH */
3621 { PCI_DEVICE(0x8086, 0x2668), 3635 { PCI_DEVICE(0x8086, 0x2668),
3622 .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_conexant.c b/sound/pci/hda/patch_conexant.c
index 60890bfecc19..009b77a693cf 100644
--- a/sound/pci/hda/patch_conexant.c
+++ b/sound/pci/hda/patch_conexant.c
@@ -558,24 +558,12 @@ static int conexant_build_controls(struct hda_codec *codec)
558 return 0; 558 return 0;
559} 559}
560 560
561#ifdef CONFIG_PM
562static int conexant_suspend(struct hda_codec *codec)
563{
564 snd_hda_shutup_pins(codec);
565 return 0;
566}
567#endif
568
569static const struct hda_codec_ops conexant_patch_ops = { 561static const struct hda_codec_ops conexant_patch_ops = {
570 .build_controls = conexant_build_controls, 562 .build_controls = conexant_build_controls,
571 .build_pcms = conexant_build_pcms, 563 .build_pcms = conexant_build_pcms,
572 .init = conexant_init, 564 .init = conexant_init,
573 .free = conexant_free, 565 .free = conexant_free,
574 .set_power_state = conexant_set_power, 566 .set_power_state = conexant_set_power,
575#ifdef CONFIG_PM
576 .suspend = conexant_suspend,
577#endif
578 .reboot_notify = snd_hda_shutup_pins,
579}; 567};
580 568
581#ifdef CONFIG_SND_HDA_INPUT_BEEP 569#ifdef CONFIG_SND_HDA_INPUT_BEEP
@@ -4405,10 +4393,6 @@ static const struct hda_codec_ops cx_auto_patch_ops = {
4405 .init = cx_auto_init, 4393 .init = cx_auto_init,
4406 .free = conexant_free, 4394 .free = conexant_free,
4407 .unsol_event = snd_hda_jack_unsol_event, 4395 .unsol_event = snd_hda_jack_unsol_event,
4408#ifdef CONFIG_PM
4409 .suspend = conexant_suspend,
4410#endif
4411 .reboot_notify = snd_hda_shutup_pins,
4412}; 4396};
4413 4397
4414/* 4398/*
@@ -4652,6 +4636,12 @@ static const struct hda_codec_preset snd_hda_preset_conexant[] = {
4652 .patch = patch_conexant_auto }, 4636 .patch = patch_conexant_auto },
4653 { .id = 0x14f15111, .name = "CX20753/4", 4637 { .id = 0x14f15111, .name = "CX20753/4",
4654 .patch = patch_conexant_auto }, 4638 .patch = patch_conexant_auto },
4639 { .id = 0x14f15113, .name = "CX20755",
4640 .patch = patch_conexant_auto },
4641 { .id = 0x14f15114, .name = "CX20756",
4642 .patch = patch_conexant_auto },
4643 { .id = 0x14f15115, .name = "CX20757",
4644 .patch = patch_conexant_auto },
4655 {} /* terminator */ 4645 {} /* terminator */
4656}; 4646};
4657 4647
@@ -4675,6 +4665,9 @@ MODULE_ALIAS("snd-hda-codec-id:14f150b9");
4675MODULE_ALIAS("snd-hda-codec-id:14f1510f"); 4665MODULE_ALIAS("snd-hda-codec-id:14f1510f");
4676MODULE_ALIAS("snd-hda-codec-id:14f15110"); 4666MODULE_ALIAS("snd-hda-codec-id:14f15110");
4677MODULE_ALIAS("snd-hda-codec-id:14f15111"); 4667MODULE_ALIAS("snd-hda-codec-id:14f15111");
4668MODULE_ALIAS("snd-hda-codec-id:14f15113");
4669MODULE_ALIAS("snd-hda-codec-id:14f15114");
4670MODULE_ALIAS("snd-hda-codec-id:14f15115");
4678 4671
4679MODULE_LICENSE("GPL"); 4672MODULE_LICENSE("GPL");
4680MODULE_DESCRIPTION("Conexant HD-audio codec"); 4673MODULE_DESCRIPTION("Conexant HD-audio codec");
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
index b6c21ea187ca..807a2aa1ff38 100644
--- a/sound/pci/hda/patch_hdmi.c
+++ b/sound/pci/hda/patch_hdmi.c
@@ -1502,7 +1502,7 @@ static int hdmi_chmap_ctl_put(struct snd_kcontrol *kcontrol,
1502 ctl_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); 1502 ctl_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
1503 substream = snd_pcm_chmap_substream(info, ctl_idx); 1503 substream = snd_pcm_chmap_substream(info, ctl_idx);
1504 if (!substream || !substream->runtime) 1504 if (!substream || !substream->runtime)
1505 return -EBADFD; 1505 return 0; /* just for avoiding error from alsactl restore */
1506 switch (substream->runtime->status->state) { 1506 switch (substream->runtime->status->state) {
1507 case SNDRV_PCM_STATE_OPEN: 1507 case SNDRV_PCM_STATE_OPEN:
1508 case SNDRV_PCM_STATE_SETUP: 1508 case SNDRV_PCM_STATE_SETUP:
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 71ae23dd7103..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 */
@@ -5817,6 +5819,9 @@ enum {
5817 ALC269_TYPE_ALC269VB, 5819 ALC269_TYPE_ALC269VB,
5818 ALC269_TYPE_ALC269VC, 5820 ALC269_TYPE_ALC269VC,
5819 ALC269_TYPE_ALC269VD, 5821 ALC269_TYPE_ALC269VD,
5822 ALC269_TYPE_ALC280,
5823 ALC269_TYPE_ALC282,
5824 ALC269_TYPE_ALC284,
5820}; 5825};
5821 5826
5822/* 5827/*
@@ -5833,10 +5838,13 @@ static int alc269_parse_auto_config(struct hda_codec *codec)
5833 switch (spec->codec_variant) { 5838 switch (spec->codec_variant) {
5834 case ALC269_TYPE_ALC269VA: 5839 case ALC269_TYPE_ALC269VA:
5835 case ALC269_TYPE_ALC269VC: 5840 case ALC269_TYPE_ALC269VC:
5841 case ALC269_TYPE_ALC280:
5842 case ALC269_TYPE_ALC284:
5836 ssids = alc269va_ssids; 5843 ssids = alc269va_ssids;
5837 break; 5844 break;
5838 case ALC269_TYPE_ALC269VB: 5845 case ALC269_TYPE_ALC269VB:
5839 case ALC269_TYPE_ALC269VD: 5846 case ALC269_TYPE_ALC269VD:
5847 case ALC269_TYPE_ALC282:
5840 ssids = alc269_ssids; 5848 ssids = alc269_ssids;
5841 break; 5849 break;
5842 default: 5850 default:
@@ -6245,6 +6253,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
6245 SND_PCI_QUIRK(0x1025, 0x0349, "Acer AOD260", ALC269_FIXUP_INV_DMIC), 6253 SND_PCI_QUIRK(0x1025, 0x0349, "Acer AOD260", ALC269_FIXUP_INV_DMIC),
6246 SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_MIC2_MUTE_LED), 6254 SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_MIC2_MUTE_LED),
6247 SND_PCI_QUIRK(0x103c, 0x1972, "HP Pavilion 17", ALC269_FIXUP_MIC1_MUTE_LED), 6255 SND_PCI_QUIRK(0x103c, 0x1972, "HP Pavilion 17", ALC269_FIXUP_MIC1_MUTE_LED),
6256 SND_PCI_QUIRK(0x103c, 0x1977, "HP Pavilion 14", ALC269_FIXUP_MIC1_MUTE_LED),
6248 SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_DMIC), 6257 SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_DMIC),
6249 SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_DMIC), 6258 SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_DMIC),
6250 SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW), 6259 SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
@@ -6259,6 +6268,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
6259 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ), 6268 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
6260 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO), 6269 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
6261 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z), 6270 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
6271 SND_PCI_QUIRK(0x1025, 0x0740, "Acer AO725", ALC271_FIXUP_HP_GATE_MIC_JACK),
6262 SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK), 6272 SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK),
6263 SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC), 6273 SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC),
6264 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK), 6274 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK),
@@ -6400,7 +6410,8 @@ static int patch_alc269(struct hda_codec *codec)
6400 6410
6401 alc_auto_parse_customize_define(codec); 6411 alc_auto_parse_customize_define(codec);
6402 6412
6403 if (codec->vendor_id == 0x10ec0269) { 6413 switch (codec->vendor_id) {
6414 case 0x10ec0269:
6404 spec->codec_variant = ALC269_TYPE_ALC269VA; 6415 spec->codec_variant = ALC269_TYPE_ALC269VA;
6405 switch (alc_get_coef0(codec) & 0x00f0) { 6416 switch (alc_get_coef0(codec) & 0x00f0) {
6406 case 0x0010: 6417 case 0x0010:
@@ -6425,6 +6436,20 @@ static int patch_alc269(struct hda_codec *codec)
6425 goto error; 6436 goto error;
6426 spec->init_hook = alc269_fill_coef; 6437 spec->init_hook = alc269_fill_coef;
6427 alc269_fill_coef(codec); 6438 alc269_fill_coef(codec);
6439 break;
6440
6441 case 0x10ec0280:
6442 case 0x10ec0290:
6443 spec->codec_variant = ALC269_TYPE_ALC280;
6444 break;
6445 case 0x10ec0282:
6446 case 0x10ec0283:
6447 spec->codec_variant = ALC269_TYPE_ALC282;
6448 break;
6449 case 0x10ec0284:
6450 case 0x10ec0292:
6451 spec->codec_variant = ALC269_TYPE_ALC284;
6452 break;
6428 } 6453 }
6429 6454
6430 /* automatic parse from the BIOS config */ 6455 /* automatic parse from the BIOS config */
@@ -7129,6 +7154,7 @@ static const struct hda_codec_preset snd_hda_preset_realtek[] = {
7129 { .id = 0x10ec0280, .name = "ALC280", .patch = patch_alc269 }, 7154 { .id = 0x10ec0280, .name = "ALC280", .patch = patch_alc269 },
7130 { .id = 0x10ec0282, .name = "ALC282", .patch = patch_alc269 }, 7155 { .id = 0x10ec0282, .name = "ALC282", .patch = patch_alc269 },
7131 { .id = 0x10ec0283, .name = "ALC283", .patch = patch_alc269 }, 7156 { .id = 0x10ec0283, .name = "ALC283", .patch = patch_alc269 },
7157 { .id = 0x10ec0284, .name = "ALC284", .patch = patch_alc269 },
7132 { .id = 0x10ec0290, .name = "ALC290", .patch = patch_alc269 }, 7158 { .id = 0x10ec0290, .name = "ALC290", .patch = patch_alc269 },
7133 { .id = 0x10ec0292, .name = "ALC292", .patch = patch_alc269 }, 7159 { .id = 0x10ec0292, .name = "ALC292", .patch = patch_alc269 },
7134 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", 7160 { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660",
diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c
index 6e02e064d7b4..223c3d9cc69e 100644
--- a/sound/pci/rme9652/hdspm.c
+++ b/sound/pci/rme9652/hdspm.c
@@ -441,6 +441,7 @@ MODULE_SUPPORTED_DEVICE("{{RME HDSPM-MADI}}");
441*/ 441*/
442/* status */ 442/* status */
443#define HDSPM_AES32_wcLock 0x0200000 443#define HDSPM_AES32_wcLock 0x0200000
444#define HDSPM_AES32_wcSync 0x0100000
444#define HDSPM_AES32_wcFreq_bit 22 445#define HDSPM_AES32_wcFreq_bit 22
445/* (status >> HDSPM_AES32_wcFreq_bit) & 0xF gives WC frequency (cf function 446/* (status >> HDSPM_AES32_wcFreq_bit) & 0xF gives WC frequency (cf function
446 HDSPM_bit2freq */ 447 HDSPM_bit2freq */
@@ -3467,10 +3468,12 @@ static int hdspm_wc_sync_check(struct hdspm *hdspm)
3467 switch (hdspm->io_type) { 3468 switch (hdspm->io_type) {
3468 case AES32: 3469 case AES32:
3469 status = hdspm_read(hdspm, HDSPM_statusRegister); 3470 status = hdspm_read(hdspm, HDSPM_statusRegister);
3470 if (status & HDSPM_wcSync) 3471 if (status & HDSPM_AES32_wcLock) {
3471 return 2; 3472 if (status & HDSPM_AES32_wcSync)
3472 else if (status & HDSPM_wcLock) 3473 return 2;
3473 return 1; 3474 else
3475 return 1;
3476 }
3474 return 0; 3477 return 0;
3475 break; 3478 break;
3476 3479
@@ -4658,6 +4661,7 @@ snd_hdspm_proc_read_aes32(struct snd_info_entry * entry,
4658 unsigned int status; 4661 unsigned int status;
4659 unsigned int status2; 4662 unsigned int status2;
4660 unsigned int timecode; 4663 unsigned int timecode;
4664 unsigned int wcLock, wcSync;
4661 int pref_syncref; 4665 int pref_syncref;
4662 char *autosync_ref; 4666 char *autosync_ref;
4663 int x; 4667 int x;
@@ -4751,8 +4755,11 @@ snd_hdspm_proc_read_aes32(struct snd_info_entry * entry,
4751 4755
4752 snd_iprintf(buffer, "--- Status:\n"); 4756 snd_iprintf(buffer, "--- Status:\n");
4753 4757
4758 wcLock = status & HDSPM_AES32_wcLock;
4759 wcSync = wcLock && (status & HDSPM_AES32_wcSync);
4760
4754 snd_iprintf(buffer, "Word: %s Frequency: %d\n", 4761 snd_iprintf(buffer, "Word: %s Frequency: %d\n",
4755 (status & HDSPM_AES32_wcLock) ? "Sync " : "No Lock", 4762 (wcLock) ? (wcSync ? "Sync " : "Lock ") : "No Lock",
4756 HDSPM_bit2freq((status >> HDSPM_AES32_wcFreq_bit) & 0xF)); 4763 HDSPM_bit2freq((status >> HDSPM_AES32_wcFreq_bit) & 0xF));
4757 4764
4758 for (x = 0; x < 8; x++) { 4765 for (x = 0; x < 8; x++) {
diff --git a/sound/soc/codecs/arizona.c b/sound/soc/codecs/arizona.c
index adf397b9d0e6..ef62c435848e 100644
--- a/sound/soc/codecs/arizona.c
+++ b/sound/soc/codecs/arizona.c
@@ -446,15 +446,9 @@ static int arizona_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
446 case SND_SOC_DAIFMT_DSP_A: 446 case SND_SOC_DAIFMT_DSP_A:
447 mode = 0; 447 mode = 0;
448 break; 448 break;
449 case SND_SOC_DAIFMT_DSP_B:
450 mode = 1;
451 break;
452 case SND_SOC_DAIFMT_I2S: 449 case SND_SOC_DAIFMT_I2S:
453 mode = 2; 450 mode = 2;
454 break; 451 break;
455 case SND_SOC_DAIFMT_LEFT_J:
456 mode = 3;
457 break;
458 default: 452 default:
459 arizona_aif_err(dai, "Unsupported DAI format %d\n", 453 arizona_aif_err(dai, "Unsupported DAI format %d\n",
460 fmt & SND_SOC_DAIFMT_FORMAT_MASK); 454 fmt & SND_SOC_DAIFMT_FORMAT_MASK);
@@ -691,7 +685,7 @@ static int arizona_hw_params(struct snd_pcm_substream *substream,
691 } 685 }
692 sr_val = i; 686 sr_val = i;
693 687
694 lrclk = snd_soc_params_to_bclk(params) / params_rate(params); 688 lrclk = rates[bclk] / params_rate(params);
695 689
696 arizona_aif_dbg(dai, "BCLK %dHz LRCLK %dHz\n", 690 arizona_aif_dbg(dai, "BCLK %dHz LRCLK %dHz\n",
697 rates[bclk], rates[bclk] / lrclk); 691 rates[bclk], rates[bclk] / lrclk);
@@ -714,7 +708,8 @@ static int arizona_hw_params(struct snd_pcm_substream *substream,
714 snd_soc_update_bits(codec, ARIZONA_ASYNC_SAMPLE_RATE_1, 708 snd_soc_update_bits(codec, ARIZONA_ASYNC_SAMPLE_RATE_1,
715 ARIZONA_ASYNC_SAMPLE_RATE_MASK, sr_val); 709 ARIZONA_ASYNC_SAMPLE_RATE_MASK, sr_val);
716 snd_soc_update_bits(codec, base + ARIZONA_AIF_RATE_CTRL, 710 snd_soc_update_bits(codec, base + ARIZONA_AIF_RATE_CTRL,
717 ARIZONA_AIF1_RATE_MASK, 8); 711 ARIZONA_AIF1_RATE_MASK,
712 8 << ARIZONA_AIF1_RATE_SHIFT);
718 break; 713 break;
719 default: 714 default:
720 arizona_aif_err(dai, "Invalid clock %d\n", dai_priv->clk); 715 arizona_aif_err(dai, "Invalid clock %d\n", dai_priv->clk);
@@ -1087,6 +1082,9 @@ int arizona_init_fll(struct arizona *arizona, int id, int base, int lock_irq,
1087 id, ret); 1082 id, ret);
1088 } 1083 }
1089 1084
1085 regmap_update_bits(arizona->regmap, fll->base + 1,
1086 ARIZONA_FLL1_FREERUN, 0);
1087
1090 return 0; 1088 return 0;
1091} 1089}
1092EXPORT_SYMBOL_GPL(arizona_init_fll); 1090EXPORT_SYMBOL_GPL(arizona_init_fll);
diff --git a/sound/soc/codecs/arizona.h b/sound/soc/codecs/arizona.h
index 41dae1ed3b71..4deebeb07177 100644
--- a/sound/soc/codecs/arizona.h
+++ b/sound/soc/codecs/arizona.h
@@ -34,15 +34,15 @@
34 34
35#define ARIZONA_FLL_SRC_MCLK1 0 35#define ARIZONA_FLL_SRC_MCLK1 0
36#define ARIZONA_FLL_SRC_MCLK2 1 36#define ARIZONA_FLL_SRC_MCLK2 1
37#define ARIZONA_FLL_SRC_SLIMCLK 2 37#define ARIZONA_FLL_SRC_SLIMCLK 3
38#define ARIZONA_FLL_SRC_FLL1 3 38#define ARIZONA_FLL_SRC_FLL1 4
39#define ARIZONA_FLL_SRC_FLL2 4 39#define ARIZONA_FLL_SRC_FLL2 5
40#define ARIZONA_FLL_SRC_AIF1BCLK 5 40#define ARIZONA_FLL_SRC_AIF1BCLK 8
41#define ARIZONA_FLL_SRC_AIF2BCLK 6 41#define ARIZONA_FLL_SRC_AIF2BCLK 9
42#define ARIZONA_FLL_SRC_AIF3BCLK 7 42#define ARIZONA_FLL_SRC_AIF3BCLK 10
43#define ARIZONA_FLL_SRC_AIF1LRCLK 8 43#define ARIZONA_FLL_SRC_AIF1LRCLK 12
44#define ARIZONA_FLL_SRC_AIF2LRCLK 9 44#define ARIZONA_FLL_SRC_AIF2LRCLK 13
45#define ARIZONA_FLL_SRC_AIF3LRCLK 10 45#define ARIZONA_FLL_SRC_AIF3LRCLK 14
46 46
47#define ARIZONA_MIXER_VOL_MASK 0x00FE 47#define ARIZONA_MIXER_VOL_MASK 0x00FE
48#define ARIZONA_MIXER_VOL_SHIFT 1 48#define ARIZONA_MIXER_VOL_SHIFT 1
diff --git a/sound/soc/codecs/cs4271.c b/sound/soc/codecs/cs4271.c
index 4f1127935fdf..ac8742a1f25a 100644
--- a/sound/soc/codecs/cs4271.c
+++ b/sound/soc/codecs/cs4271.c
@@ -474,16 +474,16 @@ static int cs4271_probe(struct snd_soc_codec *codec)
474 struct cs4271_platform_data *cs4271plat = codec->dev->platform_data; 474 struct cs4271_platform_data *cs4271plat = codec->dev->platform_data;
475 int ret; 475 int ret;
476 int gpio_nreset = -EINVAL; 476 int gpio_nreset = -EINVAL;
477 int amutec_eq_bmutec = 0; 477 bool amutec_eq_bmutec = false;
478 478
479#ifdef CONFIG_OF 479#ifdef CONFIG_OF
480 if (of_match_device(cs4271_dt_ids, codec->dev)) { 480 if (of_match_device(cs4271_dt_ids, codec->dev)) {
481 gpio_nreset = of_get_named_gpio(codec->dev->of_node, 481 gpio_nreset = of_get_named_gpio(codec->dev->of_node,
482 "reset-gpio", 0); 482 "reset-gpio", 0);
483 483
484 if (!of_get_property(codec->dev->of_node, 484 if (of_get_property(codec->dev->of_node,
485 "cirrus,amutec-eq-bmutec", NULL)) 485 "cirrus,amutec-eq-bmutec", NULL))
486 amutec_eq_bmutec = 1; 486 amutec_eq_bmutec = true;
487 } 487 }
488#endif 488#endif
489 489
diff --git a/sound/soc/codecs/cs42l52.c b/sound/soc/codecs/cs42l52.c
index 99bb1c69499e..9811a5478c87 100644
--- a/sound/soc/codecs/cs42l52.c
+++ b/sound/soc/codecs/cs42l52.c
@@ -737,7 +737,7 @@ static const struct cs42l52_clk_para clk_map_table[] = {
737 737
738static int cs42l52_get_clk(int mclk, int rate) 738static int cs42l52_get_clk(int mclk, int rate)
739{ 739{
740 int i, ret = 0; 740 int i, ret = -EINVAL;
741 u_int mclk1, mclk2 = 0; 741 u_int mclk1, mclk2 = 0;
742 742
743 for (i = 0; i < ARRAY_SIZE(clk_map_table); i++) { 743 for (i = 0; i < ARRAY_SIZE(clk_map_table); i++) {
@@ -749,8 +749,6 @@ static int cs42l52_get_clk(int mclk, int rate)
749 } 749 }
750 } 750 }
751 } 751 }
752 if (ret > ARRAY_SIZE(clk_map_table))
753 return -EINVAL;
754 return ret; 752 return ret;
755} 753}
756 754
diff --git a/sound/soc/codecs/lm49453.c b/sound/soc/codecs/lm49453.c
index d75257d40a49..e19490cfb3a8 100644
--- a/sound/soc/codecs/lm49453.c
+++ b/sound/soc/codecs/lm49453.c
@@ -111,9 +111,9 @@ static struct reg_default lm49453_reg_defs[] = {
111 { 101, 0x00 }, 111 { 101, 0x00 },
112 { 102, 0x00 }, 112 { 102, 0x00 },
113 { 103, 0x01 }, 113 { 103, 0x01 },
114 { 105, 0x01 }, 114 { 104, 0x01 },
115 { 106, 0x00 }, 115 { 105, 0x00 },
116 { 107, 0x01 }, 116 { 106, 0x01 },
117 { 107, 0x00 }, 117 { 107, 0x00 },
118 { 108, 0x00 }, 118 { 108, 0x00 },
119 { 109, 0x00 }, 119 { 109, 0x00 },
@@ -163,56 +163,25 @@ static struct reg_default lm49453_reg_defs[] = {
163 { 184, 0x00 }, 163 { 184, 0x00 },
164 { 185, 0x00 }, 164 { 185, 0x00 },
165 { 186, 0x00 }, 165 { 186, 0x00 },
166 { 189, 0x00 }, 166 { 187, 0x00 },
167 { 188, 0x00 }, 167 { 188, 0x00 },
168 { 194, 0x00 }, 168 { 189, 0x00 },
169 { 195, 0x00 }, 169 { 208, 0x06 },
170 { 196, 0x00 },
171 { 197, 0x00 },
172 { 200, 0x00 },
173 { 201, 0x00 },
174 { 202, 0x00 },
175 { 203, 0x00 },
176 { 204, 0x00 },
177 { 205, 0x00 },
178 { 208, 0x00 },
179 { 209, 0x00 }, 170 { 209, 0x00 },
180 { 210, 0x00 }, 171 { 210, 0x08 },
181 { 211, 0x00 }, 172 { 211, 0x54 },
182 { 213, 0x00 }, 173 { 212, 0x14 },
183 { 214, 0x00 }, 174 { 213, 0x0d },
184 { 215, 0x00 }, 175 { 214, 0x0d },
185 { 216, 0x00 }, 176 { 215, 0x14 },
186 { 217, 0x00 }, 177 { 216, 0x60 },
187 { 218, 0x00 },
188 { 219, 0x00 },
189 { 221, 0x00 }, 178 { 221, 0x00 },
190 { 222, 0x00 }, 179 { 222, 0x00 },
180 { 223, 0x00 },
191 { 224, 0x00 }, 181 { 224, 0x00 },
192 { 225, 0x00 },
193 { 226, 0x00 },
194 { 227, 0x00 },
195 { 228, 0x00 },
196 { 229, 0x00 },
197 { 230, 0x13 },
198 { 231, 0x00 },
199 { 232, 0x80 },
200 { 233, 0x0C },
201 { 234, 0xDD },
202 { 235, 0x00 },
203 { 236, 0x04 },
204 { 237, 0x00 },
205 { 238, 0x00 },
206 { 239, 0x00 },
207 { 240, 0x00 },
208 { 241, 0x00 },
209 { 242, 0x00 },
210 { 243, 0x00 },
211 { 244, 0x00 },
212 { 245, 0x00 },
213 { 248, 0x00 }, 182 { 248, 0x00 },
214 { 249, 0x00 }, 183 { 249, 0x00 },
215 { 254, 0x00 }, 184 { 250, 0x00 },
216 { 255, 0x00 }, 185 { 255, 0x00 },
217}; 186};
218 187
@@ -525,36 +494,41 @@ SOC_DAPM_SINGLE("Port2_2 Switch", LM49453_P0_PORT2_TX2_REG, 7, 1, 0),
525}; 494};
526 495
527/* TLV Declarations */ 496/* TLV Declarations */
528static const DECLARE_TLV_DB_SCALE(digital_tlv, -7650, 150, 1); 497static const DECLARE_TLV_DB_SCALE(adc_dac_tlv, -7650, 150, 1);
529static const DECLARE_TLV_DB_SCALE(port_tlv, 0, 600, 0); 498static const DECLARE_TLV_DB_SCALE(mic_tlv, 0, 200, 1);
499static const DECLARE_TLV_DB_SCALE(port_tlv, -1800, 600, 0);
500static const DECLARE_TLV_DB_SCALE(stn_tlv, -7200, 150, 0);
530 501
531static const struct snd_kcontrol_new lm49453_sidetone_mixer_controls[] = { 502static const struct snd_kcontrol_new lm49453_sidetone_mixer_controls[] = {
532/* Sidetone supports mono only */ 503/* Sidetone supports mono only */
533SOC_DAPM_SINGLE_TLV("Sidetone ADCL Volume", LM49453_P0_STN_VOL_ADCL_REG, 504SOC_DAPM_SINGLE_TLV("Sidetone ADCL Volume", LM49453_P0_STN_VOL_ADCL_REG,
534 0, 0x3F, 0, digital_tlv), 505 0, 0x3F, 0, stn_tlv),
535SOC_DAPM_SINGLE_TLV("Sidetone ADCR Volume", LM49453_P0_STN_VOL_ADCR_REG, 506SOC_DAPM_SINGLE_TLV("Sidetone ADCR Volume", LM49453_P0_STN_VOL_ADCR_REG,
536 0, 0x3F, 0, digital_tlv), 507 0, 0x3F, 0, stn_tlv),
537SOC_DAPM_SINGLE_TLV("Sidetone DMIC1L Volume", LM49453_P0_STN_VOL_DMIC1L_REG, 508SOC_DAPM_SINGLE_TLV("Sidetone DMIC1L Volume", LM49453_P0_STN_VOL_DMIC1L_REG,
538 0, 0x3F, 0, digital_tlv), 509 0, 0x3F, 0, stn_tlv),
539SOC_DAPM_SINGLE_TLV("Sidetone DMIC1R Volume", LM49453_P0_STN_VOL_DMIC1R_REG, 510SOC_DAPM_SINGLE_TLV("Sidetone DMIC1R Volume", LM49453_P0_STN_VOL_DMIC1R_REG,
540 0, 0x3F, 0, digital_tlv), 511 0, 0x3F, 0, stn_tlv),
541SOC_DAPM_SINGLE_TLV("Sidetone DMIC2L Volume", LM49453_P0_STN_VOL_DMIC2L_REG, 512SOC_DAPM_SINGLE_TLV("Sidetone DMIC2L Volume", LM49453_P0_STN_VOL_DMIC2L_REG,
542 0, 0x3F, 0, digital_tlv), 513 0, 0x3F, 0, stn_tlv),
543SOC_DAPM_SINGLE_TLV("Sidetone DMIC2R Volume", LM49453_P0_STN_VOL_DMIC2R_REG, 514SOC_DAPM_SINGLE_TLV("Sidetone DMIC2R Volume", LM49453_P0_STN_VOL_DMIC2R_REG,
544 0, 0x3F, 0, digital_tlv), 515 0, 0x3F, 0, stn_tlv),
545}; 516};
546 517
547static const struct snd_kcontrol_new lm49453_snd_controls[] = { 518static const struct snd_kcontrol_new lm49453_snd_controls[] = {
548 /* mic1 and mic2 supports mono only */ 519 /* mic1 and mic2 supports mono only */
549 SOC_SINGLE_TLV("Mic1 Volume", LM49453_P0_ADC_LEVELL_REG, 0, 6, 520 SOC_SINGLE_TLV("Mic1 Volume", LM49453_P0_MICL_REG, 0, 15, 0, mic_tlv),
550 0, digital_tlv), 521 SOC_SINGLE_TLV("Mic2 Volume", LM49453_P0_MICR_REG, 0, 15, 0, mic_tlv),
551 SOC_SINGLE_TLV("Mic2 Volume", LM49453_P0_ADC_LEVELR_REG, 0, 6, 522
552 0, digital_tlv), 523 SOC_SINGLE_TLV("ADCL Volume", LM49453_P0_ADC_LEVELL_REG, 0, 63,
524 0, adc_dac_tlv),
525 SOC_SINGLE_TLV("ADCR Volume", LM49453_P0_ADC_LEVELR_REG, 0, 63,
526 0, adc_dac_tlv),
553 527
554 SOC_DOUBLE_R_TLV("DMIC1 Volume", LM49453_P0_DMIC1_LEVELL_REG, 528 SOC_DOUBLE_R_TLV("DMIC1 Volume", LM49453_P0_DMIC1_LEVELL_REG,
555 LM49453_P0_DMIC1_LEVELR_REG, 0, 6, 0, digital_tlv), 529 LM49453_P0_DMIC1_LEVELR_REG, 0, 63, 0, adc_dac_tlv),
556 SOC_DOUBLE_R_TLV("DMIC2 Volume", LM49453_P0_DMIC2_LEVELL_REG, 530 SOC_DOUBLE_R_TLV("DMIC2 Volume", LM49453_P0_DMIC2_LEVELL_REG,
557 LM49453_P0_DMIC2_LEVELR_REG, 0, 6, 0, digital_tlv), 531 LM49453_P0_DMIC2_LEVELR_REG, 0, 63, 0, adc_dac_tlv),
558 532
559 SOC_DAPM_ENUM("Mic2Mode", lm49453_mic2mode_enum), 533 SOC_DAPM_ENUM("Mic2Mode", lm49453_mic2mode_enum),
560 SOC_DAPM_ENUM("DMIC12 SRC", lm49453_dmic12_cfg_enum), 534 SOC_DAPM_ENUM("DMIC12 SRC", lm49453_dmic12_cfg_enum),
@@ -569,16 +543,16 @@ static const struct snd_kcontrol_new lm49453_snd_controls[] = {
569 2, 1, 0), 543 2, 1, 0),
570 544
571 SOC_DOUBLE_R_TLV("DAC HP Volume", LM49453_P0_DAC_HP_LEVELL_REG, 545 SOC_DOUBLE_R_TLV("DAC HP Volume", LM49453_P0_DAC_HP_LEVELL_REG,
572 LM49453_P0_DAC_HP_LEVELR_REG, 0, 6, 0, digital_tlv), 546 LM49453_P0_DAC_HP_LEVELR_REG, 0, 63, 0, adc_dac_tlv),
573 SOC_DOUBLE_R_TLV("DAC LO Volume", LM49453_P0_DAC_LO_LEVELL_REG, 547 SOC_DOUBLE_R_TLV("DAC LO Volume", LM49453_P0_DAC_LO_LEVELL_REG,
574 LM49453_P0_DAC_LO_LEVELR_REG, 0, 6, 0, digital_tlv), 548 LM49453_P0_DAC_LO_LEVELR_REG, 0, 63, 0, adc_dac_tlv),
575 SOC_DOUBLE_R_TLV("DAC LS Volume", LM49453_P0_DAC_LS_LEVELL_REG, 549 SOC_DOUBLE_R_TLV("DAC LS Volume", LM49453_P0_DAC_LS_LEVELL_REG,
576 LM49453_P0_DAC_LS_LEVELR_REG, 0, 6, 0, digital_tlv), 550 LM49453_P0_DAC_LS_LEVELR_REG, 0, 63, 0, adc_dac_tlv),
577 SOC_DOUBLE_R_TLV("DAC HA Volume", LM49453_P0_DAC_HA_LEVELL_REG, 551 SOC_DOUBLE_R_TLV("DAC HA Volume", LM49453_P0_DAC_HA_LEVELL_REG,
578 LM49453_P0_DAC_HA_LEVELR_REG, 0, 6, 0, digital_tlv), 552 LM49453_P0_DAC_HA_LEVELR_REG, 0, 63, 0, adc_dac_tlv),
579 553
580 SOC_SINGLE_TLV("EP Volume", LM49453_P0_DAC_LS_LEVELL_REG, 554 SOC_SINGLE_TLV("EP Volume", LM49453_P0_DAC_LS_LEVELL_REG,
581 0, 6, 0, digital_tlv), 555 0, 63, 0, adc_dac_tlv),
582 556
583 SOC_SINGLE_TLV("PORT1_1_RX_LVL Volume", LM49453_P0_PORT1_RX_LVL1_REG, 557 SOC_SINGLE_TLV("PORT1_1_RX_LVL Volume", LM49453_P0_PORT1_RX_LVL1_REG,
584 0, 3, 0, port_tlv), 558 0, 3, 0, port_tlv),
@@ -1218,7 +1192,7 @@ static int lm49453_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt)
1218 } 1192 }
1219 1193
1220 snd_soc_update_bits(codec, LM49453_P0_AUDIO_PORT1_BASIC_REG, 1194 snd_soc_update_bits(codec, LM49453_P0_AUDIO_PORT1_BASIC_REG,
1221 LM49453_AUDIO_PORT1_BASIC_FMT_MASK|BIT(1)|BIT(5), 1195 LM49453_AUDIO_PORT1_BASIC_FMT_MASK|BIT(0)|BIT(5),
1222 (aif_val | mode | clk_phase)); 1196 (aif_val | mode | clk_phase));
1223 1197
1224 snd_soc_write(codec, LM49453_P0_AUDIO_PORT1_RX_MSB_REG, clk_shift); 1198 snd_soc_write(codec, LM49453_P0_AUDIO_PORT1_RX_MSB_REG, clk_shift);
diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c
index cb1675cd8e1c..92bbfec9b107 100644
--- a/sound/soc/codecs/sgtl5000.c
+++ b/sound/soc/codecs/sgtl5000.c
@@ -401,7 +401,7 @@ static const struct snd_kcontrol_new sgtl5000_snd_controls[] = {
401 5, 1, 0), 401 5, 1, 0),
402 402
403 SOC_SINGLE_TLV("Mic Volume", SGTL5000_CHIP_MIC_CTRL, 403 SOC_SINGLE_TLV("Mic Volume", SGTL5000_CHIP_MIC_CTRL,
404 0, 4, 0, mic_gain_tlv), 404 0, 3, 0, mic_gain_tlv),
405}; 405};
406 406
407/* mute the codec used by alsa core */ 407/* mute the codec used by alsa core */
@@ -1344,7 +1344,7 @@ static int sgtl5000_probe(struct snd_soc_codec *codec)
1344 SGTL5000_HP_ZCD_EN | 1344 SGTL5000_HP_ZCD_EN |
1345 SGTL5000_ADC_ZCD_EN); 1345 SGTL5000_ADC_ZCD_EN);
1346 1346
1347 snd_soc_write(codec, SGTL5000_CHIP_MIC_CTRL, 0); 1347 snd_soc_write(codec, SGTL5000_CHIP_MIC_CTRL, 2);
1348 1348
1349 /* 1349 /*
1350 * disable DAP 1350 * disable DAP
diff --git a/sound/soc/codecs/sta529.c b/sound/soc/codecs/sta529.c
index ab355c4f0b2d..40c07be9b581 100644
--- a/sound/soc/codecs/sta529.c
+++ b/sound/soc/codecs/sta529.c
@@ -74,9 +74,10 @@
74 SNDRV_PCM_FMTBIT_S32_LE) 74 SNDRV_PCM_FMTBIT_S32_LE)
75#define S2PC_VALUE 0x98 75#define S2PC_VALUE 0x98
76#define CLOCK_OUT 0x60 76#define CLOCK_OUT 0x60
77#define LEFT_J_DATA_FORMAT 0x10 77#define DATA_FORMAT_MSK 0x0E
78#define I2S_DATA_FORMAT 0x12 78#define LEFT_J_DATA_FORMAT 0x00
79#define RIGHT_J_DATA_FORMAT 0x14 79#define I2S_DATA_FORMAT 0x02
80#define RIGHT_J_DATA_FORMAT 0x04
80#define CODEC_MUTE_VAL 0x80 81#define CODEC_MUTE_VAL 0x80
81 82
82#define POWER_CNTLMSAK 0x40 83#define POWER_CNTLMSAK 0x40
@@ -289,7 +290,7 @@ static int sta529_set_dai_fmt(struct snd_soc_dai *codec_dai, u32 fmt)
289 return -EINVAL; 290 return -EINVAL;
290 } 291 }
291 292
292 snd_soc_update_bits(codec, STA529_S2PCFG0, 0x0D, mode); 293 snd_soc_update_bits(codec, STA529_S2PCFG0, DATA_FORMAT_MSK, mode);
293 294
294 return 0; 295 return 0;
295} 296}
diff --git a/sound/soc/codecs/wm2000.c b/sound/soc/codecs/wm2000.c
index 1cbe88f01d63..12bcae63a7f0 100644
--- a/sound/soc/codecs/wm2000.c
+++ b/sound/soc/codecs/wm2000.c
@@ -209,9 +209,9 @@ static int wm2000_power_up(struct i2c_client *i2c, int analogue)
209 209
210 ret = wm2000_read(i2c, WM2000_REG_SPEECH_CLARITY); 210 ret = wm2000_read(i2c, WM2000_REG_SPEECH_CLARITY);
211 if (wm2000->speech_clarity) 211 if (wm2000->speech_clarity)
212 ret &= ~WM2000_SPEECH_CLARITY;
213 else
214 ret |= WM2000_SPEECH_CLARITY; 212 ret |= WM2000_SPEECH_CLARITY;
213 else
214 ret &= ~WM2000_SPEECH_CLARITY;
215 wm2000_write(i2c, WM2000_REG_SPEECH_CLARITY, ret); 215 wm2000_write(i2c, WM2000_REG_SPEECH_CLARITY, ret);
216 216
217 wm2000_write(i2c, WM2000_REG_SYS_START0, 0x33); 217 wm2000_write(i2c, WM2000_REG_SYS_START0, 0x33);
diff --git a/sound/soc/codecs/wm2200.c b/sound/soc/codecs/wm2200.c
index afcf31df77e0..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 */
@@ -1566,15 +1563,9 @@ static int wm2200_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
1566 case SND_SOC_DAIFMT_DSP_A: 1563 case SND_SOC_DAIFMT_DSP_A:
1567 fmt_val = 0; 1564 fmt_val = 0;
1568 break; 1565 break;
1569 case SND_SOC_DAIFMT_DSP_B:
1570 fmt_val = 1;
1571 break;
1572 case SND_SOC_DAIFMT_I2S: 1566 case SND_SOC_DAIFMT_I2S:
1573 fmt_val = 2; 1567 fmt_val = 2;
1574 break; 1568 break;
1575 case SND_SOC_DAIFMT_LEFT_J:
1576 fmt_val = 3;
1577 break;
1578 default: 1569 default:
1579 dev_err(codec->dev, "Unsupported DAI format %d\n", 1570 dev_err(codec->dev, "Unsupported DAI format %d\n",
1580 fmt & SND_SOC_DAIFMT_FORMAT_MASK); 1571 fmt & SND_SOC_DAIFMT_FORMAT_MASK);
@@ -1626,7 +1617,7 @@ static int wm2200_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
1626 WM2200_AIF1TX_LRCLK_MSTR | WM2200_AIF1TX_LRCLK_INV, 1617 WM2200_AIF1TX_LRCLK_MSTR | WM2200_AIF1TX_LRCLK_INV,
1627 lrclk); 1618 lrclk);
1628 snd_soc_update_bits(codec, WM2200_AUDIO_IF_1_5, 1619 snd_soc_update_bits(codec, WM2200_AUDIO_IF_1_5,
1629 WM2200_AIF1_FMT_MASK << 1, fmt_val << 1); 1620 WM2200_AIF1_FMT_MASK, fmt_val);
1630 1621
1631 return 0; 1622 return 0;
1632} 1623}
diff --git a/sound/soc/codecs/wm5100.c b/sound/soc/codecs/wm5100.c
index 5a5f36936235..54397a508073 100644
--- a/sound/soc/codecs/wm5100.c
+++ b/sound/soc/codecs/wm5100.c
@@ -1279,15 +1279,9 @@ static int wm5100_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
1279 case SND_SOC_DAIFMT_DSP_A: 1279 case SND_SOC_DAIFMT_DSP_A:
1280 mask = 0; 1280 mask = 0;
1281 break; 1281 break;
1282 case SND_SOC_DAIFMT_DSP_B:
1283 mask = 1;
1284 break;
1285 case SND_SOC_DAIFMT_I2S: 1282 case SND_SOC_DAIFMT_I2S:
1286 mask = 2; 1283 mask = 2;
1287 break; 1284 break;
1288 case SND_SOC_DAIFMT_LEFT_J:
1289 mask = 3;
1290 break;
1291 default: 1285 default:
1292 dev_err(codec->dev, "Unsupported DAI format %d\n", 1286 dev_err(codec->dev, "Unsupported DAI format %d\n",
1293 fmt & SND_SOC_DAIFMT_FORMAT_MASK); 1287 fmt & SND_SOC_DAIFMT_FORMAT_MASK);
diff --git a/sound/soc/codecs/wm5102.c b/sound/soc/codecs/wm5102.c
index 688ade080589..1440b3f9b7bb 100644
--- a/sound/soc/codecs/wm5102.c
+++ b/sound/soc/codecs/wm5102.c
@@ -36,6 +36,9 @@
36struct wm5102_priv { 36struct wm5102_priv {
37 struct arizona_priv core; 37 struct arizona_priv core;
38 struct arizona_fll fll[2]; 38 struct arizona_fll fll[2];
39
40 unsigned int spk_ena:2;
41 unsigned int spk_ena_pending:1;
39}; 42};
40 43
41static DECLARE_TLV_DB_SCALE(ana_tlv, 0, 100, 0); 44static DECLARE_TLV_DB_SCALE(ana_tlv, 0, 100, 0);
@@ -787,6 +790,47 @@ ARIZONA_MIXER_CONTROLS("AIF3TX1", ARIZONA_AIF3TX1MIX_INPUT_1_SOURCE),
787ARIZONA_MIXER_CONTROLS("AIF3TX2", ARIZONA_AIF3TX2MIX_INPUT_1_SOURCE), 790ARIZONA_MIXER_CONTROLS("AIF3TX2", ARIZONA_AIF3TX2MIX_INPUT_1_SOURCE),
788}; 791};
789 792
793static int wm5102_spk_ev(struct snd_soc_dapm_widget *w,
794 struct snd_kcontrol *kcontrol,
795 int event)
796{
797 struct snd_soc_codec *codec = w->codec;
798 struct arizona *arizona = dev_get_drvdata(codec->dev->parent);
799 struct wm5102_priv *wm5102 = snd_soc_codec_get_drvdata(codec);
800
801 if (arizona->rev < 1)
802 return 0;
803
804 switch (event) {
805 case SND_SOC_DAPM_PRE_PMU:
806 if (!wm5102->spk_ena) {
807 snd_soc_write(codec, 0x4f5, 0x25a);
808 wm5102->spk_ena_pending = true;
809 }
810 break;
811 case SND_SOC_DAPM_POST_PMU:
812 if (wm5102->spk_ena_pending) {
813 msleep(75);
814 snd_soc_write(codec, 0x4f5, 0xda);
815 wm5102->spk_ena_pending = false;
816 wm5102->spk_ena++;
817 }
818 break;
819 case SND_SOC_DAPM_PRE_PMD:
820 wm5102->spk_ena--;
821 if (!wm5102->spk_ena)
822 snd_soc_write(codec, 0x4f5, 0x25a);
823 break;
824 case SND_SOC_DAPM_POST_PMD:
825 if (!wm5102->spk_ena)
826 snd_soc_write(codec, 0x4f5, 0x0da);
827 break;
828 }
829
830 return 0;
831}
832
833
790ARIZONA_MIXER_ENUMS(EQ1, ARIZONA_EQ1MIX_INPUT_1_SOURCE); 834ARIZONA_MIXER_ENUMS(EQ1, ARIZONA_EQ1MIX_INPUT_1_SOURCE);
791ARIZONA_MIXER_ENUMS(EQ2, ARIZONA_EQ2MIX_INPUT_1_SOURCE); 835ARIZONA_MIXER_ENUMS(EQ2, ARIZONA_EQ2MIX_INPUT_1_SOURCE);
792ARIZONA_MIXER_ENUMS(EQ3, ARIZONA_EQ3MIX_INPUT_1_SOURCE); 836ARIZONA_MIXER_ENUMS(EQ3, ARIZONA_EQ3MIX_INPUT_1_SOURCE);
@@ -852,8 +896,7 @@ static const unsigned int wm5102_aec_loopback_values[] = {
852 896
853static const struct soc_enum wm5102_aec_loopback = 897static const struct soc_enum wm5102_aec_loopback =
854 SOC_VALUE_ENUM_SINGLE(ARIZONA_DAC_AEC_CONTROL_1, 898 SOC_VALUE_ENUM_SINGLE(ARIZONA_DAC_AEC_CONTROL_1,
855 ARIZONA_AEC_LOOPBACK_SRC_SHIFT, 899 ARIZONA_AEC_LOOPBACK_SRC_SHIFT, 0xf,
856 ARIZONA_AEC_LOOPBACK_SRC_MASK,
857 ARRAY_SIZE(wm5102_aec_loopback_texts), 900 ARRAY_SIZE(wm5102_aec_loopback_texts),
858 wm5102_aec_loopback_texts, 901 wm5102_aec_loopback_texts,
859 wm5102_aec_loopback_values); 902 wm5102_aec_loopback_values);
@@ -1034,10 +1077,10 @@ SND_SOC_DAPM_PGA_E("OUT3L", ARIZONA_OUTPUT_ENABLES_1,
1034 ARIZONA_OUT3L_ENA_SHIFT, 0, NULL, 0, arizona_out_ev, 1077 ARIZONA_OUT3L_ENA_SHIFT, 0, NULL, 0, arizona_out_ev,
1035 SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU), 1078 SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
1036SND_SOC_DAPM_PGA_E("OUT4L", ARIZONA_OUTPUT_ENABLES_1, 1079SND_SOC_DAPM_PGA_E("OUT4L", ARIZONA_OUTPUT_ENABLES_1,
1037 ARIZONA_OUT4L_ENA_SHIFT, 0, NULL, 0, arizona_out_ev, 1080 ARIZONA_OUT4L_ENA_SHIFT, 0, NULL, 0, wm5102_spk_ev,
1038 SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU), 1081 SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
1039SND_SOC_DAPM_PGA_E("OUT4R", ARIZONA_OUTPUT_ENABLES_1, 1082SND_SOC_DAPM_PGA_E("OUT4R", ARIZONA_OUTPUT_ENABLES_1,
1040 ARIZONA_OUT4R_ENA_SHIFT, 0, NULL, 0, arizona_out_ev, 1083 ARIZONA_OUT4R_ENA_SHIFT, 0, NULL, 0, wm5102_spk_ev,
1041 SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU), 1084 SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
1042SND_SOC_DAPM_PGA_E("OUT5L", ARIZONA_OUTPUT_ENABLES_1, 1085SND_SOC_DAPM_PGA_E("OUT5L", ARIZONA_OUTPUT_ENABLES_1,
1043 ARIZONA_OUT5L_ENA_SHIFT, 0, NULL, 0, arizona_out_ev, 1086 ARIZONA_OUT5L_ENA_SHIFT, 0, NULL, 0, arizona_out_ev,
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 ffc89fab96fb..b6b654837585 100644
--- a/sound/soc/codecs/wm_adsp.c
+++ b/sound/soc/codecs/wm_adsp.c
@@ -169,6 +169,7 @@ static int wm_adsp_load(struct wm_adsp *dsp)
169 const struct wm_adsp_region *mem; 169 const struct wm_adsp_region *mem;
170 const char *region_name; 170 const char *region_name;
171 char *file, *text; 171 char *file, *text;
172 void *buf;
172 unsigned int reg; 173 unsigned int reg;
173 int regions = 0; 174 int regions = 0;
174 int ret, offset, type, sizes; 175 int ret, offset, type, sizes;
@@ -322,8 +323,18 @@ static int wm_adsp_load(struct wm_adsp *dsp)
322 } 323 }
323 324
324 if (reg) { 325 if (reg) {
325 ret = regmap_raw_write(regmap, reg, region->data, 326 buf = kmemdup(region->data, le32_to_cpu(region->len),
327 GFP_KERNEL | GFP_DMA);
328 if (!buf) {
329 adsp_err(dsp, "Out of memory\n");
330 return -ENOMEM;
331 }
332
333 ret = regmap_raw_write(regmap, reg, buf,
326 le32_to_cpu(region->len)); 334 le32_to_cpu(region->len));
335
336 kfree(buf);
337
327 if (ret != 0) { 338 if (ret != 0) {
328 adsp_err(dsp, 339 adsp_err(dsp,
329 "%s.%d: Failed to write %d bytes at %d in %s: %d\n", 340 "%s.%d: Failed to write %d bytes at %d in %s: %d\n",
@@ -359,6 +370,7 @@ static int wm_adsp_load_coeff(struct wm_adsp *dsp)
359 const char *region_name; 370 const char *region_name;
360 int ret, pos, blocks, type, offset, reg; 371 int ret, pos, blocks, type, offset, reg;
361 char *file; 372 char *file;
373 void *buf;
362 374
363 file = kzalloc(PAGE_SIZE, GFP_KERNEL); 375 file = kzalloc(PAGE_SIZE, GFP_KERNEL);
364 if (file == NULL) 376 if (file == NULL)
@@ -384,7 +396,7 @@ static int wm_adsp_load_coeff(struct wm_adsp *dsp)
384 hdr = (void*)&firmware->data[0]; 396 hdr = (void*)&firmware->data[0];
385 if (memcmp(hdr->magic, "WMDR", 4) != 0) { 397 if (memcmp(hdr->magic, "WMDR", 4) != 0) {
386 adsp_err(dsp, "%s: invalid magic\n", file); 398 adsp_err(dsp, "%s: invalid magic\n", file);
387 return -EINVAL; 399 goto out_fw;
388 } 400 }
389 401
390 adsp_dbg(dsp, "%s: v%d.%d.%d\n", file, 402 adsp_dbg(dsp, "%s: v%d.%d.%d\n", file,
@@ -426,6 +438,13 @@ static int wm_adsp_load_coeff(struct wm_adsp *dsp)
426 } 438 }
427 439
428 if (reg) { 440 if (reg) {
441 buf = kmemdup(blk->data, le32_to_cpu(blk->len),
442 GFP_KERNEL | GFP_DMA);
443 if (!buf) {
444 adsp_err(dsp, "Out of memory\n");
445 return -ENOMEM;
446 }
447
429 ret = regmap_raw_write(regmap, reg, blk->data, 448 ret = regmap_raw_write(regmap, reg, blk->data,
430 le32_to_cpu(blk->len)); 449 le32_to_cpu(blk->len));
431 if (ret != 0) { 450 if (ret != 0) {
@@ -433,6 +452,8 @@ static int wm_adsp_load_coeff(struct wm_adsp *dsp)
433 "%s.%d: Failed to write to %x in %s\n", 452 "%s.%d: Failed to write to %x in %s\n",
434 file, blocks, reg, region_name); 453 file, blocks, reg, region_name);
435 } 454 }
455
456 kfree(buf);
436 } 457 }
437 458
438 pos += le32_to_cpu(blk->len) + sizeof(*blk); 459 pos += le32_to_cpu(blk->len) + sizeof(*blk);
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-core.c b/sound/soc/soc-core.c
index 91d592ff67b7..2370063b5824 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1255,6 +1255,8 @@ static int soc_post_component_init(struct snd_soc_card *card,
1255 INIT_LIST_HEAD(&rtd->dpcm[SNDRV_PCM_STREAM_CAPTURE].fe_clients); 1255 INIT_LIST_HEAD(&rtd->dpcm[SNDRV_PCM_STREAM_CAPTURE].fe_clients);
1256 ret = device_add(rtd->dev); 1256 ret = device_add(rtd->dev);
1257 if (ret < 0) { 1257 if (ret < 0) {
1258 /* calling put_device() here to free the rtd->dev */
1259 put_device(rtd->dev);
1258 dev_err(card->dev, 1260 dev_err(card->dev,
1259 "ASoC: failed to register runtime device: %d\n", ret); 1261 "ASoC: failed to register runtime device: %d\n", ret);
1260 return ret; 1262 return ret;
@@ -1554,7 +1556,7 @@ static void soc_remove_aux_dev(struct snd_soc_card *card, int num)
1554 /* unregister the rtd device */ 1556 /* unregister the rtd device */
1555 if (rtd->dev_registered) { 1557 if (rtd->dev_registered) {
1556 device_remove_file(rtd->dev, &dev_attr_codec_reg); 1558 device_remove_file(rtd->dev, &dev_attr_codec_reg);
1557 device_del(rtd->dev); 1559 device_unregister(rtd->dev);
1558 rtd->dev_registered = 0; 1560 rtd->dev_registered = 0;
1559 } 1561 }
1560 1562
@@ -2917,7 +2919,7 @@ int snd_soc_info_volsw_range(struct snd_kcontrol *kcontrol,
2917 platform_max = mc->platform_max; 2919 platform_max = mc->platform_max;
2918 2920
2919 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; 2921 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
2920 uinfo->count = 1; 2922 uinfo->count = snd_soc_volsw_is_stereo(mc) ? 2 : 1;
2921 uinfo->value.integer.min = 0; 2923 uinfo->value.integer.min = 0;
2922 uinfo->value.integer.max = platform_max - min; 2924 uinfo->value.integer.max = platform_max - min;
2923 2925
@@ -2941,12 +2943,14 @@ int snd_soc_put_volsw_range(struct snd_kcontrol *kcontrol,
2941 (struct soc_mixer_control *)kcontrol->private_value; 2943 (struct soc_mixer_control *)kcontrol->private_value;
2942 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); 2944 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
2943 unsigned int reg = mc->reg; 2945 unsigned int reg = mc->reg;
2946 unsigned int rreg = mc->rreg;
2944 unsigned int shift = mc->shift; 2947 unsigned int shift = mc->shift;
2945 int min = mc->min; 2948 int min = mc->min;
2946 int max = mc->max; 2949 int max = mc->max;
2947 unsigned int mask = (1 << fls(max)) - 1; 2950 unsigned int mask = (1 << fls(max)) - 1;
2948 unsigned int invert = mc->invert; 2951 unsigned int invert = mc->invert;
2949 unsigned int val, val_mask; 2952 unsigned int val, val_mask;
2953 int ret;
2950 2954
2951 val = ((ucontrol->value.integer.value[0] + min) & mask); 2955 val = ((ucontrol->value.integer.value[0] + min) & mask);
2952 if (invert) 2956 if (invert)
@@ -2954,7 +2958,21 @@ int snd_soc_put_volsw_range(struct snd_kcontrol *kcontrol,
2954 val_mask = mask << shift; 2958 val_mask = mask << shift;
2955 val = val << shift; 2959 val = val << shift;
2956 2960
2957 return snd_soc_update_bits_locked(codec, reg, val_mask, val); 2961 ret = snd_soc_update_bits_locked(codec, reg, val_mask, val);
2962 if (ret != 0)
2963 return ret;
2964
2965 if (snd_soc_volsw_is_stereo(mc)) {
2966 val = ((ucontrol->value.integer.value[1] + min) & mask);
2967 if (invert)
2968 val = max - val;
2969 val_mask = mask << shift;
2970 val = val << shift;
2971
2972 ret = snd_soc_update_bits_locked(codec, rreg, val_mask, val);
2973 }
2974
2975 return ret;
2958} 2976}
2959EXPORT_SYMBOL_GPL(snd_soc_put_volsw_range); 2977EXPORT_SYMBOL_GPL(snd_soc_put_volsw_range);
2960 2978
@@ -2974,6 +2992,7 @@ int snd_soc_get_volsw_range(struct snd_kcontrol *kcontrol,
2974 (struct soc_mixer_control *)kcontrol->private_value; 2992 (struct soc_mixer_control *)kcontrol->private_value;
2975 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); 2993 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
2976 unsigned int reg = mc->reg; 2994 unsigned int reg = mc->reg;
2995 unsigned int rreg = mc->rreg;
2977 unsigned int shift = mc->shift; 2996 unsigned int shift = mc->shift;
2978 int min = mc->min; 2997 int min = mc->min;
2979 int max = mc->max; 2998 int max = mc->max;
@@ -2988,6 +3007,16 @@ int snd_soc_get_volsw_range(struct snd_kcontrol *kcontrol,
2988 ucontrol->value.integer.value[0] = 3007 ucontrol->value.integer.value[0] =
2989 ucontrol->value.integer.value[0] - min; 3008 ucontrol->value.integer.value[0] - min;
2990 3009
3010 if (snd_soc_volsw_is_stereo(mc)) {
3011 ucontrol->value.integer.value[1] =
3012 (snd_soc_read(codec, rreg) >> shift) & mask;
3013 if (invert)
3014 ucontrol->value.integer.value[1] =
3015 max - ucontrol->value.integer.value[1];
3016 ucontrol->value.integer.value[1] =
3017 ucontrol->value.integer.value[1] - min;
3018 }
3019
2991 return 0; 3020 return 0;
2992} 3021}
2993EXPORT_SYMBOL_GPL(snd_soc_get_volsw_range); 3022EXPORT_SYMBOL_GPL(snd_soc_get_volsw_range);
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/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index d7711fce119b..cf191e6aebbe 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -1243,6 +1243,7 @@ static int dpcm_be_dai_hw_free(struct snd_soc_pcm_runtime *fe, int stream)
1243 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_PARAMS) && 1243 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_PARAMS) &&
1244 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PREPARE) && 1244 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PREPARE) &&
1245 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_FREE) && 1245 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_FREE) &&
1246 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PAUSED) &&
1246 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_STOP)) 1247 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_STOP))
1247 continue; 1248 continue;
1248 1249
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 */
diff --git a/sound/usb/mixer_maps.c b/sound/usb/mixer_maps.c
index e71fe55cebef..0e2ed3d05c45 100644
--- a/sound/usb/mixer_maps.c
+++ b/sound/usb/mixer_maps.c
@@ -179,6 +179,15 @@ static struct usbmix_name_map audigy2nx_map[] = {
179 { 0 } /* terminator */ 179 { 0 } /* terminator */
180}; 180};
181 181
182static struct usbmix_selector_map c400_selectors[] = {
183 {
184 .id = 0x80,
185 .count = 2,
186 .names = (const char*[]) {"Internal", "SPDIF"}
187 },
188 { 0 } /* terminator */
189};
190
182static struct usbmix_selector_map audigy2nx_selectors[] = { 191static struct usbmix_selector_map audigy2nx_selectors[] = {
183 { 192 {
184 .id = 14, /* Capture Source */ 193 .id = 14, /* Capture Source */
@@ -367,6 +376,10 @@ static struct usbmix_ctl_map usbmix_ctl_maps[] = {
367 .map = hercules_usb51_map, 376 .map = hercules_usb51_map,
368 }, 377 },
369 { 378 {
379 .id = USB_ID(0x0763, 0x2030),
380 .selector_map = c400_selectors,
381 },
382 {
370 .id = USB_ID(0x08bb, 0x2702), 383 .id = USB_ID(0x08bb, 0x2702),
371 .map = linex_map, 384 .map = linex_map,
372 .ignore_ctl_error = 1, 385 .ignore_ctl_error = 1,
diff --git a/sound/usb/mixer_quirks.c b/sound/usb/mixer_quirks.c
index 0422b1360af3..15520de1df56 100644
--- a/sound/usb/mixer_quirks.c
+++ b/sound/usb/mixer_quirks.c
@@ -1206,7 +1206,7 @@ static int snd_c400_create_mixer(struct usb_mixer_interface *mixer)
1206 * are valid they presents mono controls as L and R channels of 1206 * are valid they presents mono controls as L and R channels of
1207 * stereo. So we provide a good mixer here. 1207 * stereo. So we provide a good mixer here.
1208 */ 1208 */
1209struct std_mono_table ebox44_table[] = { 1209static struct std_mono_table ebox44_table[] = {
1210 { 1210 {
1211 .unitid = 4, 1211 .unitid = 4,
1212 .control = 1, 1212 .control = 1,
diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c
index c6593101c049..d82e378d37cb 100644
--- a/sound/usb/pcm.c
+++ b/sound/usb/pcm.c
@@ -511,6 +511,16 @@ static int configure_sync_endpoint(struct snd_usb_substream *subs)
511 struct snd_usb_substream *sync_subs = 511 struct snd_usb_substream *sync_subs =
512 &subs->stream->substream[subs->direction ^ 1]; 512 &subs->stream->substream[subs->direction ^ 1];
513 513
514 if (subs->sync_endpoint->type != SND_USB_ENDPOINT_TYPE_DATA ||
515 !subs->stream)
516 return snd_usb_endpoint_set_params(subs->sync_endpoint,
517 subs->pcm_format,
518 subs->channels,
519 subs->period_bytes,
520 subs->cur_rate,
521 subs->cur_audiofmt,
522 NULL);
523
514 /* Try to find the best matching audioformat. */ 524 /* Try to find the best matching audioformat. */
515 list_for_each_entry(fp, &sync_subs->fmt_list, list) { 525 list_for_each_entry(fp, &sync_subs->fmt_list, list) {
516 int score = match_endpoint_audioformats(fp, subs->cur_audiofmt, 526 int score = match_endpoint_audioformats(fp, subs->cur_audiofmt,
diff --git a/sound/usb/quirks-table.h b/sound/usb/quirks-table.h
index 78e845ec65da..64d25a7a4d59 100644
--- a/sound/usb/quirks-table.h
+++ b/sound/usb/quirks-table.h
@@ -2289,7 +2289,7 @@ YAMAHA_DEVICE(0x7010, "UB99"),
2289 .rate_table = (unsigned int[]) { 2289 .rate_table = (unsigned int[]) {
2290 44100, 48000, 88200, 96000 2290 44100, 48000, 88200, 96000
2291 }, 2291 },
2292 .clock = 0x81, 2292 .clock = 0x80,
2293 } 2293 }
2294 }, 2294 },
2295 /* Capture */ 2295 /* Capture */
@@ -2315,7 +2315,7 @@ YAMAHA_DEVICE(0x7010, "UB99"),
2315 .rate_table = (unsigned int[]) { 2315 .rate_table = (unsigned int[]) {
2316 44100, 48000, 88200, 96000 2316 44100, 48000, 88200, 96000
2317 }, 2317 },
2318 .clock = 0x81, 2318 .clock = 0x80,
2319 } 2319 }
2320 }, 2320 },
2321 /* MIDI */ 2321 /* MIDI */
diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c
index acc12f004c23..2c971858d6b7 100644
--- a/sound/usb/quirks.c
+++ b/sound/usb/quirks.c
@@ -387,11 +387,13 @@ static int snd_usb_fasttrackpro_boot_quirk(struct usb_device *dev)
387 * rules 387 * rules
388 */ 388 */
389 err = usb_driver_set_configuration(dev, 2); 389 err = usb_driver_set_configuration(dev, 2);
390 if (err < 0) { 390 if (err < 0)
391 snd_printdd("error usb_driver_set_configuration: %d\n", 391 snd_printdd("error usb_driver_set_configuration: %d\n",
392 err); 392 err);
393 return -ENODEV; 393 /* Always return an error, so that we stop creating a device
394 } 394 that will just be destroyed and recreated with a new
395 configuration */
396 return -ENODEV;
395 } else 397 } else
396 snd_printk(KERN_INFO "usb-audio: Fast Track Pro config OK\n"); 398 snd_printk(KERN_INFO "usb-audio: Fast Track Pro config OK\n");
397 399
@@ -859,6 +861,17 @@ void snd_usb_endpoint_start_quirk(struct snd_usb_endpoint *ep)
859 if ((le16_to_cpu(ep->chip->dev->descriptor.idVendor) == 0x23ba) && 861 if ((le16_to_cpu(ep->chip->dev->descriptor.idVendor) == 0x23ba) &&
860 ep->type == SND_USB_ENDPOINT_TYPE_SYNC) 862 ep->type == SND_USB_ENDPOINT_TYPE_SYNC)
861 ep->skip_packets = 4; 863 ep->skip_packets = 4;
864
865 /*
866 * M-Audio Fast Track C400 - when packets are not skipped, real world
867 * latency varies by approx. +/- 50 frames (at 96KHz) each time the
868 * stream is (re)started. When skipping packets 16 at endpoint start
869 * up, the real world latency is stable within +/- 1 frame (also
870 * across power cycles).
871 */
872 if (ep->chip->usb_id == USB_ID(0x0763, 0x2030) &&
873 ep->type == SND_USB_ENDPOINT_TYPE_DATA)
874 ep->skip_packets = 16;
862} 875}
863 876
864void snd_usb_ctl_msg_quirk(struct usb_device *dev, unsigned int pipe, 877void snd_usb_ctl_msg_quirk(struct usb_device *dev, unsigned int pipe,