aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/fsl
diff options
context:
space:
mode:
authorTimur Tabi <timur@freescale.com>2011-06-08 16:02:55 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2011-06-09 07:02:08 -0400
commit147dfe90f7302f2472d83c25b983420a727aec5a (patch)
treefa9831c366b9b6b9e30f0976895c1855440f3ec0 /sound/soc/fsl
parent995e54f5fe4606043e695cd3327b18fcfc88bc62 (diff)
ASoC: p1022ds: fix incorrect referencing of device tree properties
Device tree integer properties are encoded in big-endian format, but some of the Freescale ASoC drivers were assuming that the host is in big-endian format as well. Although this is true, it's better to use endian-safe accessors. Also add a check for a failed ioremap() call in the SSI driver. Signed-off-by: Timur Tabi <timur@freescale.com> Acked-by: Liam Girdwood <lrg@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/fsl')
-rw-r--r--sound/soc/fsl/fsl_dma.c2
-rw-r--r--sound/soc/fsl/fsl_ssi.c9
-rw-r--r--sound/soc/fsl/mpc8610_hpcd.c10
-rw-r--r--sound/soc/fsl/p1022_ds.c10
4 files changed, 18 insertions, 13 deletions
diff --git a/sound/soc/fsl/fsl_dma.c b/sound/soc/fsl/fsl_dma.c
index 50b5df8c095f..3872598d04aa 100644
--- a/sound/soc/fsl/fsl_dma.c
+++ b/sound/soc/fsl/fsl_dma.c
@@ -940,7 +940,7 @@ static int __devinit fsl_soc_dma_probe(struct platform_device *pdev)
940 940
941 iprop = of_get_property(ssi_np, "fsl,fifo-depth", NULL); 941 iprop = of_get_property(ssi_np, "fsl,fifo-depth", NULL);
942 if (iprop) 942 if (iprop)
943 dma->ssi_fifo_depth = *iprop; 943 dma->ssi_fifo_depth = be32_to_cpup(iprop);
944 else 944 else
945 /* Older 8610 DTs didn't have the fifo-depth property */ 945 /* Older 8610 DTs didn't have the fifo-depth property */
946 dma->ssi_fifo_depth = 8; 946 dma->ssi_fifo_depth = 8;
diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
index 313e0ccedd5b..d48afea5d93d 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,7 +696,7 @@ 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;
diff --git a/sound/soc/fsl/mpc8610_hpcd.c b/sound/soc/fsl/mpc8610_hpcd.c
index c16c6b2eff95..a19297959587 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
@@ -379,7 +379,7 @@ static int mpc8610_hpcd_probe(struct platform_device *pdev)
379 ret = -EINVAL; 379 ret = -EINVAL;
380 goto error; 380 goto error;
381 } 381 }
382 machine_data->ssi_id = *iprop; 382 machine_data->ssi_id = be32_to_cpup(iprop);
383 383
384 /* Get the serial format and clock direction. */ 384 /* Get the serial format and clock direction. */
385 sprop = of_get_property(np, "fsl,mode", NULL); 385 sprop = of_get_property(np, "fsl,mode", NULL);
@@ -405,7 +405,7 @@ static int mpc8610_hpcd_probe(struct platform_device *pdev)
405 ret = -EINVAL; 405 ret = -EINVAL;
406 goto error; 406 goto error;
407 } 407 }
408 machine_data->clk_frequency = *iprop; 408 machine_data->clk_frequency = be32_to_cpup(iprop);
409 } else if (strcasecmp(sprop, "i2s-master") == 0) { 409 } else if (strcasecmp(sprop, "i2s-master") == 0) {
410 machine_data->dai_format = SND_SOC_DAIFMT_I2S; 410 machine_data->dai_format = SND_SOC_DAIFMT_I2S;
411 machine_data->codec_clk_direction = SND_SOC_CLOCK_IN; 411 machine_data->codec_clk_direction = SND_SOC_CLOCK_IN;
diff --git a/sound/soc/fsl/p1022_ds.c b/sound/soc/fsl/p1022_ds.c
index 66e0b68af147..8fa4d5f8eda1 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)
@@ -308,7 +308,7 @@ static int get_dma_channel(struct device_node *ssi_np,
308 return -EINVAL; 308 return -EINVAL;
309 } 309 }
310 310
311 *dma_channel_id = *iprop; 311 *dma_channel_id = be32_to_cpup(iprop);
312 *dma_id = get_parent_cell_index(dma_channel_np); 312 *dma_id = get_parent_cell_index(dma_channel_np);
313 of_node_put(dma_channel_np); 313 of_node_put(dma_channel_np);
314 314
@@ -379,7 +379,7 @@ static int p1022_ds_probe(struct platform_device *pdev)
379 ret = -EINVAL; 379 ret = -EINVAL;
380 goto error; 380 goto error;
381 } 381 }
382 mdata->ssi_id = *iprop; 382 mdata->ssi_id = be32_to_cpup(iprop);
383 383
384 /* Get the serial format and clock direction. */ 384 /* Get the serial format and clock direction. */
385 sprop = of_get_property(np, "fsl,mode", NULL); 385 sprop = of_get_property(np, "fsl,mode", NULL);
@@ -405,7 +405,7 @@ static int p1022_ds_probe(struct platform_device *pdev)
405 ret = -EINVAL; 405 ret = -EINVAL;
406 goto error; 406 goto error;
407 } 407 }
408 mdata->clk_frequency = *iprop; 408 mdata->clk_frequency = be32_to_cpup(iprop);
409 } else if (strcasecmp(sprop, "i2s-master") == 0) { 409 } else if (strcasecmp(sprop, "i2s-master") == 0) {
410 mdata->dai_format = SND_SOC_DAIFMT_I2S; 410 mdata->dai_format = SND_SOC_DAIFMT_I2S;
411 mdata->codec_clk_direction = SND_SOC_CLOCK_IN; 411 mdata->codec_clk_direction = SND_SOC_CLOCK_IN;