aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-12-27 15:59:27 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2017-12-27 15:59:27 -0500
commit9b9577948f64edc1c967d80deb6910c811abb8fc (patch)
treea0879a0a90c8dc0e242688e3d86c612a48765c36
parentbeacbc68ac3e23821a681adb30b45dc55b17488d (diff)
parent44be77c590f381bc629815ac789b8b15ecc4ddcf (diff)
Merge tag 'sound-4.15-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound
Pull sound fixes from Takashi Iwai: "It seems that Santa overslept with a bunch of gifts; the majority of changes here are various device-specific ASoC fixes, most notably the revert of rcar IOMMU support and fsl_ssi AC97 fixes, but also lots of small fixes for codecs. Besides that, the usual HD-audio quirks and fixes are included, too" * tag 'sound-4.15-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (31 commits) ALSA: hda - Fix missing COEF init for ALC225/295/299 ALSA: hda: Drop useless WARN_ON() ALSA: hda - change the location for one mic on a Lenovo machine ALSA: hda - fix headset mic detection issue on a Dell machine ALSA: hda - Add MIC_NO_PRESENCE fixup for 2 HP machines ASoC: rsnd: fixup ADG register mask ASoC: rt5514-spi: only enable wakeup when fully initialized ASoC: nau8825: fix issue that pop noise when start capture ASoC: rt5663: Fix the wrong result of the first jack detection ASoC: rsnd: ssi: fix race condition in rsnd_ssi_pointer_update ASoC: Intel: Change kern log level to avoid unwanted messages ASoC: atmel-classd: select correct Kconfig symbol ASoC: wm_adsp: Fix validation of firmware and coeff lengths ASoC: Intel: Skylake: Do not check dev_type for dmic link type ASoC: rockchip: disable clock on error ASoC: tlv320aic31xx: Fix GPIO1 register definition ASoC: codecs: msm8916-wcd: Fix supported formats ASoC: fsl_asrc: Fix typo in a field define ASoC: rsnd: ssiu: clear SSI_MODE for non TDM Extended modes ASoC: da7218: Correct IRQ level in DT binding example ...
-rw-r--r--Documentation/devicetree/bindings/sound/da7218.txt2
-rw-r--r--Documentation/devicetree/bindings/sound/da7219.txt2
-rw-r--r--sound/hda/hdac_i915.c2
-rw-r--r--sound/pci/hda/patch_conexant.c29
-rw-r--r--sound/pci/hda/patch_realtek.c14
-rw-r--r--sound/soc/amd/acp-pcm-dma.c7
-rw-r--r--sound/soc/atmel/Kconfig2
-rw-r--r--sound/soc/codecs/da7218.c2
-rw-r--r--sound/soc/codecs/msm8916-wcd-analog.c2
-rw-r--r--sound/soc/codecs/msm8916-wcd-digital.c4
-rw-r--r--sound/soc/codecs/nau8825.c1
-rw-r--r--sound/soc/codecs/rt5514-spi.c15
-rw-r--r--sound/soc/codecs/rt5514.c2
-rw-r--r--sound/soc/codecs/rt5645.c2
-rw-r--r--sound/soc/codecs/rt5663.c4
-rw-r--r--sound/soc/codecs/rt5663.h4
-rw-r--r--sound/soc/codecs/tlv320aic31xx.h2
-rw-r--r--sound/soc/codecs/twl4030.c4
-rw-r--r--sound/soc/codecs/wm_adsp.c12
-rw-r--r--sound/soc/fsl/fsl_asrc.h4
-rw-r--r--sound/soc/fsl/fsl_ssi.c44
-rw-r--r--sound/soc/intel/boards/kbl_rt5663_max98927.c2
-rw-r--r--sound/soc/intel/boards/kbl_rt5663_rt5514_max98927.c2
-rw-r--r--sound/soc/intel/skylake/skl-nhlt.c15
-rw-r--r--sound/soc/intel/skylake/skl-topology.c2
-rw-r--r--sound/soc/rockchip/rockchip_spdif.c18
-rw-r--r--sound/soc/sh/rcar/adg.c6
-rw-r--r--sound/soc/sh/rcar/core.c4
-rw-r--r--sound/soc/sh/rcar/dma.c86
-rw-r--r--sound/soc/sh/rcar/ssi.c16
-rw-r--r--sound/soc/sh/rcar/ssiu.c5
31 files changed, 173 insertions, 143 deletions
diff --git a/Documentation/devicetree/bindings/sound/da7218.txt b/Documentation/devicetree/bindings/sound/da7218.txt
index 5ca5a709b6aa..3ab9dfef38d1 100644
--- a/Documentation/devicetree/bindings/sound/da7218.txt
+++ b/Documentation/devicetree/bindings/sound/da7218.txt
@@ -73,7 +73,7 @@ Example:
73 compatible = "dlg,da7218"; 73 compatible = "dlg,da7218";
74 reg = <0x1a>; 74 reg = <0x1a>;
75 interrupt-parent = <&gpio6>; 75 interrupt-parent = <&gpio6>;
76 interrupts = <11 IRQ_TYPE_LEVEL_HIGH>; 76 interrupts = <11 IRQ_TYPE_LEVEL_LOW>;
77 wakeup-source; 77 wakeup-source;
78 78
79 VDD-supply = <&reg_audio>; 79 VDD-supply = <&reg_audio>;
diff --git a/Documentation/devicetree/bindings/sound/da7219.txt b/Documentation/devicetree/bindings/sound/da7219.txt
index cf61681826b6..5b54d2d045c3 100644
--- a/Documentation/devicetree/bindings/sound/da7219.txt
+++ b/Documentation/devicetree/bindings/sound/da7219.txt
@@ -77,7 +77,7 @@ Example:
77 reg = <0x1a>; 77 reg = <0x1a>;
78 78
79 interrupt-parent = <&gpio6>; 79 interrupt-parent = <&gpio6>;
80 interrupts = <11 IRQ_TYPE_LEVEL_HIGH>; 80 interrupts = <11 IRQ_TYPE_LEVEL_LOW>;
81 81
82 VDD-supply = <&reg_audio>; 82 VDD-supply = <&reg_audio>;
83 VDDMIC-supply = <&reg_audio>; 83 VDDMIC-supply = <&reg_audio>;
diff --git a/sound/hda/hdac_i915.c b/sound/hda/hdac_i915.c
index 038a180d3f81..cbe818eda336 100644
--- a/sound/hda/hdac_i915.c
+++ b/sound/hda/hdac_i915.c
@@ -325,7 +325,7 @@ static int hdac_component_master_match(struct device *dev, void *data)
325 */ 325 */
326int snd_hdac_i915_register_notifier(const struct i915_audio_component_audio_ops *aops) 326int snd_hdac_i915_register_notifier(const struct i915_audio_component_audio_ops *aops)
327{ 327{
328 if (WARN_ON(!hdac_acomp)) 328 if (!hdac_acomp)
329 return -ENODEV; 329 return -ENODEV;
330 330
331 hdac_acomp->audio_ops = aops; 331 hdac_acomp->audio_ops = aops;
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
index a81aacf684b2..37e1cf8218ff 100644
--- a/sound/pci/hda/patch_conexant.c
+++ b/sound/pci/hda/patch_conexant.c
@@ -271,6 +271,8 @@ enum {
271 CXT_FIXUP_HP_SPECTRE, 271 CXT_FIXUP_HP_SPECTRE,
272 CXT_FIXUP_HP_GATE_MIC, 272 CXT_FIXUP_HP_GATE_MIC,
273 CXT_FIXUP_MUTE_LED_GPIO, 273 CXT_FIXUP_MUTE_LED_GPIO,
274 CXT_FIXUP_HEADSET_MIC,
275 CXT_FIXUP_HP_MIC_NO_PRESENCE,
274}; 276};
275 277
276/* for hda_fixup_thinkpad_acpi() */ 278/* for hda_fixup_thinkpad_acpi() */
@@ -350,6 +352,18 @@ static void cxt_fixup_headphone_mic(struct hda_codec *codec,
350 } 352 }
351} 353}
352 354
355static void cxt_fixup_headset_mic(struct hda_codec *codec,
356 const struct hda_fixup *fix, int action)
357{
358 struct conexant_spec *spec = codec->spec;
359
360 switch (action) {
361 case HDA_FIXUP_ACT_PRE_PROBE:
362 spec->parse_flags |= HDA_PINCFG_HEADSET_MIC;
363 break;
364 }
365}
366
353/* OPLC XO 1.5 fixup */ 367/* OPLC XO 1.5 fixup */
354 368
355/* OLPC XO-1.5 supports DC input mode (e.g. for use with analog sensors) 369/* OLPC XO-1.5 supports DC input mode (e.g. for use with analog sensors)
@@ -880,6 +894,19 @@ static const struct hda_fixup cxt_fixups[] = {
880 .type = HDA_FIXUP_FUNC, 894 .type = HDA_FIXUP_FUNC,
881 .v.func = cxt_fixup_mute_led_gpio, 895 .v.func = cxt_fixup_mute_led_gpio,
882 }, 896 },
897 [CXT_FIXUP_HEADSET_MIC] = {
898 .type = HDA_FIXUP_FUNC,
899 .v.func = cxt_fixup_headset_mic,
900 },
901 [CXT_FIXUP_HP_MIC_NO_PRESENCE] = {
902 .type = HDA_FIXUP_PINS,
903 .v.pins = (const struct hda_pintbl[]) {
904 { 0x1a, 0x02a1113c },
905 { }
906 },
907 .chained = true,
908 .chain_id = CXT_FIXUP_HEADSET_MIC,
909 },
883}; 910};
884 911
885static const struct snd_pci_quirk cxt5045_fixups[] = { 912static const struct snd_pci_quirk cxt5045_fixups[] = {
@@ -934,6 +961,8 @@ static const struct snd_pci_quirk cxt5066_fixups[] = {
934 SND_PCI_QUIRK(0x103c, 0x8115, "HP Z1 Gen3", CXT_FIXUP_HP_GATE_MIC), 961 SND_PCI_QUIRK(0x103c, 0x8115, "HP Z1 Gen3", CXT_FIXUP_HP_GATE_MIC),
935 SND_PCI_QUIRK(0x103c, 0x814f, "HP ZBook 15u G3", CXT_FIXUP_MUTE_LED_GPIO), 962 SND_PCI_QUIRK(0x103c, 0x814f, "HP ZBook 15u G3", CXT_FIXUP_MUTE_LED_GPIO),
936 SND_PCI_QUIRK(0x103c, 0x822e, "HP ProBook 440 G4", CXT_FIXUP_MUTE_LED_GPIO), 963 SND_PCI_QUIRK(0x103c, 0x822e, "HP ProBook 440 G4", CXT_FIXUP_MUTE_LED_GPIO),
964 SND_PCI_QUIRK(0x103c, 0x8299, "HP 800 G3 SFF", CXT_FIXUP_HP_MIC_NO_PRESENCE),
965 SND_PCI_QUIRK(0x103c, 0x829a, "HP 800 G3 DM", CXT_FIXUP_HP_MIC_NO_PRESENCE),
937 SND_PCI_QUIRK(0x1043, 0x138d, "Asus", CXT_FIXUP_HEADPHONE_MIC_PIN), 966 SND_PCI_QUIRK(0x1043, 0x138d, "Asus", CXT_FIXUP_HEADPHONE_MIC_PIN),
938 SND_PCI_QUIRK(0x152d, 0x0833, "OLPC XO-1.5", CXT_FIXUP_OLPC_XO), 967 SND_PCI_QUIRK(0x152d, 0x0833, "OLPC XO-1.5", CXT_FIXUP_OLPC_XO),
939 SND_PCI_QUIRK(0x17aa, 0x20f2, "Lenovo T400", CXT_PINCFG_LENOVO_TP410), 968 SND_PCI_QUIRK(0x17aa, 0x20f2, "Lenovo T400", CXT_PINCFG_LENOVO_TP410),
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 6a4db00511ab..8fd2d9c62c96 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -324,8 +324,12 @@ static void alc_fill_eapd_coef(struct hda_codec *codec)
324 case 0x10ec0292: 324 case 0x10ec0292:
325 alc_update_coef_idx(codec, 0x4, 1<<15, 0); 325 alc_update_coef_idx(codec, 0x4, 1<<15, 0);
326 break; 326 break;
327 case 0x10ec0215:
328 case 0x10ec0225: 327 case 0x10ec0225:
328 case 0x10ec0295:
329 case 0x10ec0299:
330 alc_update_coef_idx(codec, 0x67, 0xf000, 0x3000);
331 /* fallthrough */
332 case 0x10ec0215:
329 case 0x10ec0233: 333 case 0x10ec0233:
330 case 0x10ec0236: 334 case 0x10ec0236:
331 case 0x10ec0255: 335 case 0x10ec0255:
@@ -336,10 +340,8 @@ static void alc_fill_eapd_coef(struct hda_codec *codec)
336 case 0x10ec0286: 340 case 0x10ec0286:
337 case 0x10ec0288: 341 case 0x10ec0288:
338 case 0x10ec0285: 342 case 0x10ec0285:
339 case 0x10ec0295:
340 case 0x10ec0298: 343 case 0x10ec0298:
341 case 0x10ec0289: 344 case 0x10ec0289:
342 case 0x10ec0299:
343 alc_update_coef_idx(codec, 0x10, 1<<9, 0); 345 alc_update_coef_idx(codec, 0x10, 1<<9, 0);
344 break; 346 break;
345 case 0x10ec0275: 347 case 0x10ec0275:
@@ -6328,6 +6330,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
6328 SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY), 6330 SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
6329 SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY), 6331 SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
6330 SND_PCI_QUIRK(0x17aa, 0x310c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION), 6332 SND_PCI_QUIRK(0x17aa, 0x310c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
6333 SND_PCI_QUIRK(0x17aa, 0x313c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),
6331 SND_PCI_QUIRK(0x17aa, 0x3112, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY), 6334 SND_PCI_QUIRK(0x17aa, 0x3112, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
6332 SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI), 6335 SND_PCI_QUIRK(0x17aa, 0x3902, "Lenovo E50-80", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
6333 SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC), 6336 SND_PCI_QUIRK(0x17aa, 0x3977, "IdeaPad S210", ALC283_FIXUP_INT_MIC),
@@ -6586,6 +6589,11 @@ static const struct snd_hda_pin_quirk alc269_pin_fixup_tbl[] = {
6586 {0x1b, 0x01011020}, 6589 {0x1b, 0x01011020},
6587 {0x21, 0x02211010}), 6590 {0x21, 0x02211010}),
6588 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE, 6591 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6592 {0x12, 0x90a60130},
6593 {0x14, 0x90170110},
6594 {0x1b, 0x01011020},
6595 {0x21, 0x0221101f}),
6596 SND_HDA_PIN_QUIRK(0x10ec0256, 0x1028, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE,
6589 {0x12, 0x90a60160}, 6597 {0x12, 0x90a60160},
6590 {0x14, 0x90170120}, 6598 {0x14, 0x90170120},
6591 {0x21, 0x02211030}), 6599 {0x21, 0x02211030}),
diff --git a/sound/soc/amd/acp-pcm-dma.c b/sound/soc/amd/acp-pcm-dma.c
index 9f521a55d610..b5e41df6bb3a 100644
--- a/sound/soc/amd/acp-pcm-dma.c
+++ b/sound/soc/amd/acp-pcm-dma.c
@@ -1051,6 +1051,11 @@ static int acp_audio_probe(struct platform_device *pdev)
1051 struct resource *res; 1051 struct resource *res;
1052 const u32 *pdata = pdev->dev.platform_data; 1052 const u32 *pdata = pdev->dev.platform_data;
1053 1053
1054 if (!pdata) {
1055 dev_err(&pdev->dev, "Missing platform data\n");
1056 return -ENODEV;
1057 }
1058
1054 audio_drv_data = devm_kzalloc(&pdev->dev, sizeof(struct audio_drv_data), 1059 audio_drv_data = devm_kzalloc(&pdev->dev, sizeof(struct audio_drv_data),
1055 GFP_KERNEL); 1060 GFP_KERNEL);
1056 if (audio_drv_data == NULL) 1061 if (audio_drv_data == NULL)
@@ -1058,6 +1063,8 @@ static int acp_audio_probe(struct platform_device *pdev)
1058 1063
1059 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 1064 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
1060 audio_drv_data->acp_mmio = devm_ioremap_resource(&pdev->dev, res); 1065 audio_drv_data->acp_mmio = devm_ioremap_resource(&pdev->dev, res);
1066 if (IS_ERR(audio_drv_data->acp_mmio))
1067 return PTR_ERR(audio_drv_data->acp_mmio);
1061 1068
1062 /* The following members gets populated in device 'open' 1069 /* The following members gets populated in device 'open'
1063 * function. Till then interrupts are disabled in 'acp_init' 1070 * function. Till then interrupts are disabled in 'acp_init'
diff --git a/sound/soc/atmel/Kconfig b/sound/soc/atmel/Kconfig
index 4a56f3dfba51..dcee145dd179 100644
--- a/sound/soc/atmel/Kconfig
+++ b/sound/soc/atmel/Kconfig
@@ -64,7 +64,7 @@ config SND_AT91_SOC_SAM9X5_WM8731
64config SND_ATMEL_SOC_CLASSD 64config SND_ATMEL_SOC_CLASSD
65 tristate "Atmel ASoC driver for boards using CLASSD" 65 tristate "Atmel ASoC driver for boards using CLASSD"
66 depends on ARCH_AT91 || COMPILE_TEST 66 depends on ARCH_AT91 || COMPILE_TEST
67 select SND_ATMEL_SOC_DMA 67 select SND_SOC_GENERIC_DMAENGINE_PCM
68 select REGMAP_MMIO 68 select REGMAP_MMIO
69 help 69 help
70 Say Y if you want to add support for Atmel ASoC driver for boards using 70 Say Y if you want to add support for Atmel ASoC driver for boards using
diff --git a/sound/soc/codecs/da7218.c b/sound/soc/codecs/da7218.c
index b2d42ec1dcd9..56564ce90cb6 100644
--- a/sound/soc/codecs/da7218.c
+++ b/sound/soc/codecs/da7218.c
@@ -2520,7 +2520,7 @@ static struct da7218_pdata *da7218_of_to_pdata(struct snd_soc_codec *codec)
2520 } 2520 }
2521 2521
2522 if (da7218->dev_id == DA7218_DEV_ID) { 2522 if (da7218->dev_id == DA7218_DEV_ID) {
2523 hpldet_np = of_find_node_by_name(np, "da7218_hpldet"); 2523 hpldet_np = of_get_child_by_name(np, "da7218_hpldet");
2524 if (!hpldet_np) 2524 if (!hpldet_np)
2525 return pdata; 2525 return pdata;
2526 2526
diff --git a/sound/soc/codecs/msm8916-wcd-analog.c b/sound/soc/codecs/msm8916-wcd-analog.c
index 5f3c42c4f74a..066ea2f4ce7b 100644
--- a/sound/soc/codecs/msm8916-wcd-analog.c
+++ b/sound/soc/codecs/msm8916-wcd-analog.c
@@ -267,7 +267,7 @@
267#define MSM8916_WCD_ANALOG_RATES (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000 |\ 267#define MSM8916_WCD_ANALOG_RATES (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000 |\
268 SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_48000) 268 SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_48000)
269#define MSM8916_WCD_ANALOG_FORMATS (SNDRV_PCM_FMTBIT_S16_LE |\ 269#define MSM8916_WCD_ANALOG_FORMATS (SNDRV_PCM_FMTBIT_S16_LE |\
270 SNDRV_PCM_FMTBIT_S24_LE) 270 SNDRV_PCM_FMTBIT_S32_LE)
271 271
272static int btn_mask = SND_JACK_BTN_0 | SND_JACK_BTN_1 | 272static int btn_mask = SND_JACK_BTN_0 | SND_JACK_BTN_1 |
273 SND_JACK_BTN_2 | SND_JACK_BTN_3 | SND_JACK_BTN_4; 273 SND_JACK_BTN_2 | SND_JACK_BTN_3 | SND_JACK_BTN_4;
diff --git a/sound/soc/codecs/msm8916-wcd-digital.c b/sound/soc/codecs/msm8916-wcd-digital.c
index a10a724eb448..13354d6304a8 100644
--- a/sound/soc/codecs/msm8916-wcd-digital.c
+++ b/sound/soc/codecs/msm8916-wcd-digital.c
@@ -194,7 +194,7 @@
194 SNDRV_PCM_RATE_32000 | \ 194 SNDRV_PCM_RATE_32000 | \
195 SNDRV_PCM_RATE_48000) 195 SNDRV_PCM_RATE_48000)
196#define MSM8916_WCD_DIGITAL_FORMATS (SNDRV_PCM_FMTBIT_S16_LE |\ 196#define MSM8916_WCD_DIGITAL_FORMATS (SNDRV_PCM_FMTBIT_S16_LE |\
197 SNDRV_PCM_FMTBIT_S24_LE) 197 SNDRV_PCM_FMTBIT_S32_LE)
198 198
199struct msm8916_wcd_digital_priv { 199struct msm8916_wcd_digital_priv {
200 struct clk *ahbclk, *mclk; 200 struct clk *ahbclk, *mclk;
@@ -645,7 +645,7 @@ static int msm8916_wcd_digital_hw_params(struct snd_pcm_substream *substream,
645 RX_I2S_CTL_RX_I2S_MODE_MASK, 645 RX_I2S_CTL_RX_I2S_MODE_MASK,
646 RX_I2S_CTL_RX_I2S_MODE_16); 646 RX_I2S_CTL_RX_I2S_MODE_16);
647 break; 647 break;
648 case SNDRV_PCM_FORMAT_S24_LE: 648 case SNDRV_PCM_FORMAT_S32_LE:
649 snd_soc_update_bits(dai->codec, LPASS_CDC_CLK_TX_I2S_CTL, 649 snd_soc_update_bits(dai->codec, LPASS_CDC_CLK_TX_I2S_CTL,
650 TX_I2S_CTL_TX_I2S_MODE_MASK, 650 TX_I2S_CTL_TX_I2S_MODE_MASK,
651 TX_I2S_CTL_TX_I2S_MODE_32); 651 TX_I2S_CTL_TX_I2S_MODE_32);
diff --git a/sound/soc/codecs/nau8825.c b/sound/soc/codecs/nau8825.c
index 714ce17da717..e853a6dfd33b 100644
--- a/sound/soc/codecs/nau8825.c
+++ b/sound/soc/codecs/nau8825.c
@@ -905,6 +905,7 @@ static int nau8825_adc_event(struct snd_soc_dapm_widget *w,
905 905
906 switch (event) { 906 switch (event) {
907 case SND_SOC_DAPM_POST_PMU: 907 case SND_SOC_DAPM_POST_PMU:
908 msleep(125);
908 regmap_update_bits(nau8825->regmap, NAU8825_REG_ENA_CTRL, 909 regmap_update_bits(nau8825->regmap, NAU8825_REG_ENA_CTRL,
909 NAU8825_ENABLE_ADC, NAU8825_ENABLE_ADC); 910 NAU8825_ENABLE_ADC, NAU8825_ENABLE_ADC);
910 break; 911 break;
diff --git a/sound/soc/codecs/rt5514-spi.c b/sound/soc/codecs/rt5514-spi.c
index 2df91db765ac..64bf26cec20d 100644
--- a/sound/soc/codecs/rt5514-spi.c
+++ b/sound/soc/codecs/rt5514-spi.c
@@ -289,6 +289,8 @@ static int rt5514_spi_pcm_probe(struct snd_soc_platform *platform)
289 dev_err(&rt5514_spi->dev, 289 dev_err(&rt5514_spi->dev,
290 "%s Failed to reguest IRQ: %d\n", __func__, 290 "%s Failed to reguest IRQ: %d\n", __func__,
291 ret); 291 ret);
292 else
293 device_init_wakeup(rt5514_dsp->dev, true);
292 } 294 }
293 295
294 return 0; 296 return 0;
@@ -456,8 +458,6 @@ static int rt5514_spi_probe(struct spi_device *spi)
456 return ret; 458 return ret;
457 } 459 }
458 460
459 device_init_wakeup(&spi->dev, true);
460
461 return 0; 461 return 0;
462} 462}
463 463
@@ -482,10 +482,13 @@ static int __maybe_unused rt5514_resume(struct device *dev)
482 if (device_may_wakeup(dev)) 482 if (device_may_wakeup(dev))
483 disable_irq_wake(irq); 483 disable_irq_wake(irq);
484 484
485 if (rt5514_dsp->substream) { 485 if (rt5514_dsp) {
486 rt5514_spi_burst_read(RT5514_IRQ_CTRL, (u8 *)&buf, sizeof(buf)); 486 if (rt5514_dsp->substream) {
487 if (buf[0] & RT5514_IRQ_STATUS_BIT) 487 rt5514_spi_burst_read(RT5514_IRQ_CTRL, (u8 *)&buf,
488 rt5514_schedule_copy(rt5514_dsp); 488 sizeof(buf));
489 if (buf[0] & RT5514_IRQ_STATUS_BIT)
490 rt5514_schedule_copy(rt5514_dsp);
491 }
489 } 492 }
490 493
491 return 0; 494 return 0;
diff --git a/sound/soc/codecs/rt5514.c b/sound/soc/codecs/rt5514.c
index 2a5b5d74e697..2dd6e9f990a4 100644
--- a/sound/soc/codecs/rt5514.c
+++ b/sound/soc/codecs/rt5514.c
@@ -496,7 +496,7 @@ static const struct snd_soc_dapm_widget rt5514_dapm_widgets[] = {
496 SND_SOC_DAPM_PGA("DMIC1", SND_SOC_NOPM, 0, 0, NULL, 0), 496 SND_SOC_DAPM_PGA("DMIC1", SND_SOC_NOPM, 0, 0, NULL, 0),
497 SND_SOC_DAPM_PGA("DMIC2", SND_SOC_NOPM, 0, 0, NULL, 0), 497 SND_SOC_DAPM_PGA("DMIC2", SND_SOC_NOPM, 0, 0, NULL, 0),
498 498
499 SND_SOC_DAPM_SUPPLY("DMIC CLK", SND_SOC_NOPM, 0, 0, 499 SND_SOC_DAPM_SUPPLY_S("DMIC CLK", 1, SND_SOC_NOPM, 0, 0,
500 rt5514_set_dmic_clk, SND_SOC_DAPM_PRE_PMU), 500 rt5514_set_dmic_clk, SND_SOC_DAPM_PRE_PMU),
501 501
502 SND_SOC_DAPM_SUPPLY("ADC CLK", RT5514_CLK_CTRL1, 502 SND_SOC_DAPM_SUPPLY("ADC CLK", RT5514_CLK_CTRL1,
diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c
index f020d2d1eef4..edc152c8a1fe 100644
--- a/sound/soc/codecs/rt5645.c
+++ b/sound/soc/codecs/rt5645.c
@@ -3823,6 +3823,8 @@ static int rt5645_i2c_probe(struct i2c_client *i2c,
3823 regmap_read(regmap, RT5645_VENDOR_ID, &val); 3823 regmap_read(regmap, RT5645_VENDOR_ID, &val);
3824 rt5645->v_id = val & 0xff; 3824 rt5645->v_id = val & 0xff;
3825 3825
3826 regmap_write(rt5645->regmap, RT5645_AD_DA_MIXER, 0x8080);
3827
3826 ret = regmap_register_patch(rt5645->regmap, init_list, 3828 ret = regmap_register_patch(rt5645->regmap, init_list,
3827 ARRAY_SIZE(init_list)); 3829 ARRAY_SIZE(init_list));
3828 if (ret != 0) 3830 if (ret != 0)
diff --git a/sound/soc/codecs/rt5663.c b/sound/soc/codecs/rt5663.c
index b036c9dc0c8c..d329bf719d80 100644
--- a/sound/soc/codecs/rt5663.c
+++ b/sound/soc/codecs/rt5663.c
@@ -1560,6 +1560,10 @@ static int rt5663_jack_detect(struct snd_soc_codec *codec, int jack_insert)
1560 RT5663_IRQ_POW_SAV_MASK, RT5663_IRQ_POW_SAV_EN); 1560 RT5663_IRQ_POW_SAV_MASK, RT5663_IRQ_POW_SAV_EN);
1561 snd_soc_update_bits(codec, RT5663_IRQ_1, 1561 snd_soc_update_bits(codec, RT5663_IRQ_1,
1562 RT5663_EN_IRQ_JD1_MASK, RT5663_EN_IRQ_JD1_EN); 1562 RT5663_EN_IRQ_JD1_MASK, RT5663_EN_IRQ_JD1_EN);
1563 snd_soc_update_bits(codec, RT5663_EM_JACK_TYPE_1,
1564 RT5663_EM_JD_MASK, RT5663_EM_JD_RST);
1565 snd_soc_update_bits(codec, RT5663_EM_JACK_TYPE_1,
1566 RT5663_EM_JD_MASK, RT5663_EM_JD_NOR);
1563 1567
1564 while (true) { 1568 while (true) {
1565 regmap_read(rt5663->regmap, RT5663_INT_ST_2, &val); 1569 regmap_read(rt5663->regmap, RT5663_INT_ST_2, &val);
diff --git a/sound/soc/codecs/rt5663.h b/sound/soc/codecs/rt5663.h
index c5a9b69579ad..03adc8004ba9 100644
--- a/sound/soc/codecs/rt5663.h
+++ b/sound/soc/codecs/rt5663.h
@@ -1029,6 +1029,10 @@
1029#define RT5663_POL_EXT_JD_SHIFT 10 1029#define RT5663_POL_EXT_JD_SHIFT 10
1030#define RT5663_POL_EXT_JD_EN (0x1 << 10) 1030#define RT5663_POL_EXT_JD_EN (0x1 << 10)
1031#define RT5663_POL_EXT_JD_DIS (0x0 << 10) 1031#define RT5663_POL_EXT_JD_DIS (0x0 << 10)
1032#define RT5663_EM_JD_MASK (0x1 << 7)
1033#define RT5663_EM_JD_SHIFT 7
1034#define RT5663_EM_JD_NOR (0x1 << 7)
1035#define RT5663_EM_JD_RST (0x0 << 7)
1032 1036
1033/* DACREF LDO Control (0x0112)*/ 1037/* DACREF LDO Control (0x0112)*/
1034#define RT5663_PWR_LDO_DACREFL_MASK (0x1 << 9) 1038#define RT5663_PWR_LDO_DACREFL_MASK (0x1 << 9)
diff --git a/sound/soc/codecs/tlv320aic31xx.h b/sound/soc/codecs/tlv320aic31xx.h
index 730fb2058869..1ff3edb7bbb6 100644
--- a/sound/soc/codecs/tlv320aic31xx.h
+++ b/sound/soc/codecs/tlv320aic31xx.h
@@ -116,7 +116,7 @@ struct aic31xx_pdata {
116/* INT2 interrupt control */ 116/* INT2 interrupt control */
117#define AIC31XX_INT2CTRL AIC31XX_REG(0, 49) 117#define AIC31XX_INT2CTRL AIC31XX_REG(0, 49)
118/* GPIO1 control */ 118/* GPIO1 control */
119#define AIC31XX_GPIO1 AIC31XX_REG(0, 50) 119#define AIC31XX_GPIO1 AIC31XX_REG(0, 51)
120 120
121#define AIC31XX_DACPRB AIC31XX_REG(0, 60) 121#define AIC31XX_DACPRB AIC31XX_REG(0, 60)
122/* ADC Instruction Set Register */ 122/* ADC Instruction Set Register */
diff --git a/sound/soc/codecs/twl4030.c b/sound/soc/codecs/twl4030.c
index c482b2e7a7d2..cfe72b9d4356 100644
--- a/sound/soc/codecs/twl4030.c
+++ b/sound/soc/codecs/twl4030.c
@@ -232,7 +232,7 @@ static struct twl4030_codec_data *twl4030_get_pdata(struct snd_soc_codec *codec)
232 struct twl4030_codec_data *pdata = dev_get_platdata(codec->dev); 232 struct twl4030_codec_data *pdata = dev_get_platdata(codec->dev);
233 struct device_node *twl4030_codec_node = NULL; 233 struct device_node *twl4030_codec_node = NULL;
234 234
235 twl4030_codec_node = of_find_node_by_name(codec->dev->parent->of_node, 235 twl4030_codec_node = of_get_child_by_name(codec->dev->parent->of_node,
236 "codec"); 236 "codec");
237 237
238 if (!pdata && twl4030_codec_node) { 238 if (!pdata && twl4030_codec_node) {
@@ -241,9 +241,11 @@ static struct twl4030_codec_data *twl4030_get_pdata(struct snd_soc_codec *codec)
241 GFP_KERNEL); 241 GFP_KERNEL);
242 if (!pdata) { 242 if (!pdata) {
243 dev_err(codec->dev, "Can not allocate memory\n"); 243 dev_err(codec->dev, "Can not allocate memory\n");
244 of_node_put(twl4030_codec_node);
244 return NULL; 245 return NULL;
245 } 246 }
246 twl4030_setup_pdata_of(pdata, twl4030_codec_node); 247 twl4030_setup_pdata_of(pdata, twl4030_codec_node);
248 of_node_put(twl4030_codec_node);
247 } 249 }
248 250
249 return pdata; 251 return pdata;
diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c
index 65c059b5ffd7..66e32f5d2917 100644
--- a/sound/soc/codecs/wm_adsp.c
+++ b/sound/soc/codecs/wm_adsp.c
@@ -1733,7 +1733,7 @@ static int wm_adsp_load(struct wm_adsp *dsp)
1733 le64_to_cpu(footer->timestamp)); 1733 le64_to_cpu(footer->timestamp));
1734 1734
1735 while (pos < firmware->size && 1735 while (pos < firmware->size &&
1736 pos - firmware->size > sizeof(*region)) { 1736 sizeof(*region) < firmware->size - pos) {
1737 region = (void *)&(firmware->data[pos]); 1737 region = (void *)&(firmware->data[pos]);
1738 region_name = "Unknown"; 1738 region_name = "Unknown";
1739 reg = 0; 1739 reg = 0;
@@ -1782,8 +1782,8 @@ static int wm_adsp_load(struct wm_adsp *dsp)
1782 regions, le32_to_cpu(region->len), offset, 1782 regions, le32_to_cpu(region->len), offset,
1783 region_name); 1783 region_name);
1784 1784
1785 if ((pos + le32_to_cpu(region->len) + sizeof(*region)) > 1785 if (le32_to_cpu(region->len) >
1786 firmware->size) { 1786 firmware->size - pos - sizeof(*region)) {
1787 adsp_err(dsp, 1787 adsp_err(dsp,
1788 "%s.%d: %s region len %d bytes exceeds file length %zu\n", 1788 "%s.%d: %s region len %d bytes exceeds file length %zu\n",
1789 file, regions, region_name, 1789 file, regions, region_name,
@@ -2253,7 +2253,7 @@ static int wm_adsp_load_coeff(struct wm_adsp *dsp)
2253 2253
2254 blocks = 0; 2254 blocks = 0;
2255 while (pos < firmware->size && 2255 while (pos < firmware->size &&
2256 pos - firmware->size > sizeof(*blk)) { 2256 sizeof(*blk) < firmware->size - pos) {
2257 blk = (void *)(&firmware->data[pos]); 2257 blk = (void *)(&firmware->data[pos]);
2258 2258
2259 type = le16_to_cpu(blk->type); 2259 type = le16_to_cpu(blk->type);
@@ -2327,8 +2327,8 @@ static int wm_adsp_load_coeff(struct wm_adsp *dsp)
2327 } 2327 }
2328 2328
2329 if (reg) { 2329 if (reg) {
2330 if ((pos + le32_to_cpu(blk->len) + sizeof(*blk)) > 2330 if (le32_to_cpu(blk->len) >
2331 firmware->size) { 2331 firmware->size - pos - sizeof(*blk)) {
2332 adsp_err(dsp, 2332 adsp_err(dsp,
2333 "%s.%d: %s region len %d bytes exceeds file length %zu\n", 2333 "%s.%d: %s region len %d bytes exceeds file length %zu\n",
2334 file, blocks, region_name, 2334 file, blocks, region_name,
diff --git a/sound/soc/fsl/fsl_asrc.h b/sound/soc/fsl/fsl_asrc.h
index 0f163abe4ba3..52c27a358933 100644
--- a/sound/soc/fsl/fsl_asrc.h
+++ b/sound/soc/fsl/fsl_asrc.h
@@ -260,8 +260,8 @@
260#define ASRFSTi_OUTPUT_FIFO_SHIFT 12 260#define ASRFSTi_OUTPUT_FIFO_SHIFT 12
261#define ASRFSTi_OUTPUT_FIFO_MASK (((1 << ASRFSTi_OUTPUT_FIFO_WIDTH) - 1) << ASRFSTi_OUTPUT_FIFO_SHIFT) 261#define ASRFSTi_OUTPUT_FIFO_MASK (((1 << ASRFSTi_OUTPUT_FIFO_WIDTH) - 1) << ASRFSTi_OUTPUT_FIFO_SHIFT)
262#define ASRFSTi_IAEi_SHIFT 11 262#define ASRFSTi_IAEi_SHIFT 11
263#define ASRFSTi_IAEi_MASK (1 << ASRFSTi_OAFi_SHIFT) 263#define ASRFSTi_IAEi_MASK (1 << ASRFSTi_IAEi_SHIFT)
264#define ASRFSTi_IAEi (1 << ASRFSTi_OAFi_SHIFT) 264#define ASRFSTi_IAEi (1 << ASRFSTi_IAEi_SHIFT)
265#define ASRFSTi_INPUT_FIFO_WIDTH 7 265#define ASRFSTi_INPUT_FIFO_WIDTH 7
266#define ASRFSTi_INPUT_FIFO_SHIFT 0 266#define ASRFSTi_INPUT_FIFO_SHIFT 0
267#define ASRFSTi_INPUT_FIFO_MASK ((1 << ASRFSTi_INPUT_FIFO_WIDTH) - 1) 267#define ASRFSTi_INPUT_FIFO_MASK ((1 << ASRFSTi_INPUT_FIFO_WIDTH) - 1)
diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
index f2f51e06e22c..424bafaf51ef 100644
--- a/sound/soc/fsl/fsl_ssi.c
+++ b/sound/soc/fsl/fsl_ssi.c
@@ -38,6 +38,7 @@
38#include <linux/ctype.h> 38#include <linux/ctype.h>
39#include <linux/device.h> 39#include <linux/device.h>
40#include <linux/delay.h> 40#include <linux/delay.h>
41#include <linux/mutex.h>
41#include <linux/slab.h> 42#include <linux/slab.h>
42#include <linux/spinlock.h> 43#include <linux/spinlock.h>
43#include <linux/of.h> 44#include <linux/of.h>
@@ -265,6 +266,8 @@ struct fsl_ssi_private {
265 266
266 u32 fifo_watermark; 267 u32 fifo_watermark;
267 u32 dma_maxburst; 268 u32 dma_maxburst;
269
270 struct mutex ac97_reg_lock;
268}; 271};
269 272
270/* 273/*
@@ -1260,11 +1263,13 @@ static void fsl_ssi_ac97_write(struct snd_ac97 *ac97, unsigned short reg,
1260 if (reg > 0x7f) 1263 if (reg > 0x7f)
1261 return; 1264 return;
1262 1265
1266 mutex_lock(&fsl_ac97_data->ac97_reg_lock);
1267
1263 ret = clk_prepare_enable(fsl_ac97_data->clk); 1268 ret = clk_prepare_enable(fsl_ac97_data->clk);
1264 if (ret) { 1269 if (ret) {
1265 pr_err("ac97 write clk_prepare_enable failed: %d\n", 1270 pr_err("ac97 write clk_prepare_enable failed: %d\n",
1266 ret); 1271 ret);
1267 return; 1272 goto ret_unlock;
1268 } 1273 }
1269 1274
1270 lreg = reg << 12; 1275 lreg = reg << 12;
@@ -1278,6 +1283,9 @@ static void fsl_ssi_ac97_write(struct snd_ac97 *ac97, unsigned short reg,
1278 udelay(100); 1283 udelay(100);
1279 1284
1280 clk_disable_unprepare(fsl_ac97_data->clk); 1285 clk_disable_unprepare(fsl_ac97_data->clk);
1286
1287ret_unlock:
1288 mutex_unlock(&fsl_ac97_data->ac97_reg_lock);
1281} 1289}
1282 1290
1283static unsigned short fsl_ssi_ac97_read(struct snd_ac97 *ac97, 1291static unsigned short fsl_ssi_ac97_read(struct snd_ac97 *ac97,
@@ -1285,16 +1293,18 @@ static unsigned short fsl_ssi_ac97_read(struct snd_ac97 *ac97,
1285{ 1293{
1286 struct regmap *regs = fsl_ac97_data->regs; 1294 struct regmap *regs = fsl_ac97_data->regs;
1287 1295
1288 unsigned short val = -1; 1296 unsigned short val = 0;
1289 u32 reg_val; 1297 u32 reg_val;
1290 unsigned int lreg; 1298 unsigned int lreg;
1291 int ret; 1299 int ret;
1292 1300
1301 mutex_lock(&fsl_ac97_data->ac97_reg_lock);
1302
1293 ret = clk_prepare_enable(fsl_ac97_data->clk); 1303 ret = clk_prepare_enable(fsl_ac97_data->clk);
1294 if (ret) { 1304 if (ret) {
1295 pr_err("ac97 read clk_prepare_enable failed: %d\n", 1305 pr_err("ac97 read clk_prepare_enable failed: %d\n",
1296 ret); 1306 ret);
1297 return -1; 1307 goto ret_unlock;
1298 } 1308 }
1299 1309
1300 lreg = (reg & 0x7f) << 12; 1310 lreg = (reg & 0x7f) << 12;
@@ -1309,6 +1319,8 @@ static unsigned short fsl_ssi_ac97_read(struct snd_ac97 *ac97,
1309 1319
1310 clk_disable_unprepare(fsl_ac97_data->clk); 1320 clk_disable_unprepare(fsl_ac97_data->clk);
1311 1321
1322ret_unlock:
1323 mutex_unlock(&fsl_ac97_data->ac97_reg_lock);
1312 return val; 1324 return val;
1313} 1325}
1314 1326
@@ -1458,12 +1470,6 @@ static int fsl_ssi_probe(struct platform_device *pdev)
1458 sizeof(fsl_ssi_ac97_dai)); 1470 sizeof(fsl_ssi_ac97_dai));
1459 1471
1460 fsl_ac97_data = ssi_private; 1472 fsl_ac97_data = ssi_private;
1461
1462 ret = snd_soc_set_ac97_ops_of_reset(&fsl_ssi_ac97_ops, pdev);
1463 if (ret) {
1464 dev_err(&pdev->dev, "could not set AC'97 ops\n");
1465 return ret;
1466 }
1467 } else { 1473 } else {
1468 /* Initialize this copy of the CPU DAI driver structure */ 1474 /* Initialize this copy of the CPU DAI driver structure */
1469 memcpy(&ssi_private->cpu_dai_drv, &fsl_ssi_dai_template, 1475 memcpy(&ssi_private->cpu_dai_drv, &fsl_ssi_dai_template,
@@ -1574,6 +1580,15 @@ static int fsl_ssi_probe(struct platform_device *pdev)
1574 return ret; 1580 return ret;
1575 } 1581 }
1576 1582
1583 if (fsl_ssi_is_ac97(ssi_private)) {
1584 mutex_init(&ssi_private->ac97_reg_lock);
1585 ret = snd_soc_set_ac97_ops_of_reset(&fsl_ssi_ac97_ops, pdev);
1586 if (ret) {
1587 dev_err(&pdev->dev, "could not set AC'97 ops\n");
1588 goto error_ac97_ops;
1589 }
1590 }
1591
1577 ret = devm_snd_soc_register_component(&pdev->dev, &fsl_ssi_component, 1592 ret = devm_snd_soc_register_component(&pdev->dev, &fsl_ssi_component,
1578 &ssi_private->cpu_dai_drv, 1); 1593 &ssi_private->cpu_dai_drv, 1);
1579 if (ret) { 1594 if (ret) {
@@ -1657,6 +1672,13 @@ error_sound_card:
1657 fsl_ssi_debugfs_remove(&ssi_private->dbg_stats); 1672 fsl_ssi_debugfs_remove(&ssi_private->dbg_stats);
1658 1673
1659error_asoc_register: 1674error_asoc_register:
1675 if (fsl_ssi_is_ac97(ssi_private))
1676 snd_soc_set_ac97_ops(NULL);
1677
1678error_ac97_ops:
1679 if (fsl_ssi_is_ac97(ssi_private))
1680 mutex_destroy(&ssi_private->ac97_reg_lock);
1681
1660 if (ssi_private->soc->imx) 1682 if (ssi_private->soc->imx)
1661 fsl_ssi_imx_clean(pdev, ssi_private); 1683 fsl_ssi_imx_clean(pdev, ssi_private);
1662 1684
@@ -1675,8 +1697,10 @@ static int fsl_ssi_remove(struct platform_device *pdev)
1675 if (ssi_private->soc->imx) 1697 if (ssi_private->soc->imx)
1676 fsl_ssi_imx_clean(pdev, ssi_private); 1698 fsl_ssi_imx_clean(pdev, ssi_private);
1677 1699
1678 if (fsl_ssi_is_ac97(ssi_private)) 1700 if (fsl_ssi_is_ac97(ssi_private)) {
1679 snd_soc_set_ac97_ops(NULL); 1701 snd_soc_set_ac97_ops(NULL);
1702 mutex_destroy(&ssi_private->ac97_reg_lock);
1703 }
1680 1704
1681 return 0; 1705 return 0;
1682} 1706}
diff --git a/sound/soc/intel/boards/kbl_rt5663_max98927.c b/sound/soc/intel/boards/kbl_rt5663_max98927.c
index 6f9a8bcf20f3..6dcad0a8a0d0 100644
--- a/sound/soc/intel/boards/kbl_rt5663_max98927.c
+++ b/sound/soc/intel/boards/kbl_rt5663_max98927.c
@@ -101,7 +101,7 @@ static const struct snd_soc_dapm_route kabylake_map[] = {
101 { "ssp0 Tx", NULL, "spk_out" }, 101 { "ssp0 Tx", NULL, "spk_out" },
102 102
103 { "AIF Playback", NULL, "ssp1 Tx" }, 103 { "AIF Playback", NULL, "ssp1 Tx" },
104 { "ssp1 Tx", NULL, "hs_out" }, 104 { "ssp1 Tx", NULL, "codec1_out" },
105 105
106 { "hs_in", NULL, "ssp1 Rx" }, 106 { "hs_in", NULL, "ssp1 Rx" },
107 { "ssp1 Rx", NULL, "AIF Capture" }, 107 { "ssp1 Rx", NULL, "AIF Capture" },
diff --git a/sound/soc/intel/boards/kbl_rt5663_rt5514_max98927.c b/sound/soc/intel/boards/kbl_rt5663_rt5514_max98927.c
index 6072164f2d43..271ae3c2c535 100644
--- a/sound/soc/intel/boards/kbl_rt5663_rt5514_max98927.c
+++ b/sound/soc/intel/boards/kbl_rt5663_rt5514_max98927.c
@@ -109,7 +109,7 @@ static const struct snd_soc_dapm_route kabylake_map[] = {
109 { "ssp0 Tx", NULL, "spk_out" }, 109 { "ssp0 Tx", NULL, "spk_out" },
110 110
111 { "AIF Playback", NULL, "ssp1 Tx" }, 111 { "AIF Playback", NULL, "ssp1 Tx" },
112 { "ssp1 Tx", NULL, "hs_out" }, 112 { "ssp1 Tx", NULL, "codec1_out" },
113 113
114 { "hs_in", NULL, "ssp1 Rx" }, 114 { "hs_in", NULL, "ssp1 Rx" },
115 { "ssp1 Rx", NULL, "AIF Capture" }, 115 { "ssp1 Rx", NULL, "AIF Capture" },
diff --git a/sound/soc/intel/skylake/skl-nhlt.c b/sound/soc/intel/skylake/skl-nhlt.c
index d14c50a60289..3eaac41090ca 100644
--- a/sound/soc/intel/skylake/skl-nhlt.c
+++ b/sound/soc/intel/skylake/skl-nhlt.c
@@ -119,11 +119,16 @@ static bool skl_check_ep_match(struct device *dev, struct nhlt_endpoint *epnt,
119 119
120 if ((epnt->virtual_bus_id == instance_id) && 120 if ((epnt->virtual_bus_id == instance_id) &&
121 (epnt->linktype == link_type) && 121 (epnt->linktype == link_type) &&
122 (epnt->direction == dirn) && 122 (epnt->direction == dirn)) {
123 (epnt->device_type == dev_type)) 123 /* do not check dev_type for DMIC link type */
124 return true; 124 if (epnt->linktype == NHLT_LINK_DMIC)
125 else 125 return true;
126 return false; 126
127 if (epnt->device_type == dev_type)
128 return true;
129 }
130
131 return false;
127} 132}
128 133
129struct nhlt_specific_cfg 134struct nhlt_specific_cfg
diff --git a/sound/soc/intel/skylake/skl-topology.c b/sound/soc/intel/skylake/skl-topology.c
index a072bcf209d2..81923da18ac2 100644
--- a/sound/soc/intel/skylake/skl-topology.c
+++ b/sound/soc/intel/skylake/skl-topology.c
@@ -2908,7 +2908,7 @@ static int skl_tplg_control_load(struct snd_soc_component *cmpnt,
2908 break; 2908 break;
2909 2909
2910 default: 2910 default:
2911 dev_warn(bus->dev, "Control load not supported %d:%d:%d\n", 2911 dev_dbg(bus->dev, "Control load not supported %d:%d:%d\n",
2912 hdr->ops.get, hdr->ops.put, hdr->ops.info); 2912 hdr->ops.get, hdr->ops.put, hdr->ops.info);
2913 break; 2913 break;
2914 } 2914 }
diff --git a/sound/soc/rockchip/rockchip_spdif.c b/sound/soc/rockchip/rockchip_spdif.c
index ee5055d47d13..a89fe9b6463b 100644
--- a/sound/soc/rockchip/rockchip_spdif.c
+++ b/sound/soc/rockchip/rockchip_spdif.c
@@ -322,26 +322,30 @@ static int rk_spdif_probe(struct platform_device *pdev)
322 spdif->mclk = devm_clk_get(&pdev->dev, "mclk"); 322 spdif->mclk = devm_clk_get(&pdev->dev, "mclk");
323 if (IS_ERR(spdif->mclk)) { 323 if (IS_ERR(spdif->mclk)) {
324 dev_err(&pdev->dev, "Can't retrieve rk_spdif master clock\n"); 324 dev_err(&pdev->dev, "Can't retrieve rk_spdif master clock\n");
325 return PTR_ERR(spdif->mclk); 325 ret = PTR_ERR(spdif->mclk);
326 goto err_disable_hclk;
326 } 327 }
327 328
328 ret = clk_prepare_enable(spdif->mclk); 329 ret = clk_prepare_enable(spdif->mclk);
329 if (ret) { 330 if (ret) {
330 dev_err(spdif->dev, "clock enable failed %d\n", ret); 331 dev_err(spdif->dev, "clock enable failed %d\n", ret);
331 return ret; 332 goto err_disable_clocks;
332 } 333 }
333 334
334 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 335 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
335 regs = devm_ioremap_resource(&pdev->dev, res); 336 regs = devm_ioremap_resource(&pdev->dev, res);
336 if (IS_ERR(regs)) 337 if (IS_ERR(regs)) {
337 return PTR_ERR(regs); 338 ret = PTR_ERR(regs);
339 goto err_disable_clocks;
340 }
338 341
339 spdif->regmap = devm_regmap_init_mmio_clk(&pdev->dev, "hclk", regs, 342 spdif->regmap = devm_regmap_init_mmio_clk(&pdev->dev, "hclk", regs,
340 &rk_spdif_regmap_config); 343 &rk_spdif_regmap_config);
341 if (IS_ERR(spdif->regmap)) { 344 if (IS_ERR(spdif->regmap)) {
342 dev_err(&pdev->dev, 345 dev_err(&pdev->dev,
343 "Failed to initialise managed register map\n"); 346 "Failed to initialise managed register map\n");
344 return PTR_ERR(spdif->regmap); 347 ret = PTR_ERR(spdif->regmap);
348 goto err_disable_clocks;
345 } 349 }
346 350
347 spdif->playback_dma_data.addr = res->start + SPDIF_SMPDR; 351 spdif->playback_dma_data.addr = res->start + SPDIF_SMPDR;
@@ -373,6 +377,10 @@ static int rk_spdif_probe(struct platform_device *pdev)
373 377
374err_pm_runtime: 378err_pm_runtime:
375 pm_runtime_disable(&pdev->dev); 379 pm_runtime_disable(&pdev->dev);
380err_disable_clocks:
381 clk_disable_unprepare(spdif->mclk);
382err_disable_hclk:
383 clk_disable_unprepare(spdif->hclk);
376 384
377 return ret; 385 return ret;
378} 386}
diff --git a/sound/soc/sh/rcar/adg.c b/sound/soc/sh/rcar/adg.c
index 8ddb08714faa..4672688cac32 100644
--- a/sound/soc/sh/rcar/adg.c
+++ b/sound/soc/sh/rcar/adg.c
@@ -222,7 +222,7 @@ int rsnd_adg_set_cmd_timsel_gen2(struct rsnd_mod *cmd_mod,
222 NULL, &val, NULL); 222 NULL, &val, NULL);
223 223
224 val = val << shift; 224 val = val << shift;
225 mask = 0xffff << shift; 225 mask = 0x0f1f << shift;
226 226
227 rsnd_mod_bset(adg_mod, CMDOUT_TIMSEL, mask, val); 227 rsnd_mod_bset(adg_mod, CMDOUT_TIMSEL, mask, val);
228 228
@@ -250,7 +250,7 @@ int rsnd_adg_set_src_timesel_gen2(struct rsnd_mod *src_mod,
250 250
251 in = in << shift; 251 in = in << shift;
252 out = out << shift; 252 out = out << shift;
253 mask = 0xffff << shift; 253 mask = 0x0f1f << shift;
254 254
255 switch (id / 2) { 255 switch (id / 2) {
256 case 0: 256 case 0:
@@ -380,7 +380,7 @@ int rsnd_adg_ssi_clk_try_start(struct rsnd_mod *ssi_mod, unsigned int rate)
380 ckr = 0x80000000; 380 ckr = 0x80000000;
381 } 381 }
382 382
383 rsnd_mod_bset(adg_mod, BRGCKR, 0x80FF0000, adg->ckr | ckr); 383 rsnd_mod_bset(adg_mod, BRGCKR, 0x80770000, adg->ckr | ckr);
384 rsnd_mod_write(adg_mod, BRRA, adg->rbga); 384 rsnd_mod_write(adg_mod, BRRA, adg->rbga);
385 rsnd_mod_write(adg_mod, BRRB, adg->rbgb); 385 rsnd_mod_write(adg_mod, BRRB, adg->rbgb);
386 386
diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index c70eb2097816..f12a88a21dfa 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -1332,8 +1332,8 @@ static int rsnd_pcm_new(struct snd_soc_pcm_runtime *rtd)
1332 1332
1333 return snd_pcm_lib_preallocate_pages_for_all( 1333 return snd_pcm_lib_preallocate_pages_for_all(
1334 rtd->pcm, 1334 rtd->pcm,
1335 SNDRV_DMA_TYPE_CONTINUOUS, 1335 SNDRV_DMA_TYPE_DEV,
1336 snd_dma_continuous_data(GFP_KERNEL), 1336 rtd->card->snd_card->dev,
1337 PREALLOC_BUFFER, PREALLOC_BUFFER_MAX); 1337 PREALLOC_BUFFER, PREALLOC_BUFFER_MAX);
1338} 1338}
1339 1339
diff --git a/sound/soc/sh/rcar/dma.c b/sound/soc/sh/rcar/dma.c
index fd557abfe390..4d750bdf8e24 100644
--- a/sound/soc/sh/rcar/dma.c
+++ b/sound/soc/sh/rcar/dma.c
@@ -26,10 +26,7 @@
26struct rsnd_dmaen { 26struct rsnd_dmaen {
27 struct dma_chan *chan; 27 struct dma_chan *chan;
28 dma_cookie_t cookie; 28 dma_cookie_t cookie;
29 dma_addr_t dma_buf;
30 unsigned int dma_len; 29 unsigned int dma_len;
31 unsigned int dma_period;
32 unsigned int dma_cnt;
33}; 30};
34 31
35struct rsnd_dmapp { 32struct rsnd_dmapp {
@@ -71,38 +68,10 @@ static struct rsnd_mod mem = {
71/* 68/*
72 * Audio DMAC 69 * Audio DMAC
73 */ 70 */
74#define rsnd_dmaen_sync(dmaen, io, i) __rsnd_dmaen_sync(dmaen, io, i, 1)
75#define rsnd_dmaen_unsync(dmaen, io, i) __rsnd_dmaen_sync(dmaen, io, i, 0)
76static void __rsnd_dmaen_sync(struct rsnd_dmaen *dmaen, struct rsnd_dai_stream *io,
77 int i, int sync)
78{
79 struct device *dev = dmaen->chan->device->dev;
80 enum dma_data_direction dir;
81 int is_play = rsnd_io_is_play(io);
82 dma_addr_t buf;
83 int len, max;
84 size_t period;
85
86 len = dmaen->dma_len;
87 period = dmaen->dma_period;
88 max = len / period;
89 i = i % max;
90 buf = dmaen->dma_buf + (period * i);
91
92 dir = is_play ? DMA_TO_DEVICE : DMA_FROM_DEVICE;
93
94 if (sync)
95 dma_sync_single_for_device(dev, buf, period, dir);
96 else
97 dma_sync_single_for_cpu(dev, buf, period, dir);
98}
99
100static void __rsnd_dmaen_complete(struct rsnd_mod *mod, 71static void __rsnd_dmaen_complete(struct rsnd_mod *mod,
101 struct rsnd_dai_stream *io) 72 struct rsnd_dai_stream *io)
102{ 73{
103 struct rsnd_priv *priv = rsnd_mod_to_priv(mod); 74 struct rsnd_priv *priv = rsnd_mod_to_priv(mod);
104 struct rsnd_dma *dma = rsnd_mod_to_dma(mod);
105 struct rsnd_dmaen *dmaen = rsnd_dma_to_dmaen(dma);
106 bool elapsed = false; 75 bool elapsed = false;
107 unsigned long flags; 76 unsigned long flags;
108 77
@@ -115,22 +84,9 @@ static void __rsnd_dmaen_complete(struct rsnd_mod *mod,
115 */ 84 */
116 spin_lock_irqsave(&priv->lock, flags); 85 spin_lock_irqsave(&priv->lock, flags);
117 86
118 if (rsnd_io_is_working(io)) { 87 if (rsnd_io_is_working(io))
119 rsnd_dmaen_unsync(dmaen, io, dmaen->dma_cnt);
120
121 /*
122 * Next period is already started.
123 * Let's sync Next Next period
124 * see
125 * rsnd_dmaen_start()
126 */
127 rsnd_dmaen_sync(dmaen, io, dmaen->dma_cnt + 2);
128
129 elapsed = true; 88 elapsed = true;
130 89
131 dmaen->dma_cnt++;
132 }
133
134 spin_unlock_irqrestore(&priv->lock, flags); 90 spin_unlock_irqrestore(&priv->lock, flags);
135 91
136 if (elapsed) 92 if (elapsed)
@@ -165,14 +121,8 @@ static int rsnd_dmaen_stop(struct rsnd_mod *mod,
165 struct rsnd_dma *dma = rsnd_mod_to_dma(mod); 121 struct rsnd_dma *dma = rsnd_mod_to_dma(mod);
166 struct rsnd_dmaen *dmaen = rsnd_dma_to_dmaen(dma); 122 struct rsnd_dmaen *dmaen = rsnd_dma_to_dmaen(dma);
167 123
168 if (dmaen->chan) { 124 if (dmaen->chan)
169 int is_play = rsnd_io_is_play(io);
170
171 dmaengine_terminate_all(dmaen->chan); 125 dmaengine_terminate_all(dmaen->chan);
172 dma_unmap_single(dmaen->chan->device->dev,
173 dmaen->dma_buf, dmaen->dma_len,
174 is_play ? DMA_TO_DEVICE : DMA_FROM_DEVICE);
175 }
176 126
177 return 0; 127 return 0;
178} 128}
@@ -237,11 +187,7 @@ static int rsnd_dmaen_start(struct rsnd_mod *mod,
237 struct device *dev = rsnd_priv_to_dev(priv); 187 struct device *dev = rsnd_priv_to_dev(priv);
238 struct dma_async_tx_descriptor *desc; 188 struct dma_async_tx_descriptor *desc;
239 struct dma_slave_config cfg = {}; 189 struct dma_slave_config cfg = {};
240 dma_addr_t buf;
241 size_t len;
242 size_t period;
243 int is_play = rsnd_io_is_play(io); 190 int is_play = rsnd_io_is_play(io);
244 int i;
245 int ret; 191 int ret;
246 192
247 cfg.direction = is_play ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM; 193 cfg.direction = is_play ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM;
@@ -258,19 +204,10 @@ static int rsnd_dmaen_start(struct rsnd_mod *mod,
258 if (ret < 0) 204 if (ret < 0)
259 return ret; 205 return ret;
260 206
261 len = snd_pcm_lib_buffer_bytes(substream);
262 period = snd_pcm_lib_period_bytes(substream);
263 buf = dma_map_single(dmaen->chan->device->dev,
264 substream->runtime->dma_area,
265 len,
266 is_play ? DMA_TO_DEVICE : DMA_FROM_DEVICE);
267 if (dma_mapping_error(dmaen->chan->device->dev, buf)) {
268 dev_err(dev, "dma map failed\n");
269 return -EIO;
270 }
271
272 desc = dmaengine_prep_dma_cyclic(dmaen->chan, 207 desc = dmaengine_prep_dma_cyclic(dmaen->chan,
273 buf, len, period, 208 substream->runtime->dma_addr,
209 snd_pcm_lib_buffer_bytes(substream),
210 snd_pcm_lib_period_bytes(substream),
274 is_play ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM, 211 is_play ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM,
275 DMA_PREP_INTERRUPT | DMA_CTRL_ACK); 212 DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
276 213
@@ -282,18 +219,7 @@ static int rsnd_dmaen_start(struct rsnd_mod *mod,
282 desc->callback = rsnd_dmaen_complete; 219 desc->callback = rsnd_dmaen_complete;
283 desc->callback_param = rsnd_mod_get(dma); 220 desc->callback_param = rsnd_mod_get(dma);
284 221
285 dmaen->dma_buf = buf; 222 dmaen->dma_len = snd_pcm_lib_buffer_bytes(substream);
286 dmaen->dma_len = len;
287 dmaen->dma_period = period;
288 dmaen->dma_cnt = 0;
289
290 /*
291 * synchronize this and next period
292 * see
293 * __rsnd_dmaen_complete()
294 */
295 for (i = 0; i < 2; i++)
296 rsnd_dmaen_sync(dmaen, io, i);
297 223
298 dmaen->cookie = dmaengine_submit(desc); 224 dmaen->cookie = dmaengine_submit(desc);
299 if (dmaen->cookie < 0) { 225 if (dmaen->cookie < 0) {
diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c
index fece1e5f582f..cbf3bf312d23 100644
--- a/sound/soc/sh/rcar/ssi.c
+++ b/sound/soc/sh/rcar/ssi.c
@@ -446,25 +446,29 @@ static bool rsnd_ssi_pointer_update(struct rsnd_mod *mod,
446 int byte) 446 int byte)
447{ 447{
448 struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod); 448 struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod);
449 bool ret = false;
450 int byte_pos;
449 451
450 ssi->byte_pos += byte; 452 byte_pos = ssi->byte_pos + byte;
451 453
452 if (ssi->byte_pos >= ssi->next_period_byte) { 454 if (byte_pos >= ssi->next_period_byte) {
453 struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io); 455 struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io);
454 456
455 ssi->period_pos++; 457 ssi->period_pos++;
456 ssi->next_period_byte += ssi->byte_per_period; 458 ssi->next_period_byte += ssi->byte_per_period;
457 459
458 if (ssi->period_pos >= runtime->periods) { 460 if (ssi->period_pos >= runtime->periods) {
459 ssi->byte_pos = 0; 461 byte_pos = 0;
460 ssi->period_pos = 0; 462 ssi->period_pos = 0;
461 ssi->next_period_byte = ssi->byte_per_period; 463 ssi->next_period_byte = ssi->byte_per_period;
462 } 464 }
463 465
464 return true; 466 ret = true;
465 } 467 }
466 468
467 return false; 469 WRITE_ONCE(ssi->byte_pos, byte_pos);
470
471 return ret;
468} 472}
469 473
470/* 474/*
@@ -838,7 +842,7 @@ static int rsnd_ssi_pointer(struct rsnd_mod *mod,
838 struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod); 842 struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod);
839 struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io); 843 struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io);
840 844
841 *pointer = bytes_to_frames(runtime, ssi->byte_pos); 845 *pointer = bytes_to_frames(runtime, READ_ONCE(ssi->byte_pos));
842 846
843 return 0; 847 return 0;
844} 848}
diff --git a/sound/soc/sh/rcar/ssiu.c b/sound/soc/sh/rcar/ssiu.c
index 4d948757d300..6ff8a36c2c82 100644
--- a/sound/soc/sh/rcar/ssiu.c
+++ b/sound/soc/sh/rcar/ssiu.c
@@ -125,6 +125,7 @@ static int rsnd_ssiu_init_gen2(struct rsnd_mod *mod,
125{ 125{
126 int hdmi = rsnd_ssi_hdmi_port(io); 126 int hdmi = rsnd_ssi_hdmi_port(io);
127 int ret; 127 int ret;
128 u32 mode = 0;
128 129
129 ret = rsnd_ssiu_init(mod, io, priv); 130 ret = rsnd_ssiu_init(mod, io, priv);
130 if (ret < 0) 131 if (ret < 0)
@@ -136,9 +137,11 @@ static int rsnd_ssiu_init_gen2(struct rsnd_mod *mod,
136 * see 137 * see
137 * rsnd_ssi_config_init() 138 * rsnd_ssi_config_init()
138 */ 139 */
139 rsnd_mod_write(mod, SSI_MODE, 0x1); 140 mode = 0x1;
140 } 141 }
141 142
143 rsnd_mod_write(mod, SSI_MODE, mode);
144
142 if (rsnd_ssi_use_busif(io)) { 145 if (rsnd_ssi_use_busif(io)) {
143 rsnd_mod_write(mod, SSI_BUSIF_ADINR, 146 rsnd_mod_write(mod, SSI_BUSIF_ADINR,
144 rsnd_get_adinr_bit(mod, io) | 147 rsnd_get_adinr_bit(mod, io) |