aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorLee Jones <lee.jones@linaro.org>2012-07-26 12:07:26 -0400
committerLee Jones <lee.jones@linaro.org>2012-09-20 03:10:57 -0400
commit49731c23bee88fd76af8cd57b915547b2175a26a (patch)
tree6a9bd7720279652be34ba3481cbdb2779de3adaa /sound
parent0af541ce47ee4e80393dda12109a1efaf757fdcd (diff)
ASoC: Ux500: Enable ux500 MSP driver for Device Tree
Register both parts of the MSP driver from Device Tree so that they are probed when Device Tree is enabled. Also, as there is platform data involved, we ensure that there is allocated memory to place the configuration into and that the correct information is extracted from the DT binary. Acked-by: Ola Lilja <ola.o.lilja@stericsson.com> Acked-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Lee Jones <lee.jones@linaro.org>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/ux500/ux500_msp_dai.c6
-rw-r--r--sound/soc/ux500/ux500_msp_i2s.c22
2 files changed, 25 insertions, 3 deletions
diff --git a/sound/soc/ux500/ux500_msp_dai.c b/sound/soc/ux500/ux500_msp_dai.c
index 057e28ef770e..45e43b4057b0 100644
--- a/sound/soc/ux500/ux500_msp_dai.c
+++ b/sound/soc/ux500/ux500_msp_dai.c
@@ -830,10 +830,16 @@ static int __devexit ux500_msp_drv_remove(struct platform_device *pdev)
830 return 0; 830 return 0;
831} 831}
832 832
833static const struct of_device_id ux500_msp_i2s_match[] = {
834 { .compatible = "stericsson,ux500-msp-i2s", },
835 {},
836};
837
833static struct platform_driver msp_i2s_driver = { 838static struct platform_driver msp_i2s_driver = {
834 .driver = { 839 .driver = {
835 .name = "ux500-msp-i2s", 840 .name = "ux500-msp-i2s",
836 .owner = THIS_MODULE, 841 .owner = THIS_MODULE,
842 .of_match_table = ux500_msp_i2s_match,
837 }, 843 },
838 .probe = ux500_msp_drv_probe, 844 .probe = ux500_msp_drv_probe,
839 .remove = ux500_msp_drv_remove, 845 .remove = ux500_msp_drv_remove,
diff --git a/sound/soc/ux500/ux500_msp_i2s.c b/sound/soc/ux500/ux500_msp_i2s.c
index 12d7f567420d..e5c79ca42518 100644
--- a/sound/soc/ux500/ux500_msp_i2s.c
+++ b/sound/soc/ux500/ux500_msp_i2s.c
@@ -18,6 +18,7 @@
18#include <linux/pinctrl/consumer.h> 18#include <linux/pinctrl/consumer.h>
19#include <linux/delay.h> 19#include <linux/delay.h>
20#include <linux/slab.h> 20#include <linux/slab.h>
21#include <linux/of.h>
21 22
22#include <mach/hardware.h> 23#include <mach/hardware.h>
23#include <mach/msp.h> 24#include <mach/msp.h>
@@ -683,14 +684,29 @@ int ux500_msp_i2s_init_msp(struct platform_device *pdev,
683{ 684{
684 struct resource *res = NULL; 685 struct resource *res = NULL;
685 struct i2s_controller *i2s_cont; 686 struct i2s_controller *i2s_cont;
687 struct device_node *np = pdev->dev.of_node;
686 struct ux500_msp *msp; 688 struct ux500_msp *msp;
687 689
688 dev_dbg(&pdev->dev, "%s: Enter (name: %s, id: %d).\n", __func__,
689 pdev->name, platform_data->id);
690
691 *msp_p = devm_kzalloc(&pdev->dev, sizeof(struct ux500_msp), GFP_KERNEL); 690 *msp_p = devm_kzalloc(&pdev->dev, sizeof(struct ux500_msp), GFP_KERNEL);
692 msp = *msp_p; 691 msp = *msp_p;
693 692
693 if (np) {
694 if (!platform_data) {
695 platform_data = devm_kzalloc(&pdev->dev,
696 sizeof(struct msp_i2s_platform_data), GFP_KERNEL);
697 if (!platform_data)
698 ret = -ENOMEM;
699 }
700 } else
701 if (!platform_data)
702 ret = -EINVAL;
703
704 if (ret)
705 goto err_res;
706
707 dev_dbg(&pdev->dev, "%s: Enter (name: %s, id: %d).\n", __func__,
708 pdev->name, platform_data->id);
709
694 msp->id = platform_data->id; 710 msp->id = platform_data->id;
695 msp->dev = &pdev->dev; 711 msp->dev = &pdev->dev;
696 msp->dma_cfg_rx = platform_data->msp_i2s_dma_rx; 712 msp->dma_cfg_rx = platform_data->msp_i2s_dma_rx;