aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
Diffstat (limited to 'sound')
-rw-r--r--sound/core/info.c4
-rw-r--r--sound/core/pcm_lib.c8
-rw-r--r--sound/core/pcm_misc.c4
-rw-r--r--sound/firewire/amdtp.c11
-rw-r--r--sound/firewire/amdtp.h1
-rw-r--r--sound/firewire/dice.c29
-rw-r--r--sound/pci/ctxfi/ct20k1reg.h4
-rw-r--r--sound/pci/hda/ca0132_regs.h2
-rw-r--r--sound/pci/hda/patch_conexant.c10
-rw-r--r--sound/pci/hda/patch_hdmi.c12
-rw-r--r--sound/pci/hda/patch_realtek.c46
-rw-r--r--sound/pci/hda/patch_sigmatel.c17
-rw-r--r--sound/soc/codecs/arizona.c6
-rw-r--r--sound/soc/codecs/cs4265.c18
-rw-r--r--sound/soc/codecs/da732x.h2
-rw-r--r--sound/soc/codecs/pcm512x.c4
-rw-r--r--sound/soc/codecs/rt286.c7
-rw-r--r--sound/soc/codecs/rt5640.c1
-rw-r--r--sound/soc/codecs/rt5677.c8
-rw-r--r--sound/soc/codecs/sta529.c4
-rw-r--r--sound/soc/codecs/tlv320aic31xx.c51
-rw-r--r--sound/soc/davinci/davinci-mcasp.c25
-rw-r--r--sound/soc/dwc/designware_i2s.c4
-rw-r--r--sound/soc/fsl/Kconfig1
-rw-r--r--sound/soc/fsl/fsl_esai.c2
-rw-r--r--sound/soc/fsl/fsl_ssi.c12
-rw-r--r--sound/soc/generic/simple-card.c8
-rw-r--r--sound/soc/intel/sst-acpi.c4
-rw-r--r--sound/soc/intel/sst-baytrail-ipc.c10
-rw-r--r--sound/soc/intel/sst-baytrail-ipc.h1
-rw-r--r--sound/soc/intel/sst-baytrail-pcm.c43
-rw-r--r--sound/soc/omap/omap-twl4030.c2
-rw-r--r--sound/soc/pxa/pxa-ssp.c4
-rw-r--r--sound/soc/rockchip/rockchip_i2s.c13
-rw-r--r--sound/soc/samsung/i2s.c5
-rw-r--r--sound/soc/sh/rcar/gen.c2
-rw-r--r--sound/soc/soc-compress.c6
-rw-r--r--sound/soc/soc-core.c4
-rw-r--r--sound/soc/soc-dapm.c12
-rw-r--r--sound/soc/soc-pcm.c6
-rw-r--r--sound/soc/spear/spear_pcm.c4
-rw-r--r--sound/soc/tegra/tegra_asoc_utils.h2
-rw-r--r--sound/usb/caiaq/control.c18
43 files changed, 277 insertions, 160 deletions
diff --git a/sound/core/info.c b/sound/core/info.c
index 051d55b05521..9f404e965ea2 100644
--- a/sound/core/info.c
+++ b/sound/core/info.c
@@ -684,7 +684,7 @@ int snd_info_card_free(struct snd_card *card)
684 * snd_info_get_line - read one line from the procfs buffer 684 * snd_info_get_line - read one line from the procfs buffer
685 * @buffer: the procfs buffer 685 * @buffer: the procfs buffer
686 * @line: the buffer to store 686 * @line: the buffer to store
687 * @len: the max. buffer size - 1 687 * @len: the max. buffer size
688 * 688 *
689 * Reads one line from the buffer and stores the string. 689 * Reads one line from the buffer and stores the string.
690 * 690 *
@@ -704,7 +704,7 @@ int snd_info_get_line(struct snd_info_buffer *buffer, char *line, int len)
704 buffer->stop = 1; 704 buffer->stop = 1;
705 if (c == '\n') 705 if (c == '\n')
706 break; 706 break;
707 if (len) { 707 if (len > 1) {
708 len--; 708 len--;
709 *line++ = c; 709 *line++ = c;
710 } 710 }
diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c
index 9acc77eae487..0032278567ad 100644
--- a/sound/core/pcm_lib.c
+++ b/sound/core/pcm_lib.c
@@ -1782,14 +1782,16 @@ static int snd_pcm_lib_ioctl_fifo_size(struct snd_pcm_substream *substream,
1782{ 1782{
1783 struct snd_pcm_hw_params *params = arg; 1783 struct snd_pcm_hw_params *params = arg;
1784 snd_pcm_format_t format; 1784 snd_pcm_format_t format;
1785 int channels, width; 1785 int channels;
1786 ssize_t frame_size;
1786 1787
1787 params->fifo_size = substream->runtime->hw.fifo_size; 1788 params->fifo_size = substream->runtime->hw.fifo_size;
1788 if (!(substream->runtime->hw.info & SNDRV_PCM_INFO_FIFO_IN_FRAMES)) { 1789 if (!(substream->runtime->hw.info & SNDRV_PCM_INFO_FIFO_IN_FRAMES)) {
1789 format = params_format(params); 1790 format = params_format(params);
1790 channels = params_channels(params); 1791 channels = params_channels(params);
1791 width = snd_pcm_format_physical_width(format); 1792 frame_size = snd_pcm_format_size(format, channels);
1792 params->fifo_size /= width * channels; 1793 if (frame_size > 0)
1794 params->fifo_size /= (unsigned)frame_size;
1793 } 1795 }
1794 return 0; 1796 return 0;
1795} 1797}
diff --git a/sound/core/pcm_misc.c b/sound/core/pcm_misc.c
index 4560ca0e5651..2c6fd80e0bd1 100644
--- a/sound/core/pcm_misc.c
+++ b/sound/core/pcm_misc.c
@@ -142,11 +142,11 @@ static struct pcm_format_data pcm_formats[(INT)SNDRV_PCM_FORMAT_LAST+1] = {
142 }, 142 },
143 [SNDRV_PCM_FORMAT_DSD_U8] = { 143 [SNDRV_PCM_FORMAT_DSD_U8] = {
144 .width = 8, .phys = 8, .le = 1, .signd = 0, 144 .width = 8, .phys = 8, .le = 1, .signd = 0,
145 .silence = {}, 145 .silence = { 0x69 },
146 }, 146 },
147 [SNDRV_PCM_FORMAT_DSD_U16_LE] = { 147 [SNDRV_PCM_FORMAT_DSD_U16_LE] = {
148 .width = 16, .phys = 16, .le = 1, .signd = 0, 148 .width = 16, .phys = 16, .le = 1, .signd = 0,
149 .silence = {}, 149 .silence = { 0x69, 0x69 },
150 }, 150 },
151 /* FIXME: the following three formats are not defined properly yet */ 151 /* FIXME: the following three formats are not defined properly yet */
152 [SNDRV_PCM_FORMAT_MPEG] = { 152 [SNDRV_PCM_FORMAT_MPEG] = {
diff --git a/sound/firewire/amdtp.c b/sound/firewire/amdtp.c
index f96bf4c7c232..95fc2eaf11dc 100644
--- a/sound/firewire/amdtp.c
+++ b/sound/firewire/amdtp.c
@@ -507,7 +507,16 @@ static void amdtp_pull_midi(struct amdtp_stream *s,
507static void update_pcm_pointers(struct amdtp_stream *s, 507static void update_pcm_pointers(struct amdtp_stream *s,
508 struct snd_pcm_substream *pcm, 508 struct snd_pcm_substream *pcm,
509 unsigned int frames) 509 unsigned int frames)
510{ unsigned int ptr; 510{
511 unsigned int ptr;
512
513 /*
514 * In IEC 61883-6, one data block represents one event. In ALSA, one
515 * event equals to one PCM frame. But Dice has a quirk to transfer
516 * two PCM frames in one data block.
517 */
518 if (s->double_pcm_frames)
519 frames *= 2;
511 520
512 ptr = s->pcm_buffer_pointer + frames; 521 ptr = s->pcm_buffer_pointer + frames;
513 if (ptr >= pcm->runtime->buffer_size) 522 if (ptr >= pcm->runtime->buffer_size)
diff --git a/sound/firewire/amdtp.h b/sound/firewire/amdtp.h
index d8ee7b0e9386..4823c08196ac 100644
--- a/sound/firewire/amdtp.h
+++ b/sound/firewire/amdtp.h
@@ -125,6 +125,7 @@ struct amdtp_stream {
125 unsigned int pcm_buffer_pointer; 125 unsigned int pcm_buffer_pointer;
126 unsigned int pcm_period_pointer; 126 unsigned int pcm_period_pointer;
127 bool pointer_flush; 127 bool pointer_flush;
128 bool double_pcm_frames;
128 129
129 struct snd_rawmidi_substream *midi[AMDTP_MAX_CHANNELS_FOR_MIDI * 8]; 130 struct snd_rawmidi_substream *midi[AMDTP_MAX_CHANNELS_FOR_MIDI * 8];
130 131
diff --git a/sound/firewire/dice.c b/sound/firewire/dice.c
index a9a30c0161f1..e3a04d69c853 100644
--- a/sound/firewire/dice.c
+++ b/sound/firewire/dice.c
@@ -567,10 +567,14 @@ static int dice_hw_params(struct snd_pcm_substream *substream,
567 return err; 567 return err;
568 568
569 /* 569 /*
570 * At rates above 96 kHz, pretend that the stream runs at half the 570 * At 176.4/192.0 kHz, Dice has a quirk to transfer two PCM frames in
571 * actual sample rate with twice the number of channels; two samples 571 * one data block of AMDTP packet. Thus sampling transfer frequency is
572 * of a channel are stored consecutively in the packet. Requires 572 * a half of PCM sampling frequency, i.e. PCM frames at 192.0 kHz are
573 * blocking mode and PCM buffer size should be aligned to SYT_INTERVAL. 573 * transferred on AMDTP packets at 96 kHz. Two successive samples of a
574 * channel are stored consecutively in the packet. This quirk is called
575 * as 'Dual Wire'.
576 * For this quirk, blocking mode is required and PCM buffer size should
577 * be aligned to SYT_INTERVAL.
574 */ 578 */
575 channels = params_channels(hw_params); 579 channels = params_channels(hw_params);
576 if (rate_index > 4) { 580 if (rate_index > 4) {
@@ -579,18 +583,25 @@ static int dice_hw_params(struct snd_pcm_substream *substream,
579 return err; 583 return err;
580 } 584 }
581 585
582 for (i = 0; i < channels; i++) {
583 dice->stream.pcm_positions[i * 2] = i;
584 dice->stream.pcm_positions[i * 2 + 1] = i + channels;
585 }
586
587 rate /= 2; 586 rate /= 2;
588 channels *= 2; 587 channels *= 2;
588 dice->stream.double_pcm_frames = true;
589 } else {
590 dice->stream.double_pcm_frames = false;
589 } 591 }
590 592
591 mode = rate_index_to_mode(rate_index); 593 mode = rate_index_to_mode(rate_index);
592 amdtp_stream_set_parameters(&dice->stream, rate, channels, 594 amdtp_stream_set_parameters(&dice->stream, rate, channels,
593 dice->rx_midi_ports[mode]); 595 dice->rx_midi_ports[mode]);
596 if (rate_index > 4) {
597 channels /= 2;
598
599 for (i = 0; i < channels; i++) {
600 dice->stream.pcm_positions[i] = i * 2;
601 dice->stream.pcm_positions[i + channels] = i * 2 + 1;
602 }
603 }
604
594 amdtp_stream_set_pcm_format(&dice->stream, 605 amdtp_stream_set_pcm_format(&dice->stream,
595 params_format(hw_params)); 606 params_format(hw_params));
596 607
diff --git a/sound/pci/ctxfi/ct20k1reg.h b/sound/pci/ctxfi/ct20k1reg.h
index f2e34e3f27ee..5851249f11d9 100644
--- a/sound/pci/ctxfi/ct20k1reg.h
+++ b/sound/pci/ctxfi/ct20k1reg.h
@@ -7,7 +7,7 @@
7 */ 7 */
8 8
9#ifndef CT20K1REG_H 9#ifndef CT20K1REG_H
10#define CT20k1REG_H 10#define CT20K1REG_H
11 11
12/* 20k1 registers */ 12/* 20k1 registers */
13#define DSPXRAM_START 0x000000 13#define DSPXRAM_START 0x000000
@@ -632,5 +632,3 @@
632#define I2SD_R 0x19L 632#define I2SD_R 0x19L
633 633
634#endif /* CT20K1REG_H */ 634#endif /* CT20K1REG_H */
635
636
diff --git a/sound/pci/hda/ca0132_regs.h b/sound/pci/hda/ca0132_regs.h
index 07e760937d3c..8371274aa811 100644
--- a/sound/pci/hda/ca0132_regs.h
+++ b/sound/pci/hda/ca0132_regs.h
@@ -20,7 +20,7 @@
20 */ 20 */
21 21
22#ifndef __CA0132_REGS_H 22#ifndef __CA0132_REGS_H
23#define __CA0312_REGS_H 23#define __CA0132_REGS_H
24 24
25#define DSP_CHIP_OFFSET 0x100000 25#define DSP_CHIP_OFFSET 0x100000
26#define DSP_DBGCNTL_MODULE_OFFSET 0xE30 26#define DSP_DBGCNTL_MODULE_OFFSET 0xE30
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
index 6f2fa838b635..47ccb8f44adb 100644
--- a/sound/pci/hda/patch_conexant.c
+++ b/sound/pci/hda/patch_conexant.c
@@ -217,6 +217,7 @@ enum {
217 CXT_FIXUP_HEADPHONE_MIC_PIN, 217 CXT_FIXUP_HEADPHONE_MIC_PIN,
218 CXT_FIXUP_HEADPHONE_MIC, 218 CXT_FIXUP_HEADPHONE_MIC,
219 CXT_FIXUP_GPIO1, 219 CXT_FIXUP_GPIO1,
220 CXT_FIXUP_ASPIRE_DMIC,
220 CXT_FIXUP_THINKPAD_ACPI, 221 CXT_FIXUP_THINKPAD_ACPI,
221 CXT_FIXUP_OLPC_XO, 222 CXT_FIXUP_OLPC_XO,
222 CXT_FIXUP_CAP_MIX_AMP, 223 CXT_FIXUP_CAP_MIX_AMP,
@@ -664,6 +665,12 @@ static const struct hda_fixup cxt_fixups[] = {
664 { } 665 { }
665 }, 666 },
666 }, 667 },
668 [CXT_FIXUP_ASPIRE_DMIC] = {
669 .type = HDA_FIXUP_FUNC,
670 .v.func = cxt_fixup_stereo_dmic,
671 .chained = true,
672 .chain_id = CXT_FIXUP_GPIO1,
673 },
667 [CXT_FIXUP_THINKPAD_ACPI] = { 674 [CXT_FIXUP_THINKPAD_ACPI] = {
668 .type = HDA_FIXUP_FUNC, 675 .type = HDA_FIXUP_FUNC,
669 .v.func = hda_fixup_thinkpad_acpi, 676 .v.func = hda_fixup_thinkpad_acpi,
@@ -744,7 +751,7 @@ static const struct hda_model_fixup cxt5051_fixup_models[] = {
744 751
745static const struct snd_pci_quirk cxt5066_fixups[] = { 752static const struct snd_pci_quirk cxt5066_fixups[] = {
746 SND_PCI_QUIRK(0x1025, 0x0543, "Acer Aspire One 522", CXT_FIXUP_STEREO_DMIC), 753 SND_PCI_QUIRK(0x1025, 0x0543, "Acer Aspire One 522", CXT_FIXUP_STEREO_DMIC),
747 SND_PCI_QUIRK(0x1025, 0x054c, "Acer Aspire 3830TG", CXT_FIXUP_GPIO1), 754 SND_PCI_QUIRK(0x1025, 0x054c, "Acer Aspire 3830TG", CXT_FIXUP_ASPIRE_DMIC),
748 SND_PCI_QUIRK(0x1043, 0x138d, "Asus", CXT_FIXUP_HEADPHONE_MIC_PIN), 755 SND_PCI_QUIRK(0x1043, 0x138d, "Asus", CXT_FIXUP_HEADPHONE_MIC_PIN),
749 SND_PCI_QUIRK(0x152d, 0x0833, "OLPC XO-1.5", CXT_FIXUP_OLPC_XO), 756 SND_PCI_QUIRK(0x152d, 0x0833, "OLPC XO-1.5", CXT_FIXUP_OLPC_XO),
750 SND_PCI_QUIRK(0x17aa, 0x20f2, "Lenovo T400", CXT_PINCFG_LENOVO_TP410), 757 SND_PCI_QUIRK(0x17aa, 0x20f2, "Lenovo T400", CXT_PINCFG_LENOVO_TP410),
@@ -770,6 +777,7 @@ static const struct hda_model_fixup cxt5066_fixup_models[] = {
770 { .id = CXT_PINCFG_LENOVO_TP410, .name = "tp410" }, 777 { .id = CXT_PINCFG_LENOVO_TP410, .name = "tp410" },
771 { .id = CXT_FIXUP_THINKPAD_ACPI, .name = "thinkpad" }, 778 { .id = CXT_FIXUP_THINKPAD_ACPI, .name = "thinkpad" },
772 { .id = CXT_PINCFG_LEMOTE_A1004, .name = "lemote-a1004" }, 779 { .id = CXT_PINCFG_LEMOTE_A1004, .name = "lemote-a1004" },
780 { .id = CXT_PINCFG_LEMOTE_A1205, .name = "lemote-a1205" },
773 { .id = CXT_FIXUP_OLPC_XO, .name = "olpc-xo" }, 781 { .id = CXT_FIXUP_OLPC_XO, .name = "olpc-xo" },
774 {} 782 {}
775}; 783};
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
index 36badba2dcec..99d7d7fecaad 100644
--- a/sound/pci/hda/patch_hdmi.c
+++ b/sound/pci/hda/patch_hdmi.c
@@ -50,6 +50,8 @@ MODULE_PARM_DESC(static_hdmi_pcm, "Don't restrict PCM parameters per ELD info");
50#define is_haswell_plus(codec) (is_haswell(codec) || is_broadwell(codec)) 50#define is_haswell_plus(codec) (is_haswell(codec) || is_broadwell(codec))
51 51
52#define is_valleyview(codec) ((codec)->vendor_id == 0x80862882) 52#define is_valleyview(codec) ((codec)->vendor_id == 0x80862882)
53#define is_cherryview(codec) ((codec)->vendor_id == 0x80862883)
54#define is_valleyview_plus(codec) (is_valleyview(codec) || is_cherryview(codec))
53 55
54struct hdmi_spec_per_cvt { 56struct hdmi_spec_per_cvt {
55 hda_nid_t cvt_nid; 57 hda_nid_t cvt_nid;
@@ -1459,7 +1461,7 @@ static int hdmi_pcm_open(struct hda_pcm_stream *hinfo,
1459 mux_idx); 1461 mux_idx);
1460 1462
1461 /* configure unused pins to choose other converters */ 1463 /* configure unused pins to choose other converters */
1462 if (is_haswell_plus(codec) || is_valleyview(codec)) 1464 if (is_haswell_plus(codec) || is_valleyview_plus(codec))
1463 intel_not_share_assigned_cvt(codec, per_pin->pin_nid, mux_idx); 1465 intel_not_share_assigned_cvt(codec, per_pin->pin_nid, mux_idx);
1464 1466
1465 snd_hda_spdif_ctls_assign(codec, pin_idx, per_cvt->cvt_nid); 1467 snd_hda_spdif_ctls_assign(codec, pin_idx, per_cvt->cvt_nid);
@@ -1598,7 +1600,8 @@ static bool hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, int repoll)
1598 * and this can make HW reset converter selection on a pin. 1600 * and this can make HW reset converter selection on a pin.
1599 */ 1601 */
1600 if (eld->eld_valid && !old_eld_valid && per_pin->setup) { 1602 if (eld->eld_valid && !old_eld_valid && per_pin->setup) {
1601 if (is_haswell_plus(codec) || is_valleyview(codec)) { 1603 if (is_haswell_plus(codec) ||
1604 is_valleyview_plus(codec)) {
1602 intel_verify_pin_cvt_connect(codec, per_pin); 1605 intel_verify_pin_cvt_connect(codec, per_pin);
1603 intel_not_share_assigned_cvt(codec, pin_nid, 1606 intel_not_share_assigned_cvt(codec, pin_nid,
1604 per_pin->mux_idx); 1607 per_pin->mux_idx);
@@ -1779,7 +1782,7 @@ static int generic_hdmi_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
1779 bool non_pcm; 1782 bool non_pcm;
1780 int pinctl; 1783 int pinctl;
1781 1784
1782 if (is_haswell_plus(codec) || is_valleyview(codec)) { 1785 if (is_haswell_plus(codec) || is_valleyview_plus(codec)) {
1783 /* Verify pin:cvt selections to avoid silent audio after S3. 1786 /* Verify pin:cvt selections to avoid silent audio after S3.
1784 * After S3, the audio driver restores pin:cvt selections 1787 * After S3, the audio driver restores pin:cvt selections
1785 * but this can happen before gfx is ready and such selection 1788 * but this can happen before gfx is ready and such selection
@@ -2330,9 +2333,8 @@ static int patch_generic_hdmi(struct hda_codec *codec)
2330 intel_haswell_fixup_enable_dp12(codec); 2333 intel_haswell_fixup_enable_dp12(codec);
2331 } 2334 }
2332 2335
2333 if (is_haswell(codec) || is_valleyview(codec)) { 2336 if (is_haswell_plus(codec) || is_valleyview_plus(codec))
2334 codec->depop_delay = 0; 2337 codec->depop_delay = 0;
2335 }
2336 2338
2337 if (hdmi_parse_codec(codec) < 0) { 2339 if (hdmi_parse_codec(codec) < 0) {
2338 codec->spec = NULL; 2340 codec->spec = NULL;
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 6b38ec3c6e57..1ba22fb527c2 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -181,6 +181,8 @@ static void alc_fix_pll(struct hda_codec *codec)
181 spec->pll_coef_idx); 181 spec->pll_coef_idx);
182 val = snd_hda_codec_read(codec, spec->pll_nid, 0, 182 val = snd_hda_codec_read(codec, spec->pll_nid, 0,
183 AC_VERB_GET_PROC_COEF, 0); 183 AC_VERB_GET_PROC_COEF, 0);
184 if (val == -1)
185 return;
184 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX, 186 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_COEF_INDEX,
185 spec->pll_coef_idx); 187 spec->pll_coef_idx);
186 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF, 188 snd_hda_codec_write(codec, spec->pll_nid, 0, AC_VERB_SET_PROC_COEF,
@@ -326,6 +328,7 @@ static void alc_auto_init_amp(struct hda_codec *codec, int type)
326 case 0x10ec0885: 328 case 0x10ec0885:
327 case 0x10ec0887: 329 case 0x10ec0887:
328 /*case 0x10ec0889:*/ /* this causes an SPDIF problem */ 330 /*case 0x10ec0889:*/ /* this causes an SPDIF problem */
331 case 0x10ec0900:
329 alc889_coef_init(codec); 332 alc889_coef_init(codec);
330 break; 333 break;
331 case 0x10ec0888: 334 case 0x10ec0888:
@@ -2348,6 +2351,7 @@ static int patch_alc882(struct hda_codec *codec)
2348 switch (codec->vendor_id) { 2351 switch (codec->vendor_id) {
2349 case 0x10ec0882: 2352 case 0x10ec0882:
2350 case 0x10ec0885: 2353 case 0x10ec0885:
2354 case 0x10ec0900:
2351 break; 2355 break;
2352 default: 2356 default:
2353 /* ALC883 and variants */ 2357 /* ALC883 and variants */
@@ -2806,6 +2810,8 @@ static void alc286_shutup(struct hda_codec *codec)
2806static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up) 2810static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up)
2807{ 2811{
2808 int val = alc_read_coef_idx(codec, 0x04); 2812 int val = alc_read_coef_idx(codec, 0x04);
2813 if (val == -1)
2814 return;
2809 if (power_up) 2815 if (power_up)
2810 val |= 1 << 11; 2816 val |= 1 << 11;
2811 else 2817 else
@@ -3264,6 +3270,15 @@ static int alc269_resume(struct hda_codec *codec)
3264 snd_hda_codec_resume_cache(codec); 3270 snd_hda_codec_resume_cache(codec);
3265 alc_inv_dmic_sync(codec, true); 3271 alc_inv_dmic_sync(codec, true);
3266 hda_call_check_power_status(codec, 0x01); 3272 hda_call_check_power_status(codec, 0x01);
3273
3274 /* on some machine, the BIOS will clear the codec gpio data when enter
3275 * suspend, and won't restore the data after resume, so we restore it
3276 * in the driver.
3277 */
3278 if (spec->gpio_led)
3279 snd_hda_codec_write(codec, codec->afg, 0, AC_VERB_SET_GPIO_DATA,
3280 spec->gpio_led);
3281
3267 if (spec->has_alc5505_dsp) 3282 if (spec->has_alc5505_dsp)
3268 alc5505_dsp_resume(codec); 3283 alc5505_dsp_resume(codec);
3269 3284
@@ -4395,6 +4410,7 @@ enum {
4395 ALC292_FIXUP_TPT440_DOCK, 4410 ALC292_FIXUP_TPT440_DOCK,
4396 ALC283_FIXUP_BXBT2807_MIC, 4411 ALC283_FIXUP_BXBT2807_MIC,
4397 ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED, 4412 ALC255_FIXUP_DELL_WMI_MIC_MUTE_LED,
4413 ALC282_FIXUP_ASPIRE_V5_PINS,
4398}; 4414};
4399 4415
4400static const struct hda_fixup alc269_fixups[] = { 4416static const struct hda_fixup alc269_fixups[] = {
@@ -4842,6 +4858,22 @@ static const struct hda_fixup alc269_fixups[] = {
4842 .chained_before = true, 4858 .chained_before = true,
4843 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE 4859 .chain_id = ALC255_FIXUP_DELL1_MIC_NO_PRESENCE
4844 }, 4860 },
4861 [ALC282_FIXUP_ASPIRE_V5_PINS] = {
4862 .type = HDA_FIXUP_PINS,
4863 .v.pins = (const struct hda_pintbl[]) {
4864 { 0x12, 0x90a60130 },
4865 { 0x14, 0x90170110 },
4866 { 0x17, 0x40000008 },
4867 { 0x18, 0x411111f0 },
4868 { 0x19, 0x411111f0 },
4869 { 0x1a, 0x411111f0 },
4870 { 0x1b, 0x411111f0 },
4871 { 0x1d, 0x40f89b2d },
4872 { 0x1e, 0x411111f0 },
4873 { 0x21, 0x0321101f },
4874 { },
4875 },
4876 },
4845 4877
4846}; 4878};
4847 4879
@@ -4853,6 +4885,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
4853 SND_PCI_QUIRK(0x1025, 0x0740, "Acer AO725", ALC271_FIXUP_HP_GATE_MIC_JACK), 4885 SND_PCI_QUIRK(0x1025, 0x0740, "Acer AO725", ALC271_FIXUP_HP_GATE_MIC_JACK),
4854 SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK), 4886 SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK),
4855 SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572), 4887 SND_PCI_QUIRK(0x1025, 0x0775, "Acer Aspire E1-572", ALC271_FIXUP_HP_GATE_MIC_JACK_E1_572),
4888 SND_PCI_QUIRK(0x1025, 0x079b, "Acer Aspire V5-573G", ALC282_FIXUP_ASPIRE_V5_PINS),
4856 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z), 4889 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
4857 SND_PCI_QUIRK(0x1028, 0x05bd, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE), 4890 SND_PCI_QUIRK(0x1028, 0x05bd, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE),
4858 SND_PCI_QUIRK(0x1028, 0x05be, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE), 4891 SND_PCI_QUIRK(0x1028, 0x05be, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE),
@@ -5311,27 +5344,30 @@ static void alc269_fill_coef(struct hda_codec *codec)
5311 if ((alc_get_coef0(codec) & 0x00ff) == 0x017) { 5344 if ((alc_get_coef0(codec) & 0x00ff) == 0x017) {
5312 val = alc_read_coef_idx(codec, 0x04); 5345 val = alc_read_coef_idx(codec, 0x04);
5313 /* Power up output pin */ 5346 /* Power up output pin */
5314 alc_write_coef_idx(codec, 0x04, val | (1<<11)); 5347 if (val != -1)
5348 alc_write_coef_idx(codec, 0x04, val | (1<<11));
5315 } 5349 }
5316 5350
5317 if ((alc_get_coef0(codec) & 0x00ff) == 0x018) { 5351 if ((alc_get_coef0(codec) & 0x00ff) == 0x018) {
5318 val = alc_read_coef_idx(codec, 0xd); 5352 val = alc_read_coef_idx(codec, 0xd);
5319 if ((val & 0x0c00) >> 10 != 0x1) { 5353 if (val != -1 && (val & 0x0c00) >> 10 != 0x1) {
5320 /* Capless ramp up clock control */ 5354 /* Capless ramp up clock control */
5321 alc_write_coef_idx(codec, 0xd, val | (1<<10)); 5355 alc_write_coef_idx(codec, 0xd, val | (1<<10));
5322 } 5356 }
5323 val = alc_read_coef_idx(codec, 0x17); 5357 val = alc_read_coef_idx(codec, 0x17);
5324 if ((val & 0x01c0) >> 6 != 0x4) { 5358 if (val != -1 && (val & 0x01c0) >> 6 != 0x4) {
5325 /* Class D power on reset */ 5359 /* Class D power on reset */
5326 alc_write_coef_idx(codec, 0x17, val | (1<<7)); 5360 alc_write_coef_idx(codec, 0x17, val | (1<<7));
5327 } 5361 }
5328 } 5362 }
5329 5363
5330 val = alc_read_coef_idx(codec, 0xd); /* Class D */ 5364 val = alc_read_coef_idx(codec, 0xd); /* Class D */
5331 alc_write_coef_idx(codec, 0xd, val | (1<<14)); 5365 if (val != -1)
5366 alc_write_coef_idx(codec, 0xd, val | (1<<14));
5332 5367
5333 val = alc_read_coef_idx(codec, 0x4); /* HP */ 5368 val = alc_read_coef_idx(codec, 0x4); /* HP */
5334 alc_write_coef_idx(codec, 0x4, val | (1<<11)); 5369 if (val != -1)
5370 alc_write_coef_idx(codec, 0x4, val | (1<<11));
5335} 5371}
5336 5372
5337/* 5373/*
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index ea823e1100da..98cd1908c039 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -566,8 +566,8 @@ static void stac_init_power_map(struct hda_codec *codec)
566 if (snd_hda_jack_tbl_get(codec, nid)) 566 if (snd_hda_jack_tbl_get(codec, nid))
567 continue; 567 continue;
568 if (def_conf == AC_JACK_PORT_COMPLEX && 568 if (def_conf == AC_JACK_PORT_COMPLEX &&
569 !(spec->vref_mute_led_nid == nid || 569 spec->vref_mute_led_nid != nid &&
570 is_jack_detectable(codec, nid))) { 570 is_jack_detectable(codec, nid)) {
571 snd_hda_jack_detect_enable_callback(codec, nid, 571 snd_hda_jack_detect_enable_callback(codec, nid,
572 STAC_PWR_EVENT, 572 STAC_PWR_EVENT,
573 jack_update_power); 573 jack_update_power);
@@ -4276,11 +4276,18 @@ static int stac_parse_auto_config(struct hda_codec *codec)
4276 return err; 4276 return err;
4277 } 4277 }
4278 4278
4279 stac_init_power_map(codec);
4280
4281 return 0; 4279 return 0;
4282} 4280}
4283 4281
4282static int stac_build_controls(struct hda_codec *codec)
4283{
4284 int err = snd_hda_gen_build_controls(codec);
4285
4286 if (err < 0)
4287 return err;
4288 stac_init_power_map(codec);
4289 return 0;
4290}
4284 4291
4285static int stac_init(struct hda_codec *codec) 4292static int stac_init(struct hda_codec *codec)
4286{ 4293{
@@ -4392,7 +4399,7 @@ static int stac_suspend(struct hda_codec *codec)
4392#endif /* CONFIG_PM */ 4399#endif /* CONFIG_PM */
4393 4400
4394static const struct hda_codec_ops stac_patch_ops = { 4401static const struct hda_codec_ops stac_patch_ops = {
4395 .build_controls = snd_hda_gen_build_controls, 4402 .build_controls = stac_build_controls,
4396 .build_pcms = snd_hda_gen_build_pcms, 4403 .build_pcms = snd_hda_gen_build_pcms,
4397 .init = stac_init, 4404 .init = stac_init,
4398 .free = stac_free, 4405 .free = stac_free,
diff --git a/sound/soc/codecs/arizona.c b/sound/soc/codecs/arizona.c
index bd41ee4da078..2c71f16bd661 100644
--- a/sound/soc/codecs/arizona.c
+++ b/sound/soc/codecs/arizona.c
@@ -1278,6 +1278,8 @@ static int arizona_hw_params(struct snd_pcm_substream *substream,
1278 else 1278 else
1279 rates = &arizona_48k_bclk_rates[0]; 1279 rates = &arizona_48k_bclk_rates[0];
1280 1280
1281 wl = snd_pcm_format_width(params_format(params));
1282
1281 if (tdm_slots) { 1283 if (tdm_slots) {
1282 arizona_aif_dbg(dai, "Configuring for %d %d bit TDM slots\n", 1284 arizona_aif_dbg(dai, "Configuring for %d %d bit TDM slots\n",
1283 tdm_slots, tdm_width); 1285 tdm_slots, tdm_width);
@@ -1285,6 +1287,7 @@ static int arizona_hw_params(struct snd_pcm_substream *substream,
1285 channels = tdm_slots; 1287 channels = tdm_slots;
1286 } else { 1288 } else {
1287 bclk_target = snd_soc_params_to_bclk(params); 1289 bclk_target = snd_soc_params_to_bclk(params);
1290 tdm_width = wl;
1288 } 1291 }
1289 1292
1290 if (chan_limit && chan_limit < channels) { 1293 if (chan_limit && chan_limit < channels) {
@@ -1319,8 +1322,7 @@ static int arizona_hw_params(struct snd_pcm_substream *substream,
1319 arizona_aif_dbg(dai, "BCLK %dHz LRCLK %dHz\n", 1322 arizona_aif_dbg(dai, "BCLK %dHz LRCLK %dHz\n",
1320 rates[bclk], rates[bclk] / lrclk); 1323 rates[bclk], rates[bclk] / lrclk);
1321 1324
1322 wl = snd_pcm_format_width(params_format(params)); 1325 frame = wl << ARIZONA_AIF1TX_WL_SHIFT | tdm_width;
1323 frame = wl << ARIZONA_AIF1TX_WL_SHIFT | wl;
1324 1326
1325 reconfig = arizona_aif_cfg_changed(codec, base, bclk, lrclk, frame); 1327 reconfig = arizona_aif_cfg_changed(codec, base, bclk, lrclk, frame);
1326 1328
diff --git a/sound/soc/codecs/cs4265.c b/sound/soc/codecs/cs4265.c
index a20b30ca52c0..69a85164357c 100644
--- a/sound/soc/codecs/cs4265.c
+++ b/sound/soc/codecs/cs4265.c
@@ -282,10 +282,10 @@ static const struct cs4265_clk_para clk_map_table[] = {
282 282
283 /*64k*/ 283 /*64k*/
284 {8192000, 64000, 1, 0}, 284 {8192000, 64000, 1, 0},
285 {1228800, 64000, 1, 1}, 285 {12288000, 64000, 1, 1},
286 {1693440, 64000, 1, 2}, 286 {16934400, 64000, 1, 2},
287 {2457600, 64000, 1, 3}, 287 {24576000, 64000, 1, 3},
288 {3276800, 64000, 1, 4}, 288 {32768000, 64000, 1, 4},
289 289
290 /* 88.2k */ 290 /* 88.2k */
291 {11289600, 88200, 1, 0}, 291 {11289600, 88200, 1, 0},
@@ -435,10 +435,10 @@ static int cs4265_pcm_hw_params(struct snd_pcm_substream *substream,
435 index = cs4265_get_clk_index(cs4265->sysclk, params_rate(params)); 435 index = cs4265_get_clk_index(cs4265->sysclk, params_rate(params));
436 if (index >= 0) { 436 if (index >= 0) {
437 snd_soc_update_bits(codec, CS4265_ADC_CTL, 437 snd_soc_update_bits(codec, CS4265_ADC_CTL,
438 CS4265_ADC_FM, clk_map_table[index].fm_mode); 438 CS4265_ADC_FM, clk_map_table[index].fm_mode << 6);
439 snd_soc_update_bits(codec, CS4265_MCLK_FREQ, 439 snd_soc_update_bits(codec, CS4265_MCLK_FREQ,
440 CS4265_MCLK_FREQ_MASK, 440 CS4265_MCLK_FREQ_MASK,
441 clk_map_table[index].mclkdiv); 441 clk_map_table[index].mclkdiv << 4);
442 442
443 } else { 443 } else {
444 dev_err(codec->dev, "can't get correct mclk\n"); 444 dev_err(codec->dev, "can't get correct mclk\n");
@@ -458,12 +458,12 @@ static int cs4265_pcm_hw_params(struct snd_pcm_substream *substream,
458 if (params_width(params) == 16) { 458 if (params_width(params) == 16) {
459 snd_soc_update_bits(codec, CS4265_DAC_CTL, 459 snd_soc_update_bits(codec, CS4265_DAC_CTL,
460 CS4265_DAC_CTL_DIF, (1 << 5)); 460 CS4265_DAC_CTL_DIF, (1 << 5));
461 snd_soc_update_bits(codec, CS4265_ADC_CTL, 461 snd_soc_update_bits(codec, CS4265_SPDIF_CTL2,
462 CS4265_SPDIF_CTL2_DIF, (1 << 7)); 462 CS4265_SPDIF_CTL2_DIF, (1 << 7));
463 } else { 463 } else {
464 snd_soc_update_bits(codec, CS4265_DAC_CTL, 464 snd_soc_update_bits(codec, CS4265_DAC_CTL,
465 CS4265_DAC_CTL_DIF, (3 << 5)); 465 CS4265_DAC_CTL_DIF, (3 << 5));
466 snd_soc_update_bits(codec, CS4265_ADC_CTL, 466 snd_soc_update_bits(codec, CS4265_SPDIF_CTL2,
467 CS4265_SPDIF_CTL2_DIF, (1 << 7)); 467 CS4265_SPDIF_CTL2_DIF, (1 << 7));
468 } 468 }
469 break; 469 break;
@@ -472,7 +472,7 @@ static int cs4265_pcm_hw_params(struct snd_pcm_substream *substream,
472 CS4265_DAC_CTL_DIF, 0); 472 CS4265_DAC_CTL_DIF, 0);
473 snd_soc_update_bits(codec, CS4265_ADC_CTL, 473 snd_soc_update_bits(codec, CS4265_ADC_CTL,
474 CS4265_ADC_DIF, 0); 474 CS4265_ADC_DIF, 0);
475 snd_soc_update_bits(codec, CS4265_ADC_CTL, 475 snd_soc_update_bits(codec, CS4265_SPDIF_CTL2,
476 CS4265_SPDIF_CTL2_DIF, (1 << 6)); 476 CS4265_SPDIF_CTL2_DIF, (1 << 6));
477 477
478 break; 478 break;
diff --git a/sound/soc/codecs/da732x.h b/sound/soc/codecs/da732x.h
index 1dceafeec415..f586cbd30b77 100644
--- a/sound/soc/codecs/da732x.h
+++ b/sound/soc/codecs/da732x.h
@@ -11,7 +11,7 @@
11 */ 11 */
12 12
13#ifndef __DA732X_H_ 13#ifndef __DA732X_H_
14#define __DA732X_H 14#define __DA732X_H_
15 15
16#include <sound/soc.h> 16#include <sound/soc.h>
17 17
diff --git a/sound/soc/codecs/pcm512x.c b/sound/soc/codecs/pcm512x.c
index 163ec3855fd4..0c8aefab404c 100644
--- a/sound/soc/codecs/pcm512x.c
+++ b/sound/soc/codecs/pcm512x.c
@@ -259,13 +259,13 @@ static const struct soc_enum pcm512x_veds =
259 pcm512x_ramp_step_text); 259 pcm512x_ramp_step_text);
260 260
261static const struct snd_kcontrol_new pcm512x_controls[] = { 261static const struct snd_kcontrol_new pcm512x_controls[] = {
262SOC_DOUBLE_R_TLV("Playback Digital Volume", PCM512x_DIGITAL_VOLUME_2, 262SOC_DOUBLE_R_TLV("Digital Playback Volume", PCM512x_DIGITAL_VOLUME_2,
263 PCM512x_DIGITAL_VOLUME_3, 0, 255, 1, digital_tlv), 263 PCM512x_DIGITAL_VOLUME_3, 0, 255, 1, digital_tlv),
264SOC_DOUBLE_TLV("Playback Volume", PCM512x_ANALOG_GAIN_CTRL, 264SOC_DOUBLE_TLV("Playback Volume", PCM512x_ANALOG_GAIN_CTRL,
265 PCM512x_LAGN_SHIFT, PCM512x_RAGN_SHIFT, 1, 1, analog_tlv), 265 PCM512x_LAGN_SHIFT, PCM512x_RAGN_SHIFT, 1, 1, analog_tlv),
266SOC_DOUBLE_TLV("Playback Boost Volume", PCM512x_ANALOG_GAIN_BOOST, 266SOC_DOUBLE_TLV("Playback Boost Volume", PCM512x_ANALOG_GAIN_BOOST,
267 PCM512x_AGBL_SHIFT, PCM512x_AGBR_SHIFT, 1, 0, boost_tlv), 267 PCM512x_AGBL_SHIFT, PCM512x_AGBR_SHIFT, 1, 0, boost_tlv),
268SOC_DOUBLE("Playback Digital Switch", PCM512x_MUTE, PCM512x_RQML_SHIFT, 268SOC_DOUBLE("Digital Playback Switch", PCM512x_MUTE, PCM512x_RQML_SHIFT,
269 PCM512x_RQMR_SHIFT, 1, 1), 269 PCM512x_RQMR_SHIFT, 1, 1),
270 270
271SOC_SINGLE("Deemphasis Switch", PCM512x_DSP, PCM512x_DEMP_SHIFT, 1, 1), 271SOC_SINGLE("Deemphasis Switch", PCM512x_DSP, PCM512x_DEMP_SHIFT, 1, 1),
diff --git a/sound/soc/codecs/rt286.c b/sound/soc/codecs/rt286.c
index e4f6102efc1a..b86b426f159d 100644
--- a/sound/soc/codecs/rt286.c
+++ b/sound/soc/codecs/rt286.c
@@ -51,7 +51,7 @@ static struct reg_default rt286_index_def[] = {
51 { 0x04, 0xaf01 }, 51 { 0x04, 0xaf01 },
52 { 0x08, 0x000d }, 52 { 0x08, 0x000d },
53 { 0x09, 0xd810 }, 53 { 0x09, 0xd810 },
54 { 0x0a, 0x0060 }, 54 { 0x0a, 0x0120 },
55 { 0x0b, 0x0000 }, 55 { 0x0b, 0x0000 },
56 { 0x0d, 0x2800 }, 56 { 0x0d, 0x2800 },
57 { 0x0f, 0x0000 }, 57 { 0x0f, 0x0000 },
@@ -60,7 +60,7 @@ static struct reg_default rt286_index_def[] = {
60 { 0x33, 0x0208 }, 60 { 0x33, 0x0208 },
61 { 0x49, 0x0004 }, 61 { 0x49, 0x0004 },
62 { 0x4f, 0x50e9 }, 62 { 0x4f, 0x50e9 },
63 { 0x50, 0x2c00 }, 63 { 0x50, 0x2000 },
64 { 0x63, 0x2902 }, 64 { 0x63, 0x2902 },
65 { 0x67, 0x1111 }, 65 { 0x67, 0x1111 },
66 { 0x68, 0x1016 }, 66 { 0x68, 0x1016 },
@@ -104,7 +104,6 @@ static const struct reg_default rt286_reg[] = {
104 { 0x02170700, 0x00000000 }, 104 { 0x02170700, 0x00000000 },
105 { 0x02270100, 0x00000000 }, 105 { 0x02270100, 0x00000000 },
106 { 0x02370100, 0x00000000 }, 106 { 0x02370100, 0x00000000 },
107 { 0x02040000, 0x00004002 },
108 { 0x01870700, 0x00000020 }, 107 { 0x01870700, 0x00000020 },
109 { 0x00830000, 0x000000c3 }, 108 { 0x00830000, 0x000000c3 },
110 { 0x00930000, 0x000000c3 }, 109 { 0x00930000, 0x000000c3 },
@@ -192,7 +191,6 @@ static int rt286_hw_write(void *context, unsigned int reg, unsigned int value)
192 /*handle index registers*/ 191 /*handle index registers*/
193 if (reg <= 0xff) { 192 if (reg <= 0xff) {
194 rt286_hw_write(client, RT286_COEF_INDEX, reg); 193 rt286_hw_write(client, RT286_COEF_INDEX, reg);
195 reg = RT286_PROC_COEF;
196 for (i = 0; i < INDEX_CACHE_SIZE; i++) { 194 for (i = 0; i < INDEX_CACHE_SIZE; i++) {
197 if (reg == rt286->index_cache[i].reg) { 195 if (reg == rt286->index_cache[i].reg) {
198 rt286->index_cache[i].def = value; 196 rt286->index_cache[i].def = value;
@@ -200,6 +198,7 @@ static int rt286_hw_write(void *context, unsigned int reg, unsigned int value)
200 } 198 }
201 199
202 } 200 }
201 reg = RT286_PROC_COEF;
203 } 202 }
204 203
205 data[0] = (reg >> 24) & 0xff; 204 data[0] = (reg >> 24) & 0xff;
diff --git a/sound/soc/codecs/rt5640.c b/sound/soc/codecs/rt5640.c
index 6bc6efdec550..f1ec6e6bd08a 100644
--- a/sound/soc/codecs/rt5640.c
+++ b/sound/soc/codecs/rt5640.c
@@ -2059,6 +2059,7 @@ static struct snd_soc_codec_driver soc_codec_dev_rt5640 = {
2059static const struct regmap_config rt5640_regmap = { 2059static const struct regmap_config rt5640_regmap = {
2060 .reg_bits = 8, 2060 .reg_bits = 8,
2061 .val_bits = 16, 2061 .val_bits = 16,
2062 .use_single_rw = true,
2062 2063
2063 .max_register = RT5640_VENDOR_ID2 + 1 + (ARRAY_SIZE(rt5640_ranges) * 2064 .max_register = RT5640_VENDOR_ID2 + 1 + (ARRAY_SIZE(rt5640_ranges) *
2064 RT5640_PR_SPACING), 2065 RT5640_PR_SPACING),
diff --git a/sound/soc/codecs/rt5677.c b/sound/soc/codecs/rt5677.c
index 67f14556462f..5337c448b5e3 100644
--- a/sound/soc/codecs/rt5677.c
+++ b/sound/soc/codecs/rt5677.c
@@ -2135,10 +2135,10 @@ static const struct snd_soc_dapm_route rt5677_dapm_routes[] = {
2135 { "BST2", NULL, "IN2P" }, 2135 { "BST2", NULL, "IN2P" },
2136 { "BST2", NULL, "IN2N" }, 2136 { "BST2", NULL, "IN2N" },
2137 2137
2138 { "IN1P", NULL, "micbias1" }, 2138 { "IN1P", NULL, "MICBIAS1" },
2139 { "IN1N", NULL, "micbias1" }, 2139 { "IN1N", NULL, "MICBIAS1" },
2140 { "IN2P", NULL, "micbias1" }, 2140 { "IN2P", NULL, "MICBIAS1" },
2141 { "IN2N", NULL, "micbias1" }, 2141 { "IN2N", NULL, "MICBIAS1" },
2142 2142
2143 { "ADC 1", NULL, "BST1" }, 2143 { "ADC 1", NULL, "BST1" },
2144 { "ADC 1", NULL, "ADC 1 power" }, 2144 { "ADC 1", NULL, "ADC 1 power" },
diff --git a/sound/soc/codecs/sta529.c b/sound/soc/codecs/sta529.c
index 9aa1323fb2ab..89c748dd3d6e 100644
--- a/sound/soc/codecs/sta529.c
+++ b/sound/soc/codecs/sta529.c
@@ -4,7 +4,7 @@
4 * sound/soc/codecs/sta529.c -- spear ALSA Soc codec driver 4 * sound/soc/codecs/sta529.c -- spear ALSA Soc codec driver
5 * 5 *
6 * Copyright (C) 2012 ST Microelectronics 6 * Copyright (C) 2012 ST Microelectronics
7 * Rajeev Kumar <rajeev-dlh.kumar@st.com> 7 * Rajeev Kumar <rajeevkumar.linux@gmail.com>
8 * 8 *
9 * This file is licensed under the terms of the GNU General Public 9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any 10 * License version 2. This program is licensed "as is" without any
@@ -426,5 +426,5 @@ static struct i2c_driver sta529_i2c_driver = {
426module_i2c_driver(sta529_i2c_driver); 426module_i2c_driver(sta529_i2c_driver);
427 427
428MODULE_DESCRIPTION("ASoC STA529 codec driver"); 428MODULE_DESCRIPTION("ASoC STA529 codec driver");
429MODULE_AUTHOR("Rajeev Kumar <rajeev-dlh.kumar@st.com>"); 429MODULE_AUTHOR("Rajeev Kumar <rajeevkumar.linux@gmail.com>");
430MODULE_LICENSE("GPL"); 430MODULE_LICENSE("GPL");
diff --git a/sound/soc/codecs/tlv320aic31xx.c b/sound/soc/codecs/tlv320aic31xx.c
index 0f64c7890eed..aea9e1ff9126 100644
--- a/sound/soc/codecs/tlv320aic31xx.c
+++ b/sound/soc/codecs/tlv320aic31xx.c
@@ -189,46 +189,57 @@ static const struct aic31xx_rate_divs aic31xx_divs[] = {
189 /* mclk rate pll: p j d dosr ndac mdac aors nadc madc */ 189 /* mclk rate pll: p j d dosr ndac mdac aors nadc madc */
190 /* 8k rate */ 190 /* 8k rate */
191 {12000000, 8000, 1, 8, 1920, 128, 48, 2, 128, 48, 2}, 191 {12000000, 8000, 1, 8, 1920, 128, 48, 2, 128, 48, 2},
192 {12000000, 8000, 1, 8, 1920, 128, 32, 3, 128, 32, 3},
192 {24000000, 8000, 2, 8, 1920, 128, 48, 2, 128, 48, 2}, 193 {24000000, 8000, 2, 8, 1920, 128, 48, 2, 128, 48, 2},
193 {25000000, 8000, 2, 7, 8643, 128, 48, 2, 128, 48, 2}, 194 {25000000, 8000, 2, 7, 8643, 128, 48, 2, 128, 48, 2},
194 /* 11.025k rate */ 195 /* 11.025k rate */
195 {12000000, 11025, 1, 7, 5264, 128, 32, 2, 128, 32, 2}, 196 {12000000, 11025, 1, 7, 5264, 128, 32, 2, 128, 32, 2},
197 {12000000, 11025, 1, 8, 4672, 128, 24, 3, 128, 24, 3},
196 {24000000, 11025, 2, 7, 5264, 128, 32, 2, 128, 32, 2}, 198 {24000000, 11025, 2, 7, 5264, 128, 32, 2, 128, 32, 2},
197 {25000000, 11025, 2, 7, 2253, 128, 32, 2, 128, 32, 2}, 199 {25000000, 11025, 2, 7, 2253, 128, 32, 2, 128, 32, 2},
198 /* 16k rate */ 200 /* 16k rate */
199 {12000000, 16000, 1, 8, 1920, 128, 24, 2, 128, 24, 2}, 201 {12000000, 16000, 1, 8, 1920, 128, 24, 2, 128, 24, 2},
202 {12000000, 16000, 1, 8, 1920, 128, 16, 3, 128, 16, 3},
200 {24000000, 16000, 2, 8, 1920, 128, 24, 2, 128, 24, 2}, 203 {24000000, 16000, 2, 8, 1920, 128, 24, 2, 128, 24, 2},
201 {25000000, 16000, 2, 7, 8643, 128, 24, 2, 128, 24, 2}, 204 {25000000, 16000, 2, 7, 8643, 128, 24, 2, 128, 24, 2},
202 /* 22.05k rate */ 205 /* 22.05k rate */
203 {12000000, 22050, 1, 7, 5264, 128, 16, 2, 128, 16, 2}, 206 {12000000, 22050, 1, 7, 5264, 128, 16, 2, 128, 16, 2},
207 {12000000, 22050, 1, 8, 4672, 128, 12, 3, 128, 12, 3},
204 {24000000, 22050, 2, 7, 5264, 128, 16, 2, 128, 16, 2}, 208 {24000000, 22050, 2, 7, 5264, 128, 16, 2, 128, 16, 2},
205 {25000000, 22050, 2, 7, 2253, 128, 16, 2, 128, 16, 2}, 209 {25000000, 22050, 2, 7, 2253, 128, 16, 2, 128, 16, 2},
206 /* 32k rate */ 210 /* 32k rate */
207 {12000000, 32000, 1, 8, 1920, 128, 12, 2, 128, 12, 2}, 211 {12000000, 32000, 1, 8, 1920, 128, 12, 2, 128, 12, 2},
212 {12000000, 32000, 1, 8, 1920, 128, 8, 3, 128, 8, 3},
208 {24000000, 32000, 2, 8, 1920, 128, 12, 2, 128, 12, 2}, 213 {24000000, 32000, 2, 8, 1920, 128, 12, 2, 128, 12, 2},
209 {25000000, 32000, 2, 7, 8643, 128, 12, 2, 128, 12, 2}, 214 {25000000, 32000, 2, 7, 8643, 128, 12, 2, 128, 12, 2},
210 /* 44.1k rate */ 215 /* 44.1k rate */
211 {12000000, 44100, 1, 7, 5264, 128, 8, 2, 128, 8, 2}, 216 {12000000, 44100, 1, 7, 5264, 128, 8, 2, 128, 8, 2},
217 {12000000, 44100, 1, 8, 4672, 128, 6, 3, 128, 6, 3},
212 {24000000, 44100, 2, 7, 5264, 128, 8, 2, 128, 8, 2}, 218 {24000000, 44100, 2, 7, 5264, 128, 8, 2, 128, 8, 2},
213 {25000000, 44100, 2, 7, 2253, 128, 8, 2, 128, 8, 2}, 219 {25000000, 44100, 2, 7, 2253, 128, 8, 2, 128, 8, 2},
214 /* 48k rate */ 220 /* 48k rate */
215 {12000000, 48000, 1, 8, 1920, 128, 8, 2, 128, 8, 2}, 221 {12000000, 48000, 1, 8, 1920, 128, 8, 2, 128, 8, 2},
222 {12000000, 48000, 1, 7, 6800, 96, 5, 4, 96, 5, 4},
216 {24000000, 48000, 2, 8, 1920, 128, 8, 2, 128, 8, 2}, 223 {24000000, 48000, 2, 8, 1920, 128, 8, 2, 128, 8, 2},
217 {25000000, 48000, 2, 7, 8643, 128, 8, 2, 128, 8, 2}, 224 {25000000, 48000, 2, 7, 8643, 128, 8, 2, 128, 8, 2},
218 /* 88.2k rate */ 225 /* 88.2k rate */
219 {12000000, 88200, 1, 7, 5264, 64, 8, 2, 64, 8, 2}, 226 {12000000, 88200, 1, 7, 5264, 64, 8, 2, 64, 8, 2},
227 {12000000, 88200, 1, 8, 4672, 64, 6, 3, 64, 6, 3},
220 {24000000, 88200, 2, 7, 5264, 64, 8, 2, 64, 8, 2}, 228 {24000000, 88200, 2, 7, 5264, 64, 8, 2, 64, 8, 2},
221 {25000000, 88200, 2, 7, 2253, 64, 8, 2, 64, 8, 2}, 229 {25000000, 88200, 2, 7, 2253, 64, 8, 2, 64, 8, 2},
222 /* 96k rate */ 230 /* 96k rate */
223 {12000000, 96000, 1, 8, 1920, 64, 8, 2, 64, 8, 2}, 231 {12000000, 96000, 1, 8, 1920, 64, 8, 2, 64, 8, 2},
232 {12000000, 96000, 1, 7, 6800, 48, 5, 4, 48, 5, 4},
224 {24000000, 96000, 2, 8, 1920, 64, 8, 2, 64, 8, 2}, 233 {24000000, 96000, 2, 8, 1920, 64, 8, 2, 64, 8, 2},
225 {25000000, 96000, 2, 7, 8643, 64, 8, 2, 64, 8, 2}, 234 {25000000, 96000, 2, 7, 8643, 64, 8, 2, 64, 8, 2},
226 /* 176.4k rate */ 235 /* 176.4k rate */
227 {12000000, 176400, 1, 7, 5264, 32, 8, 2, 32, 8, 2}, 236 {12000000, 176400, 1, 7, 5264, 32, 8, 2, 32, 8, 2},
237 {12000000, 176400, 1, 8, 4672, 32, 6, 3, 32, 6, 3},
228 {24000000, 176400, 2, 7, 5264, 32, 8, 2, 32, 8, 2}, 238 {24000000, 176400, 2, 7, 5264, 32, 8, 2, 32, 8, 2},
229 {25000000, 176400, 2, 7, 2253, 32, 8, 2, 32, 8, 2}, 239 {25000000, 176400, 2, 7, 2253, 32, 8, 2, 32, 8, 2},
230 /* 192k rate */ 240 /* 192k rate */
231 {12000000, 192000, 1, 8, 1920, 32, 8, 2, 32, 8, 2}, 241 {12000000, 192000, 1, 8, 1920, 32, 8, 2, 32, 8, 2},
242 {12000000, 192000, 1, 7, 6800, 24, 5, 4, 24, 5, 4},
232 {24000000, 192000, 2, 8, 1920, 32, 8, 2, 32, 8, 2}, 243 {24000000, 192000, 2, 8, 1920, 32, 8, 2, 32, 8, 2},
233 {25000000, 192000, 2, 7, 8643, 32, 8, 2, 32, 8, 2}, 244 {25000000, 192000, 2, 7, 8643, 32, 8, 2, 32, 8, 2},
234}; 245};
@@ -680,7 +691,9 @@ static int aic31xx_setup_pll(struct snd_soc_codec *codec,
680 struct snd_pcm_hw_params *params) 691 struct snd_pcm_hw_params *params)
681{ 692{
682 struct aic31xx_priv *aic31xx = snd_soc_codec_get_drvdata(codec); 693 struct aic31xx_priv *aic31xx = snd_soc_codec_get_drvdata(codec);
694 int bclk_score = snd_soc_params_to_frame_size(params);
683 int bclk_n = 0; 695 int bclk_n = 0;
696 int match = -1;
684 int i; 697 int i;
685 698
686 /* Use PLL as CODEC_CLKIN and DAC_CLK as BDIV_CLKIN */ 699 /* Use PLL as CODEC_CLKIN and DAC_CLK as BDIV_CLKIN */
@@ -691,15 +704,37 @@ static int aic31xx_setup_pll(struct snd_soc_codec *codec,
691 704
692 for (i = 0; i < ARRAY_SIZE(aic31xx_divs); i++) { 705 for (i = 0; i < ARRAY_SIZE(aic31xx_divs); i++) {
693 if (aic31xx_divs[i].rate == params_rate(params) && 706 if (aic31xx_divs[i].rate == params_rate(params) &&
694 aic31xx_divs[i].mclk == aic31xx->sysclk) 707 aic31xx_divs[i].mclk == aic31xx->sysclk) {
695 break; 708 int s = (aic31xx_divs[i].dosr * aic31xx_divs[i].mdac) %
709 snd_soc_params_to_frame_size(params);
710 int bn = (aic31xx_divs[i].dosr * aic31xx_divs[i].mdac) /
711 snd_soc_params_to_frame_size(params);
712 if (s < bclk_score && bn > 0) {
713 match = i;
714 bclk_n = bn;
715 bclk_score = s;
716 }
717 }
696 } 718 }
697 719
698 if (i == ARRAY_SIZE(aic31xx_divs)) { 720 if (match == -1) {
699 dev_err(codec->dev, "%s: Sampling rate %u not supported\n", 721 dev_err(codec->dev,
722 "%s: Sample rate (%u) and format not supported\n",
700 __func__, params_rate(params)); 723 __func__, params_rate(params));
724 /* See bellow for details how fix this. */
701 return -EINVAL; 725 return -EINVAL;
702 } 726 }
727 if (bclk_score != 0) {
728 dev_warn(codec->dev, "Can not produce exact bitclock");
729 /* This is fine if using dsp format, but if using i2s
730 there may be trouble. To fix the issue edit the
731 aic31xx_divs table for your mclk and sample
732 rate. Details can be found from:
733 http://www.ti.com/lit/ds/symlink/tlv320aic3100.pdf
734 Section: 5.6 CLOCK Generation and PLL
735 */
736 }
737 i = match;
703 738
704 /* PLL configuration */ 739 /* PLL configuration */
705 snd_soc_update_bits(codec, AIC31XX_PLLPR, AIC31XX_PLL_MASK, 740 snd_soc_update_bits(codec, AIC31XX_PLLPR, AIC31XX_PLL_MASK,
@@ -729,14 +764,6 @@ static int aic31xx_setup_pll(struct snd_soc_codec *codec,
729 snd_soc_write(codec, AIC31XX_AOSR, aic31xx_divs[i].aosr); 764 snd_soc_write(codec, AIC31XX_AOSR, aic31xx_divs[i].aosr);
730 765
731 /* Bit clock divider configuration. */ 766 /* Bit clock divider configuration. */
732 bclk_n = (aic31xx_divs[i].dosr * aic31xx_divs[i].mdac)
733 / snd_soc_params_to_frame_size(params);
734 if (bclk_n == 0) {
735 dev_err(codec->dev, "%s: Not enough BLCK bandwidth\n",
736 __func__);
737 return -EINVAL;
738 }
739
740 snd_soc_update_bits(codec, AIC31XX_BCLKN, 767 snd_soc_update_bits(codec, AIC31XX_BCLKN,
741 AIC31XX_PLL_MASK, bclk_n); 768 AIC31XX_PLL_MASK, bclk_n);
742 769
diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c
index c28508da34cf..68347b55f6e1 100644
--- a/sound/soc/davinci/davinci-mcasp.c
+++ b/sound/soc/davinci/davinci-mcasp.c
@@ -403,7 +403,8 @@ out:
403 return ret; 403 return ret;
404} 404}
405 405
406static int davinci_mcasp_set_clkdiv(struct snd_soc_dai *dai, int div_id, int div) 406static int __davinci_mcasp_set_clkdiv(struct snd_soc_dai *dai, int div_id,
407 int div, bool explicit)
407{ 408{
408 struct davinci_mcasp *mcasp = snd_soc_dai_get_drvdata(dai); 409 struct davinci_mcasp *mcasp = snd_soc_dai_get_drvdata(dai);
409 410
@@ -420,7 +421,8 @@ static int davinci_mcasp_set_clkdiv(struct snd_soc_dai *dai, int div_id, int div
420 ACLKXDIV(div - 1), ACLKXDIV_MASK); 421 ACLKXDIV(div - 1), ACLKXDIV_MASK);
421 mcasp_mod_bits(mcasp, DAVINCI_MCASP_ACLKRCTL_REG, 422 mcasp_mod_bits(mcasp, DAVINCI_MCASP_ACLKRCTL_REG,
422 ACLKRDIV(div - 1), ACLKRDIV_MASK); 423 ACLKRDIV(div - 1), ACLKRDIV_MASK);
423 mcasp->bclk_div = div; 424 if (explicit)
425 mcasp->bclk_div = div;
424 break; 426 break;
425 427
426 case 2: /* BCLK/LRCLK ratio */ 428 case 2: /* BCLK/LRCLK ratio */
@@ -434,6 +436,12 @@ static int davinci_mcasp_set_clkdiv(struct snd_soc_dai *dai, int div_id, int div
434 return 0; 436 return 0;
435} 437}
436 438
439static int davinci_mcasp_set_clkdiv(struct snd_soc_dai *dai, int div_id,
440 int div)
441{
442 return __davinci_mcasp_set_clkdiv(dai, div_id, div, 1);
443}
444
437static int davinci_mcasp_set_sysclk(struct snd_soc_dai *dai, int clk_id, 445static int davinci_mcasp_set_sysclk(struct snd_soc_dai *dai, int clk_id,
438 unsigned int freq, int dir) 446 unsigned int freq, int dir)
439{ 447{
@@ -459,8 +467,17 @@ static int davinci_config_channel_size(struct davinci_mcasp *mcasp,
459{ 467{
460 u32 fmt; 468 u32 fmt;
461 u32 tx_rotate = (word_length / 4) & 0x7; 469 u32 tx_rotate = (word_length / 4) & 0x7;
462 u32 rx_rotate = (32 - word_length) / 4;
463 u32 mask = (1ULL << word_length) - 1; 470 u32 mask = (1ULL << word_length) - 1;
471 /*
472 * For captured data we should not rotate, inversion and masking is
473 * enoguh to get the data to the right position:
474 * Format data from bus after reverse (XRBUF)
475 * S16_LE: |LSB|MSB|xxx|xxx| |xxx|xxx|MSB|LSB|
476 * S24_3LE: |LSB|DAT|MSB|xxx| |xxx|MSB|DAT|LSB|
477 * S24_LE: |LSB|DAT|MSB|xxx| |xxx|MSB|DAT|LSB|
478 * S32_LE: |LSB|DAT|DAT|MSB| |MSB|DAT|DAT|LSB|
479 */
480 u32 rx_rotate = 0;
464 481
465 /* 482 /*
466 * if s BCLK-to-LRCLK ratio has been configured via the set_clkdiv() 483 * if s BCLK-to-LRCLK ratio has been configured via the set_clkdiv()
@@ -738,7 +755,7 @@ static int davinci_mcasp_hw_params(struct snd_pcm_substream *substream,
738 "Inaccurate BCLK: %u Hz / %u != %u Hz\n", 755 "Inaccurate BCLK: %u Hz / %u != %u Hz\n",
739 mcasp->sysclk_freq, div, bclk_freq); 756 mcasp->sysclk_freq, div, bclk_freq);
740 } 757 }
741 davinci_mcasp_set_clkdiv(cpu_dai, 1, div); 758 __davinci_mcasp_set_clkdiv(cpu_dai, 1, div, 0);
742 } 759 }
743 760
744 ret = mcasp_common_hw_param(mcasp, substream->stream, 761 ret = mcasp_common_hw_param(mcasp, substream->stream,
diff --git a/sound/soc/dwc/designware_i2s.c b/sound/soc/dwc/designware_i2s.c
index 25c31f1655f6..e961388e6e9c 100644
--- a/sound/soc/dwc/designware_i2s.c
+++ b/sound/soc/dwc/designware_i2s.c
@@ -4,7 +4,7 @@
4 * sound/soc/dwc/designware_i2s.c 4 * sound/soc/dwc/designware_i2s.c
5 * 5 *
6 * Copyright (C) 2010 ST Microelectronics 6 * Copyright (C) 2010 ST Microelectronics
7 * Rajeev Kumar <rajeev-dlh.kumar@st.com> 7 * Rajeev Kumar <rajeevkumar.linux@gmail.com>
8 * 8 *
9 * This file is licensed under the terms of the GNU General Public 9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any 10 * License version 2. This program is licensed "as is" without any
@@ -455,7 +455,7 @@ static struct platform_driver dw_i2s_driver = {
455 455
456module_platform_driver(dw_i2s_driver); 456module_platform_driver(dw_i2s_driver);
457 457
458MODULE_AUTHOR("Rajeev Kumar <rajeev-dlh.kumar@st.com>"); 458MODULE_AUTHOR("Rajeev Kumar <rajeevkumar.linux@gmail.com>");
459MODULE_DESCRIPTION("DESIGNWARE I2S SoC Interface"); 459MODULE_DESCRIPTION("DESIGNWARE I2S SoC Interface");
460MODULE_LICENSE("GPL"); 460MODULE_LICENSE("GPL");
461MODULE_ALIAS("platform:designware_i2s"); 461MODULE_ALIAS("platform:designware_i2s");
diff --git a/sound/soc/fsl/Kconfig b/sound/soc/fsl/Kconfig
index f54a8fc99291..f3012b645b51 100644
--- a/sound/soc/fsl/Kconfig
+++ b/sound/soc/fsl/Kconfig
@@ -49,7 +49,6 @@ config SND_SOC_FSL_ESAI
49 tristate "Enhanced Serial Audio Interface (ESAI) module support" 49 tristate "Enhanced Serial Audio Interface (ESAI) module support"
50 select REGMAP_MMIO 50 select REGMAP_MMIO
51 select SND_SOC_IMX_PCM_DMA if SND_IMX_SOC != n 51 select SND_SOC_IMX_PCM_DMA if SND_IMX_SOC != n
52 select SND_SOC_FSL_UTILS
53 help 52 help
54 Say Y if you want to add Enhanced Synchronous Audio Interface 53 Say Y if you want to add Enhanced Synchronous Audio Interface
55 (ESAI) support for the Freescale CPUs. 54 (ESAI) support for the Freescale CPUs.
diff --git a/sound/soc/fsl/fsl_esai.c b/sound/soc/fsl/fsl_esai.c
index 72d154e7dd03..a3b29ed84963 100644
--- a/sound/soc/fsl/fsl_esai.c
+++ b/sound/soc/fsl/fsl_esai.c
@@ -18,7 +18,6 @@
18 18
19#include "fsl_esai.h" 19#include "fsl_esai.h"
20#include "imx-pcm.h" 20#include "imx-pcm.h"
21#include "fsl_utils.h"
22 21
23#define FSL_ESAI_RATES SNDRV_PCM_RATE_8000_192000 22#define FSL_ESAI_RATES SNDRV_PCM_RATE_8000_192000
24#define FSL_ESAI_FORMATS (SNDRV_PCM_FMTBIT_S8 | \ 23#define FSL_ESAI_FORMATS (SNDRV_PCM_FMTBIT_S8 | \
@@ -607,7 +606,6 @@ static struct snd_soc_dai_ops fsl_esai_dai_ops = {
607 .hw_params = fsl_esai_hw_params, 606 .hw_params = fsl_esai_hw_params,
608 .set_sysclk = fsl_esai_set_dai_sysclk, 607 .set_sysclk = fsl_esai_set_dai_sysclk,
609 .set_fmt = fsl_esai_set_dai_fmt, 608 .set_fmt = fsl_esai_set_dai_fmt,
610 .xlate_tdm_slot_mask = fsl_asoc_xlate_tdm_slot_mask,
611 .set_tdm_slot = fsl_esai_set_dai_tdm_slot, 609 .set_tdm_slot = fsl_esai_set_dai_tdm_slot,
612}; 610};
613 611
diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
index 87eb5776a39b..de6ab06f58a5 100644
--- a/sound/soc/fsl/fsl_ssi.c
+++ b/sound/soc/fsl/fsl_ssi.c
@@ -748,8 +748,9 @@ static int fsl_ssi_hw_free(struct snd_pcm_substream *substream,
748 return 0; 748 return 0;
749} 749}
750 750
751static int _fsl_ssi_set_dai_fmt(struct fsl_ssi_private *ssi_private, 751static int _fsl_ssi_set_dai_fmt(struct device *dev,
752 unsigned int fmt) 752 struct fsl_ssi_private *ssi_private,
753 unsigned int fmt)
753{ 754{
754 struct regmap *regs = ssi_private->regs; 755 struct regmap *regs = ssi_private->regs;
755 u32 strcr = 0, stcr, srcr, scr, mask; 756 u32 strcr = 0, stcr, srcr, scr, mask;
@@ -758,7 +759,7 @@ static int _fsl_ssi_set_dai_fmt(struct fsl_ssi_private *ssi_private,
758 ssi_private->dai_fmt = fmt; 759 ssi_private->dai_fmt = fmt;
759 760
760 if (fsl_ssi_is_i2s_master(ssi_private) && IS_ERR(ssi_private->baudclk)) { 761 if (fsl_ssi_is_i2s_master(ssi_private) && IS_ERR(ssi_private->baudclk)) {
761 dev_err(&ssi_private->pdev->dev, "baudclk is missing which is necessary for master mode\n"); 762 dev_err(dev, "baudclk is missing which is necessary for master mode\n");
762 return -EINVAL; 763 return -EINVAL;
763 } 764 }
764 765
@@ -913,7 +914,7 @@ static int fsl_ssi_set_dai_fmt(struct snd_soc_dai *cpu_dai, unsigned int fmt)
913{ 914{
914 struct fsl_ssi_private *ssi_private = snd_soc_dai_get_drvdata(cpu_dai); 915 struct fsl_ssi_private *ssi_private = snd_soc_dai_get_drvdata(cpu_dai);
915 916
916 return _fsl_ssi_set_dai_fmt(ssi_private, fmt); 917 return _fsl_ssi_set_dai_fmt(cpu_dai->dev, ssi_private, fmt);
917} 918}
918 919
919/** 920/**
@@ -1387,7 +1388,8 @@ static int fsl_ssi_probe(struct platform_device *pdev)
1387 1388
1388done: 1389done:
1389 if (ssi_private->dai_fmt) 1390 if (ssi_private->dai_fmt)
1390 _fsl_ssi_set_dai_fmt(ssi_private, ssi_private->dai_fmt); 1391 _fsl_ssi_set_dai_fmt(&pdev->dev, ssi_private,
1392 ssi_private->dai_fmt);
1391 1393
1392 return 0; 1394 return 0;
1393 1395
diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c
index 159e517fa09a..cef7776b712c 100644
--- a/sound/soc/generic/simple-card.c
+++ b/sound/soc/generic/simple-card.c
@@ -481,12 +481,19 @@ static int asoc_simple_card_probe(struct platform_device *pdev)
481 snd_soc_card_set_drvdata(&priv->snd_card, priv); 481 snd_soc_card_set_drvdata(&priv->snd_card, priv);
482 482
483 ret = devm_snd_soc_register_card(&pdev->dev, &priv->snd_card); 483 ret = devm_snd_soc_register_card(&pdev->dev, &priv->snd_card);
484 if (ret >= 0)
485 return ret;
484 486
485err: 487err:
486 asoc_simple_card_unref(pdev); 488 asoc_simple_card_unref(pdev);
487 return ret; 489 return ret;
488} 490}
489 491
492static int asoc_simple_card_remove(struct platform_device *pdev)
493{
494 return asoc_simple_card_unref(pdev);
495}
496
490static const struct of_device_id asoc_simple_of_match[] = { 497static const struct of_device_id asoc_simple_of_match[] = {
491 { .compatible = "simple-audio-card", }, 498 { .compatible = "simple-audio-card", },
492 {}, 499 {},
@@ -500,6 +507,7 @@ static struct platform_driver asoc_simple_card = {
500 .of_match_table = asoc_simple_of_match, 507 .of_match_table = asoc_simple_of_match,
501 }, 508 },
502 .probe = asoc_simple_card_probe, 509 .probe = asoc_simple_card_probe,
510 .remove = asoc_simple_card_remove,
503}; 511};
504 512
505module_platform_driver(asoc_simple_card); 513module_platform_driver(asoc_simple_card);
diff --git a/sound/soc/intel/sst-acpi.c b/sound/soc/intel/sst-acpi.c
index 42edc6f4fc4a..03d0a166b635 100644
--- a/sound/soc/intel/sst-acpi.c
+++ b/sound/soc/intel/sst-acpi.c
@@ -246,8 +246,8 @@ static struct sst_acpi_desc sst_acpi_broadwell_desc = {
246}; 246};
247 247
248static struct sst_acpi_mach baytrail_machines[] = { 248static struct sst_acpi_mach baytrail_machines[] = {
249 { "10EC5640", "byt-rt5640", "intel/fw_sst_0f28.bin-i2s_master" }, 249 { "10EC5640", "byt-rt5640", "intel/fw_sst_0f28.bin-48kHz_i2s_master" },
250 { "193C9890", "byt-max98090", "intel/fw_sst_0f28.bin-i2s_master" }, 250 { "193C9890", "byt-max98090", "intel/fw_sst_0f28.bin-48kHz_i2s_master" },
251 {} 251 {}
252}; 252};
253 253
diff --git a/sound/soc/intel/sst-baytrail-ipc.c b/sound/soc/intel/sst-baytrail-ipc.c
index 67673a2c0f41..b4ad98c43e5c 100644
--- a/sound/soc/intel/sst-baytrail-ipc.c
+++ b/sound/soc/intel/sst-baytrail-ipc.c
@@ -817,7 +817,7 @@ static struct sst_dsp_device byt_dev = {
817 .ops = &sst_byt_ops, 817 .ops = &sst_byt_ops,
818}; 818};
819 819
820int sst_byt_dsp_suspend_noirq(struct device *dev, struct sst_pdata *pdata) 820int sst_byt_dsp_suspend_late(struct device *dev, struct sst_pdata *pdata)
821{ 821{
822 struct sst_byt *byt = pdata->dsp; 822 struct sst_byt *byt = pdata->dsp;
823 823
@@ -826,14 +826,6 @@ int sst_byt_dsp_suspend_noirq(struct device *dev, struct sst_pdata *pdata)
826 sst_byt_drop_all(byt); 826 sst_byt_drop_all(byt);
827 dev_dbg(byt->dev, "dsp in reset\n"); 827 dev_dbg(byt->dev, "dsp in reset\n");
828 828
829 return 0;
830}
831EXPORT_SYMBOL_GPL(sst_byt_dsp_suspend_noirq);
832
833int sst_byt_dsp_suspend_late(struct device *dev, struct sst_pdata *pdata)
834{
835 struct sst_byt *byt = pdata->dsp;
836
837 dev_dbg(byt->dev, "free all blocks and unload fw\n"); 829 dev_dbg(byt->dev, "free all blocks and unload fw\n");
838 sst_fw_unload(byt->fw); 830 sst_fw_unload(byt->fw);
839 831
diff --git a/sound/soc/intel/sst-baytrail-ipc.h b/sound/soc/intel/sst-baytrail-ipc.h
index 06a4d202689b..8faff6dcf25d 100644
--- a/sound/soc/intel/sst-baytrail-ipc.h
+++ b/sound/soc/intel/sst-baytrail-ipc.h
@@ -66,7 +66,6 @@ int sst_byt_get_dsp_position(struct sst_byt *byt,
66int sst_byt_dsp_init(struct device *dev, struct sst_pdata *pdata); 66int sst_byt_dsp_init(struct device *dev, struct sst_pdata *pdata);
67void sst_byt_dsp_free(struct device *dev, struct sst_pdata *pdata); 67void sst_byt_dsp_free(struct device *dev, struct sst_pdata *pdata);
68struct sst_dsp *sst_byt_get_dsp(struct sst_byt *byt); 68struct sst_dsp *sst_byt_get_dsp(struct sst_byt *byt);
69int sst_byt_dsp_suspend_noirq(struct device *dev, struct sst_pdata *pdata);
70int sst_byt_dsp_suspend_late(struct device *dev, struct sst_pdata *pdata); 69int sst_byt_dsp_suspend_late(struct device *dev, struct sst_pdata *pdata);
71int sst_byt_dsp_boot(struct device *dev, struct sst_pdata *pdata); 70int sst_byt_dsp_boot(struct device *dev, struct sst_pdata *pdata);
72int sst_byt_dsp_wait_for_ready(struct device *dev, struct sst_pdata *pdata); 71int sst_byt_dsp_wait_for_ready(struct device *dev, struct sst_pdata *pdata);
diff --git a/sound/soc/intel/sst-baytrail-pcm.c b/sound/soc/intel/sst-baytrail-pcm.c
index 599401c0c655..eab1c7d85187 100644
--- a/sound/soc/intel/sst-baytrail-pcm.c
+++ b/sound/soc/intel/sst-baytrail-pcm.c
@@ -59,6 +59,9 @@ struct sst_byt_priv_data {
59 59
60 /* DAI data */ 60 /* DAI data */
61 struct sst_byt_pcm_data pcm[BYT_PCM_COUNT]; 61 struct sst_byt_pcm_data pcm[BYT_PCM_COUNT];
62
63 /* flag indicating is stream context restore needed after suspend */
64 bool restore_stream;
62}; 65};
63 66
64/* this may get called several times by oss emulation */ 67/* this may get called several times by oss emulation */
@@ -184,7 +187,10 @@ static int sst_byt_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
184 sst_byt_stream_start(byt, pcm_data->stream, 0); 187 sst_byt_stream_start(byt, pcm_data->stream, 0);
185 break; 188 break;
186 case SNDRV_PCM_TRIGGER_RESUME: 189 case SNDRV_PCM_TRIGGER_RESUME:
187 schedule_work(&pcm_data->work); 190 if (pdata->restore_stream == true)
191 schedule_work(&pcm_data->work);
192 else
193 sst_byt_stream_resume(byt, pcm_data->stream);
188 break; 194 break;
189 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: 195 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
190 sst_byt_stream_resume(byt, pcm_data->stream); 196 sst_byt_stream_resume(byt, pcm_data->stream);
@@ -193,6 +199,7 @@ static int sst_byt_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
193 sst_byt_stream_stop(byt, pcm_data->stream); 199 sst_byt_stream_stop(byt, pcm_data->stream);
194 break; 200 break;
195 case SNDRV_PCM_TRIGGER_SUSPEND: 201 case SNDRV_PCM_TRIGGER_SUSPEND:
202 pdata->restore_stream = false;
196 case SNDRV_PCM_TRIGGER_PAUSE_PUSH: 203 case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
197 sst_byt_stream_pause(byt, pcm_data->stream); 204 sst_byt_stream_pause(byt, pcm_data->stream);
198 break; 205 break;
@@ -404,26 +411,10 @@ static const struct snd_soc_component_driver byt_dai_component = {
404}; 411};
405 412
406#ifdef CONFIG_PM 413#ifdef CONFIG_PM
407static int sst_byt_pcm_dev_suspend_noirq(struct device *dev)
408{
409 struct sst_pdata *sst_pdata = dev_get_platdata(dev);
410 int ret;
411
412 dev_dbg(dev, "suspending noirq\n");
413
414 /* at this point all streams will be stopped and context saved */
415 ret = sst_byt_dsp_suspend_noirq(dev, sst_pdata);
416 if (ret < 0) {
417 dev_err(dev, "failed to suspend %d\n", ret);
418 return ret;
419 }
420
421 return ret;
422}
423
424static int sst_byt_pcm_dev_suspend_late(struct device *dev) 414static int sst_byt_pcm_dev_suspend_late(struct device *dev)
425{ 415{
426 struct sst_pdata *sst_pdata = dev_get_platdata(dev); 416 struct sst_pdata *sst_pdata = dev_get_platdata(dev);
417 struct sst_byt_priv_data *priv_data = dev_get_drvdata(dev);
427 int ret; 418 int ret;
428 419
429 dev_dbg(dev, "suspending late\n"); 420 dev_dbg(dev, "suspending late\n");
@@ -434,34 +425,30 @@ static int sst_byt_pcm_dev_suspend_late(struct device *dev)
434 return ret; 425 return ret;
435 } 426 }
436 427
428 priv_data->restore_stream = true;
429
437 return ret; 430 return ret;
438} 431}
439 432
440static int sst_byt_pcm_dev_resume_early(struct device *dev) 433static int sst_byt_pcm_dev_resume_early(struct device *dev)
441{ 434{
442 struct sst_pdata *sst_pdata = dev_get_platdata(dev); 435 struct sst_pdata *sst_pdata = dev_get_platdata(dev);
436 int ret;
443 437
444 dev_dbg(dev, "resume early\n"); 438 dev_dbg(dev, "resume early\n");
445 439
446 /* load fw and boot DSP */ 440 /* load fw and boot DSP */
447 return sst_byt_dsp_boot(dev, sst_pdata); 441 ret = sst_byt_dsp_boot(dev, sst_pdata);
448} 442 if (ret)
449 443 return ret;
450static int sst_byt_pcm_dev_resume(struct device *dev)
451{
452 struct sst_pdata *sst_pdata = dev_get_platdata(dev);
453
454 dev_dbg(dev, "resume\n");
455 444
456 /* wait for FW to finish booting */ 445 /* wait for FW to finish booting */
457 return sst_byt_dsp_wait_for_ready(dev, sst_pdata); 446 return sst_byt_dsp_wait_for_ready(dev, sst_pdata);
458} 447}
459 448
460static const struct dev_pm_ops sst_byt_pm_ops = { 449static const struct dev_pm_ops sst_byt_pm_ops = {
461 .suspend_noirq = sst_byt_pcm_dev_suspend_noirq,
462 .suspend_late = sst_byt_pcm_dev_suspend_late, 450 .suspend_late = sst_byt_pcm_dev_suspend_late,
463 .resume_early = sst_byt_pcm_dev_resume_early, 451 .resume_early = sst_byt_pcm_dev_resume_early,
464 .resume = sst_byt_pcm_dev_resume,
465}; 452};
466 453
467#define SST_BYT_PM_OPS (&sst_byt_pm_ops) 454#define SST_BYT_PM_OPS (&sst_byt_pm_ops)
diff --git a/sound/soc/omap/omap-twl4030.c b/sound/soc/omap/omap-twl4030.c
index f8a6adc2d81c..4336d1831485 100644
--- a/sound/soc/omap/omap-twl4030.c
+++ b/sound/soc/omap/omap-twl4030.c
@@ -260,7 +260,7 @@ static struct snd_soc_dai_link omap_twl4030_dai_links[] = {
260 .stream_name = "TWL4030 Voice", 260 .stream_name = "TWL4030 Voice",
261 .cpu_dai_name = "omap-mcbsp.3", 261 .cpu_dai_name = "omap-mcbsp.3",
262 .codec_dai_name = "twl4030-voice", 262 .codec_dai_name = "twl4030-voice",
263 .platform_name = "omap-mcbsp.2", 263 .platform_name = "omap-mcbsp.3",
264 .codec_name = "twl4030-codec", 264 .codec_name = "twl4030-codec",
265 .dai_fmt = SND_SOC_DAIFMT_DSP_A | SND_SOC_DAIFMT_IB_NF | 265 .dai_fmt = SND_SOC_DAIFMT_DSP_A | SND_SOC_DAIFMT_IB_NF |
266 SND_SOC_DAIFMT_CBM_CFM, 266 SND_SOC_DAIFMT_CBM_CFM,
diff --git a/sound/soc/pxa/pxa-ssp.c b/sound/soc/pxa/pxa-ssp.c
index 0109f6c2334e..a8e097433074 100644
--- a/sound/soc/pxa/pxa-ssp.c
+++ b/sound/soc/pxa/pxa-ssp.c
@@ -765,9 +765,7 @@ static int pxa_ssp_remove(struct snd_soc_dai *dai)
765 SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_64000 | \ 765 SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_64000 | \
766 SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000) 766 SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000)
767 767
768#define PXA_SSP_FORMATS (SNDRV_PCM_FMTBIT_S16_LE |\ 768#define PXA_SSP_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S32_LE)
769 SNDRV_PCM_FMTBIT_S24_LE | \
770 SNDRV_PCM_FMTBIT_S32_LE)
771 769
772static const struct snd_soc_dai_ops pxa_ssp_dai_ops = { 770static const struct snd_soc_dai_ops pxa_ssp_dai_ops = {
773 .startup = pxa_ssp_startup, 771 .startup = pxa_ssp_startup,
diff --git a/sound/soc/rockchip/rockchip_i2s.c b/sound/soc/rockchip/rockchip_i2s.c
index 8d8e4b59049f..fb9e05c9f471 100644
--- a/sound/soc/rockchip/rockchip_i2s.c
+++ b/sound/soc/rockchip/rockchip_i2s.c
@@ -165,13 +165,14 @@ static int rockchip_i2s_set_fmt(struct snd_soc_dai *cpu_dai,
165 struct rk_i2s_dev *i2s = to_info(cpu_dai); 165 struct rk_i2s_dev *i2s = to_info(cpu_dai);
166 unsigned int mask = 0, val = 0; 166 unsigned int mask = 0, val = 0;
167 167
168 mask = I2S_CKR_MSS_SLAVE; 168 mask = I2S_CKR_MSS_MASK;
169 switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { 169 switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
170 case SND_SOC_DAIFMT_CBS_CFS: 170 case SND_SOC_DAIFMT_CBS_CFS:
171 val = I2S_CKR_MSS_SLAVE; 171 /* Set source clock in Master mode */
172 val = I2S_CKR_MSS_MASTER;
172 break; 173 break;
173 case SND_SOC_DAIFMT_CBM_CFM: 174 case SND_SOC_DAIFMT_CBM_CFM:
174 val = I2S_CKR_MSS_MASTER; 175 val = I2S_CKR_MSS_SLAVE;
175 break; 176 break;
176 default: 177 default:
177 return -EINVAL; 178 return -EINVAL;
@@ -361,6 +362,8 @@ static bool rockchip_i2s_rd_reg(struct device *dev, unsigned int reg)
361 case I2S_XFER: 362 case I2S_XFER:
362 case I2S_CLR: 363 case I2S_CLR:
363 case I2S_RXDR: 364 case I2S_RXDR:
365 case I2S_FIFOLR:
366 case I2S_INTSR:
364 return true; 367 return true;
365 default: 368 default:
366 return false; 369 return false;
@@ -370,8 +373,8 @@ static bool rockchip_i2s_rd_reg(struct device *dev, unsigned int reg)
370static bool rockchip_i2s_volatile_reg(struct device *dev, unsigned int reg) 373static bool rockchip_i2s_volatile_reg(struct device *dev, unsigned int reg)
371{ 374{
372 switch (reg) { 375 switch (reg) {
373 case I2S_FIFOLR:
374 case I2S_INTSR: 376 case I2S_INTSR:
377 case I2S_CLR:
375 return true; 378 return true;
376 default: 379 default:
377 return false; 380 return false;
@@ -381,8 +384,6 @@ static bool rockchip_i2s_volatile_reg(struct device *dev, unsigned int reg)
381static bool rockchip_i2s_precious_reg(struct device *dev, unsigned int reg) 384static bool rockchip_i2s_precious_reg(struct device *dev, unsigned int reg)
382{ 385{
383 switch (reg) { 386 switch (reg) {
384 case I2S_FIFOLR:
385 return true;
386 default: 387 default:
387 return false; 388 return false;
388 } 389 }
diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c
index 03eec22f0f46..9d513473b300 100644
--- a/sound/soc/samsung/i2s.c
+++ b/sound/soc/samsung/i2s.c
@@ -462,7 +462,7 @@ static int i2s_set_sysclk(struct snd_soc_dai *dai,
462 if (dir == SND_SOC_CLOCK_IN) 462 if (dir == SND_SOC_CLOCK_IN)
463 rfs = 0; 463 rfs = 0;
464 464
465 if ((rfs && other->rfs && (other->rfs != rfs)) || 465 if ((rfs && other && other->rfs && (other->rfs != rfs)) ||
466 (any_active(i2s) && 466 (any_active(i2s) &&
467 (((dir == SND_SOC_CLOCK_IN) 467 (((dir == SND_SOC_CLOCK_IN)
468 && !(mod & MOD_CDCLKCON)) || 468 && !(mod & MOD_CDCLKCON)) ||
@@ -762,7 +762,8 @@ static void i2s_shutdown(struct snd_pcm_substream *substream,
762 } else { 762 } else {
763 u32 mod = readl(i2s->addr + I2SMOD); 763 u32 mod = readl(i2s->addr + I2SMOD);
764 i2s->cdclk_out = !(mod & MOD_CDCLKCON); 764 i2s->cdclk_out = !(mod & MOD_CDCLKCON);
765 other->cdclk_out = i2s->cdclk_out; 765 if (other)
766 other->cdclk_out = i2s->cdclk_out;
766 } 767 }
767 /* Reset any constraint on RFS and BFS */ 768 /* Reset any constraint on RFS and BFS */
768 i2s->rfs = 0; 769 i2s->rfs = 0;
diff --git a/sound/soc/sh/rcar/gen.c b/sound/soc/sh/rcar/gen.c
index 3fdf3be7b99a..f95e7ab135e8 100644
--- a/sound/soc/sh/rcar/gen.c
+++ b/sound/soc/sh/rcar/gen.c
@@ -247,7 +247,7 @@ rsnd_gen2_dma_addr(struct rsnd_priv *priv,
247 }; 247 };
248 248
249 /* it shouldn't happen */ 249 /* it shouldn't happen */
250 if (use_dvc & !use_src) 250 if (use_dvc && !use_src)
251 dev_err(dev, "DVC is selected without SRC\n"); 251 dev_err(dev, "DVC is selected without SRC\n");
252 252
253 /* use SSIU or SSI ? */ 253 /* use SSIU or SSI ? */
diff --git a/sound/soc/soc-compress.c b/sound/soc/soc-compress.c
index 27c06acce205..cecfab3cc948 100644
--- a/sound/soc/soc-compress.c
+++ b/sound/soc/soc-compress.c
@@ -101,10 +101,12 @@ static int soc_compr_open_fe(struct snd_compr_stream *cstream)
101 101
102 fe->dpcm[stream].runtime = fe_substream->runtime; 102 fe->dpcm[stream].runtime = fe_substream->runtime;
103 103
104 if (dpcm_path_get(fe, stream, &list) <= 0) { 104 ret = dpcm_path_get(fe, stream, &list);
105 if (ret < 0)
106 goto fe_err;
107 else if (ret == 0)
105 dev_dbg(fe->dev, "ASoC: %s no valid %s route\n", 108 dev_dbg(fe->dev, "ASoC: %s no valid %s route\n",
106 fe->dai_link->name, stream ? "capture" : "playback"); 109 fe->dai_link->name, stream ? "capture" : "playback");
107 }
108 110
109 /* calculate valid and active FE <-> BE dpcms */ 111 /* calculate valid and active FE <-> BE dpcms */
110 dpcm_process_paths(fe, stream, &list, 1); 112 dpcm_process_paths(fe, stream, &list, 1);
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index d4bfd4a9076f..d074aa91b023 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1325,7 +1325,7 @@ static int soc_post_component_init(struct snd_soc_pcm_runtime *rtd,
1325 device_initialize(rtd->dev); 1325 device_initialize(rtd->dev);
1326 rtd->dev->parent = rtd->card->dev; 1326 rtd->dev->parent = rtd->card->dev;
1327 rtd->dev->release = rtd_release; 1327 rtd->dev->release = rtd_release;
1328 rtd->dev->init_name = name; 1328 dev_set_name(rtd->dev, "%s", name);
1329 dev_set_drvdata(rtd->dev, rtd); 1329 dev_set_drvdata(rtd->dev, rtd);
1330 mutex_init(&rtd->pcm_mutex); 1330 mutex_init(&rtd->pcm_mutex);
1331 INIT_LIST_HEAD(&rtd->dpcm[SNDRV_PCM_STREAM_PLAYBACK].be_clients); 1331 INIT_LIST_HEAD(&rtd->dpcm[SNDRV_PCM_STREAM_PLAYBACK].be_clients);
@@ -3203,7 +3203,7 @@ int snd_soc_bytes_put(struct snd_kcontrol *kcontrol,
3203 unsigned int val, mask; 3203 unsigned int val, mask;
3204 void *data; 3204 void *data;
3205 3205
3206 if (!component->regmap) 3206 if (!component->regmap || !params->num_regs)
3207 return -EINVAL; 3207 return -EINVAL;
3208 3208
3209 len = params->num_regs * component->val_bytes; 3209 len = params->num_regs * component->val_bytes;
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 8348352dc2c6..177bd8639ef9 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -2860,12 +2860,14 @@ int snd_soc_dapm_get_enum_double(struct snd_kcontrol *kcontrol,
2860 struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kcontrol); 2860 struct snd_soc_dapm_context *dapm = snd_soc_dapm_kcontrol_dapm(kcontrol);
2861 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; 2861 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
2862 unsigned int reg_val, val; 2862 unsigned int reg_val, val;
2863 int ret = 0;
2864 2863
2865 if (e->reg != SND_SOC_NOPM) 2864 if (e->reg != SND_SOC_NOPM) {
2866 ret = soc_dapm_read(dapm, e->reg, &reg_val); 2865 int ret = soc_dapm_read(dapm, e->reg, &reg_val);
2867 else 2866 if (ret)
2867 return ret;
2868 } else {
2868 reg_val = dapm_kcontrol_get_value(kcontrol); 2869 reg_val = dapm_kcontrol_get_value(kcontrol);
2870 }
2869 2871
2870 val = (reg_val >> e->shift_l) & e->mask; 2872 val = (reg_val >> e->shift_l) & e->mask;
2871 ucontrol->value.enumerated.item[0] = snd_soc_enum_val_to_item(e, val); 2873 ucontrol->value.enumerated.item[0] = snd_soc_enum_val_to_item(e, val);
@@ -2875,7 +2877,7 @@ int snd_soc_dapm_get_enum_double(struct snd_kcontrol *kcontrol,
2875 ucontrol->value.enumerated.item[1] = val; 2877 ucontrol->value.enumerated.item[1] = val;
2876 } 2878 }
2877 2879
2878 return ret; 2880 return 0;
2879} 2881}
2880EXPORT_SYMBOL_GPL(snd_soc_dapm_get_enum_double); 2882EXPORT_SYMBOL_GPL(snd_soc_dapm_get_enum_double);
2881 2883
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index 731fdb5b5f9b..642c86240752 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -2352,7 +2352,11 @@ static int dpcm_fe_dai_open(struct snd_pcm_substream *fe_substream)
2352 mutex_lock_nested(&fe->card->mutex, SND_SOC_CARD_CLASS_RUNTIME); 2352 mutex_lock_nested(&fe->card->mutex, SND_SOC_CARD_CLASS_RUNTIME);
2353 fe->dpcm[stream].runtime = fe_substream->runtime; 2353 fe->dpcm[stream].runtime = fe_substream->runtime;
2354 2354
2355 if (dpcm_path_get(fe, stream, &list) <= 0) { 2355 ret = dpcm_path_get(fe, stream, &list);
2356 if (ret < 0) {
2357 mutex_unlock(&fe->card->mutex);
2358 return ret;
2359 } else if (ret == 0) {
2356 dev_dbg(fe->dev, "ASoC: %s no valid %s route\n", 2360 dev_dbg(fe->dev, "ASoC: %s no valid %s route\n",
2357 fe->dai_link->name, stream ? "capture" : "playback"); 2361 fe->dai_link->name, stream ? "capture" : "playback");
2358 } 2362 }
diff --git a/sound/soc/spear/spear_pcm.c b/sound/soc/spear/spear_pcm.c
index 0e5a8f35d0ad..a7dc3c56f44d 100644
--- a/sound/soc/spear/spear_pcm.c
+++ b/sound/soc/spear/spear_pcm.c
@@ -4,7 +4,7 @@
4 * sound/soc/spear/spear_pcm.c 4 * sound/soc/spear/spear_pcm.c
5 * 5 *
6 * Copyright (C) 2012 ST Microelectronics 6 * Copyright (C) 2012 ST Microelectronics
7 * Rajeev Kumar<rajeev-dlh.kumar@st.com> 7 * Rajeev Kumar<rajeevkumar.linux@gmail.com>
8 * 8 *
9 * This file is licensed under the terms of the GNU General Public 9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any 10 * License version 2. This program is licensed "as is" without any
@@ -50,6 +50,6 @@ int devm_spear_pcm_platform_register(struct device *dev,
50} 50}
51EXPORT_SYMBOL_GPL(devm_spear_pcm_platform_register); 51EXPORT_SYMBOL_GPL(devm_spear_pcm_platform_register);
52 52
53MODULE_AUTHOR("Rajeev Kumar <rajeev-dlh.kumar@st.com>"); 53MODULE_AUTHOR("Rajeev Kumar <rajeevkumar.linux@gmail.com>");
54MODULE_DESCRIPTION("SPEAr PCM DMA module"); 54MODULE_DESCRIPTION("SPEAr PCM DMA module");
55MODULE_LICENSE("GPL"); 55MODULE_LICENSE("GPL");
diff --git a/sound/soc/tegra/tegra_asoc_utils.h b/sound/soc/tegra/tegra_asoc_utils.h
index 9577121ce971..ca8037634100 100644
--- a/sound/soc/tegra/tegra_asoc_utils.h
+++ b/sound/soc/tegra/tegra_asoc_utils.h
@@ -21,7 +21,7 @@
21 */ 21 */
22 22
23#ifndef __TEGRA_ASOC_UTILS_H__ 23#ifndef __TEGRA_ASOC_UTILS_H__
24#define __TEGRA_ASOC_UTILS_H_ 24#define __TEGRA_ASOC_UTILS_H__
25 25
26struct clk; 26struct clk;
27struct device; 27struct device;
diff --git a/sound/usb/caiaq/control.c b/sound/usb/caiaq/control.c
index f65fc0987cfb..b7a7c805d63f 100644
--- a/sound/usb/caiaq/control.c
+++ b/sound/usb/caiaq/control.c
@@ -100,15 +100,19 @@ static int control_put(struct snd_kcontrol *kcontrol,
100 struct snd_usb_caiaqdev *cdev = caiaqdev(chip->card); 100 struct snd_usb_caiaqdev *cdev = caiaqdev(chip->card);
101 int pos = kcontrol->private_value; 101 int pos = kcontrol->private_value;
102 int v = ucontrol->value.integer.value[0]; 102 int v = ucontrol->value.integer.value[0];
103 unsigned char cmd = EP1_CMD_WRITE_IO; 103 unsigned char cmd;
104 104
105 if (cdev->chip.usb_id == 105 switch (cdev->chip.usb_id) {
106 USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_TRAKTORKONTROLX1)) 106 case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_MASCHINECONTROLLER):
107 cmd = EP1_CMD_DIMM_LEDS; 107 case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_TRAKTORKONTROLX1):
108 108 case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_KORECONTROLLER2):
109 if (cdev->chip.usb_id == 109 case USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_KORECONTROLLER):
110 USB_ID(USB_VID_NATIVEINSTRUMENTS, USB_PID_MASCHINECONTROLLER))
111 cmd = EP1_CMD_DIMM_LEDS; 110 cmd = EP1_CMD_DIMM_LEDS;
111 break;
112 default:
113 cmd = EP1_CMD_WRITE_IO;
114 break;
115 }
112 116
113 if (pos & CNT_INTVAL) { 117 if (pos & CNT_INTVAL) {
114 int i = pos & ~CNT_INTVAL; 118 int i = pos & ~CNT_INTVAL;