aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/devicetree/bindings/sound/pcm512x.txt3
-rw-r--r--include/sound/soc-dapm.h1
-rw-r--r--sound/soc/codecs/pcm512x-i2c.c4
-rw-r--r--sound/soc/codecs/pcm512x-spi.c4
-rw-r--r--sound/soc/codecs/rt5677.c9
-rw-r--r--sound/soc/dwc/designware_i2s.c135
-rw-r--r--sound/soc/intel/Kconfig4
-rw-r--r--sound/soc/intel/bytcr_dpcm_rt5640.c2
-rw-r--r--sound/soc/intel/sst-firmware.c6
-rw-r--r--sound/soc/intel/sst/sst_acpi.c2
-rw-r--r--sound/soc/omap/omap-hdmi-audio.c1
-rw-r--r--sound/soc/rockchip/rockchip_i2s.c4
-rw-r--r--sound/soc/rockchip/rockchip_i2s.h2
-rw-r--r--sound/soc/soc-core.c17
-rw-r--r--sound/soc/soc-dapm.c105
-rw-r--r--sound/soc/soc-pcm.c7
16 files changed, 123 insertions, 183 deletions
diff --git a/Documentation/devicetree/bindings/sound/pcm512x.txt b/Documentation/devicetree/bindings/sound/pcm512x.txt
index faff75e64573..98e0d34915e8 100644
--- a/Documentation/devicetree/bindings/sound/pcm512x.txt
+++ b/Documentation/devicetree/bindings/sound/pcm512x.txt
@@ -5,7 +5,8 @@ on the board).
5 5
6Required properties: 6Required properties:
7 7
8 - compatible : One of "ti,pcm5121" or "ti,pcm5122" 8 - compatible : One of "ti,pcm5121", "ti,pcm5122", "ti,pcm5141" or
9 "ti,pcm5142"
9 10
10 - reg : the I2C address of the device for I2C, the chip select 11 - reg : the I2C address of the device for I2C, the chip select
11 number for SPI. 12 number for SPI.
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index 89823cfe6f04..ecffeccb5534 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -431,7 +431,6 @@ int snd_soc_dapm_force_enable_pin_unlocked(struct snd_soc_dapm_context *dapm,
431 const char *pin); 431 const char *pin);
432int snd_soc_dapm_ignore_suspend(struct snd_soc_dapm_context *dapm, 432int snd_soc_dapm_ignore_suspend(struct snd_soc_dapm_context *dapm,
433 const char *pin); 433 const char *pin);
434void snd_soc_dapm_auto_nc_pins(struct snd_soc_card *card);
435unsigned int dapm_kcontrol_get_value(const struct snd_kcontrol *kcontrol); 434unsigned int dapm_kcontrol_get_value(const struct snd_kcontrol *kcontrol);
436 435
437/* Mostly internal - should not normally be used */ 436/* Mostly internal - should not normally be used */
diff --git a/sound/soc/codecs/pcm512x-i2c.c b/sound/soc/codecs/pcm512x-i2c.c
index d0547fa275fc..dcdfac0ffeb1 100644
--- a/sound/soc/codecs/pcm512x-i2c.c
+++ b/sound/soc/codecs/pcm512x-i2c.c
@@ -46,6 +46,8 @@ static int pcm512x_i2c_remove(struct i2c_client *i2c)
46static const struct i2c_device_id pcm512x_i2c_id[] = { 46static const struct i2c_device_id pcm512x_i2c_id[] = {
47 { "pcm5121", }, 47 { "pcm5121", },
48 { "pcm5122", }, 48 { "pcm5122", },
49 { "pcm5141", },
50 { "pcm5142", },
49 { } 51 { }
50}; 52};
51MODULE_DEVICE_TABLE(i2c, pcm512x_i2c_id); 53MODULE_DEVICE_TABLE(i2c, pcm512x_i2c_id);
@@ -53,6 +55,8 @@ MODULE_DEVICE_TABLE(i2c, pcm512x_i2c_id);
53static const struct of_device_id pcm512x_of_match[] = { 55static const struct of_device_id pcm512x_of_match[] = {
54 { .compatible = "ti,pcm5121", }, 56 { .compatible = "ti,pcm5121", },
55 { .compatible = "ti,pcm5122", }, 57 { .compatible = "ti,pcm5122", },
58 { .compatible = "ti,pcm5141", },
59 { .compatible = "ti,pcm5142", },
56 { } 60 { }
57}; 61};
58MODULE_DEVICE_TABLE(of, pcm512x_of_match); 62MODULE_DEVICE_TABLE(of, pcm512x_of_match);
diff --git a/sound/soc/codecs/pcm512x-spi.c b/sound/soc/codecs/pcm512x-spi.c
index f297058c0038..7b64a9cef704 100644
--- a/sound/soc/codecs/pcm512x-spi.c
+++ b/sound/soc/codecs/pcm512x-spi.c
@@ -43,6 +43,8 @@ static int pcm512x_spi_remove(struct spi_device *spi)
43static const struct spi_device_id pcm512x_spi_id[] = { 43static const struct spi_device_id pcm512x_spi_id[] = {
44 { "pcm5121", }, 44 { "pcm5121", },
45 { "pcm5122", }, 45 { "pcm5122", },
46 { "pcm5141", },
47 { "pcm5142", },
46 { }, 48 { },
47}; 49};
48MODULE_DEVICE_TABLE(spi, pcm512x_spi_id); 50MODULE_DEVICE_TABLE(spi, pcm512x_spi_id);
@@ -50,6 +52,8 @@ MODULE_DEVICE_TABLE(spi, pcm512x_spi_id);
50static const struct of_device_id pcm512x_of_match[] = { 52static const struct of_device_id pcm512x_of_match[] = {
51 { .compatible = "ti,pcm5121", }, 53 { .compatible = "ti,pcm5121", },
52 { .compatible = "ti,pcm5122", }, 54 { .compatible = "ti,pcm5122", },
55 { .compatible = "ti,pcm5141", },
56 { .compatible = "ti,pcm5142", },
53 { } 57 { }
54}; 58};
55MODULE_DEVICE_TABLE(of, pcm512x_of_match); 59MODULE_DEVICE_TABLE(of, pcm512x_of_match);
diff --git a/sound/soc/codecs/rt5677.c b/sound/soc/codecs/rt5677.c
index 81fe1464d268..c0fbe1881439 100644
--- a/sound/soc/codecs/rt5677.c
+++ b/sound/soc/codecs/rt5677.c
@@ -784,8 +784,8 @@ static unsigned int bst_tlv[] = {
784static int rt5677_dsp_vad_get(struct snd_kcontrol *kcontrol, 784static int rt5677_dsp_vad_get(struct snd_kcontrol *kcontrol,
785 struct snd_ctl_elem_value *ucontrol) 785 struct snd_ctl_elem_value *ucontrol)
786{ 786{
787 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); 787 struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
788 struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); 788 struct rt5677_priv *rt5677 = snd_soc_component_get_drvdata(component);
789 789
790 ucontrol->value.integer.value[0] = rt5677->dsp_vad_en; 790 ucontrol->value.integer.value[0] = rt5677->dsp_vad_en;
791 791
@@ -795,8 +795,9 @@ static int rt5677_dsp_vad_get(struct snd_kcontrol *kcontrol,
795static int rt5677_dsp_vad_put(struct snd_kcontrol *kcontrol, 795static int rt5677_dsp_vad_put(struct snd_kcontrol *kcontrol,
796 struct snd_ctl_elem_value *ucontrol) 796 struct snd_ctl_elem_value *ucontrol)
797{ 797{
798 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); 798 struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
799 struct rt5677_priv *rt5677 = snd_soc_codec_get_drvdata(codec); 799 struct rt5677_priv *rt5677 = snd_soc_component_get_drvdata(component);
800 struct snd_soc_codec *codec = snd_soc_component_to_codec(component);
800 801
801 rt5677->dsp_vad_en = !!ucontrol->value.integer.value[0]; 802 rt5677->dsp_vad_en = !!ucontrol->value.integer.value[0];
802 803
diff --git a/sound/soc/dwc/designware_i2s.c b/sound/soc/dwc/designware_i2s.c
index b93168d4f648..06d3a34ac90a 100644
--- a/sound/soc/dwc/designware_i2s.c
+++ b/sound/soc/dwc/designware_i2s.c
@@ -209,16 +209,9 @@ static int dw_i2s_hw_params(struct snd_pcm_substream *substream,
209 209
210 switch (config->chan_nr) { 210 switch (config->chan_nr) {
211 case EIGHT_CHANNEL_SUPPORT: 211 case EIGHT_CHANNEL_SUPPORT:
212 ch_reg = 3;
213 break;
214 case SIX_CHANNEL_SUPPORT: 212 case SIX_CHANNEL_SUPPORT:
215 ch_reg = 2;
216 break;
217 case FOUR_CHANNEL_SUPPORT: 213 case FOUR_CHANNEL_SUPPORT:
218 ch_reg = 1;
219 break;
220 case TWO_CHANNEL_SUPPORT: 214 case TWO_CHANNEL_SUPPORT:
221 ch_reg = 0;
222 break; 215 break;
223 default: 216 default:
224 dev_err(dev->dev, "channel not supported\n"); 217 dev_err(dev->dev, "channel not supported\n");
@@ -227,18 +220,22 @@ static int dw_i2s_hw_params(struct snd_pcm_substream *substream,
227 220
228 i2s_disable_channels(dev, substream->stream); 221 i2s_disable_channels(dev, substream->stream);
229 222
230 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { 223 for (ch_reg = 0; ch_reg < (config->chan_nr / 2); ch_reg++) {
231 i2s_write_reg(dev->i2s_base, TCR(ch_reg), xfer_resolution); 224 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
232 i2s_write_reg(dev->i2s_base, TFCR(ch_reg), 0x02); 225 i2s_write_reg(dev->i2s_base, TCR(ch_reg),
233 irq = i2s_read_reg(dev->i2s_base, IMR(ch_reg)); 226 xfer_resolution);
234 i2s_write_reg(dev->i2s_base, IMR(ch_reg), irq & ~0x30); 227 i2s_write_reg(dev->i2s_base, TFCR(ch_reg), 0x02);
235 i2s_write_reg(dev->i2s_base, TER(ch_reg), 1); 228 irq = i2s_read_reg(dev->i2s_base, IMR(ch_reg));
236 } else { 229 i2s_write_reg(dev->i2s_base, IMR(ch_reg), irq & ~0x30);
237 i2s_write_reg(dev->i2s_base, RCR(ch_reg), xfer_resolution); 230 i2s_write_reg(dev->i2s_base, TER(ch_reg), 1);
238 i2s_write_reg(dev->i2s_base, RFCR(ch_reg), 0x07); 231 } else {
239 irq = i2s_read_reg(dev->i2s_base, IMR(ch_reg)); 232 i2s_write_reg(dev->i2s_base, RCR(ch_reg),
240 i2s_write_reg(dev->i2s_base, IMR(ch_reg), irq & ~0x03); 233 xfer_resolution);
241 i2s_write_reg(dev->i2s_base, RER(ch_reg), 1); 234 i2s_write_reg(dev->i2s_base, RFCR(ch_reg), 0x07);
235 irq = i2s_read_reg(dev->i2s_base, IMR(ch_reg));
236 i2s_write_reg(dev->i2s_base, IMR(ch_reg), irq & ~0x03);
237 i2s_write_reg(dev->i2s_base, RER(ch_reg), 1);
238 }
242 } 239 }
243 240
244 i2s_write_reg(dev->i2s_base, CCR, ccr); 241 i2s_write_reg(dev->i2s_base, CCR, ccr);
@@ -263,6 +260,19 @@ static void dw_i2s_shutdown(struct snd_pcm_substream *substream,
263 snd_soc_dai_set_dma_data(dai, substream, NULL); 260 snd_soc_dai_set_dma_data(dai, substream, NULL);
264} 261}
265 262
263static int dw_i2s_prepare(struct snd_pcm_substream *substream,
264 struct snd_soc_dai *dai)
265{
266 struct dw_i2s_dev *dev = snd_soc_dai_get_drvdata(dai);
267
268 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
269 i2s_write_reg(dev->i2s_base, TXFFR, 1);
270 else
271 i2s_write_reg(dev->i2s_base, RXFFR, 1);
272
273 return 0;
274}
275
266static int dw_i2s_trigger(struct snd_pcm_substream *substream, 276static int dw_i2s_trigger(struct snd_pcm_substream *substream,
267 int cmd, struct snd_soc_dai *dai) 277 int cmd, struct snd_soc_dai *dai)
268{ 278{
@@ -294,6 +304,7 @@ static struct snd_soc_dai_ops dw_i2s_dai_ops = {
294 .startup = dw_i2s_startup, 304 .startup = dw_i2s_startup,
295 .shutdown = dw_i2s_shutdown, 305 .shutdown = dw_i2s_shutdown,
296 .hw_params = dw_i2s_hw_params, 306 .hw_params = dw_i2s_hw_params,
307 .prepare = dw_i2s_prepare,
297 .trigger = dw_i2s_trigger, 308 .trigger = dw_i2s_trigger,
298}; 309};
299 310
@@ -324,13 +335,47 @@ static int dw_i2s_resume(struct snd_soc_dai *dai)
324#define dw_i2s_resume NULL 335#define dw_i2s_resume NULL
325#endif 336#endif
326 337
338static void dw_configure_dai_by_pd(struct dw_i2s_dev *dev,
339 struct snd_soc_dai_driver *dw_i2s_dai,
340 struct resource *res,
341 const struct i2s_platform_data *pdata)
342{
343 /* Set DMA slaves info */
344
345 dev->play_dma_data.data = pdata->play_dma_data;
346 dev->capture_dma_data.data = pdata->capture_dma_data;
347 dev->play_dma_data.addr = res->start + I2S_TXDMA;
348 dev->capture_dma_data.addr = res->start + I2S_RXDMA;
349 dev->play_dma_data.max_burst = 16;
350 dev->capture_dma_data.max_burst = 16;
351 dev->play_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES;
352 dev->capture_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES;
353 dev->play_dma_data.filter = pdata->filter;
354 dev->capture_dma_data.filter = pdata->filter;
355
356 if (pdata->cap & DWC_I2S_PLAY) {
357 dev_dbg(dev->dev, " designware: play supported\n");
358 dw_i2s_dai->playback.channels_min = MIN_CHANNEL_NUM;
359 dw_i2s_dai->playback.channels_max = pdata->channel;
360 dw_i2s_dai->playback.formats = pdata->snd_fmts;
361 dw_i2s_dai->playback.rates = pdata->snd_rates;
362 }
363
364 if (pdata->cap & DWC_I2S_RECORD) {
365 dev_dbg(dev->dev, "designware: record supported\n");
366 dw_i2s_dai->capture.channels_min = MIN_CHANNEL_NUM;
367 dw_i2s_dai->capture.channels_max = pdata->channel;
368 dw_i2s_dai->capture.formats = pdata->snd_fmts;
369 dw_i2s_dai->capture.rates = pdata->snd_rates;
370 }
371}
372
327static int dw_i2s_probe(struct platform_device *pdev) 373static int dw_i2s_probe(struct platform_device *pdev)
328{ 374{
329 const struct i2s_platform_data *pdata = pdev->dev.platform_data; 375 const struct i2s_platform_data *pdata = pdev->dev.platform_data;
330 struct dw_i2s_dev *dev; 376 struct dw_i2s_dev *dev;
331 struct resource *res; 377 struct resource *res;
332 int ret; 378 int ret;
333 unsigned int cap;
334 struct snd_soc_dai_driver *dw_i2s_dai; 379 struct snd_soc_dai_driver *dw_i2s_dai;
335 380
336 if (!pdata) { 381 if (!pdata) {
@@ -345,44 +390,23 @@ static int dw_i2s_probe(struct platform_device *pdev)
345 } 390 }
346 391
347 dw_i2s_dai = devm_kzalloc(&pdev->dev, sizeof(*dw_i2s_dai), GFP_KERNEL); 392 dw_i2s_dai = devm_kzalloc(&pdev->dev, sizeof(*dw_i2s_dai), GFP_KERNEL);
348 if (!dw_i2s_dai) { 393 if (!dw_i2s_dai)
349 dev_err(&pdev->dev, "mem allocation failed for dai driver\n");
350 return -ENOMEM; 394 return -ENOMEM;
351 }
352 395
353 dw_i2s_dai->ops = &dw_i2s_dai_ops; 396 dw_i2s_dai->ops = &dw_i2s_dai_ops;
354 dw_i2s_dai->suspend = dw_i2s_suspend; 397 dw_i2s_dai->suspend = dw_i2s_suspend;
355 dw_i2s_dai->resume = dw_i2s_resume; 398 dw_i2s_dai->resume = dw_i2s_resume;
356 399
357 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 400 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
358 if (!res) {
359 dev_err(&pdev->dev, "no i2s resource defined\n");
360 return -ENODEV;
361 }
362
363 dev->i2s_base = devm_ioremap_resource(&pdev->dev, res); 401 dev->i2s_base = devm_ioremap_resource(&pdev->dev, res);
364 if (IS_ERR(dev->i2s_base)) { 402 if (IS_ERR(dev->i2s_base))
365 dev_err(&pdev->dev, "ioremap fail for i2s_region\n");
366 return PTR_ERR(dev->i2s_base); 403 return PTR_ERR(dev->i2s_base);
367 }
368
369 cap = pdata->cap;
370 dev->capability = cap;
371 dev->i2s_clk_cfg = pdata->i2s_clk_cfg;
372 404
373 /* Set DMA slaves info */ 405 dev->dev = &pdev->dev;
374 406 dw_configure_dai_by_pd(dev, dw_i2s_dai, res, pdata);
375 dev->play_dma_data.data = pdata->play_dma_data;
376 dev->capture_dma_data.data = pdata->capture_dma_data;
377 dev->play_dma_data.addr = res->start + I2S_TXDMA;
378 dev->capture_dma_data.addr = res->start + I2S_RXDMA;
379 dev->play_dma_data.max_burst = 16;
380 dev->capture_dma_data.max_burst = 16;
381 dev->play_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES;
382 dev->capture_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_2_BYTES;
383 dev->play_dma_data.filter = pdata->filter;
384 dev->capture_dma_data.filter = pdata->filter;
385 407
408 dev->capability = pdata->cap;
409 dev->i2s_clk_cfg = pdata->i2s_clk_cfg;
386 dev->clk = clk_get(&pdev->dev, NULL); 410 dev->clk = clk_get(&pdev->dev, NULL);
387 if (IS_ERR(dev->clk)) 411 if (IS_ERR(dev->clk))
388 return PTR_ERR(dev->clk); 412 return PTR_ERR(dev->clk);
@@ -391,23 +415,6 @@ static int dw_i2s_probe(struct platform_device *pdev)
391 if (ret < 0) 415 if (ret < 0)
392 goto err_clk_put; 416 goto err_clk_put;
393 417
394 if (cap & DWC_I2S_PLAY) {
395 dev_dbg(&pdev->dev, " designware: play supported\n");
396 dw_i2s_dai->playback.channels_min = MIN_CHANNEL_NUM;
397 dw_i2s_dai->playback.channels_max = pdata->channel;
398 dw_i2s_dai->playback.formats = pdata->snd_fmts;
399 dw_i2s_dai->playback.rates = pdata->snd_rates;
400 }
401
402 if (cap & DWC_I2S_RECORD) {
403 dev_dbg(&pdev->dev, "designware: record supported\n");
404 dw_i2s_dai->capture.channels_min = MIN_CHANNEL_NUM;
405 dw_i2s_dai->capture.channels_max = pdata->channel;
406 dw_i2s_dai->capture.formats = pdata->snd_fmts;
407 dw_i2s_dai->capture.rates = pdata->snd_rates;
408 }
409
410 dev->dev = &pdev->dev;
411 dev_set_drvdata(&pdev->dev, dev); 418 dev_set_drvdata(&pdev->dev, dev);
412 ret = snd_soc_register_component(&pdev->dev, &dw_i2s_component, 419 ret = snd_soc_register_component(&pdev->dev, &dw_i2s_component,
413 dw_i2s_dai, 1); 420 dw_i2s_dai, 1);
diff --git a/sound/soc/intel/Kconfig b/sound/soc/intel/Kconfig
index f06fcf1e21a5..c0813f546d1f 100644
--- a/sound/soc/intel/Kconfig
+++ b/sound/soc/intel/Kconfig
@@ -89,7 +89,7 @@ config SND_SOC_INTEL_BROADWELL_MACH
89 89
90config SND_SOC_INTEL_BYTCR_RT5640_MACH 90config SND_SOC_INTEL_BYTCR_RT5640_MACH
91 tristate "ASoC Audio DSP Support for MID BYT Platform" 91 tristate "ASoC Audio DSP Support for MID BYT Platform"
92 depends on X86 92 depends on X86 && I2C
93 select SND_SOC_RT5640 93 select SND_SOC_RT5640
94 select SND_SST_MFLD_PLATFORM 94 select SND_SST_MFLD_PLATFORM
95 select SND_SST_IPC_ACPI 95 select SND_SST_IPC_ACPI
@@ -101,7 +101,7 @@ config SND_SOC_INTEL_BYTCR_RT5640_MACH
101 101
102config SND_SOC_INTEL_CHT_BSW_RT5672_MACH 102config SND_SOC_INTEL_CHT_BSW_RT5672_MACH
103 tristate "ASoC Audio driver for Intel Cherrytrail & Braswell with RT5672 codec" 103 tristate "ASoC Audio driver for Intel Cherrytrail & Braswell with RT5672 codec"
104 depends on X86_INTEL_LPSS 104 depends on X86_INTEL_LPSS && I2C
105 select SND_SOC_RT5670 105 select SND_SOC_RT5670
106 select SND_SST_MFLD_PLATFORM 106 select SND_SST_MFLD_PLATFORM
107 select SND_SST_IPC_ACPI 107 select SND_SST_IPC_ACPI
diff --git a/sound/soc/intel/bytcr_dpcm_rt5640.c b/sound/soc/intel/bytcr_dpcm_rt5640.c
index 9277f2baefb1..59308629043e 100644
--- a/sound/soc/intel/bytcr_dpcm_rt5640.c
+++ b/sound/soc/intel/bytcr_dpcm_rt5640.c
@@ -226,4 +226,4 @@ module_platform_driver(snd_byt_mc_driver);
226MODULE_DESCRIPTION("ASoC Intel(R) Baytrail CR Machine driver"); 226MODULE_DESCRIPTION("ASoC Intel(R) Baytrail CR Machine driver");
227MODULE_AUTHOR("Subhransu S. Prusty <subhransu.s.prusty@intel.com>"); 227MODULE_AUTHOR("Subhransu S. Prusty <subhransu.s.prusty@intel.com>");
228MODULE_LICENSE("GPL v2"); 228MODULE_LICENSE("GPL v2");
229MODULE_ALIAS("platform:bytrt5640-audio"); 229MODULE_ALIAS("platform:bytt100_rt5640");
diff --git a/sound/soc/intel/sst-firmware.c b/sound/soc/intel/sst-firmware.c
index cad6ea179cea..50d6925893ff 100644
--- a/sound/soc/intel/sst-firmware.c
+++ b/sound/soc/intel/sst-firmware.c
@@ -764,8 +764,12 @@ static int block_alloc_fixed(struct sst_dsp *dsp, struct sst_block_allocator *ba
764 /* does block span more than 1 section */ 764 /* does block span more than 1 section */
765 if (ba->offset >= block->offset && ba->offset < block_end) { 765 if (ba->offset >= block->offset && ba->offset < block_end) {
766 766
767 /* add block */
768 list_move(&block->list, &dsp->used_block_list);
769 list_add(&block->module_list, block_list);
767 /* align ba to block boundary */ 770 /* align ba to block boundary */
768 ba->offset = block->offset; 771 ba->size -= block_end - ba->offset;
772 ba->offset = block_end;
769 773
770 err = block_alloc_contiguous(dsp, ba, block_list); 774 err = block_alloc_contiguous(dsp, ba, block_list);
771 if (err < 0) 775 if (err < 0)
diff --git a/sound/soc/intel/sst/sst_acpi.c b/sound/soc/intel/sst/sst_acpi.c
index df2b5cc23766..c3fbcdec6a15 100644
--- a/sound/soc/intel/sst/sst_acpi.c
+++ b/sound/soc/intel/sst/sst_acpi.c
@@ -343,7 +343,7 @@ static int sst_acpi_remove(struct platform_device *pdev)
343} 343}
344 344
345static struct sst_machines sst_acpi_bytcr[] = { 345static struct sst_machines sst_acpi_bytcr[] = {
346 {"10EC5640", "T100", "bytt100_rt5640", NULL, "fw_sst_0f28.bin", 346 {"10EC5640", "T100", "bytt100_rt5640", NULL, "intel/fw_sst_0f28.bin",
347 &byt_rvp_platform_data }, 347 &byt_rvp_platform_data },
348 {}, 348 {},
349}; 349};
diff --git a/sound/soc/omap/omap-hdmi-audio.c b/sound/soc/omap/omap-hdmi-audio.c
index 3f9ac7dbdc80..ccfb41c22e53 100644
--- a/sound/soc/omap/omap-hdmi-audio.c
+++ b/sound/soc/omap/omap-hdmi-audio.c
@@ -393,7 +393,6 @@ static int omap_hdmi_audio_remove(struct platform_device *pdev)
393static struct platform_driver hdmi_audio_driver = { 393static struct platform_driver hdmi_audio_driver = {
394 .driver = { 394 .driver = {
395 .name = DRV_NAME, 395 .name = DRV_NAME,
396 .owner = THIS_MODULE,
397 }, 396 },
398 .probe = omap_hdmi_audio_probe, 397 .probe = omap_hdmi_audio_probe,
399 .remove = omap_hdmi_audio_remove, 398 .remove = omap_hdmi_audio_remove,
diff --git a/sound/soc/rockchip/rockchip_i2s.c b/sound/soc/rockchip/rockchip_i2s.c
index 26ec5117b35c..13d8507333b8 100644
--- a/sound/soc/rockchip/rockchip_i2s.c
+++ b/sound/soc/rockchip/rockchip_i2s.c
@@ -454,11 +454,11 @@ static int rockchip_i2s_probe(struct platform_device *pdev)
454 454
455 i2s->playback_dma_data.addr = res->start + I2S_TXDR; 455 i2s->playback_dma_data.addr = res->start + I2S_TXDR;
456 i2s->playback_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; 456 i2s->playback_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
457 i2s->playback_dma_data.maxburst = 16; 457 i2s->playback_dma_data.maxburst = 4;
458 458
459 i2s->capture_dma_data.addr = res->start + I2S_RXDR; 459 i2s->capture_dma_data.addr = res->start + I2S_RXDR;
460 i2s->capture_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; 460 i2s->capture_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
461 i2s->capture_dma_data.maxburst = 16; 461 i2s->capture_dma_data.maxburst = 4;
462 462
463 i2s->dev = &pdev->dev; 463 i2s->dev = &pdev->dev;
464 dev_set_drvdata(&pdev->dev, i2s); 464 dev_set_drvdata(&pdev->dev, i2s);
diff --git a/sound/soc/rockchip/rockchip_i2s.h b/sound/soc/rockchip/rockchip_i2s.h
index 89a5d8bc6ee7..93f456f518a9 100644
--- a/sound/soc/rockchip/rockchip_i2s.h
+++ b/sound/soc/rockchip/rockchip_i2s.h
@@ -127,7 +127,7 @@
127#define I2S_DMACR_TDE_DISABLE (0 << I2S_DMACR_TDE_SHIFT) 127#define I2S_DMACR_TDE_DISABLE (0 << I2S_DMACR_TDE_SHIFT)
128#define I2S_DMACR_TDE_ENABLE (1 << I2S_DMACR_TDE_SHIFT) 128#define I2S_DMACR_TDE_ENABLE (1 << I2S_DMACR_TDE_SHIFT)
129#define I2S_DMACR_TDL_SHIFT 0 129#define I2S_DMACR_TDL_SHIFT 0
130#define I2S_DMACR_TDL(x) ((x - 1) << I2S_DMACR_TDL_SHIFT) 130#define I2S_DMACR_TDL(x) ((x) << I2S_DMACR_TDL_SHIFT)
131#define I2S_DMACR_TDL_MASK (0x1f << I2S_DMACR_TDL_SHIFT) 131#define I2S_DMACR_TDL_MASK (0x1f << I2S_DMACR_TDL_SHIFT)
132 132
133/* 133/*
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 985052b3fbed..c024962ba500 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1626,9 +1626,6 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card)
1626 } 1626 }
1627 } 1627 }
1628 1628
1629 if (card->fully_routed)
1630 snd_soc_dapm_auto_nc_pins(card);
1631
1632 snd_soc_dapm_new_widgets(card); 1629 snd_soc_dapm_new_widgets(card);
1633 1630
1634 ret = snd_card_register(card->snd_card); 1631 ret = snd_card_register(card->snd_card);
@@ -3230,7 +3227,7 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
3230 const char *propname) 3227 const char *propname)
3231{ 3228{
3232 struct device_node *np = card->dev->of_node; 3229 struct device_node *np = card->dev->of_node;
3233 int num_routes, old_routes; 3230 int num_routes;
3234 struct snd_soc_dapm_route *routes; 3231 struct snd_soc_dapm_route *routes;
3235 int i, ret; 3232 int i, ret;
3236 3233
@@ -3248,9 +3245,7 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
3248 return -EINVAL; 3245 return -EINVAL;
3249 } 3246 }
3250 3247
3251 old_routes = card->num_dapm_routes; 3248 routes = devm_kzalloc(card->dev, num_routes * sizeof(*routes),
3252 routes = devm_kzalloc(card->dev,
3253 (old_routes + num_routes) * sizeof(*routes),
3254 GFP_KERNEL); 3249 GFP_KERNEL);
3255 if (!routes) { 3250 if (!routes) {
3256 dev_err(card->dev, 3251 dev_err(card->dev,
@@ -3258,11 +3253,9 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
3258 return -EINVAL; 3253 return -EINVAL;
3259 } 3254 }
3260 3255
3261 memcpy(routes, card->dapm_routes, old_routes * sizeof(*routes));
3262
3263 for (i = 0; i < num_routes; i++) { 3256 for (i = 0; i < num_routes; i++) {
3264 ret = of_property_read_string_index(np, propname, 3257 ret = of_property_read_string_index(np, propname,
3265 2 * i, &routes[old_routes + i].sink); 3258 2 * i, &routes[i].sink);
3266 if (ret) { 3259 if (ret) {
3267 dev_err(card->dev, 3260 dev_err(card->dev,
3268 "ASoC: Property '%s' index %d could not be read: %d\n", 3261 "ASoC: Property '%s' index %d could not be read: %d\n",
@@ -3270,7 +3263,7 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
3270 return -EINVAL; 3263 return -EINVAL;
3271 } 3264 }
3272 ret = of_property_read_string_index(np, propname, 3265 ret = of_property_read_string_index(np, propname,
3273 (2 * i) + 1, &routes[old_routes + i].source); 3266 (2 * i) + 1, &routes[i].source);
3274 if (ret) { 3267 if (ret) {
3275 dev_err(card->dev, 3268 dev_err(card->dev,
3276 "ASoC: Property '%s' index %d could not be read: %d\n", 3269 "ASoC: Property '%s' index %d could not be read: %d\n",
@@ -3279,7 +3272,7 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
3279 } 3272 }
3280 } 3273 }
3281 3274
3282 card->num_dapm_routes += num_routes; 3275 card->num_dapm_routes = num_routes;
3283 card->dapm_routes = routes; 3276 card->dapm_routes = routes;
3284 3277
3285 return 0; 3278 return 0;
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index c5136bb1f982..ea496842ee83 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -2279,6 +2279,9 @@ static void dapm_update_widget_flags(struct snd_soc_dapm_widget *w)
2279 2279
2280 switch (w->id) { 2280 switch (w->id) {
2281 case snd_soc_dapm_input: 2281 case snd_soc_dapm_input:
2282 /* On a fully routed card a input is never a source */
2283 if (w->dapm->card->fully_routed)
2284 break;
2282 w->is_source = 1; 2285 w->is_source = 1;
2283 list_for_each_entry(p, &w->sources, list_sink) { 2286 list_for_each_entry(p, &w->sources, list_sink) {
2284 if (p->source->id == snd_soc_dapm_micbias || 2287 if (p->source->id == snd_soc_dapm_micbias ||
@@ -2291,6 +2294,9 @@ static void dapm_update_widget_flags(struct snd_soc_dapm_widget *w)
2291 } 2294 }
2292 break; 2295 break;
2293 case snd_soc_dapm_output: 2296 case snd_soc_dapm_output:
2297 /* On a fully routed card a output is never a sink */
2298 if (w->dapm->card->fully_routed)
2299 break;
2294 w->is_sink = 1; 2300 w->is_sink = 1;
2295 list_for_each_entry(p, &w->sinks, list_source) { 2301 list_for_each_entry(p, &w->sinks, list_source) {
2296 if (p->sink->id == snd_soc_dapm_spk || 2302 if (p->sink->id == snd_soc_dapm_spk ||
@@ -3085,16 +3091,24 @@ snd_soc_dapm_new_control(struct snd_soc_dapm_context *dapm,
3085 3091
3086 switch (w->id) { 3092 switch (w->id) {
3087 case snd_soc_dapm_mic: 3093 case snd_soc_dapm_mic:
3088 case snd_soc_dapm_input:
3089 w->is_source = 1; 3094 w->is_source = 1;
3090 w->power_check = dapm_generic_check_power; 3095 w->power_check = dapm_generic_check_power;
3091 break; 3096 break;
3097 case snd_soc_dapm_input:
3098 if (!dapm->card->fully_routed)
3099 w->is_source = 1;
3100 w->power_check = dapm_generic_check_power;
3101 break;
3092 case snd_soc_dapm_spk: 3102 case snd_soc_dapm_spk:
3093 case snd_soc_dapm_hp: 3103 case snd_soc_dapm_hp:
3094 case snd_soc_dapm_output:
3095 w->is_sink = 1; 3104 w->is_sink = 1;
3096 w->power_check = dapm_generic_check_power; 3105 w->power_check = dapm_generic_check_power;
3097 break; 3106 break;
3107 case snd_soc_dapm_output:
3108 if (!dapm->card->fully_routed)
3109 w->is_sink = 1;
3110 w->power_check = dapm_generic_check_power;
3111 break;
3098 case snd_soc_dapm_vmid: 3112 case snd_soc_dapm_vmid:
3099 case snd_soc_dapm_siggen: 3113 case snd_soc_dapm_siggen:
3100 w->is_source = 1; 3114 w->is_source = 1;
@@ -3809,93 +3823,6 @@ int snd_soc_dapm_ignore_suspend(struct snd_soc_dapm_context *dapm,
3809EXPORT_SYMBOL_GPL(snd_soc_dapm_ignore_suspend); 3823EXPORT_SYMBOL_GPL(snd_soc_dapm_ignore_suspend);
3810 3824
3811/** 3825/**
3812 * dapm_is_external_path() - Checks if a path is a external path
3813 * @card: The card the path belongs to
3814 * @path: The path to check
3815 *
3816 * Returns true if the path is either between two different DAPM contexts or
3817 * between two external pins of the same DAPM context. Otherwise returns
3818 * false.
3819 */
3820static bool dapm_is_external_path(struct snd_soc_card *card,
3821 struct snd_soc_dapm_path *path)
3822{
3823 dev_dbg(card->dev,
3824 "... Path %s(id:%d dapm:%p) - %s(id:%d dapm:%p)\n",
3825 path->source->name, path->source->id, path->source->dapm,
3826 path->sink->name, path->sink->id, path->sink->dapm);
3827
3828 /* Connection between two different DAPM contexts */
3829 if (path->source->dapm != path->sink->dapm)
3830 return true;
3831
3832 /* Loopback connection from external pin to external pin */
3833 if (path->sink->id == snd_soc_dapm_input) {
3834 switch (path->source->id) {
3835 case snd_soc_dapm_output:
3836 case snd_soc_dapm_micbias:
3837 return true;
3838 default:
3839 break;
3840 }
3841 }
3842
3843 return false;
3844}
3845
3846static bool snd_soc_dapm_widget_in_card_paths(struct snd_soc_card *card,
3847 struct snd_soc_dapm_widget *w)
3848{
3849 struct snd_soc_dapm_path *p;
3850
3851 list_for_each_entry(p, &w->sources, list_sink) {
3852 if (dapm_is_external_path(card, p))
3853 return true;
3854 }
3855
3856 list_for_each_entry(p, &w->sinks, list_source) {
3857 if (dapm_is_external_path(card, p))
3858 return true;
3859 }
3860
3861 return false;
3862}
3863
3864/**
3865 * snd_soc_dapm_auto_nc_pins - call snd_soc_dapm_nc_pin for unused pins
3866 * @card: The card whose pins should be processed
3867 *
3868 * Automatically call snd_soc_dapm_nc_pin() for any external pins in the card
3869 * which are unused. Pins are used if they are connected externally to a
3870 * component, whether that be to some other device, or a loop-back connection to
3871 * the component itself.
3872 */
3873void snd_soc_dapm_auto_nc_pins(struct snd_soc_card *card)
3874{
3875 struct snd_soc_dapm_widget *w;
3876
3877 dev_dbg(card->dev, "ASoC: Auto NC: DAPMs: card:%p\n", &card->dapm);
3878
3879 list_for_each_entry(w, &card->widgets, list) {
3880 switch (w->id) {
3881 case snd_soc_dapm_input:
3882 case snd_soc_dapm_output:
3883 case snd_soc_dapm_micbias:
3884 dev_dbg(card->dev, "ASoC: Auto NC: Checking widget %s\n",
3885 w->name);
3886 if (!snd_soc_dapm_widget_in_card_paths(card, w)) {
3887 dev_dbg(card->dev,
3888 "... Not in map; disabling\n");
3889 snd_soc_dapm_nc_pin(w->dapm, w->name);
3890 }
3891 break;
3892 default:
3893 break;
3894 }
3895 }
3896}
3897
3898/**
3899 * snd_soc_dapm_free - free dapm resources 3826 * snd_soc_dapm_free - free dapm resources
3900 * @dapm: DAPM context 3827 * @dapm: DAPM context
3901 * 3828 *
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index eb87d96e2cf0..0ae0e2a9eed7 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -746,7 +746,8 @@ static int soc_pcm_prepare(struct snd_pcm_substream *substream)
746 codec_dai); 746 codec_dai);
747 if (ret < 0) { 747 if (ret < 0) {
748 dev_err(codec_dai->dev, 748 dev_err(codec_dai->dev,
749 "ASoC: DAI prepare error: %d\n", ret); 749 "ASoC: codec DAI prepare error: %d\n",
750 ret);
750 goto out; 751 goto out;
751 } 752 }
752 } 753 }
@@ -755,8 +756,8 @@ static int soc_pcm_prepare(struct snd_pcm_substream *substream)
755 if (cpu_dai->driver->ops && cpu_dai->driver->ops->prepare) { 756 if (cpu_dai->driver->ops && cpu_dai->driver->ops->prepare) {
756 ret = cpu_dai->driver->ops->prepare(substream, cpu_dai); 757 ret = cpu_dai->driver->ops->prepare(substream, cpu_dai);
757 if (ret < 0) { 758 if (ret < 0) {
758 dev_err(cpu_dai->dev, "ASoC: DAI prepare error: %d\n", 759 dev_err(cpu_dai->dev,
759 ret); 760 "ASoC: cpu DAI prepare error: %d\n", ret);
760 goto out; 761 goto out;
761 } 762 }
762 } 763 }