summaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2016-08-25 11:56:09 -0400
committerTakashi Iwai <tiwai@suse.de>2016-08-25 11:56:09 -0400
commita820cd3d25c2891028b5f296a8a871ce6dd92c0d (patch)
tree3e86aeb1b898e9ca0dd6754dc7e6ff68865ee175 /sound
parentabaa2274811d607679e8687b4118c4922a3517ac (diff)
parentcfb89f2e7505c6823020a18bbdc5410284305234 (diff)
Merge tag 'asoc-fix-v4.8-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus
ASoC: Fixes for v4.8 A clutch of fixes for v4.8. These are mainly driver specific, the most notable ones being those for OMAP which fix a series of issues that broke boot on some platforms there when deferred probe kicked in. There's also one core fix for an issue when unbinding a card which for some reason had managed to not manifest until recently.
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/atmel/atmel_ssc_dai.c5
-rw-r--r--sound/soc/codecs/da7213.c4
-rw-r--r--sound/soc/codecs/max98371.c1
-rw-r--r--sound/soc/codecs/nau8825.c78
-rw-r--r--sound/soc/codecs/wm2000.c2
-rw-r--r--sound/soc/generic/Makefile6
-rw-r--r--sound/soc/generic/simple-card-utils.c6
-rw-r--r--sound/soc/intel/skylake/skl-sst-utils.c5
-rw-r--r--sound/soc/intel/skylake/skl.c4
-rw-r--r--sound/soc/omap/omap-abe-twl6040.c61
-rw-r--r--sound/soc/omap/omap-mcpdm.c22
-rw-r--r--sound/soc/samsung/s3c24xx_uda134x.c7
-rw-r--r--sound/soc/sh/rcar/src.c6
-rw-r--r--sound/soc/soc-compress.c4
-rw-r--r--sound/soc/soc-core.c5
-rw-r--r--sound/soc/soc-dapm.c10
16 files changed, 115 insertions, 111 deletions
diff --git a/sound/soc/atmel/atmel_ssc_dai.c b/sound/soc/atmel/atmel_ssc_dai.c
index 54c09acd3fed..16e459aedffe 100644
--- a/sound/soc/atmel/atmel_ssc_dai.c
+++ b/sound/soc/atmel/atmel_ssc_dai.c
@@ -299,8 +299,9 @@ static int atmel_ssc_startup(struct snd_pcm_substream *substream,
299 clk_enable(ssc_p->ssc->clk); 299 clk_enable(ssc_p->ssc->clk);
300 ssc_p->mck_rate = clk_get_rate(ssc_p->ssc->clk); 300 ssc_p->mck_rate = clk_get_rate(ssc_p->ssc->clk);
301 301
302 /* Reset the SSC to keep it at a clean status */ 302 /* Reset the SSC unless initialized to keep it in a clean state */
303 ssc_writel(ssc_p->ssc->regs, CR, SSC_BIT(CR_SWRST)); 303 if (!ssc_p->initialized)
304 ssc_writel(ssc_p->ssc->regs, CR, SSC_BIT(CR_SWRST));
304 305
305 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { 306 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
306 dir = 0; 307 dir = 0;
diff --git a/sound/soc/codecs/da7213.c b/sound/soc/codecs/da7213.c
index e5527bc570ae..bcf1834c5648 100644
--- a/sound/soc/codecs/da7213.c
+++ b/sound/soc/codecs/da7213.c
@@ -1247,8 +1247,8 @@ static int da7213_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt)
1247 return -EINVAL; 1247 return -EINVAL;
1248 } 1248 }
1249 1249
1250 /* By default only 32 BCLK per WCLK is supported */ 1250 /* By default only 64 BCLK per WCLK is supported */
1251 dai_clk_mode |= DA7213_DAI_BCLKS_PER_WCLK_32; 1251 dai_clk_mode |= DA7213_DAI_BCLKS_PER_WCLK_64;
1252 1252
1253 snd_soc_write(codec, DA7213_DAI_CLK_MODE, dai_clk_mode); 1253 snd_soc_write(codec, DA7213_DAI_CLK_MODE, dai_clk_mode);
1254 snd_soc_update_bits(codec, DA7213_DAI_CTRL, DA7213_DAI_FORMAT_MASK, 1254 snd_soc_update_bits(codec, DA7213_DAI_CTRL, DA7213_DAI_FORMAT_MASK,
diff --git a/sound/soc/codecs/max98371.c b/sound/soc/codecs/max98371.c
index cf0a39bb631a..02352ed8961c 100644
--- a/sound/soc/codecs/max98371.c
+++ b/sound/soc/codecs/max98371.c
@@ -412,6 +412,7 @@ static int max98371_i2c_remove(struct i2c_client *client)
412 412
413static const struct i2c_device_id max98371_i2c_id[] = { 413static const struct i2c_device_id max98371_i2c_id[] = {
414 { "max98371", 0 }, 414 { "max98371", 0 },
415 { }
415}; 416};
416 417
417MODULE_DEVICE_TABLE(i2c, max98371_i2c_id); 418MODULE_DEVICE_TABLE(i2c, max98371_i2c_id);
diff --git a/sound/soc/codecs/nau8825.c b/sound/soc/codecs/nau8825.c
index 5c9707ac4bbf..2e59a85e360b 100644
--- a/sound/soc/codecs/nau8825.c
+++ b/sound/soc/codecs/nau8825.c
@@ -212,31 +212,6 @@ static const unsigned short logtable[256] = {
212 0xfa2f, 0xfaea, 0xfba5, 0xfc60, 0xfd1a, 0xfdd4, 0xfe8e, 0xff47 212 0xfa2f, 0xfaea, 0xfba5, 0xfc60, 0xfd1a, 0xfdd4, 0xfe8e, 0xff47
213}; 213};
214 214
215static struct snd_soc_dai *nau8825_get_codec_dai(struct nau8825 *nau8825)
216{
217 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(nau8825->dapm);
218 struct snd_soc_component *component = &codec->component;
219 struct snd_soc_dai *codec_dai, *_dai;
220
221 list_for_each_entry_safe(codec_dai, _dai, &component->dai_list, list) {
222 if (!strncmp(codec_dai->name, NUVOTON_CODEC_DAI,
223 strlen(NUVOTON_CODEC_DAI)))
224 return codec_dai;
225 }
226 return NULL;
227}
228
229static bool nau8825_dai_is_active(struct nau8825 *nau8825)
230{
231 struct snd_soc_dai *codec_dai = nau8825_get_codec_dai(nau8825);
232
233 if (codec_dai) {
234 if (codec_dai->playback_active || codec_dai->capture_active)
235 return true;
236 }
237 return false;
238}
239
240/** 215/**
241 * nau8825_sema_acquire - acquire the semaphore of nau88l25 216 * nau8825_sema_acquire - acquire the semaphore of nau88l25
242 * @nau8825: component to register the codec private data with 217 * @nau8825: component to register the codec private data with
@@ -250,19 +225,26 @@ static bool nau8825_dai_is_active(struct nau8825 *nau8825)
250 * Acquires the semaphore without jiffies. If no more tasks are allowed 225 * Acquires the semaphore without jiffies. If no more tasks are allowed
251 * to acquire the semaphore, calling this function will put the task to 226 * to acquire the semaphore, calling this function will put the task to
252 * sleep until the semaphore is released. 227 * sleep until the semaphore is released.
253 * It returns if the semaphore was acquired. 228 * If the semaphore is not released within the specified number of jiffies,
229 * this function returns -ETIME.
230 * If the sleep is interrupted by a signal, this function will return -EINTR.
231 * It returns 0 if the semaphore was acquired successfully.
254 */ 232 */
255static void nau8825_sema_acquire(struct nau8825 *nau8825, long timeout) 233static int nau8825_sema_acquire(struct nau8825 *nau8825, long timeout)
256{ 234{
257 int ret; 235 int ret;
258 236
259 if (timeout) 237 if (timeout) {
260 ret = down_timeout(&nau8825->xtalk_sem, timeout); 238 ret = down_timeout(&nau8825->xtalk_sem, timeout);
261 else 239 if (ret < 0)
240 dev_warn(nau8825->dev, "Acquire semaphone timeout\n");
241 } else {
262 ret = down_interruptible(&nau8825->xtalk_sem); 242 ret = down_interruptible(&nau8825->xtalk_sem);
243 if (ret < 0)
244 dev_warn(nau8825->dev, "Acquire semaphone fail\n");
245 }
263 246
264 if (ret < 0) 247 return ret;
265 dev_warn(nau8825->dev, "Acquire semaphone fail\n");
266} 248}
267 249
268/** 250/**
@@ -1205,6 +1187,8 @@ static int nau8825_hw_params(struct snd_pcm_substream *substream,
1205 struct nau8825 *nau8825 = snd_soc_codec_get_drvdata(codec); 1187 struct nau8825 *nau8825 = snd_soc_codec_get_drvdata(codec);
1206 unsigned int val_len = 0; 1188 unsigned int val_len = 0;
1207 1189
1190 nau8825_sema_acquire(nau8825, 2 * HZ);
1191
1208 switch (params_width(params)) { 1192 switch (params_width(params)) {
1209 case 16: 1193 case 16:
1210 val_len |= NAU8825_I2S_DL_16; 1194 val_len |= NAU8825_I2S_DL_16;
@@ -1225,6 +1209,9 @@ static int nau8825_hw_params(struct snd_pcm_substream *substream,
1225 regmap_update_bits(nau8825->regmap, NAU8825_REG_I2S_PCM_CTRL1, 1209 regmap_update_bits(nau8825->regmap, NAU8825_REG_I2S_PCM_CTRL1,
1226 NAU8825_I2S_DL_MASK, val_len); 1210 NAU8825_I2S_DL_MASK, val_len);
1227 1211
1212 /* Release the semaphone. */
1213 nau8825_sema_release(nau8825);
1214
1228 return 0; 1215 return 0;
1229} 1216}
1230 1217
@@ -1234,6 +1221,8 @@ static int nau8825_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt)
1234 struct nau8825 *nau8825 = snd_soc_codec_get_drvdata(codec); 1221 struct nau8825 *nau8825 = snd_soc_codec_get_drvdata(codec);
1235 unsigned int ctrl1_val = 0, ctrl2_val = 0; 1222 unsigned int ctrl1_val = 0, ctrl2_val = 0;
1236 1223
1224 nau8825_sema_acquire(nau8825, 2 * HZ);
1225
1237 switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { 1226 switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
1238 case SND_SOC_DAIFMT_CBM_CFM: 1227 case SND_SOC_DAIFMT_CBM_CFM:
1239 ctrl2_val |= NAU8825_I2S_MS_MASTER; 1228 ctrl2_val |= NAU8825_I2S_MS_MASTER;
@@ -1282,6 +1271,9 @@ static int nau8825_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt)
1282 regmap_update_bits(nau8825->regmap, NAU8825_REG_I2S_PCM_CTRL2, 1271 regmap_update_bits(nau8825->regmap, NAU8825_REG_I2S_PCM_CTRL2,
1283 NAU8825_I2S_MS_MASK, ctrl2_val); 1272 NAU8825_I2S_MS_MASK, ctrl2_val);
1284 1273
1274 /* Release the semaphone. */
1275 nau8825_sema_release(nau8825);
1276
1285 return 0; 1277 return 0;
1286} 1278}
1287 1279
@@ -1611,8 +1603,11 @@ static irqreturn_t nau8825_interrupt(int irq, void *data)
1611 * cess and restore changes if process 1603 * cess and restore changes if process
1612 * is ongoing when ejection. 1604 * is ongoing when ejection.
1613 */ 1605 */
1606 int ret;
1614 nau8825->xtalk_protect = true; 1607 nau8825->xtalk_protect = true;
1615 nau8825_sema_acquire(nau8825, 0); 1608 ret = nau8825_sema_acquire(nau8825, 0);
1609 if (ret < 0)
1610 nau8825->xtalk_protect = false;
1616 } 1611 }
1617 /* Startup cross talk detection process */ 1612 /* Startup cross talk detection process */
1618 nau8825->xtalk_state = NAU8825_XTALK_PREPARE; 1613 nau8825->xtalk_state = NAU8825_XTALK_PREPARE;
@@ -2238,23 +2233,14 @@ static int __maybe_unused nau8825_suspend(struct snd_soc_codec *codec)
2238static int __maybe_unused nau8825_resume(struct snd_soc_codec *codec) 2233static int __maybe_unused nau8825_resume(struct snd_soc_codec *codec)
2239{ 2234{
2240 struct nau8825 *nau8825 = snd_soc_codec_get_drvdata(codec); 2235 struct nau8825 *nau8825 = snd_soc_codec_get_drvdata(codec);
2236 int ret;
2241 2237
2242 regcache_cache_only(nau8825->regmap, false); 2238 regcache_cache_only(nau8825->regmap, false);
2243 regcache_sync(nau8825->regmap); 2239 regcache_sync(nau8825->regmap);
2244 if (nau8825_is_jack_inserted(nau8825->regmap)) { 2240 nau8825->xtalk_protect = true;
2245 /* If the jack is inserted, we need to check whether the play- 2241 ret = nau8825_sema_acquire(nau8825, 0);
2246 * back is active before suspend. If active, the driver has to 2242 if (ret < 0)
2247 * raise the protection for cross talk function to avoid the 2243 nau8825->xtalk_protect = false;
2248 * playback recovers before cross talk process finish. Other-
2249 * wise, the playback will be interfered by cross talk func-
2250 * tion. It is better to apply hardware related parameters
2251 * before starting playback or record.
2252 */
2253 if (nau8825_dai_is_active(nau8825)) {
2254 nau8825->xtalk_protect = true;
2255 nau8825_sema_acquire(nau8825, 0);
2256 }
2257 }
2258 enable_irq(nau8825->irq); 2244 enable_irq(nau8825->irq);
2259 2245
2260 return 0; 2246 return 0;
diff --git a/sound/soc/codecs/wm2000.c b/sound/soc/codecs/wm2000.c
index a67ea10f41a1..f2664396be6f 100644
--- a/sound/soc/codecs/wm2000.c
+++ b/sound/soc/codecs/wm2000.c
@@ -581,7 +581,7 @@ static int wm2000_anc_transition(struct wm2000_priv *wm2000,
581 if (anc_transitions[i].dest == ANC_OFF) 581 if (anc_transitions[i].dest == ANC_OFF)
582 clk_disable_unprepare(wm2000->mclk); 582 clk_disable_unprepare(wm2000->mclk);
583 583
584 return ret; 584 return 0;
585} 585}
586 586
587static int wm2000_anc_set_mode(struct wm2000_priv *wm2000) 587static int wm2000_anc_set_mode(struct wm2000_priv *wm2000)
diff --git a/sound/soc/generic/Makefile b/sound/soc/generic/Makefile
index 45602ca8536e..2d53c8d70705 100644
--- a/sound/soc/generic/Makefile
+++ b/sound/soc/generic/Makefile
@@ -1,5 +1,5 @@
1obj-$(CONFIG_SND_SIMPLE_CARD_UTILS) := simple-card-utils.o 1snd-soc-simple-card-utils-objs := simple-card-utils.o
2
3snd-soc-simple-card-objs := simple-card.o 2snd-soc-simple-card-objs := simple-card.o
4 3
5obj-$(CONFIG_SND_SIMPLE_CARD) += snd-soc-simple-card.o 4obj-$(CONFIG_SND_SIMPLE_CARD_UTILS) += snd-soc-simple-card-utils.o
5obj-$(CONFIG_SND_SIMPLE_CARD) += snd-soc-simple-card.o
diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c
index d89a9a1b2471..9599de69a880 100644
--- a/sound/soc/generic/simple-card-utils.c
+++ b/sound/soc/generic/simple-card-utils.c
@@ -7,6 +7,7 @@
7 * it under the terms of the GNU General Public License version 2 as 7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9 */ 9 */
10#include <linux/module.h>
10#include <linux/of.h> 11#include <linux/of.h>
11#include <sound/simple_card_utils.h> 12#include <sound/simple_card_utils.h>
12 13
@@ -95,3 +96,8 @@ int asoc_simple_card_parse_card_name(struct snd_soc_card *card,
95 return 0; 96 return 0;
96} 97}
97EXPORT_SYMBOL_GPL(asoc_simple_card_parse_card_name); 98EXPORT_SYMBOL_GPL(asoc_simple_card_parse_card_name);
99
100/* Module information */
101MODULE_AUTHOR("Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>");
102MODULE_DESCRIPTION("ALSA SoC Simple Card Utils");
103MODULE_LICENSE("GPL v2");
diff --git a/sound/soc/intel/skylake/skl-sst-utils.c b/sound/soc/intel/skylake/skl-sst-utils.c
index 25fcb796bd86..ddcb52a51854 100644
--- a/sound/soc/intel/skylake/skl-sst-utils.c
+++ b/sound/soc/intel/skylake/skl-sst-utils.c
@@ -123,6 +123,11 @@ int snd_skl_get_module_info(struct skl_sst *ctx, u8 *uuid,
123 123
124 uuid_mod = (uuid_le *)uuid; 124 uuid_mod = (uuid_le *)uuid;
125 125
126 if (list_empty(&ctx->uuid_list)) {
127 dev_err(ctx->dev, "Module list is empty\n");
128 return -EINVAL;
129 }
130
126 list_for_each_entry(module, &ctx->uuid_list, list) { 131 list_for_each_entry(module, &ctx->uuid_list, list) {
127 if (uuid_le_cmp(*uuid_mod, module->uuid) == 0) { 132 if (uuid_le_cmp(*uuid_mod, module->uuid) == 0) {
128 dfw_config->module_id = module->id; 133 dfw_config->module_id = module->id;
diff --git a/sound/soc/intel/skylake/skl.c b/sound/soc/intel/skylake/skl.c
index cd59536a761d..e3e764167765 100644
--- a/sound/soc/intel/skylake/skl.c
+++ b/sound/soc/intel/skylake/skl.c
@@ -672,8 +672,10 @@ static int skl_probe(struct pci_dev *pci,
672 672
673 skl->nhlt = skl_nhlt_init(bus->dev); 673 skl->nhlt = skl_nhlt_init(bus->dev);
674 674
675 if (skl->nhlt == NULL) 675 if (skl->nhlt == NULL) {
676 err = -ENODEV;
676 goto out_free; 677 goto out_free;
678 }
677 679
678 skl_nhlt_update_topology_bin(skl); 680 skl_nhlt_update_topology_bin(skl);
679 681
diff --git a/sound/soc/omap/omap-abe-twl6040.c b/sound/soc/omap/omap-abe-twl6040.c
index 0843a68f277c..f61b3b58083b 100644
--- a/sound/soc/omap/omap-abe-twl6040.c
+++ b/sound/soc/omap/omap-abe-twl6040.c
@@ -38,10 +38,10 @@
38struct abe_twl6040 { 38struct abe_twl6040 {
39 int jack_detection; /* board can detect jack events */ 39 int jack_detection; /* board can detect jack events */
40 int mclk_freq; /* MCLK frequency speed for twl6040 */ 40 int mclk_freq; /* MCLK frequency speed for twl6040 */
41
42 struct platform_device *dmic_codec_dev;
43}; 41};
44 42
43struct platform_device *dmic_codec_dev;
44
45static int omap_abe_hw_params(struct snd_pcm_substream *substream, 45static int omap_abe_hw_params(struct snd_pcm_substream *substream,
46 struct snd_pcm_hw_params *params) 46 struct snd_pcm_hw_params *params)
47{ 47{
@@ -258,8 +258,6 @@ static int omap_abe_probe(struct platform_device *pdev)
258 if (priv == NULL) 258 if (priv == NULL)
259 return -ENOMEM; 259 return -ENOMEM;
260 260
261 priv->dmic_codec_dev = ERR_PTR(-EINVAL);
262
263 if (snd_soc_of_parse_card_name(card, "ti,model")) { 261 if (snd_soc_of_parse_card_name(card, "ti,model")) {
264 dev_err(&pdev->dev, "Card name is not provided\n"); 262 dev_err(&pdev->dev, "Card name is not provided\n");
265 return -ENODEV; 263 return -ENODEV;
@@ -284,13 +282,6 @@ static int omap_abe_probe(struct platform_device *pdev)
284 num_links = 2; 282 num_links = 2;
285 abe_twl6040_dai_links[1].cpu_of_node = dai_node; 283 abe_twl6040_dai_links[1].cpu_of_node = dai_node;
286 abe_twl6040_dai_links[1].platform_of_node = dai_node; 284 abe_twl6040_dai_links[1].platform_of_node = dai_node;
287
288 priv->dmic_codec_dev = platform_device_register_simple(
289 "dmic-codec", -1, NULL, 0);
290 if (IS_ERR(priv->dmic_codec_dev)) {
291 dev_err(&pdev->dev, "Can't instantiate dmic-codec\n");
292 return PTR_ERR(priv->dmic_codec_dev);
293 }
294 } else { 285 } else {
295 num_links = 1; 286 num_links = 1;
296 } 287 }
@@ -299,16 +290,14 @@ static int omap_abe_probe(struct platform_device *pdev)
299 of_property_read_u32(node, "ti,mclk-freq", &priv->mclk_freq); 290 of_property_read_u32(node, "ti,mclk-freq", &priv->mclk_freq);
300 if (!priv->mclk_freq) { 291 if (!priv->mclk_freq) {
301 dev_err(&pdev->dev, "MCLK frequency not provided\n"); 292 dev_err(&pdev->dev, "MCLK frequency not provided\n");
302 ret = -EINVAL; 293 return -EINVAL;
303 goto err_unregister;
304 } 294 }
305 295
306 card->fully_routed = 1; 296 card->fully_routed = 1;
307 297
308 if (!priv->mclk_freq) { 298 if (!priv->mclk_freq) {
309 dev_err(&pdev->dev, "MCLK frequency missing\n"); 299 dev_err(&pdev->dev, "MCLK frequency missing\n");
310 ret = -ENODEV; 300 return -ENODEV;
311 goto err_unregister;
312 } 301 }
313 302
314 card->dai_link = abe_twl6040_dai_links; 303 card->dai_link = abe_twl6040_dai_links;
@@ -317,17 +306,9 @@ static int omap_abe_probe(struct platform_device *pdev)
317 snd_soc_card_set_drvdata(card, priv); 306 snd_soc_card_set_drvdata(card, priv);
318 307
319 ret = snd_soc_register_card(card); 308 ret = snd_soc_register_card(card);
320 if (ret) { 309 if (ret)
321 dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n", 310 dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n",
322 ret); 311 ret);
323 goto err_unregister;
324 }
325
326 return 0;
327
328err_unregister:
329 if (!IS_ERR(priv->dmic_codec_dev))
330 platform_device_unregister(priv->dmic_codec_dev);
331 312
332 return ret; 313 return ret;
333} 314}
@@ -335,13 +316,9 @@ err_unregister:
335static int omap_abe_remove(struct platform_device *pdev) 316static int omap_abe_remove(struct platform_device *pdev)
336{ 317{
337 struct snd_soc_card *card = platform_get_drvdata(pdev); 318 struct snd_soc_card *card = platform_get_drvdata(pdev);
338 struct abe_twl6040 *priv = snd_soc_card_get_drvdata(card);
339 319
340 snd_soc_unregister_card(card); 320 snd_soc_unregister_card(card);
341 321
342 if (!IS_ERR(priv->dmic_codec_dev))
343 platform_device_unregister(priv->dmic_codec_dev);
344
345 return 0; 322 return 0;
346} 323}
347 324
@@ -361,7 +338,33 @@ static struct platform_driver omap_abe_driver = {
361 .remove = omap_abe_remove, 338 .remove = omap_abe_remove,
362}; 339};
363 340
364module_platform_driver(omap_abe_driver); 341static int __init omap_abe_init(void)
342{
343 int ret;
344
345 dmic_codec_dev = platform_device_register_simple("dmic-codec", -1, NULL,
346 0);
347 if (IS_ERR(dmic_codec_dev)) {
348 pr_err("%s: dmic-codec device registration failed\n", __func__);
349 return PTR_ERR(dmic_codec_dev);
350 }
351
352 ret = platform_driver_register(&omap_abe_driver);
353 if (ret) {
354 pr_err("%s: platform driver registration failed\n", __func__);
355 platform_device_unregister(dmic_codec_dev);
356 }
357
358 return ret;
359}
360module_init(omap_abe_init);
361
362static void __exit omap_abe_exit(void)
363{
364 platform_driver_unregister(&omap_abe_driver);
365 platform_device_unregister(dmic_codec_dev);
366}
367module_exit(omap_abe_exit);
365 368
366MODULE_AUTHOR("Misael Lopez Cruz <misael.lopez@ti.com>"); 369MODULE_AUTHOR("Misael Lopez Cruz <misael.lopez@ti.com>");
367MODULE_DESCRIPTION("ALSA SoC for OMAP boards with ABE and twl6040 codec"); 370MODULE_DESCRIPTION("ALSA SoC for OMAP boards with ABE and twl6040 codec");
diff --git a/sound/soc/omap/omap-mcpdm.c b/sound/soc/omap/omap-mcpdm.c
index e7cdc51fd806..64609c77a79d 100644
--- a/sound/soc/omap/omap-mcpdm.c
+++ b/sound/soc/omap/omap-mcpdm.c
@@ -31,7 +31,6 @@
31#include <linux/err.h> 31#include <linux/err.h>
32#include <linux/io.h> 32#include <linux/io.h>
33#include <linux/irq.h> 33#include <linux/irq.h>
34#include <linux/clk.h>
35#include <linux/slab.h> 34#include <linux/slab.h>
36#include <linux/pm_runtime.h> 35#include <linux/pm_runtime.h>
37#include <linux/of_device.h> 36#include <linux/of_device.h>
@@ -55,7 +54,6 @@ struct omap_mcpdm {
55 unsigned long phys_base; 54 unsigned long phys_base;
56 void __iomem *io_base; 55 void __iomem *io_base;
57 int irq; 56 int irq;
58 struct clk *pdmclk;
59 57
60 struct mutex mutex; 58 struct mutex mutex;
61 59
@@ -390,15 +388,14 @@ static int omap_mcpdm_probe(struct snd_soc_dai *dai)
390 struct omap_mcpdm *mcpdm = snd_soc_dai_get_drvdata(dai); 388 struct omap_mcpdm *mcpdm = snd_soc_dai_get_drvdata(dai);
391 int ret; 389 int ret;
392 390
393 clk_prepare_enable(mcpdm->pdmclk);
394 pm_runtime_enable(mcpdm->dev); 391 pm_runtime_enable(mcpdm->dev);
395 392
396 /* Disable lines while request is ongoing */ 393 /* Disable lines while request is ongoing */
397 pm_runtime_get_sync(mcpdm->dev); 394 pm_runtime_get_sync(mcpdm->dev);
398 omap_mcpdm_write(mcpdm, MCPDM_REG_CTRL, 0x00); 395 omap_mcpdm_write(mcpdm, MCPDM_REG_CTRL, 0x00);
399 396
400 ret = devm_request_irq(mcpdm->dev, mcpdm->irq, omap_mcpdm_irq_handler, 397 ret = request_irq(mcpdm->irq, omap_mcpdm_irq_handler, 0, "McPDM",
401 0, "McPDM", (void *)mcpdm); 398 (void *)mcpdm);
402 399
403 pm_runtime_put_sync(mcpdm->dev); 400 pm_runtime_put_sync(mcpdm->dev);
404 401
@@ -423,9 +420,9 @@ static int omap_mcpdm_remove(struct snd_soc_dai *dai)
423{ 420{
424 struct omap_mcpdm *mcpdm = snd_soc_dai_get_drvdata(dai); 421 struct omap_mcpdm *mcpdm = snd_soc_dai_get_drvdata(dai);
425 422
423 free_irq(mcpdm->irq, (void *)mcpdm);
426 pm_runtime_disable(mcpdm->dev); 424 pm_runtime_disable(mcpdm->dev);
427 425
428 clk_disable_unprepare(mcpdm->pdmclk);
429 return 0; 426 return 0;
430} 427}
431 428
@@ -445,8 +442,6 @@ static int omap_mcpdm_suspend(struct snd_soc_dai *dai)
445 mcpdm->pm_active_count++; 442 mcpdm->pm_active_count++;
446 } 443 }
447 444
448 clk_disable_unprepare(mcpdm->pdmclk);
449
450 return 0; 445 return 0;
451} 446}
452 447
@@ -454,8 +449,6 @@ static int omap_mcpdm_resume(struct snd_soc_dai *dai)
454{ 449{
455 struct omap_mcpdm *mcpdm = snd_soc_dai_get_drvdata(dai); 450 struct omap_mcpdm *mcpdm = snd_soc_dai_get_drvdata(dai);
456 451
457 clk_prepare_enable(mcpdm->pdmclk);
458
459 if (mcpdm->pm_active_count) { 452 if (mcpdm->pm_active_count) {
460 while (mcpdm->pm_active_count--) 453 while (mcpdm->pm_active_count--)
461 pm_runtime_get_sync(mcpdm->dev); 454 pm_runtime_get_sync(mcpdm->dev);
@@ -549,15 +542,6 @@ static int asoc_mcpdm_probe(struct platform_device *pdev)
549 542
550 mcpdm->dev = &pdev->dev; 543 mcpdm->dev = &pdev->dev;
551 544
552 mcpdm->pdmclk = devm_clk_get(&pdev->dev, "pdmclk");
553 if (IS_ERR(mcpdm->pdmclk)) {
554 if (PTR_ERR(mcpdm->pdmclk) == -EPROBE_DEFER)
555 return -EPROBE_DEFER;
556 dev_warn(&pdev->dev, "Error getting pdmclk (%ld)!\n",
557 PTR_ERR(mcpdm->pdmclk));
558 mcpdm->pdmclk = NULL;
559 }
560
561 ret = devm_snd_soc_register_component(&pdev->dev, 545 ret = devm_snd_soc_register_component(&pdev->dev,
562 &omap_mcpdm_component, 546 &omap_mcpdm_component,
563 &omap_mcpdm_dai, 1); 547 &omap_mcpdm_dai, 1);
diff --git a/sound/soc/samsung/s3c24xx_uda134x.c b/sound/soc/samsung/s3c24xx_uda134x.c
index 50849e137fc0..92e88bca386e 100644
--- a/sound/soc/samsung/s3c24xx_uda134x.c
+++ b/sound/soc/samsung/s3c24xx_uda134x.c
@@ -58,10 +58,12 @@ static struct platform_device *s3c24xx_uda134x_snd_device;
58 58
59static int s3c24xx_uda134x_startup(struct snd_pcm_substream *substream) 59static int s3c24xx_uda134x_startup(struct snd_pcm_substream *substream)
60{ 60{
61 int ret = 0; 61 struct snd_soc_pcm_runtime *rtd = substream->private_data;
62 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
62#ifdef ENFORCE_RATES 63#ifdef ENFORCE_RATES
63 struct snd_pcm_runtime *runtime = substream->runtime; 64 struct snd_pcm_runtime *runtime = substream->runtime;
64#endif 65#endif
66 int ret = 0;
65 67
66 mutex_lock(&clk_lock); 68 mutex_lock(&clk_lock);
67 pr_debug("%s %d\n", __func__, clk_users); 69 pr_debug("%s %d\n", __func__, clk_users);
@@ -71,8 +73,7 @@ static int s3c24xx_uda134x_startup(struct snd_pcm_substream *substream)
71 printk(KERN_ERR "%s cannot get xtal\n", __func__); 73 printk(KERN_ERR "%s cannot get xtal\n", __func__);
72 ret = PTR_ERR(xtal); 74 ret = PTR_ERR(xtal);
73 } else { 75 } else {
74 pclk = clk_get(&s3c24xx_uda134x_snd_device->dev, 76 pclk = clk_get(cpu_dai->dev, "iis");
75 "pclk");
76 if (IS_ERR(pclk)) { 77 if (IS_ERR(pclk)) {
77 printk(KERN_ERR "%s cannot get pclk\n", 78 printk(KERN_ERR "%s cannot get pclk\n",
78 __func__); 79 __func__);
diff --git a/sound/soc/sh/rcar/src.c b/sound/soc/sh/rcar/src.c
index e39f916d0f2f..969a5169de25 100644
--- a/sound/soc/sh/rcar/src.c
+++ b/sound/soc/sh/rcar/src.c
@@ -226,8 +226,12 @@ static void rsnd_src_set_convert_rate(struct rsnd_dai_stream *io,
226 ifscr = 0; 226 ifscr = 0;
227 fsrate = 0; 227 fsrate = 0;
228 if (fin != fout) { 228 if (fin != fout) {
229 u64 n;
230
229 ifscr = 1; 231 ifscr = 1;
230 fsrate = 0x0400000 / fout * fin; 232 n = (u64)0x0400000 * fin;
233 do_div(n, fout);
234 fsrate = n;
231 } 235 }
232 236
233 /* 237 /*
diff --git a/sound/soc/soc-compress.c b/sound/soc/soc-compress.c
index d2df46c14c68..bf7b52fce597 100644
--- a/sound/soc/soc-compress.c
+++ b/sound/soc/soc-compress.c
@@ -121,7 +121,7 @@ static int soc_compr_open_fe(struct snd_compr_stream *cstream)
121 121
122 dpcm_be_disconnect(fe, stream); 122 dpcm_be_disconnect(fe, stream);
123 fe->dpcm[stream].runtime = NULL; 123 fe->dpcm[stream].runtime = NULL;
124 goto fe_err; 124 goto path_err;
125 } 125 }
126 126
127 dpcm_clear_pending_state(fe, stream); 127 dpcm_clear_pending_state(fe, stream);
@@ -136,6 +136,8 @@ static int soc_compr_open_fe(struct snd_compr_stream *cstream)
136 136
137 return 0; 137 return 0;
138 138
139path_err:
140 dpcm_path_put(&list);
139fe_err: 141fe_err:
140 if (fe->dai_link->compr_ops && fe->dai_link->compr_ops->shutdown) 142 if (fe->dai_link->compr_ops && fe->dai_link->compr_ops->shutdown)
141 fe->dai_link->compr_ops->shutdown(cstream); 143 fe->dai_link->compr_ops->shutdown(cstream);
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 16369cad4803..4afa8dba5e98 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1056,7 +1056,7 @@ static int soc_bind_dai_link(struct snd_soc_card *card,
1056 if (!rtd->platform) { 1056 if (!rtd->platform) {
1057 dev_err(card->dev, "ASoC: platform %s not registered\n", 1057 dev_err(card->dev, "ASoC: platform %s not registered\n",
1058 dai_link->platform_name); 1058 dai_link->platform_name);
1059 return -EPROBE_DEFER; 1059 goto _err_defer;
1060 } 1060 }
1061 1061
1062 soc_add_pcm_runtime(card, rtd); 1062 soc_add_pcm_runtime(card, rtd);
@@ -2083,14 +2083,13 @@ static int soc_cleanup_card_resources(struct snd_soc_card *card)
2083 /* remove auxiliary devices */ 2083 /* remove auxiliary devices */
2084 soc_remove_aux_devices(card); 2084 soc_remove_aux_devices(card);
2085 2085
2086 snd_soc_dapm_free(&card->dapm);
2086 soc_cleanup_card_debugfs(card); 2087 soc_cleanup_card_debugfs(card);
2087 2088
2088 /* remove the card */ 2089 /* remove the card */
2089 if (card->remove) 2090 if (card->remove)
2090 card->remove(card); 2091 card->remove(card);
2091 2092
2092 snd_soc_dapm_free(&card->dapm);
2093
2094 snd_card_free(card->snd_card); 2093 snd_card_free(card->snd_card);
2095 return 0; 2094 return 0;
2096 2095
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 8698c26773b3..d908ff8f9755 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -3493,6 +3493,7 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w,
3493 const struct snd_soc_pcm_stream *config = w->params + w->params_select; 3493 const struct snd_soc_pcm_stream *config = w->params + w->params_select;
3494 struct snd_pcm_substream substream; 3494 struct snd_pcm_substream substream;
3495 struct snd_pcm_hw_params *params = NULL; 3495 struct snd_pcm_hw_params *params = NULL;
3496 struct snd_pcm_runtime *runtime = NULL;
3496 u64 fmt; 3497 u64 fmt;
3497 int ret; 3498 int ret;
3498 3499
@@ -3541,6 +3542,14 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w,
3541 3542
3542 memset(&substream, 0, sizeof(substream)); 3543 memset(&substream, 0, sizeof(substream));
3543 3544
3545 /* Allocate a dummy snd_pcm_runtime for startup() and other ops() */
3546 runtime = kzalloc(sizeof(*runtime), GFP_KERNEL);
3547 if (!runtime) {
3548 ret = -ENOMEM;
3549 goto out;
3550 }
3551 substream.runtime = runtime;
3552
3544 switch (event) { 3553 switch (event) {
3545 case SND_SOC_DAPM_PRE_PMU: 3554 case SND_SOC_DAPM_PRE_PMU:
3546 substream.stream = SNDRV_PCM_STREAM_CAPTURE; 3555 substream.stream = SNDRV_PCM_STREAM_CAPTURE;
@@ -3606,6 +3615,7 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w,
3606 } 3615 }
3607 3616
3608out: 3617out:
3618 kfree(runtime);
3609 kfree(params); 3619 kfree(params);
3610 return ret; 3620 return ret;
3611} 3621}