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.c6
-rw-r--r--sound/soc/fsl/mpc5200_dma.c17
-rw-r--r--sound/soc/fsl/mpc8610_hpcd.c18
-rw-r--r--sound/soc/fsl/p1022_ds.c36
5 files changed, 31 insertions, 56 deletions
diff --git a/sound/soc/fsl/fsl_dma.c b/sound/soc/fsl/fsl_dma.c
index 4f59bbaba48f..96bb92dd174c 100644
--- a/sound/soc/fsl/fsl_dma.c
+++ b/sound/soc/fsl/fsl_dma.c
@@ -311,23 +311,23 @@ static int fsl_dma_new(struct snd_soc_pcm_runtime *rtd)
311 * should allocate a DMA buffer only for the streams that are valid. 311 * should allocate a DMA buffer only for the streams that are valid.
312 */ 312 */
313 313
314 if (pcm->streams[0].substream) { 314 if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) {
315 ret = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, card->dev, 315 ret = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, card->dev,
316 fsl_dma_hardware.buffer_bytes_max, 316 fsl_dma_hardware.buffer_bytes_max,
317 &pcm->streams[0].substream->dma_buffer); 317 &pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream->dma_buffer);
318 if (ret) { 318 if (ret) {
319 dev_err(card->dev, "can't alloc playback dma buffer\n"); 319 dev_err(card->dev, "can't alloc playback dma buffer\n");
320 return ret; 320 return ret;
321 } 321 }
322 } 322 }
323 323
324 if (pcm->streams[1].substream) { 324 if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) {
325 ret = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, card->dev, 325 ret = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, card->dev,
326 fsl_dma_hardware.buffer_bytes_max, 326 fsl_dma_hardware.buffer_bytes_max,
327 &pcm->streams[1].substream->dma_buffer); 327 &pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream->dma_buffer);
328 if (ret) { 328 if (ret) {
329 dev_err(card->dev, "can't alloc capture dma buffer\n"); 329 dev_err(card->dev, "can't alloc capture dma buffer\n");
330 snd_dma_free_pages(&pcm->streams[0].substream->dma_buffer); 330 snd_dma_free_pages(&pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream->dma_buffer);
331 return ret; 331 return ret;
332 } 332 }
333 } 333 }
diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
index 3e066966d878..2eb407fa3b48 100644
--- a/sound/soc/fsl/fsl_ssi.c
+++ b/sound/soc/fsl/fsl_ssi.c
@@ -716,12 +716,12 @@ static int __devinit fsl_ssi_probe(struct platform_device *pdev)
716 } 716 }
717 717
718 /* Trigger the machine driver's probe function. The platform driver 718 /* Trigger the machine driver's probe function. The platform driver
719 * name of the machine driver is taken from the /model property of the 719 * name of the machine driver is taken from /compatible property of the
720 * device tree. We also pass the address of the CPU DAI driver 720 * device tree. We also pass the address of the CPU DAI driver
721 * structure. 721 * structure.
722 */ 722 */
723 sprop = of_get_property(of_find_node_by_path("/"), "model", NULL); 723 sprop = of_get_property(of_find_node_by_path("/"), "compatible", NULL);
724 /* Sometimes the model name has a "fsl," prefix, so we strip that. */ 724 /* Sometimes the compatible name has a "fsl," prefix, so we strip it. */
725 p = strrchr(sprop, ','); 725 p = strrchr(sprop, ',');
726 if (p) 726 if (p)
727 sprop = p + 1; 727 sprop = p + 1;
diff --git a/sound/soc/fsl/mpc5200_dma.c b/sound/soc/fsl/mpc5200_dma.c
index e7803d34c425..9a3f7c5ab687 100644
--- a/sound/soc/fsl/mpc5200_dma.c
+++ b/sound/soc/fsl/mpc5200_dma.c
@@ -8,6 +8,7 @@
8 8
9#include <linux/module.h> 9#include <linux/module.h>
10#include <linux/of_device.h> 10#include <linux/of_device.h>
11#include <linux/dma-mapping.h>
11#include <linux/slab.h> 12#include <linux/slab.h>
12#include <linux/of_platform.h> 13#include <linux/of_platform.h>
13 14
@@ -298,7 +299,7 @@ static struct snd_pcm_ops psc_dma_ops = {
298 .hw_params = psc_dma_hw_params, 299 .hw_params = psc_dma_hw_params,
299}; 300};
300 301
301static u64 psc_dma_dmamask = 0xffffffff; 302static u64 psc_dma_dmamask = DMA_BIT_MASK(32);
302static int psc_dma_new(struct snd_soc_pcm_runtime *rtd) 303static int psc_dma_new(struct snd_soc_pcm_runtime *rtd)
303{ 304{
304 struct snd_card *card = rtd->card->snd_card; 305 struct snd_card *card = rtd->card->snd_card;
@@ -314,18 +315,18 @@ static int psc_dma_new(struct snd_soc_pcm_runtime *rtd)
314 if (!card->dev->dma_mask) 315 if (!card->dev->dma_mask)
315 card->dev->dma_mask = &psc_dma_dmamask; 316 card->dev->dma_mask = &psc_dma_dmamask;
316 if (!card->dev->coherent_dma_mask) 317 if (!card->dev->coherent_dma_mask)
317 card->dev->coherent_dma_mask = 0xffffffff; 318 card->dev->coherent_dma_mask = DMA_BIT_MASK(32);
318 319
319 if (pcm->streams[0].substream) { 320 if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) {
320 rc = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, pcm->card->dev, 321 rc = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, pcm->card->dev,
321 size, &pcm->streams[0].substream->dma_buffer); 322 size, &pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream->dma_buffer);
322 if (rc) 323 if (rc)
323 goto playback_alloc_err; 324 goto playback_alloc_err;
324 } 325 }
325 326
326 if (pcm->streams[1].substream) { 327 if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) {
327 rc = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, pcm->card->dev, 328 rc = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, pcm->card->dev,
328 size, &pcm->streams[1].substream->dma_buffer); 329 size, &pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream->dma_buffer);
329 if (rc) 330 if (rc)
330 goto capture_alloc_err; 331 goto capture_alloc_err;
331 } 332 }
@@ -336,8 +337,8 @@ static int psc_dma_new(struct snd_soc_pcm_runtime *rtd)
336 return 0; 337 return 0;
337 338
338 capture_alloc_err: 339 capture_alloc_err:
339 if (pcm->streams[0].substream) 340 if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream)
340 snd_dma_free_pages(&pcm->streams[0].substream->dma_buffer); 341 snd_dma_free_pages(&pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream->dma_buffer);
341 342
342 playback_alloc_err: 343 playback_alloc_err:
343 dev_err(card->dev, "Cannot allocate buffer(s)\n"); 344 dev_err(card->dev, "Cannot allocate buffer(s)\n");
diff --git a/sound/soc/fsl/mpc8610_hpcd.c b/sound/soc/fsl/mpc8610_hpcd.c
index 0ea4a5a96e06..afbabf427f27 100644
--- a/sound/soc/fsl/mpc8610_hpcd.c
+++ b/sound/soc/fsl/mpc8610_hpcd.c
@@ -245,7 +245,7 @@ static int get_parent_cell_index(struct device_node *np)
245 * 'struct device' It's ugly and hackish, but it works. 245 * 'struct device' It's ugly and hackish, but it works.
246 * 246 *
247 * The dev_name for such devices include the bus number and I2C address. For 247 * The dev_name for such devices include the bus number and I2C address. For
248 * example, "cs4270-codec.0-004f". 248 * example, "cs4270.0-004f".
249 */ 249 */
250static int codec_node_dev_name(struct device_node *np, char *buf, size_t len) 250static int codec_node_dev_name(struct device_node *np, char *buf, size_t len)
251{ 251{
@@ -267,13 +267,13 @@ static int codec_node_dev_name(struct device_node *np, char *buf, size_t len)
267 if (!i2c) 267 if (!i2c)
268 return -ENODEV; 268 return -ENODEV;
269 269
270 snprintf(buf, len, "%s-codec.%u-%04x", temp, i2c->adapter->nr, addr); 270 snprintf(buf, len, "%s.%u-%04x", temp, i2c->adapter->nr, addr);
271 271
272 return 0; 272 return 0;
273} 273}
274 274
275static int get_dma_channel(struct device_node *ssi_np, 275static int get_dma_channel(struct device_node *ssi_np,
276 const char *compatible, 276 const char *name,
277 struct snd_soc_dai_link *dai, 277 struct snd_soc_dai_link *dai,
278 unsigned int *dma_channel_id, 278 unsigned int *dma_channel_id,
279 unsigned int *dma_id) 279 unsigned int *dma_id)
@@ -283,7 +283,7 @@ static int get_dma_channel(struct device_node *ssi_np,
283 const u32 *iprop; 283 const u32 *iprop;
284 int ret; 284 int ret;
285 285
286 dma_channel_np = get_node_by_phandle_name(ssi_np, compatible, 286 dma_channel_np = get_node_by_phandle_name(ssi_np, name,
287 "fsl,ssi-dma-channel"); 287 "fsl,ssi-dma-channel");
288 if (!dma_channel_np) 288 if (!dma_channel_np)
289 return -EINVAL; 289 return -EINVAL;
@@ -336,12 +336,8 @@ static int mpc8610_hpcd_probe(struct platform_device *pdev)
336 const char *sprop; 336 const char *sprop;
337 const u32 *iprop; 337 const u32 *iprop;
338 338
339 /* We are only interested in SSIs with a codec phandle in them, 339 /* Find the codec node for this SSI. */
340 * so let's make sure this SSI has one. The MPC8610 HPCD only 340 codec_np = of_parse_phandle(np, "codec-handle", 0);
341 * knows about the CS4270 codec, so reject anything else.
342 */
343 codec_np = get_node_by_phandle_name(np, "codec-handle",
344 "cirrus,cs4270");
345 if (!codec_np) { 341 if (!codec_np) {
346 dev_err(dev, "invalid codec node\n"); 342 dev_err(dev, "invalid codec node\n");
347 return -EINVAL; 343 return -EINVAL;
@@ -550,7 +546,7 @@ static struct platform_driver mpc8610_hpcd_driver = {
550 .probe = mpc8610_hpcd_probe, 546 .probe = mpc8610_hpcd_probe,
551 .remove = __devexit_p(mpc8610_hpcd_remove), 547 .remove = __devexit_p(mpc8610_hpcd_remove),
552 .driver = { 548 .driver = {
553 /* The name must match the 'model' property in the device tree, 549 /* The name must match 'compatible' property in the device tree,
554 * in lowercase letters. 550 * in lowercase letters.
555 */ 551 */
556 .name = "snd-soc-mpc8610hpcd", 552 .name = "snd-soc-mpc8610hpcd",
diff --git a/sound/soc/fsl/p1022_ds.c b/sound/soc/fsl/p1022_ds.c
index a5d4e80a9cf4..b88987083475 100644
--- a/sound/soc/fsl/p1022_ds.c
+++ b/sound/soc/fsl/p1022_ds.c
@@ -276,7 +276,7 @@ static int codec_node_dev_name(struct device_node *np, char *buf, size_t len)
276} 276}
277 277
278static int get_dma_channel(struct device_node *ssi_np, 278static int get_dma_channel(struct device_node *ssi_np,
279 const char *compatible, 279 const char *name,
280 struct snd_soc_dai_link *dai, 280 struct snd_soc_dai_link *dai,
281 unsigned int *dma_channel_id, 281 unsigned int *dma_channel_id,
282 unsigned int *dma_id) 282 unsigned int *dma_id)
@@ -286,7 +286,7 @@ static int get_dma_channel(struct device_node *ssi_np,
286 const u32 *iprop; 286 const u32 *iprop;
287 int ret; 287 int ret;
288 288
289 dma_channel_np = get_node_by_phandle_name(ssi_np, compatible, 289 dma_channel_np = get_node_by_phandle_name(ssi_np, name,
290 "fsl,ssi-dma-channel"); 290 "fsl,ssi-dma-channel");
291 if (!dma_channel_np) 291 if (!dma_channel_np)
292 return -EINVAL; 292 return -EINVAL;
@@ -543,6 +543,11 @@ static struct platform_driver p1022_ds_driver = {
543 .probe = p1022_ds_probe, 543 .probe = p1022_ds_probe,
544 .remove = __devexit_p(p1022_ds_remove), 544 .remove = __devexit_p(p1022_ds_remove),
545 .driver = { 545 .driver = {
546 /*
547 * The name must match 'compatible' property in the device tree,
548 * in lowercase letters.
549 */
550 .name = "snd-soc-p1022ds",
546 .owner = THIS_MODULE, 551 .owner = THIS_MODULE,
547 }, 552 },
548}; 553};
@@ -556,33 +561,6 @@ static int __init p1022_ds_init(void)
556{ 561{
557 struct device_node *guts_np; 562 struct device_node *guts_np;
558 struct resource res; 563 struct resource res;
559 const char *sprop;
560
561 /*
562 * Check if we're actually running on a P1022DS. Older device trees
563 * have a model of "fsl,P1022" and newer ones use "fsl,P1022DS", so we
564 * need to support both. The SSI driver uses that property to link to
565 * the machine driver, so have to match it.
566 */
567 sprop = of_get_property(of_find_node_by_path("/"), "model", NULL);
568 if (!sprop) {
569 pr_err("snd-soc-p1022ds: missing /model node");
570 return -ENODEV;
571 }
572
573 pr_debug("snd-soc-p1022ds: board model name is %s\n", sprop);
574
575 /*
576 * The name of this board, taken from the device tree. Normally, this is a*
577 * fixed string, but some P1022DS device trees have a /model property of
578 * "fsl,P1022", and others have "fsl,P1022DS".
579 */
580 if (strcasecmp(sprop, "fsl,p1022ds") == 0)
581 p1022_ds_driver.driver.name = "snd-soc-p1022ds";
582 else if (strcasecmp(sprop, "fsl,p1022") == 0)
583 p1022_ds_driver.driver.name = "snd-soc-p1022";
584 else
585 return -ENODEV;
586 564
587 /* Get the physical address of the global utilities registers */ 565 /* Get the physical address of the global utilities registers */
588 guts_np = of_find_compatible_node(NULL, NULL, "fsl,p1022-guts"); 566 guts_np = of_find_compatible_node(NULL, NULL, "fsl,p1022-guts");