aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/fsl
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/fsl')
-rw-r--r--sound/soc/fsl/fsl_dma.c10
-rw-r--r--sound/soc/fsl/fsl_ssi.c10
-rw-r--r--sound/soc/fsl/mpc5200_dma.c15
-rw-r--r--sound/soc/fsl/mpc8610_hpcd.c28
-rw-r--r--sound/soc/fsl/p1022_ds.c14
5 files changed, 45 insertions, 32 deletions
diff --git a/sound/soc/fsl/fsl_dma.c b/sound/soc/fsl/fsl_dma.c
index 6680c0b4d20..cb50598338e 100644
--- a/sound/soc/fsl/fsl_dma.c
+++ b/sound/soc/fsl/fsl_dma.c
@@ -294,9 +294,11 @@ static irqreturn_t fsl_dma_isr(int irq, void *dev_id)
294 * Regardless of where the memory is actually allocated, since the device can 294 * Regardless of where the memory is actually allocated, since the device can
295 * technically DMA to any 36-bit address, we do need to set the DMA mask to 36. 295 * technically DMA to any 36-bit address, we do need to set the DMA mask to 36.
296 */ 296 */
297static int fsl_dma_new(struct snd_card *card, struct snd_soc_dai *dai, 297static int fsl_dma_new(struct snd_soc_pcm_runtime *rtd)
298 struct snd_pcm *pcm)
299{ 298{
299 struct snd_card *card = rtd->card->snd_card;
300 struct snd_soc_dai *dai = rtd->cpu_dai;
301 struct snd_pcm *pcm = rtd->pcm;
300 static u64 fsl_dma_dmamask = DMA_BIT_MASK(36); 302 static u64 fsl_dma_dmamask = DMA_BIT_MASK(36);
301 int ret; 303 int ret;
302 304
@@ -877,10 +879,12 @@ static struct device_node *find_ssi_node(struct device_node *dma_channel_np)
877 * assume that device_node pointers are a valid comparison. 879 * assume that device_node pointers are a valid comparison.
878 */ 880 */
879 np = of_parse_phandle(ssi_np, "fsl,playback-dma", 0); 881 np = of_parse_phandle(ssi_np, "fsl,playback-dma", 0);
882 of_node_put(np);
880 if (np == dma_channel_np) 883 if (np == dma_channel_np)
881 return ssi_np; 884 return ssi_np;
882 885
883 np = of_parse_phandle(ssi_np, "fsl,capture-dma", 0); 886 np = of_parse_phandle(ssi_np, "fsl,capture-dma", 0);
887 of_node_put(np);
884 if (np == dma_channel_np) 888 if (np == dma_channel_np)
885 return ssi_np; 889 return ssi_np;
886 } 890 }
@@ -939,7 +943,7 @@ static int __devinit fsl_soc_dma_probe(struct platform_device *pdev)
939 943
940 iprop = of_get_property(ssi_np, "fsl,fifo-depth", NULL); 944 iprop = of_get_property(ssi_np, "fsl,fifo-depth", NULL);
941 if (iprop) 945 if (iprop)
942 dma->ssi_fifo_depth = *iprop; 946 dma->ssi_fifo_depth = be32_to_cpup(iprop);
943 else 947 else
944 /* Older 8610 DTs didn't have the fifo-depth property */ 948 /* Older 8610 DTs didn't have the fifo-depth property */
945 dma->ssi_fifo_depth = 8; 949 dma->ssi_fifo_depth = 8;
diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
index 313e0ccedd5..672982924f1 100644
--- a/sound/soc/fsl/fsl_ssi.c
+++ b/sound/soc/fsl/fsl_ssi.c
@@ -678,7 +678,12 @@ static int __devinit fsl_ssi_probe(struct platform_device *pdev)
678 kfree(ssi_private); 678 kfree(ssi_private);
679 return ret; 679 return ret;
680 } 680 }
681 ssi_private->ssi = ioremap(res.start, 1 + res.end - res.start); 681 ssi_private->ssi = of_iomap(np, 0);
682 if (!ssi_private->ssi) {
683 dev_err(&pdev->dev, "could not map device resources\n");
684 kfree(ssi_private);
685 return -ENOMEM;
686 }
682 ssi_private->ssi_phys = res.start; 687 ssi_private->ssi_phys = res.start;
683 ssi_private->irq = irq_of_parse_and_map(np, 0); 688 ssi_private->irq = irq_of_parse_and_map(np, 0);
684 689
@@ -691,13 +696,14 @@ static int __devinit fsl_ssi_probe(struct platform_device *pdev)
691 /* Determine the FIFO depth. */ 696 /* Determine the FIFO depth. */
692 iprop = of_get_property(np, "fsl,fifo-depth", NULL); 697 iprop = of_get_property(np, "fsl,fifo-depth", NULL);
693 if (iprop) 698 if (iprop)
694 ssi_private->fifo_depth = *iprop; 699 ssi_private->fifo_depth = be32_to_cpup(iprop);
695 else 700 else
696 /* Older 8610 DTs didn't have the fifo-depth property */ 701 /* Older 8610 DTs didn't have the fifo-depth property */
697 ssi_private->fifo_depth = 8; 702 ssi_private->fifo_depth = 8;
698 703
699 /* Initialize the the device_attribute structure */ 704 /* Initialize the the device_attribute structure */
700 dev_attr = &ssi_private->dev_attr; 705 dev_attr = &ssi_private->dev_attr;
706 sysfs_attr_init(&dev_attr->attr);
701 dev_attr->attr.name = "statistics"; 707 dev_attr->attr.name = "statistics";
702 dev_attr->attr.mode = S_IRUGO; 708 dev_attr->attr.mode = S_IRUGO;
703 dev_attr->show = fsl_sysfs_ssi_show; 709 dev_attr->show = fsl_sysfs_ssi_show;
diff --git a/sound/soc/fsl/mpc5200_dma.c b/sound/soc/fsl/mpc5200_dma.c
index fff695ccdd3..5c6c2457386 100644
--- a/sound/soc/fsl/mpc5200_dma.c
+++ b/sound/soc/fsl/mpc5200_dma.c
@@ -299,10 +299,11 @@ static struct snd_pcm_ops psc_dma_ops = {
299}; 299};
300 300
301static u64 psc_dma_dmamask = 0xffffffff; 301static u64 psc_dma_dmamask = 0xffffffff;
302static int psc_dma_new(struct snd_card *card, struct snd_soc_dai *dai, 302static int psc_dma_new(struct snd_soc_pcm_runtime *rtd)
303 struct snd_pcm *pcm)
304{ 303{
305 struct snd_soc_pcm_runtime *rtd = pcm->private_data; 304 struct snd_card *card = rtd->card->snd_card;
305 struct snd_soc_dai *dai = rtd->cpu_dai;
306 struct snd_pcm *pcm = rtd->pcm;
306 struct psc_dma *psc_dma = snd_soc_dai_get_drvdata(rtd->cpu_dai); 307 struct psc_dma *psc_dma = snd_soc_dai_get_drvdata(rtd->cpu_dai);
307 size_t size = psc_dma_hardware.buffer_bytes_max; 308 size_t size = psc_dma_hardware.buffer_bytes_max;
308 int rc = 0; 309 int rc = 0;
@@ -368,7 +369,7 @@ static struct snd_soc_platform_driver mpc5200_audio_dma_platform = {
368 .pcm_free = &psc_dma_free, 369 .pcm_free = &psc_dma_free,
369}; 370};
370 371
371static int mpc5200_hpcd_probe(struct of_device *op) 372static int mpc5200_hpcd_probe(struct platform_device *op)
372{ 373{
373 phys_addr_t fifo; 374 phys_addr_t fifo;
374 struct psc_dma *psc_dma; 375 struct psc_dma *psc_dma;
@@ -384,7 +385,7 @@ static int mpc5200_hpcd_probe(struct of_device *op)
384 dev_err(&op->dev, "Missing reg property\n"); 385 dev_err(&op->dev, "Missing reg property\n");
385 return -ENODEV; 386 return -ENODEV;
386 } 387 }
387 regs = ioremap(res.start, 1 + res.end - res.start); 388 regs = ioremap(res.start, resource_size(&res));
388 if (!regs) { 389 if (!regs) {
389 dev_err(&op->dev, "Could not map registers\n"); 390 dev_err(&op->dev, "Could not map registers\n");
390 return -ENODEV; 391 return -ENODEV;
@@ -486,7 +487,7 @@ out_unmap:
486 return ret; 487 return ret;
487} 488}
488 489
489static int mpc5200_hpcd_remove(struct of_device *op) 490static int mpc5200_hpcd_remove(struct platform_device *op)
490{ 491{
491 struct psc_dma *psc_dma = dev_get_drvdata(&op->dev); 492 struct psc_dma *psc_dma = dev_get_drvdata(&op->dev);
492 493
@@ -518,7 +519,7 @@ MODULE_DEVICE_TABLE(of, mpc5200_hpcd_match);
518static struct platform_driver mpc5200_hpcd_of_driver = { 519static struct platform_driver mpc5200_hpcd_of_driver = {
519 .probe = mpc5200_hpcd_probe, 520 .probe = mpc5200_hpcd_probe,
520 .remove = mpc5200_hpcd_remove, 521 .remove = mpc5200_hpcd_remove,
521 .dev = { 522 .driver = {
522 .owner = THIS_MODULE, 523 .owner = THIS_MODULE,
523 .name = "mpc5200-pcm-audio", 524 .name = "mpc5200-pcm-audio",
524 .of_match_table = mpc5200_hpcd_match, 525 .of_match_table = mpc5200_hpcd_match,
diff --git a/sound/soc/fsl/mpc8610_hpcd.c b/sound/soc/fsl/mpc8610_hpcd.c
index c16c6b2eff9..358f0baaf71 100644
--- a/sound/soc/fsl/mpc8610_hpcd.c
+++ b/sound/soc/fsl/mpc8610_hpcd.c
@@ -233,7 +233,7 @@ static int get_parent_cell_index(struct device_node *np)
233 if (!iprop) 233 if (!iprop)
234 return -1; 234 return -1;
235 235
236 return *iprop; 236 return be32_to_cpup(iprop);
237} 237}
238 238
239/** 239/**
@@ -258,7 +258,7 @@ static int codec_node_dev_name(struct device_node *np, char *buf, size_t len)
258 if (!iprop) 258 if (!iprop)
259 return -EINVAL; 259 return -EINVAL;
260 260
261 addr = *iprop; 261 addr = be32_to_cpup(iprop);
262 262
263 bus = get_parent_cell_index(np); 263 bus = get_parent_cell_index(np);
264 if (bus < 0) 264 if (bus < 0)
@@ -305,7 +305,7 @@ static int get_dma_channel(struct device_node *ssi_np,
305 return -EINVAL; 305 return -EINVAL;
306 } 306 }
307 307
308 *dma_channel_id = *iprop; 308 *dma_channel_id = be32_to_cpup(iprop);
309 *dma_id = get_parent_cell_index(dma_channel_np); 309 *dma_id = get_parent_cell_index(dma_channel_np);
310 of_node_put(dma_channel_np); 310 of_node_put(dma_channel_np);
311 311
@@ -345,8 +345,10 @@ static int mpc8610_hpcd_probe(struct platform_device *pdev)
345 } 345 }
346 346
347 machine_data = kzalloc(sizeof(struct mpc8610_hpcd_data), GFP_KERNEL); 347 machine_data = kzalloc(sizeof(struct mpc8610_hpcd_data), GFP_KERNEL);
348 if (!machine_data) 348 if (!machine_data) {
349 return -ENOMEM; 349 ret = -ENOMEM;
350 goto error_alloc;
351 }
350 352
351 machine_data->dai[0].cpu_dai_name = dev_name(&ssi_pdev->dev); 353 machine_data->dai[0].cpu_dai_name = dev_name(&ssi_pdev->dev);
352 machine_data->dai[0].ops = &mpc8610_hpcd_ops; 354 machine_data->dai[0].ops = &mpc8610_hpcd_ops;
@@ -379,7 +381,7 @@ static int mpc8610_hpcd_probe(struct platform_device *pdev)
379 ret = -EINVAL; 381 ret = -EINVAL;
380 goto error; 382 goto error;
381 } 383 }
382 machine_data->ssi_id = *iprop; 384 machine_data->ssi_id = be32_to_cpup(iprop);
383 385
384 /* Get the serial format and clock direction. */ 386 /* Get the serial format and clock direction. */
385 sprop = of_get_property(np, "fsl,mode", NULL); 387 sprop = of_get_property(np, "fsl,mode", NULL);
@@ -405,7 +407,7 @@ static int mpc8610_hpcd_probe(struct platform_device *pdev)
405 ret = -EINVAL; 407 ret = -EINVAL;
406 goto error; 408 goto error;
407 } 409 }
408 machine_data->clk_frequency = *iprop; 410 machine_data->clk_frequency = be32_to_cpup(iprop);
409 } else if (strcasecmp(sprop, "i2s-master") == 0) { 411 } else if (strcasecmp(sprop, "i2s-master") == 0) {
410 machine_data->dai_format = SND_SOC_DAIFMT_I2S; 412 machine_data->dai_format = SND_SOC_DAIFMT_I2S;
411 machine_data->codec_clk_direction = SND_SOC_CLOCK_IN; 413 machine_data->codec_clk_direction = SND_SOC_CLOCK_IN;
@@ -494,7 +496,7 @@ static int mpc8610_hpcd_probe(struct platform_device *pdev)
494 ret = platform_device_add(sound_device); 496 ret = platform_device_add(sound_device);
495 if (ret) { 497 if (ret) {
496 dev_err(&pdev->dev, "platform device add failed\n"); 498 dev_err(&pdev->dev, "platform device add failed\n");
497 goto error; 499 goto error_sound;
498 } 500 }
499 dev_set_drvdata(&pdev->dev, sound_device); 501 dev_set_drvdata(&pdev->dev, sound_device);
500 502
@@ -502,14 +504,12 @@ static int mpc8610_hpcd_probe(struct platform_device *pdev)
502 504
503 return 0; 505 return 0;
504 506
507error_sound:
508 platform_device_unregister(sound_device);
505error: 509error:
506 of_node_put(codec_np);
507
508 if (sound_device)
509 platform_device_unregister(sound_device);
510
511 kfree(machine_data); 510 kfree(machine_data);
512 511error_alloc:
512 of_node_put(codec_np);
513 return ret; 513 return ret;
514} 514}
515 515
diff --git a/sound/soc/fsl/p1022_ds.c b/sound/soc/fsl/p1022_ds.c
index 66e0b68af14..fcb862eb0c7 100644
--- a/sound/soc/fsl/p1022_ds.c
+++ b/sound/soc/fsl/p1022_ds.c
@@ -232,7 +232,7 @@ static int get_parent_cell_index(struct device_node *np)
232 232
233 iprop = of_get_property(parent, "cell-index", NULL); 233 iprop = of_get_property(parent, "cell-index", NULL);
234 if (iprop) 234 if (iprop)
235 ret = *iprop; 235 ret = be32_to_cpup(iprop);
236 236
237 of_node_put(parent); 237 of_node_put(parent);
238 238
@@ -261,7 +261,7 @@ static int codec_node_dev_name(struct device_node *np, char *buf, size_t len)
261 if (!iprop) 261 if (!iprop)
262 return -EINVAL; 262 return -EINVAL;
263 263
264 addr = *iprop; 264 addr = be32_to_cpup(iprop);
265 265
266 bus = get_parent_cell_index(np); 266 bus = get_parent_cell_index(np);
267 if (bus < 0) 267 if (bus < 0)
@@ -297,8 +297,10 @@ static int get_dma_channel(struct device_node *ssi_np,
297 * dai->platform name should already point to an allocated buffer. 297 * dai->platform name should already point to an allocated buffer.
298 */ 298 */
299 ret = of_address_to_resource(dma_channel_np, 0, &res); 299 ret = of_address_to_resource(dma_channel_np, 0, &res);
300 if (ret) 300 if (ret) {
301 of_node_put(dma_channel_np);
301 return ret; 302 return ret;
303 }
302 snprintf((char *)dai->platform_name, DAI_NAME_SIZE, "%llx.%s", 304 snprintf((char *)dai->platform_name, DAI_NAME_SIZE, "%llx.%s",
303 (unsigned long long) res.start, dma_channel_np->name); 305 (unsigned long long) res.start, dma_channel_np->name);
304 306
@@ -308,7 +310,7 @@ static int get_dma_channel(struct device_node *ssi_np,
308 return -EINVAL; 310 return -EINVAL;
309 } 311 }
310 312
311 *dma_channel_id = *iprop; 313 *dma_channel_id = be32_to_cpup(iprop);
312 *dma_id = get_parent_cell_index(dma_channel_np); 314 *dma_id = get_parent_cell_index(dma_channel_np);
313 of_node_put(dma_channel_np); 315 of_node_put(dma_channel_np);
314 316
@@ -379,7 +381,7 @@ static int p1022_ds_probe(struct platform_device *pdev)
379 ret = -EINVAL; 381 ret = -EINVAL;
380 goto error; 382 goto error;
381 } 383 }
382 mdata->ssi_id = *iprop; 384 mdata->ssi_id = be32_to_cpup(iprop);
383 385
384 /* Get the serial format and clock direction. */ 386 /* Get the serial format and clock direction. */
385 sprop = of_get_property(np, "fsl,mode", NULL); 387 sprop = of_get_property(np, "fsl,mode", NULL);
@@ -405,7 +407,7 @@ static int p1022_ds_probe(struct platform_device *pdev)
405 ret = -EINVAL; 407 ret = -EINVAL;
406 goto error; 408 goto error;
407 } 409 }
408 mdata->clk_frequency = *iprop; 410 mdata->clk_frequency = be32_to_cpup(iprop);
409 } else if (strcasecmp(sprop, "i2s-master") == 0) { 411 } else if (strcasecmp(sprop, "i2s-master") == 0) {
410 mdata->dai_format = SND_SOC_DAIFMT_I2S; 412 mdata->dai_format = SND_SOC_DAIFMT_I2S;
411 mdata->codec_clk_direction = SND_SOC_CLOCK_IN; 413 mdata->codec_clk_direction = SND_SOC_CLOCK_IN;