aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-05-20 03:50:38 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-05-20 03:50:38 -0400
commit60b5f90d0fac7585f1a43ccdad06787b97eda0ab (patch)
tree3c20f605fa9d9fa10d20fe59d1cd79475e836052
parentc7d6891a770aa97dd36c2df3545031e64c6a0ef3 (diff)
parent665ebe926e7b714369b5329d48745bfef17db512 (diff)
Merge tag 'sound-3.15-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound
Pull sound fixes from Takashi Iwai: "Unfortunately this update became bigger than previous pull requests, which is almost a pattern in rc5-6. But, the only obvious big changes are for the new Intel DSP ASoC drivers, so the impact must be fairly limited. Other than that, usual small fixes in various fields: HD-audio, ASoC core and ASoC fsl and codec drivers" * tag 'sound-3.15-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (26 commits) ALSA: sb_mixer: missing return statement ASoC: wm8962: Update register CLASS_D_CONTROL_1 to be non-volatile ASoC: Intel: Fix Baytrail SST DSP firmware loading ALSA: hda - mask buggy stream DMA0 for Broadwell display controller ALSA: hda - Add new GPU codec ID to snd-hda ASoC: fsl_esai: Set PCRC and PRRC registers at the end of hw_params() ASoC: fsl_esai: Only bypass sck_div for EXTAL source ASoC: fsl_esai: Fix incorrect condition within ratio range check for FP ASoC: dapm: Fix SUSPEND -> OFF bias sequence ASoC: dapm: Skip CODEC<->CODEC links in connect_dai_link_widgets() ASoC: pcm: Fix incorrect condition check for case SNDRV_PCM_TRIGGER_SUSPEND ALSA: hda - add headset mic detect quirks for three Dell laptops ASoC: Update Cirrus Logic CODEC maintainers. ASoC: Intel: Fix block offset calculations. ASoC: Intel: Fix check for pdata usage before dereference. ASoC: Intel: Fix stream position pointer. ASoC: Intel: Fix allow hw_params to be called more than once. ASoC: Intel: Fix Audio DSP usage when IOMMU is enabled. ASoC: Intel: Fix Haswell/Broadwell DSP page table creation. ASoC: Intel: Fix allocated block list usage when adding blocks. ...
-rw-r--r--MAINTAINERS6
-rw-r--r--sound/isa/sb/sb_mixer.c14
-rw-r--r--sound/pci/hda/hda_intel.c6
-rw-r--r--sound/pci/hda/patch_hdmi.c2
-rw-r--r--sound/pci/hda/patch_realtek.c3
-rw-r--r--sound/soc/codecs/tlv320aic31xx.c2
-rw-r--r--sound/soc/codecs/wm8962.c15
-rw-r--r--sound/soc/codecs/wm8962.h4
-rw-r--r--sound/soc/fsl/fsl_esai.c22
-rw-r--r--sound/soc/fsl/imx-audmux.c2
-rw-r--r--sound/soc/intel/sst-acpi.c1
-rw-r--r--sound/soc/intel/sst-baytrail-dsp.c2
-rw-r--r--sound/soc/intel/sst-baytrail-ipc.c8
-rw-r--r--sound/soc/intel/sst-dsp-priv.h1
-rw-r--r--sound/soc/intel/sst-dsp.c1
-rw-r--r--sound/soc/intel/sst-dsp.h1
-rw-r--r--sound/soc/intel/sst-firmware.c25
-rw-r--r--sound/soc/intel/sst-haswell-dsp.c4
-rw-r--r--sound/soc/intel/sst-haswell-ipc.c31
-rw-r--r--sound/soc/intel/sst-haswell-ipc.h4
-rw-r--r--sound/soc/intel/sst-haswell-pcm.c107
-rw-r--r--sound/soc/sh/rcar/core.c5
-rw-r--r--sound/soc/soc-dapm.c14
-rw-r--r--sound/soc/soc-pcm.c2
24 files changed, 190 insertions, 92 deletions
diff --git a/MAINTAINERS b/MAINTAINERS
index 2e4fe5450fea..6846c7c622e3 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2246,12 +2246,6 @@ L: linux-usb@vger.kernel.org
2246S: Maintained 2246S: Maintained
2247F: drivers/usb/host/ohci-ep93xx.c 2247F: drivers/usb/host/ohci-ep93xx.c
2248 2248
2249CIRRUS LOGIC CS4270 SOUND DRIVER
2250M: Timur Tabi <timur@tabi.org>
2251L: alsa-devel@alsa-project.org (moderated for non-subscribers)
2252S: Odd Fixes
2253F: sound/soc/codecs/cs4270*
2254
2255CIRRUS LOGIC AUDIO CODEC DRIVERS 2249CIRRUS LOGIC AUDIO CODEC DRIVERS
2256M: Brian Austin <brian.austin@cirrus.com> 2250M: Brian Austin <brian.austin@cirrus.com>
2257M: Paul Handrigan <Paul.Handrigan@cirrus.com> 2251M: Paul Handrigan <Paul.Handrigan@cirrus.com>
diff --git a/sound/isa/sb/sb_mixer.c b/sound/isa/sb/sb_mixer.c
index 6496822c1808..1ff78ec9f0ac 100644
--- a/sound/isa/sb/sb_mixer.c
+++ b/sound/isa/sb/sb_mixer.c
@@ -818,12 +818,14 @@ int snd_sbmixer_new(struct snd_sb *chip)
818 return err; 818 return err;
819 break; 819 break;
820 case SB_HW_DT019X: 820 case SB_HW_DT019X:
821 if ((err = snd_sbmixer_init(chip, 821 err = snd_sbmixer_init(chip,
822 snd_dt019x_controls, 822 snd_dt019x_controls,
823 ARRAY_SIZE(snd_dt019x_controls), 823 ARRAY_SIZE(snd_dt019x_controls),
824 snd_dt019x_init_values, 824 snd_dt019x_init_values,
825 ARRAY_SIZE(snd_dt019x_init_values), 825 ARRAY_SIZE(snd_dt019x_init_values),
826 "DT019X")) < 0) 826 "DT019X");
827 if (err < 0)
828 return err;
827 break; 829 break;
828 default: 830 default:
829 strcpy(card->mixername, "???"); 831 strcpy(card->mixername, "???");
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index b540ad71eb0d..2c54629d62d1 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -1367,6 +1367,12 @@ static int azx_first_init(struct azx *chip)
1367 /* initialize streams */ 1367 /* initialize streams */
1368 azx_init_stream(chip); 1368 azx_init_stream(chip);
1369 1369
1370 /* workaround for Broadwell HDMI: the first stream is broken,
1371 * so mask it by keeping it as if opened
1372 */
1373 if (pci->vendor == 0x8086 && pci->device == 0x160c)
1374 chip->azx_dev[0].opened = 1;
1375
1370 /* initialize chip */ 1376 /* initialize chip */
1371 azx_init_pci(chip); 1377 azx_init_pci(chip);
1372 azx_init_chip(chip, (probe_only[dev] & 2) == 0); 1378 azx_init_chip(chip, (probe_only[dev] & 2) == 0);
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
index 1edbb9c47c2d..b4218a19df22 100644
--- a/sound/pci/hda/patch_hdmi.c
+++ b/sound/pci/hda/patch_hdmi.c
@@ -3332,6 +3332,7 @@ static const struct hda_codec_preset snd_hda_preset_hdmi[] = {
3332{ .id = 0x10de0051, .name = "GPU 51 HDMI/DP", .patch = patch_nvhdmi }, 3332{ .id = 0x10de0051, .name = "GPU 51 HDMI/DP", .patch = patch_nvhdmi },
3333{ .id = 0x10de0060, .name = "GPU 60 HDMI/DP", .patch = patch_nvhdmi }, 3333{ .id = 0x10de0060, .name = "GPU 60 HDMI/DP", .patch = patch_nvhdmi },
3334{ .id = 0x10de0067, .name = "MCP67 HDMI", .patch = patch_nvhdmi_2ch }, 3334{ .id = 0x10de0067, .name = "MCP67 HDMI", .patch = patch_nvhdmi_2ch },
3335{ .id = 0x10de0071, .name = "GPU 71 HDMI/DP", .patch = patch_nvhdmi },
3335{ .id = 0x10de8001, .name = "MCP73 HDMI", .patch = patch_nvhdmi_2ch }, 3336{ .id = 0x10de8001, .name = "MCP73 HDMI", .patch = patch_nvhdmi_2ch },
3336{ .id = 0x11069f80, .name = "VX900 HDMI/DP", .patch = patch_via_hdmi }, 3337{ .id = 0x11069f80, .name = "VX900 HDMI/DP", .patch = patch_via_hdmi },
3337{ .id = 0x11069f81, .name = "VX900 HDMI/DP", .patch = patch_via_hdmi }, 3338{ .id = 0x11069f81, .name = "VX900 HDMI/DP", .patch = patch_via_hdmi },
@@ -3387,6 +3388,7 @@ MODULE_ALIAS("snd-hda-codec-id:10de0044");
3387MODULE_ALIAS("snd-hda-codec-id:10de0051"); 3388MODULE_ALIAS("snd-hda-codec-id:10de0051");
3388MODULE_ALIAS("snd-hda-codec-id:10de0060"); 3389MODULE_ALIAS("snd-hda-codec-id:10de0060");
3389MODULE_ALIAS("snd-hda-codec-id:10de0067"); 3390MODULE_ALIAS("snd-hda-codec-id:10de0067");
3391MODULE_ALIAS("snd-hda-codec-id:10de0071");
3390MODULE_ALIAS("snd-hda-codec-id:10de8001"); 3392MODULE_ALIAS("snd-hda-codec-id:10de8001");
3391MODULE_ALIAS("snd-hda-codec-id:11069f80"); 3393MODULE_ALIAS("snd-hda-codec-id:11069f80");
3392MODULE_ALIAS("snd-hda-codec-id:11069f81"); 3394MODULE_ALIAS("snd-hda-codec-id:11069f81");
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 5f7c765391f1..49e884fb3e5d 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -4616,6 +4616,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
4616 SND_PCI_QUIRK(0x1028, 0x0653, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE), 4616 SND_PCI_QUIRK(0x1028, 0x0653, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
4617 SND_PCI_QUIRK(0x1028, 0x0657, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE), 4617 SND_PCI_QUIRK(0x1028, 0x0657, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
4618 SND_PCI_QUIRK(0x1028, 0x0658, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE), 4618 SND_PCI_QUIRK(0x1028, 0x0658, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
4619 SND_PCI_QUIRK(0x1028, 0x065c, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
4619 SND_PCI_QUIRK(0x1028, 0x065f, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE), 4620 SND_PCI_QUIRK(0x1028, 0x065f, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
4620 SND_PCI_QUIRK(0x1028, 0x0662, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE), 4621 SND_PCI_QUIRK(0x1028, 0x0662, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
4621 SND_PCI_QUIRK(0x1028, 0x0667, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE), 4622 SND_PCI_QUIRK(0x1028, 0x0667, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
@@ -4624,6 +4625,8 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
4624 SND_PCI_QUIRK(0x1028, 0x0674, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE), 4625 SND_PCI_QUIRK(0x1028, 0x0674, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
4625 SND_PCI_QUIRK(0x1028, 0x067e, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE), 4626 SND_PCI_QUIRK(0x1028, 0x067e, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
4626 SND_PCI_QUIRK(0x1028, 0x067f, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE), 4627 SND_PCI_QUIRK(0x1028, 0x067f, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
4628 SND_PCI_QUIRK(0x1028, 0x0680, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
4629 SND_PCI_QUIRK(0x1028, 0x0684, "Dell", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE),
4627 SND_PCI_QUIRK(0x1028, 0x15cc, "Dell X5 Precision", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE), 4630 SND_PCI_QUIRK(0x1028, 0x15cc, "Dell X5 Precision", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE),
4628 SND_PCI_QUIRK(0x1028, 0x15cd, "Dell X5 Precision", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE), 4631 SND_PCI_QUIRK(0x1028, 0x15cd, "Dell X5 Precision", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE),
4629 SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2), 4632 SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
diff --git a/sound/soc/codecs/tlv320aic31xx.c b/sound/soc/codecs/tlv320aic31xx.c
index fa158cfe9b32..d1929de641e2 100644
--- a/sound/soc/codecs/tlv320aic31xx.c
+++ b/sound/soc/codecs/tlv320aic31xx.c
@@ -376,7 +376,7 @@ static int aic31xx_dapm_power_event(struct snd_soc_dapm_widget *w,
376 reg = AIC31XX_ADCFLAG; 376 reg = AIC31XX_ADCFLAG;
377 break; 377 break;
378 default: 378 default:
379 dev_err(w->codec->dev, "Unknown widget '%s' calling %s/n", 379 dev_err(w->codec->dev, "Unknown widget '%s' calling %s\n",
380 w->name, __func__); 380 w->name, __func__);
381 return -EINVAL; 381 return -EINVAL;
382 } 382 }
diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c
index 5522d2566c67..ecd26dd2e442 100644
--- a/sound/soc/codecs/wm8962.c
+++ b/sound/soc/codecs/wm8962.c
@@ -154,6 +154,7 @@ static struct reg_default wm8962_reg[] = {
154 { 40, 0x0000 }, /* R40 - SPKOUTL volume */ 154 { 40, 0x0000 }, /* R40 - SPKOUTL volume */
155 { 41, 0x0000 }, /* R41 - SPKOUTR volume */ 155 { 41, 0x0000 }, /* R41 - SPKOUTR volume */
156 156
157 { 49, 0x0010 }, /* R49 - Class D Control 1 */
157 { 51, 0x0003 }, /* R51 - Class D Control 2 */ 158 { 51, 0x0003 }, /* R51 - Class D Control 2 */
158 159
159 { 56, 0x0506 }, /* R56 - Clocking 4 */ 160 { 56, 0x0506 }, /* R56 - Clocking 4 */
@@ -795,7 +796,6 @@ static bool wm8962_volatile_register(struct device *dev, unsigned int reg)
795 case WM8962_ALC2: 796 case WM8962_ALC2:
796 case WM8962_THERMAL_SHUTDOWN_STATUS: 797 case WM8962_THERMAL_SHUTDOWN_STATUS:
797 case WM8962_ADDITIONAL_CONTROL_4: 798 case WM8962_ADDITIONAL_CONTROL_4:
798 case WM8962_CLASS_D_CONTROL_1:
799 case WM8962_DC_SERVO_6: 799 case WM8962_DC_SERVO_6:
800 case WM8962_INTERRUPT_STATUS_1: 800 case WM8962_INTERRUPT_STATUS_1:
801 case WM8962_INTERRUPT_STATUS_2: 801 case WM8962_INTERRUPT_STATUS_2:
@@ -2929,13 +2929,22 @@ static int wm8962_set_fll(struct snd_soc_codec *codec, int fll_id, int source,
2929static int wm8962_mute(struct snd_soc_dai *dai, int mute) 2929static int wm8962_mute(struct snd_soc_dai *dai, int mute)
2930{ 2930{
2931 struct snd_soc_codec *codec = dai->codec; 2931 struct snd_soc_codec *codec = dai->codec;
2932 int val; 2932 int val, ret;
2933 2933
2934 if (mute) 2934 if (mute)
2935 val = WM8962_DAC_MUTE; 2935 val = WM8962_DAC_MUTE | WM8962_DAC_MUTE_ALT;
2936 else 2936 else
2937 val = 0; 2937 val = 0;
2938 2938
2939 /**
2940 * The DAC mute bit is mirrored in two registers, update both to keep
2941 * the register cache consistent.
2942 */
2943 ret = snd_soc_update_bits(codec, WM8962_CLASS_D_CONTROL_1,
2944 WM8962_DAC_MUTE_ALT, val);
2945 if (ret < 0)
2946 return ret;
2947
2939 return snd_soc_update_bits(codec, WM8962_ADC_DAC_CONTROL_1, 2948 return snd_soc_update_bits(codec, WM8962_ADC_DAC_CONTROL_1,
2940 WM8962_DAC_MUTE, val); 2949 WM8962_DAC_MUTE, val);
2941} 2950}
diff --git a/sound/soc/codecs/wm8962.h b/sound/soc/codecs/wm8962.h
index a1a5d5294c19..910aafd09d21 100644
--- a/sound/soc/codecs/wm8962.h
+++ b/sound/soc/codecs/wm8962.h
@@ -1954,6 +1954,10 @@
1954#define WM8962_SPKOUTL_ENA_MASK 0x0040 /* SPKOUTL_ENA */ 1954#define WM8962_SPKOUTL_ENA_MASK 0x0040 /* SPKOUTL_ENA */
1955#define WM8962_SPKOUTL_ENA_SHIFT 6 /* SPKOUTL_ENA */ 1955#define WM8962_SPKOUTL_ENA_SHIFT 6 /* SPKOUTL_ENA */
1956#define WM8962_SPKOUTL_ENA_WIDTH 1 /* SPKOUTL_ENA */ 1956#define WM8962_SPKOUTL_ENA_WIDTH 1 /* SPKOUTL_ENA */
1957#define WM8962_DAC_MUTE_ALT 0x0010 /* DAC_MUTE */
1958#define WM8962_DAC_MUTE_ALT_MASK 0x0010 /* DAC_MUTE */
1959#define WM8962_DAC_MUTE_ALT_SHIFT 4 /* DAC_MUTE */
1960#define WM8962_DAC_MUTE_ALT_WIDTH 1 /* DAC_MUTE */
1957#define WM8962_SPKOUTL_PGA_MUTE 0x0002 /* SPKOUTL_PGA_MUTE */ 1961#define WM8962_SPKOUTL_PGA_MUTE 0x0002 /* SPKOUTL_PGA_MUTE */
1958#define WM8962_SPKOUTL_PGA_MUTE_MASK 0x0002 /* SPKOUTL_PGA_MUTE */ 1962#define WM8962_SPKOUTL_PGA_MUTE_MASK 0x0002 /* SPKOUTL_PGA_MUTE */
1959#define WM8962_SPKOUTL_PGA_MUTE_SHIFT 1 /* SPKOUTL_PGA_MUTE */ 1963#define WM8962_SPKOUTL_PGA_MUTE_SHIFT 1 /* SPKOUTL_PGA_MUTE */
diff --git a/sound/soc/fsl/fsl_esai.c b/sound/soc/fsl/fsl_esai.c
index c8e5db1414d7..496ce2eb2f1f 100644
--- a/sound/soc/fsl/fsl_esai.c
+++ b/sound/soc/fsl/fsl_esai.c
@@ -258,10 +258,16 @@ static int fsl_esai_set_dai_sysclk(struct snd_soc_dai *dai, int clk_id,
258 return -EINVAL; 258 return -EINVAL;
259 } 259 }
260 260
261 if (ratio == 1) { 261 /* Only EXTAL source can be output directly without using PSR and PM */
262 if (ratio == 1 && clksrc == esai_priv->extalclk) {
262 /* Bypass all the dividers if not being needed */ 263 /* Bypass all the dividers if not being needed */
263 ecr |= tx ? ESAI_ECR_ETO : ESAI_ECR_ERO; 264 ecr |= tx ? ESAI_ECR_ETO : ESAI_ECR_ERO;
264 goto out; 265 goto out;
266 } else if (ratio < 2) {
267 /* The ratio should be no less than 2 if using other sources */
268 dev_err(dai->dev, "failed to derive required HCK%c rate\n",
269 tx ? 'T' : 'R');
270 return -EINVAL;
265 } 271 }
266 272
267 ret = fsl_esai_divisor_cal(dai, tx, ratio, false, 0); 273 ret = fsl_esai_divisor_cal(dai, tx, ratio, false, 0);
@@ -307,7 +313,8 @@ static int fsl_esai_set_bclk(struct snd_soc_dai *dai, bool tx, u32 freq)
307 return -EINVAL; 313 return -EINVAL;
308 } 314 }
309 315
310 if (esai_priv->sck_div[tx] && (ratio > 16 || ratio == 0)) { 316 /* The ratio should be contented by FP alone if bypassing PM and PSR */
317 if (!esai_priv->sck_div[tx] && (ratio > 16 || ratio == 0)) {
311 dev_err(dai->dev, "the ratio is out of range (1 ~ 16)\n"); 318 dev_err(dai->dev, "the ratio is out of range (1 ~ 16)\n");
312 return -EINVAL; 319 return -EINVAL;
313 } 320 }
@@ -454,12 +461,6 @@ static int fsl_esai_startup(struct snd_pcm_substream *substream,
454 } 461 }
455 462
456 if (!dai->active) { 463 if (!dai->active) {
457 /* Reset Port C */
458 regmap_update_bits(esai_priv->regmap, REG_ESAI_PRRC,
459 ESAI_PRRC_PDC_MASK, ESAI_PRRC_PDC(ESAI_GPIO));
460 regmap_update_bits(esai_priv->regmap, REG_ESAI_PCRC,
461 ESAI_PCRC_PC_MASK, ESAI_PCRC_PC(ESAI_GPIO));
462
463 /* Set synchronous mode */ 464 /* Set synchronous mode */
464 regmap_update_bits(esai_priv->regmap, REG_ESAI_SAICR, 465 regmap_update_bits(esai_priv->regmap, REG_ESAI_SAICR,
465 ESAI_SAICR_SYNC, esai_priv->synchronous ? 466 ESAI_SAICR_SYNC, esai_priv->synchronous ?
@@ -519,6 +520,11 @@ static int fsl_esai_hw_params(struct snd_pcm_substream *substream,
519 520
520 regmap_update_bits(esai_priv->regmap, REG_ESAI_xCR(tx), mask, val); 521 regmap_update_bits(esai_priv->regmap, REG_ESAI_xCR(tx), mask, val);
521 522
523 /* Remove ESAI personal reset by configuring ESAI_PCRC and ESAI_PRRC */
524 regmap_update_bits(esai_priv->regmap, REG_ESAI_PRRC,
525 ESAI_PRRC_PDC_MASK, ESAI_PRRC_PDC(ESAI_GPIO));
526 regmap_update_bits(esai_priv->regmap, REG_ESAI_PCRC,
527 ESAI_PCRC_PC_MASK, ESAI_PCRC_PC(ESAI_GPIO));
522 return 0; 528 return 0;
523} 529}
524 530
diff --git a/sound/soc/fsl/imx-audmux.c b/sound/soc/fsl/imx-audmux.c
index ac869931d7f1..267717aa96c1 100644
--- a/sound/soc/fsl/imx-audmux.c
+++ b/sound/soc/fsl/imx-audmux.c
@@ -145,7 +145,7 @@ static const struct file_operations audmux_debugfs_fops = {
145 .llseek = default_llseek, 145 .llseek = default_llseek,
146}; 146};
147 147
148static void __init audmux_debugfs_init(void) 148static void audmux_debugfs_init(void)
149{ 149{
150 int i; 150 int i;
151 char buf[20]; 151 char buf[20];
diff --git a/sound/soc/intel/sst-acpi.c b/sound/soc/intel/sst-acpi.c
index 5d06eecb6198..18aee77f8d4a 100644
--- a/sound/soc/intel/sst-acpi.c
+++ b/sound/soc/intel/sst-acpi.c
@@ -138,6 +138,7 @@ static int sst_acpi_probe(struct platform_device *pdev)
138 138
139 sst_pdata = &sst_acpi->sst_pdata; 139 sst_pdata = &sst_acpi->sst_pdata;
140 sst_pdata->id = desc->sst_id; 140 sst_pdata->id = desc->sst_id;
141 sst_pdata->dma_dev = dev;
141 sst_acpi->desc = desc; 142 sst_acpi->desc = desc;
142 sst_acpi->mach = mach; 143 sst_acpi->mach = mach;
143 144
diff --git a/sound/soc/intel/sst-baytrail-dsp.c b/sound/soc/intel/sst-baytrail-dsp.c
index a50bf7fc0e3a..adf0aca5aca6 100644
--- a/sound/soc/intel/sst-baytrail-dsp.c
+++ b/sound/soc/intel/sst-baytrail-dsp.c
@@ -324,7 +324,7 @@ static int sst_byt_init(struct sst_dsp *sst, struct sst_pdata *pdata)
324 memcpy_toio(sst->addr.lpe + SST_BYT_MAILBOX_OFFSET, 324 memcpy_toio(sst->addr.lpe + SST_BYT_MAILBOX_OFFSET,
325 &pdata->fw_base, sizeof(u32)); 325 &pdata->fw_base, sizeof(u32));
326 326
327 ret = dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(32)); 327 ret = dma_coerce_mask_and_coherent(sst->dma_dev, DMA_BIT_MASK(32));
328 if (ret) 328 if (ret)
329 return ret; 329 return ret;
330 330
diff --git a/sound/soc/intel/sst-baytrail-ipc.c b/sound/soc/intel/sst-baytrail-ipc.c
index d0eaeee21be4..0d31dbbf4806 100644
--- a/sound/soc/intel/sst-baytrail-ipc.c
+++ b/sound/soc/intel/sst-baytrail-ipc.c
@@ -542,16 +542,20 @@ struct sst_byt_stream *sst_byt_stream_new(struct sst_byt *byt, int id,
542 void *data) 542 void *data)
543{ 543{
544 struct sst_byt_stream *stream; 544 struct sst_byt_stream *stream;
545 struct sst_dsp *sst = byt->dsp;
546 unsigned long flags;
545 547
546 stream = kzalloc(sizeof(*stream), GFP_KERNEL); 548 stream = kzalloc(sizeof(*stream), GFP_KERNEL);
547 if (stream == NULL) 549 if (stream == NULL)
548 return NULL; 550 return NULL;
549 551
552 spin_lock_irqsave(&sst->spinlock, flags);
550 list_add(&stream->node, &byt->stream_list); 553 list_add(&stream->node, &byt->stream_list);
551 stream->notify_position = notify_position; 554 stream->notify_position = notify_position;
552 stream->pdata = data; 555 stream->pdata = data;
553 stream->byt = byt; 556 stream->byt = byt;
554 stream->str_id = id; 557 stream->str_id = id;
558 spin_unlock_irqrestore(&sst->spinlock, flags);
555 559
556 return stream; 560 return stream;
557} 561}
@@ -630,6 +634,8 @@ int sst_byt_stream_free(struct sst_byt *byt, struct sst_byt_stream *stream)
630{ 634{
631 u64 header; 635 u64 header;
632 int ret = 0; 636 int ret = 0;
637 struct sst_dsp *sst = byt->dsp;
638 unsigned long flags;
633 639
634 if (!stream->commited) 640 if (!stream->commited)
635 goto out; 641 goto out;
@@ -644,8 +650,10 @@ int sst_byt_stream_free(struct sst_byt *byt, struct sst_byt_stream *stream)
644 650
645 stream->commited = false; 651 stream->commited = false;
646out: 652out:
653 spin_lock_irqsave(&sst->spinlock, flags);
647 list_del(&stream->node); 654 list_del(&stream->node);
648 kfree(stream); 655 kfree(stream);
656 spin_unlock_irqrestore(&sst->spinlock, flags);
649 657
650 return ret; 658 return ret;
651} 659}
diff --git a/sound/soc/intel/sst-dsp-priv.h b/sound/soc/intel/sst-dsp-priv.h
index 30ca14a6a835..401213455497 100644
--- a/sound/soc/intel/sst-dsp-priv.h
+++ b/sound/soc/intel/sst-dsp-priv.h
@@ -228,6 +228,7 @@ struct sst_dsp {
228 spinlock_t spinlock; /* IPC locking */ 228 spinlock_t spinlock; /* IPC locking */
229 struct mutex mutex; /* DSP FW lock */ 229 struct mutex mutex; /* DSP FW lock */
230 struct device *dev; 230 struct device *dev;
231 struct device *dma_dev;
231 void *thread_context; 232 void *thread_context;
232 int irq; 233 int irq;
233 u32 id; 234 u32 id;
diff --git a/sound/soc/intel/sst-dsp.c b/sound/soc/intel/sst-dsp.c
index 0c129fd85ecf..0b715b20a2d7 100644
--- a/sound/soc/intel/sst-dsp.c
+++ b/sound/soc/intel/sst-dsp.c
@@ -337,6 +337,7 @@ struct sst_dsp *sst_dsp_new(struct device *dev,
337 spin_lock_init(&sst->spinlock); 337 spin_lock_init(&sst->spinlock);
338 mutex_init(&sst->mutex); 338 mutex_init(&sst->mutex);
339 sst->dev = dev; 339 sst->dev = dev;
340 sst->dma_dev = pdata->dma_dev;
340 sst->thread_context = sst_dev->thread_context; 341 sst->thread_context = sst_dev->thread_context;
341 sst->sst_dev = sst_dev; 342 sst->sst_dev = sst_dev;
342 sst->id = pdata->id; 343 sst->id = pdata->id;
diff --git a/sound/soc/intel/sst-dsp.h b/sound/soc/intel/sst-dsp.h
index 74052b59485c..e44423be66c4 100644
--- a/sound/soc/intel/sst-dsp.h
+++ b/sound/soc/intel/sst-dsp.h
@@ -169,6 +169,7 @@ struct sst_pdata {
169 u32 dma_base; 169 u32 dma_base;
170 u32 dma_size; 170 u32 dma_size;
171 int dma_engine; 171 int dma_engine;
172 struct device *dma_dev;
172 173
173 /* DSP */ 174 /* DSP */
174 u32 id; 175 u32 id;
diff --git a/sound/soc/intel/sst-firmware.c b/sound/soc/intel/sst-firmware.c
index f7687107cf7f..928f228c38e7 100644
--- a/sound/soc/intel/sst-firmware.c
+++ b/sound/soc/intel/sst-firmware.c
@@ -57,14 +57,8 @@ struct sst_fw *sst_fw_new(struct sst_dsp *dsp,
57 sst_fw->private = private; 57 sst_fw->private = private;
58 sst_fw->size = fw->size; 58 sst_fw->size = fw->size;
59 59
60 err = dma_coerce_mask_and_coherent(dsp->dev, DMA_BIT_MASK(32));
61 if (err < 0) {
62 kfree(sst_fw);
63 return NULL;
64 }
65
66 /* allocate DMA buffer to store FW data */ 60 /* allocate DMA buffer to store FW data */
67 sst_fw->dma_buf = dma_alloc_coherent(dsp->dev, sst_fw->size, 61 sst_fw->dma_buf = dma_alloc_coherent(dsp->dma_dev, sst_fw->size,
68 &sst_fw->dmable_fw_paddr, GFP_DMA | GFP_KERNEL); 62 &sst_fw->dmable_fw_paddr, GFP_DMA | GFP_KERNEL);
69 if (!sst_fw->dma_buf) { 63 if (!sst_fw->dma_buf) {
70 dev_err(dsp->dev, "error: DMA alloc failed\n"); 64 dev_err(dsp->dev, "error: DMA alloc failed\n");
@@ -106,7 +100,7 @@ void sst_fw_free(struct sst_fw *sst_fw)
106 list_del(&sst_fw->list); 100 list_del(&sst_fw->list);
107 mutex_unlock(&dsp->mutex); 101 mutex_unlock(&dsp->mutex);
108 102
109 dma_free_coherent(dsp->dev, sst_fw->size, sst_fw->dma_buf, 103 dma_free_coherent(dsp->dma_dev, sst_fw->size, sst_fw->dma_buf,
110 sst_fw->dmable_fw_paddr); 104 sst_fw->dmable_fw_paddr);
111 kfree(sst_fw); 105 kfree(sst_fw);
112} 106}
@@ -202,6 +196,9 @@ static int block_alloc_contiguous(struct sst_module *module,
202 size -= block->size; 196 size -= block->size;
203 } 197 }
204 198
199 list_for_each_entry(block, &tmp, list)
200 list_add(&block->module_list, &module->block_list);
201
205 list_splice(&tmp, &dsp->used_block_list); 202 list_splice(&tmp, &dsp->used_block_list);
206 return 0; 203 return 0;
207} 204}
@@ -247,8 +244,7 @@ static int block_alloc(struct sst_module *module,
247 /* do we span > 1 blocks */ 244 /* do we span > 1 blocks */
248 if (data->size > block->size) { 245 if (data->size > block->size) {
249 ret = block_alloc_contiguous(module, data, 246 ret = block_alloc_contiguous(module, data,
250 block->offset + block->size, 247 block->offset, data->size);
251 data->size - block->size);
252 if (ret == 0) 248 if (ret == 0)
253 return ret; 249 return ret;
254 } 250 }
@@ -344,7 +340,7 @@ static int block_alloc_fixed(struct sst_module *module,
344 340
345 err = block_alloc_contiguous(module, data, 341 err = block_alloc_contiguous(module, data,
346 block->offset + block->size, 342 block->offset + block->size,
347 data->size - block->size + data->offset - block->offset); 343 data->size - block->size);
348 if (err < 0) 344 if (err < 0)
349 return -ENOMEM; 345 return -ENOMEM;
350 346
@@ -371,15 +367,10 @@ static int block_alloc_fixed(struct sst_module *module,
371 if (data->offset >= block->offset && data->offset < block_end) { 367 if (data->offset >= block->offset && data->offset < block_end) {
372 368
373 err = block_alloc_contiguous(module, data, 369 err = block_alloc_contiguous(module, data,
374 block->offset + block->size, 370 block->offset, data->size);
375 data->size - block->size);
376 if (err < 0) 371 if (err < 0)
377 return -ENOMEM; 372 return -ENOMEM;
378 373
379 /* add block */
380 block->data_type = data->data_type;
381 list_move(&block->list, &dsp->used_block_list);
382 list_add(&block->module_list, &module->block_list);
383 return 0; 374 return 0;
384 } 375 }
385 376
diff --git a/sound/soc/intel/sst-haswell-dsp.c b/sound/soc/intel/sst-haswell-dsp.c
index f5ebf36af889..535f517629fd 100644
--- a/sound/soc/intel/sst-haswell-dsp.c
+++ b/sound/soc/intel/sst-haswell-dsp.c
@@ -433,7 +433,7 @@ static int hsw_init(struct sst_dsp *sst, struct sst_pdata *pdata)
433 int ret = -ENODEV, i, j, region_count; 433 int ret = -ENODEV, i, j, region_count;
434 u32 offset, size; 434 u32 offset, size;
435 435
436 dev = sst->dev; 436 dev = sst->dma_dev;
437 437
438 switch (sst->id) { 438 switch (sst->id) {
439 case SST_DEV_ID_LYNX_POINT: 439 case SST_DEV_ID_LYNX_POINT:
@@ -466,7 +466,7 @@ static int hsw_init(struct sst_dsp *sst, struct sst_pdata *pdata)
466 return ret; 466 return ret;
467 } 467 }
468 468
469 ret = dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(32)); 469 ret = dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(31));
470 if (ret) 470 if (ret)
471 return ret; 471 return ret;
472 472
diff --git a/sound/soc/intel/sst-haswell-ipc.c b/sound/soc/intel/sst-haswell-ipc.c
index 50e4246d4b57..e7996b39a484 100644
--- a/sound/soc/intel/sst-haswell-ipc.c
+++ b/sound/soc/intel/sst-haswell-ipc.c
@@ -1159,11 +1159,14 @@ struct sst_hsw_stream *sst_hsw_stream_new(struct sst_hsw *hsw, int id,
1159 void *data) 1159 void *data)
1160{ 1160{
1161 struct sst_hsw_stream *stream; 1161 struct sst_hsw_stream *stream;
1162 struct sst_dsp *sst = hsw->dsp;
1163 unsigned long flags;
1162 1164
1163 stream = kzalloc(sizeof(*stream), GFP_KERNEL); 1165 stream = kzalloc(sizeof(*stream), GFP_KERNEL);
1164 if (stream == NULL) 1166 if (stream == NULL)
1165 return NULL; 1167 return NULL;
1166 1168
1169 spin_lock_irqsave(&sst->spinlock, flags);
1167 list_add(&stream->node, &hsw->stream_list); 1170 list_add(&stream->node, &hsw->stream_list);
1168 stream->notify_position = notify_position; 1171 stream->notify_position = notify_position;
1169 stream->pdata = data; 1172 stream->pdata = data;
@@ -1172,6 +1175,7 @@ struct sst_hsw_stream *sst_hsw_stream_new(struct sst_hsw *hsw, int id,
1172 1175
1173 /* work to process notification messages */ 1176 /* work to process notification messages */
1174 INIT_WORK(&stream->notify_work, hsw_notification_work); 1177 INIT_WORK(&stream->notify_work, hsw_notification_work);
1178 spin_unlock_irqrestore(&sst->spinlock, flags);
1175 1179
1176 return stream; 1180 return stream;
1177} 1181}
@@ -1180,6 +1184,8 @@ int sst_hsw_stream_free(struct sst_hsw *hsw, struct sst_hsw_stream *stream)
1180{ 1184{
1181 u32 header; 1185 u32 header;
1182 int ret = 0; 1186 int ret = 0;
1187 struct sst_dsp *sst = hsw->dsp;
1188 unsigned long flags;
1183 1189
1184 /* dont free DSP streams that are not commited */ 1190 /* dont free DSP streams that are not commited */
1185 if (!stream->commited) 1191 if (!stream->commited)
@@ -1201,8 +1207,11 @@ int sst_hsw_stream_free(struct sst_hsw *hsw, struct sst_hsw_stream *stream)
1201 trace_hsw_stream_free_req(stream, &stream->free_req); 1207 trace_hsw_stream_free_req(stream, &stream->free_req);
1202 1208
1203out: 1209out:
1210 cancel_work_sync(&stream->notify_work);
1211 spin_lock_irqsave(&sst->spinlock, flags);
1204 list_del(&stream->node); 1212 list_del(&stream->node);
1205 kfree(stream); 1213 kfree(stream);
1214 spin_unlock_irqrestore(&sst->spinlock, flags);
1206 1215
1207 return ret; 1216 return ret;
1208} 1217}
@@ -1538,10 +1547,28 @@ int sst_hsw_stream_reset(struct sst_hsw *hsw, struct sst_hsw_stream *stream)
1538} 1547}
1539 1548
1540/* Stream pointer positions */ 1549/* Stream pointer positions */
1541int sst_hsw_get_dsp_position(struct sst_hsw *hsw, 1550u32 sst_hsw_get_dsp_position(struct sst_hsw *hsw,
1542 struct sst_hsw_stream *stream) 1551 struct sst_hsw_stream *stream)
1543{ 1552{
1544 return stream->rpos.position; 1553 u32 rpos;
1554
1555 sst_dsp_read(hsw->dsp, &rpos,
1556 stream->reply.read_position_register_address, sizeof(rpos));
1557
1558 return rpos;
1559}
1560
1561/* Stream presentation (monotonic) positions */
1562u64 sst_hsw_get_dsp_presentation_position(struct sst_hsw *hsw,
1563 struct sst_hsw_stream *stream)
1564{
1565 u64 ppos;
1566
1567 sst_dsp_read(hsw->dsp, &ppos,
1568 stream->reply.presentation_position_register_address,
1569 sizeof(ppos));
1570
1571 return ppos;
1545} 1572}
1546 1573
1547int sst_hsw_stream_set_write_position(struct sst_hsw *hsw, 1574int sst_hsw_stream_set_write_position(struct sst_hsw *hsw,
diff --git a/sound/soc/intel/sst-haswell-ipc.h b/sound/soc/intel/sst-haswell-ipc.h
index d517929ccc38..2ac194a6d04b 100644
--- a/sound/soc/intel/sst-haswell-ipc.h
+++ b/sound/soc/intel/sst-haswell-ipc.h
@@ -464,7 +464,9 @@ int sst_hsw_stream_get_write_pos(struct sst_hsw *hsw,
464 struct sst_hsw_stream *stream, u32 *position); 464 struct sst_hsw_stream *stream, u32 *position);
465int sst_hsw_stream_set_write_position(struct sst_hsw *hsw, 465int sst_hsw_stream_set_write_position(struct sst_hsw *hsw,
466 struct sst_hsw_stream *stream, u32 stage_id, u32 position); 466 struct sst_hsw_stream *stream, u32 stage_id, u32 position);
467int sst_hsw_get_dsp_position(struct sst_hsw *hsw, 467u32 sst_hsw_get_dsp_position(struct sst_hsw *hsw,
468 struct sst_hsw_stream *stream);
469u64 sst_hsw_get_dsp_presentation_position(struct sst_hsw *hsw,
468 struct sst_hsw_stream *stream); 470 struct sst_hsw_stream *stream);
469 471
470/* HW port config */ 472/* HW port config */
diff --git a/sound/soc/intel/sst-haswell-pcm.c b/sound/soc/intel/sst-haswell-pcm.c
index 0a32dd13a23d..9d5f64a583a3 100644
--- a/sound/soc/intel/sst-haswell-pcm.c
+++ b/sound/soc/intel/sst-haswell-pcm.c
@@ -99,6 +99,7 @@ struct hsw_pcm_data {
99 struct snd_compr_stream *cstream; 99 struct snd_compr_stream *cstream;
100 unsigned int wpos; 100 unsigned int wpos;
101 struct mutex mutex; 101 struct mutex mutex;
102 bool allocated;
102}; 103};
103 104
104/* private data for the driver */ 105/* private data for the driver */
@@ -107,12 +108,14 @@ struct hsw_priv_data {
107 struct sst_hsw *hsw; 108 struct sst_hsw *hsw;
108 109
109 /* page tables */ 110 /* page tables */
110 unsigned char *pcm_pg[HSW_PCM_COUNT][2]; 111 struct snd_dma_buffer dmab[HSW_PCM_COUNT][2];
111 112
112 /* DAI data */ 113 /* DAI data */
113 struct hsw_pcm_data pcm[HSW_PCM_COUNT]; 114 struct hsw_pcm_data pcm[HSW_PCM_COUNT];
114}; 115};
115 116
117static u32 hsw_notify_pointer(struct sst_hsw_stream *stream, void *data);
118
116static inline u32 hsw_mixer_to_ipc(unsigned int value) 119static inline u32 hsw_mixer_to_ipc(unsigned int value)
117{ 120{
118 if (value >= ARRAY_SIZE(volume_map)) 121 if (value >= ARRAY_SIZE(volume_map))
@@ -273,28 +276,26 @@ static const struct snd_kcontrol_new hsw_volume_controls[] = {
273}; 276};
274 277
275/* Create DMA buffer page table for DSP */ 278/* Create DMA buffer page table for DSP */
276static int create_adsp_page_table(struct hsw_priv_data *pdata, 279static int create_adsp_page_table(struct snd_pcm_substream *substream,
277 struct snd_soc_pcm_runtime *rtd, 280 struct hsw_priv_data *pdata, struct snd_soc_pcm_runtime *rtd,
278 unsigned char *dma_area, size_t size, int pcm, int stream) 281 unsigned char *dma_area, size_t size, int pcm)
279{ 282{
280 int i, pages; 283 struct snd_dma_buffer *dmab = snd_pcm_get_dma_buf(substream);
284 int i, pages, stream = substream->stream;
281 285
282 if (size % PAGE_SIZE) 286 pages = snd_sgbuf_aligned_pages(size);
283 pages = (size / PAGE_SIZE) + 1;
284 else
285 pages = size / PAGE_SIZE;
286 287
287 dev_dbg(rtd->dev, "generating page table for %p size 0x%zu pages %d\n", 288 dev_dbg(rtd->dev, "generating page table for %p size 0x%zu pages %d\n",
288 dma_area, size, pages); 289 dma_area, size, pages);
289 290
290 for (i = 0; i < pages; i++) { 291 for (i = 0; i < pages; i++) {
291 u32 idx = (((i << 2) + i)) >> 1; 292 u32 idx = (((i << 2) + i)) >> 1;
292 u32 pfn = (virt_to_phys(dma_area + i * PAGE_SIZE)) >> PAGE_SHIFT; 293 u32 pfn = snd_sgbuf_get_addr(dmab, i * PAGE_SIZE) >> PAGE_SHIFT;
293 u32 *pg_table; 294 u32 *pg_table;
294 295
295 dev_dbg(rtd->dev, "pfn i %i idx %d pfn %x\n", i, idx, pfn); 296 dev_dbg(rtd->dev, "pfn i %i idx %d pfn %x\n", i, idx, pfn);
296 297
297 pg_table = (u32*)(pdata->pcm_pg[pcm][stream] + idx); 298 pg_table = (u32 *)(pdata->dmab[pcm][stream].area + idx);
298 299
299 if (i & 1) 300 if (i & 1)
300 *pg_table |= (pfn << 4); 301 *pg_table |= (pfn << 4);
@@ -317,12 +318,36 @@ static int hsw_pcm_hw_params(struct snd_pcm_substream *substream,
317 struct sst_hsw *hsw = pdata->hsw; 318 struct sst_hsw *hsw = pdata->hsw;
318 struct sst_module *module_data; 319 struct sst_module *module_data;
319 struct sst_dsp *dsp; 320 struct sst_dsp *dsp;
321 struct snd_dma_buffer *dmab;
320 enum sst_hsw_stream_type stream_type; 322 enum sst_hsw_stream_type stream_type;
321 enum sst_hsw_stream_path_id path_id; 323 enum sst_hsw_stream_path_id path_id;
322 u32 rate, bits, map, pages, module_id; 324 u32 rate, bits, map, pages, module_id;
323 u8 channels; 325 u8 channels;
324 int ret; 326 int ret;
325 327
328 /* check if we are being called a subsequent time */
329 if (pcm_data->allocated) {
330 ret = sst_hsw_stream_reset(hsw, pcm_data->stream);
331 if (ret < 0)
332 dev_dbg(rtd->dev, "error: reset stream failed %d\n",
333 ret);
334
335 ret = sst_hsw_stream_free(hsw, pcm_data->stream);
336 if (ret < 0) {
337 dev_dbg(rtd->dev, "error: free stream failed %d\n",
338 ret);
339 return ret;
340 }
341 pcm_data->allocated = false;
342
343 pcm_data->stream = sst_hsw_stream_new(hsw, rtd->cpu_dai->id,
344 hsw_notify_pointer, pcm_data);
345 if (pcm_data->stream == NULL) {
346 dev_err(rtd->dev, "error: failed to create stream\n");
347 return -EINVAL;
348 }
349 }
350
326 /* stream direction */ 351 /* stream direction */
327 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) 352 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
328 path_id = SST_HSW_STREAM_PATH_SSP0_OUT; 353 path_id = SST_HSW_STREAM_PATH_SSP0_OUT;
@@ -416,8 +441,10 @@ static int hsw_pcm_hw_params(struct snd_pcm_substream *substream,
416 return ret; 441 return ret;
417 } 442 }
418 443
419 ret = create_adsp_page_table(pdata, rtd, runtime->dma_area, 444 dmab = snd_pcm_get_dma_buf(substream);
420 runtime->dma_bytes, rtd->cpu_dai->id, substream->stream); 445
446 ret = create_adsp_page_table(substream, pdata, rtd, runtime->dma_area,
447 runtime->dma_bytes, rtd->cpu_dai->id);
421 if (ret < 0) 448 if (ret < 0)
422 return ret; 449 return ret;
423 450
@@ -430,9 +457,9 @@ static int hsw_pcm_hw_params(struct snd_pcm_substream *substream,
430 pages = runtime->dma_bytes / PAGE_SIZE; 457 pages = runtime->dma_bytes / PAGE_SIZE;
431 458
432 ret = sst_hsw_stream_buffer(hsw, pcm_data->stream, 459 ret = sst_hsw_stream_buffer(hsw, pcm_data->stream,
433 virt_to_phys(pdata->pcm_pg[rtd->cpu_dai->id][substream->stream]), 460 pdata->dmab[rtd->cpu_dai->id][substream->stream].addr,
434 pages, runtime->dma_bytes, 0, 461 pages, runtime->dma_bytes, 0,
435 (u32)(virt_to_phys(runtime->dma_area) >> PAGE_SHIFT)); 462 snd_sgbuf_get_addr(dmab, 0) >> PAGE_SHIFT);
436 if (ret < 0) { 463 if (ret < 0) {
437 dev_err(rtd->dev, "error: failed to set DMA buffer %d\n", ret); 464 dev_err(rtd->dev, "error: failed to set DMA buffer %d\n", ret);
438 return ret; 465 return ret;
@@ -474,6 +501,7 @@ static int hsw_pcm_hw_params(struct snd_pcm_substream *substream,
474 dev_err(rtd->dev, "error: failed to commit stream %d\n", ret); 501 dev_err(rtd->dev, "error: failed to commit stream %d\n", ret);
475 return ret; 502 return ret;
476 } 503 }
504 pcm_data->allocated = true;
477 505
478 ret = sst_hsw_stream_pause(hsw, pcm_data->stream, 1); 506 ret = sst_hsw_stream_pause(hsw, pcm_data->stream, 1);
479 if (ret < 0) 507 if (ret < 0)
@@ -541,12 +569,14 @@ static snd_pcm_uframes_t hsw_pcm_pointer(struct snd_pcm_substream *substream)
541 struct hsw_pcm_data *pcm_data = snd_soc_pcm_get_drvdata(rtd); 569 struct hsw_pcm_data *pcm_data = snd_soc_pcm_get_drvdata(rtd);
542 struct sst_hsw *hsw = pdata->hsw; 570 struct sst_hsw *hsw = pdata->hsw;
543 snd_pcm_uframes_t offset; 571 snd_pcm_uframes_t offset;
572 uint64_t ppos;
573 u32 position = sst_hsw_get_dsp_position(hsw, pcm_data->stream);
544 574
545 offset = bytes_to_frames(runtime, 575 offset = bytes_to_frames(runtime, position);
546 sst_hsw_get_dsp_position(hsw, pcm_data->stream)); 576 ppos = sst_hsw_get_dsp_presentation_position(hsw, pcm_data->stream);
547 577
548 dev_dbg(rtd->dev, "PCM: DMA pointer %zu bytes\n", 578 dev_dbg(rtd->dev, "PCM: DMA pointer %du bytes, pos %llu\n",
549 frames_to_bytes(runtime, (u32)offset)); 579 position, ppos);
550 return offset; 580 return offset;
551} 581}
552 582
@@ -606,6 +636,7 @@ static int hsw_pcm_close(struct snd_pcm_substream *substream)
606 dev_dbg(rtd->dev, "error: free stream failed %d\n", ret); 636 dev_dbg(rtd->dev, "error: free stream failed %d\n", ret);
607 goto out; 637 goto out;
608 } 638 }
639 pcm_data->allocated = 0;
609 pcm_data->stream = NULL; 640 pcm_data->stream = NULL;
610 641
611out: 642out:
@@ -621,7 +652,7 @@ static struct snd_pcm_ops hsw_pcm_ops = {
621 .hw_free = hsw_pcm_hw_free, 652 .hw_free = hsw_pcm_hw_free,
622 .trigger = hsw_pcm_trigger, 653 .trigger = hsw_pcm_trigger,
623 .pointer = hsw_pcm_pointer, 654 .pointer = hsw_pcm_pointer,
624 .mmap = snd_pcm_lib_default_mmap, 655 .page = snd_pcm_sgbuf_ops_page,
625}; 656};
626 657
627static void hsw_pcm_free(struct snd_pcm *pcm) 658static void hsw_pcm_free(struct snd_pcm *pcm)
@@ -632,17 +663,16 @@ static void hsw_pcm_free(struct snd_pcm *pcm)
632static int hsw_pcm_new(struct snd_soc_pcm_runtime *rtd) 663static int hsw_pcm_new(struct snd_soc_pcm_runtime *rtd)
633{ 664{
634 struct snd_pcm *pcm = rtd->pcm; 665 struct snd_pcm *pcm = rtd->pcm;
666 struct snd_soc_platform *platform = rtd->platform;
667 struct sst_pdata *pdata = dev_get_platdata(platform->dev);
668 struct device *dev = pdata->dma_dev;
635 int ret = 0; 669 int ret = 0;
636 670
637 ret = dma_coerce_mask_and_coherent(rtd->card->dev, DMA_BIT_MASK(32));
638 if (ret)
639 return ret;
640
641 if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream || 671 if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream ||
642 pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) { 672 pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) {
643 ret = snd_pcm_lib_preallocate_pages_for_all(pcm, 673 ret = snd_pcm_lib_preallocate_pages_for_all(pcm,
644 SNDRV_DMA_TYPE_DEV, 674 SNDRV_DMA_TYPE_DEV_SG,
645 rtd->card->dev, 675 dev,
646 hsw_pcm_hardware.buffer_bytes_max, 676 hsw_pcm_hardware.buffer_bytes_max,
647 hsw_pcm_hardware.buffer_bytes_max); 677 hsw_pcm_hardware.buffer_bytes_max);
648 if (ret) { 678 if (ret) {
@@ -742,11 +772,14 @@ static int hsw_pcm_probe(struct snd_soc_platform *platform)
742{ 772{
743 struct sst_pdata *pdata = dev_get_platdata(platform->dev); 773 struct sst_pdata *pdata = dev_get_platdata(platform->dev);
744 struct hsw_priv_data *priv_data; 774 struct hsw_priv_data *priv_data;
745 int i; 775 struct device *dma_dev;
776 int i, ret = 0;
746 777
747 if (!pdata) 778 if (!pdata)
748 return -ENODEV; 779 return -ENODEV;
749 780
781 dma_dev = pdata->dma_dev;
782
750 priv_data = devm_kzalloc(platform->dev, sizeof(*priv_data), GFP_KERNEL); 783 priv_data = devm_kzalloc(platform->dev, sizeof(*priv_data), GFP_KERNEL);
751 priv_data->hsw = pdata->dsp; 784 priv_data->hsw = pdata->dsp;
752 snd_soc_platform_set_drvdata(platform, priv_data); 785 snd_soc_platform_set_drvdata(platform, priv_data);
@@ -758,15 +791,17 @@ static int hsw_pcm_probe(struct snd_soc_platform *platform)
758 791
759 /* playback */ 792 /* playback */
760 if (hsw_dais[i].playback.channels_min) { 793 if (hsw_dais[i].playback.channels_min) {
761 priv_data->pcm_pg[i][0] = kzalloc(PAGE_SIZE, GFP_DMA); 794 ret = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, dma_dev,
762 if (priv_data->pcm_pg[i][0] == NULL) 795 PAGE_SIZE, &priv_data->dmab[i][0]);
796 if (ret < 0)
763 goto err; 797 goto err;
764 } 798 }
765 799
766 /* capture */ 800 /* capture */
767 if (hsw_dais[i].capture.channels_min) { 801 if (hsw_dais[i].capture.channels_min) {
768 priv_data->pcm_pg[i][1] = kzalloc(PAGE_SIZE, GFP_DMA); 802 ret = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, dma_dev,
769 if (priv_data->pcm_pg[i][1] == NULL) 803 PAGE_SIZE, &priv_data->dmab[i][1]);
804 if (ret < 0)
770 goto err; 805 goto err;
771 } 806 }
772 } 807 }
@@ -776,11 +811,11 @@ static int hsw_pcm_probe(struct snd_soc_platform *platform)
776err: 811err:
777 for (;i >= 0; i--) { 812 for (;i >= 0; i--) {
778 if (hsw_dais[i].playback.channels_min) 813 if (hsw_dais[i].playback.channels_min)
779 kfree(priv_data->pcm_pg[i][0]); 814 snd_dma_free_pages(&priv_data->dmab[i][0]);
780 if (hsw_dais[i].capture.channels_min) 815 if (hsw_dais[i].capture.channels_min)
781 kfree(priv_data->pcm_pg[i][1]); 816 snd_dma_free_pages(&priv_data->dmab[i][1]);
782 } 817 }
783 return -ENOMEM; 818 return ret;
784} 819}
785 820
786static int hsw_pcm_remove(struct snd_soc_platform *platform) 821static int hsw_pcm_remove(struct snd_soc_platform *platform)
@@ -791,9 +826,9 @@ static int hsw_pcm_remove(struct snd_soc_platform *platform)
791 826
792 for (i = 0; i < ARRAY_SIZE(hsw_dais); i++) { 827 for (i = 0; i < ARRAY_SIZE(hsw_dais); i++) {
793 if (hsw_dais[i].playback.channels_min) 828 if (hsw_dais[i].playback.channels_min)
794 kfree(priv_data->pcm_pg[i][0]); 829 snd_dma_free_pages(&priv_data->dmab[i][0]);
795 if (hsw_dais[i].capture.channels_min) 830 if (hsw_dais[i].capture.channels_min)
796 kfree(priv_data->pcm_pg[i][1]); 831 snd_dma_free_pages(&priv_data->dmab[i][1]);
797 } 832 }
798 833
799 return 0; 834 return 0;
diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index 215b668166be..89424470a1f3 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -197,13 +197,12 @@ static void rsnd_dma_complete(void *data)
197 * rsnd_dai_pointer_update() will be called twice, 197 * rsnd_dai_pointer_update() will be called twice,
198 * ant it will breaks io->byte_pos 198 * ant it will breaks io->byte_pos
199 */ 199 */
200
201 rsnd_dai_pointer_update(io, io->byte_per_period);
202
203 if (dma->submit_loop) 200 if (dma->submit_loop)
204 rsnd_dma_continue(dma); 201 rsnd_dma_continue(dma);
205 202
206 rsnd_unlock(priv, flags); 203 rsnd_unlock(priv, flags);
204
205 rsnd_dai_pointer_update(io, io->byte_per_period);
207} 206}
208 207
209static void __rsnd_dma_start(struct rsnd_dma *dma) 208static void __rsnd_dma_start(struct rsnd_dma *dma)
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 7769b0a2bc5a..6d6ceee447d5 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -1612,8 +1612,11 @@ static void dapm_pre_sequence_async(void *data, async_cookie_t cookie)
1612 "ASoC: Failed to turn on bias: %d\n", ret); 1612 "ASoC: Failed to turn on bias: %d\n", ret);
1613 } 1613 }
1614 1614
1615 /* Prepare for a STADDBY->ON or ON->STANDBY transition */ 1615 /* Prepare for a transition to ON or away from ON */
1616 if (d->bias_level != d->target_bias_level) { 1616 if ((d->target_bias_level == SND_SOC_BIAS_ON &&
1617 d->bias_level != SND_SOC_BIAS_ON) ||
1618 (d->target_bias_level != SND_SOC_BIAS_ON &&
1619 d->bias_level == SND_SOC_BIAS_ON)) {
1617 ret = snd_soc_dapm_set_bias_level(d, SND_SOC_BIAS_PREPARE); 1620 ret = snd_soc_dapm_set_bias_level(d, SND_SOC_BIAS_PREPARE);
1618 if (ret != 0) 1621 if (ret != 0)
1619 dev_err(d->dev, 1622 dev_err(d->dev,
@@ -3475,8 +3478,11 @@ void snd_soc_dapm_connect_dai_link_widgets(struct snd_soc_card *card)
3475 cpu_dai = rtd->cpu_dai; 3478 cpu_dai = rtd->cpu_dai;
3476 codec_dai = rtd->codec_dai; 3479 codec_dai = rtd->codec_dai;
3477 3480
3478 /* dynamic FE links have no fixed DAI mapping */ 3481 /*
3479 if (rtd->dai_link->dynamic) 3482 * dynamic FE links have no fixed DAI mapping.
3483 * CODEC<->CODEC links have no direct connection.
3484 */
3485 if (rtd->dai_link->dynamic || rtd->dai_link->params)
3480 continue; 3486 continue;
3481 3487
3482 /* there is no point in connecting BE DAI links with dummies */ 3488 /* there is no point in connecting BE DAI links with dummies */
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index 2cedf09f6d96..a391de058037 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -1675,7 +1675,7 @@ int dpcm_be_dai_trigger(struct snd_soc_pcm_runtime *fe, int stream,
1675 be->dpcm[stream].state = SND_SOC_DPCM_STATE_STOP; 1675 be->dpcm[stream].state = SND_SOC_DPCM_STATE_STOP;
1676 break; 1676 break;
1677 case SNDRV_PCM_TRIGGER_SUSPEND: 1677 case SNDRV_PCM_TRIGGER_SUSPEND:
1678 if (be->dpcm[stream].state != SND_SOC_DPCM_STATE_STOP) 1678 if (be->dpcm[stream].state != SND_SOC_DPCM_STATE_START)
1679 continue; 1679 continue;
1680 1680
1681 if (!snd_soc_dpcm_can_be_free_stop(fe, be, stream)) 1681 if (!snd_soc_dpcm_can_be_free_stop(fe, be, stream))