aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/omap
diff options
context:
space:
mode:
authorPeter Ujfalusi <peter.ujfalusi@ti.com>2012-08-16 09:41:08 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-08-22 15:17:18 -0400
commit11dd586421b3091007e6f084a9211f3baa66f9fc (patch)
tree5e4e33a7ed3d006065433b9d0fbe33ddb9273365 /sound/soc/omap
parente586e955aa47f9b4afe6e665798fd2cb074a90f4 (diff)
ASoC: omap-mcbsp: Add device tree bindings
Device tree support for McBSP modules on OMAP2+ SoC. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/omap')
-rw-r--r--sound/soc/omap/omap-mcbsp.c66
1 files changed, 65 insertions, 1 deletions
diff --git a/sound/soc/omap/omap-mcbsp.c b/sound/soc/omap/omap-mcbsp.c
index b9770eea28a..2e1750e2ab3 100644
--- a/sound/soc/omap/omap-mcbsp.c
+++ b/sound/soc/omap/omap-mcbsp.c
@@ -26,6 +26,8 @@
26#include <linux/module.h> 26#include <linux/module.h>
27#include <linux/device.h> 27#include <linux/device.h>
28#include <linux/pm_runtime.h> 28#include <linux/pm_runtime.h>
29#include <linux/of.h>
30#include <linux/of_device.h>
29#include <sound/core.h> 31#include <sound/core.h>
30#include <sound/pcm.h> 32#include <sound/pcm.h>
31#include <sound/pcm_params.h> 33#include <sound/pcm_params.h>
@@ -737,13 +739,74 @@ int omap_mcbsp_st_add_controls(struct snd_soc_pcm_runtime *rtd)
737} 739}
738EXPORT_SYMBOL_GPL(omap_mcbsp_st_add_controls); 740EXPORT_SYMBOL_GPL(omap_mcbsp_st_add_controls);
739 741
742static struct omap_mcbsp_platform_data omap2420_pdata = {
743 .reg_step = 4,
744 .reg_size = 2,
745};
746
747static struct omap_mcbsp_platform_data omap2430_pdata = {
748 .reg_step = 4,
749 .reg_size = 4,
750 .has_ccr = true,
751};
752
753static struct omap_mcbsp_platform_data omap3_pdata = {
754 .reg_step = 4,
755 .reg_size = 4,
756 .has_ccr = true,
757 .has_wakeup = true,
758};
759
760static struct omap_mcbsp_platform_data omap4_pdata = {
761 .reg_step = 4,
762 .reg_size = 4,
763 .has_ccr = true,
764 .has_wakeup = true,
765};
766
767static const struct of_device_id omap_mcbsp_of_match[] = {
768 {
769 .compatible = "ti,omap2420-mcbsp",
770 .data = &omap2420_pdata,
771 },
772 {
773 .compatible = "ti,omap2430-mcbsp",
774 .data = &omap2430_pdata,
775 },
776 {
777 .compatible = "ti,omap3-mcbsp",
778 .data = &omap3_pdata,
779 },
780 {
781 .compatible = "ti,omap4-mcbsp",
782 .data = &omap4_pdata,
783 },
784 { },
785};
786MODULE_DEVICE_TABLE(of, omap_mcbsp_of_match);
787
740static __devinit int asoc_mcbsp_probe(struct platform_device *pdev) 788static __devinit int asoc_mcbsp_probe(struct platform_device *pdev)
741{ 789{
742 struct omap_mcbsp_platform_data *pdata = dev_get_platdata(&pdev->dev); 790 struct omap_mcbsp_platform_data *pdata = dev_get_platdata(&pdev->dev);
743 struct omap_mcbsp *mcbsp; 791 struct omap_mcbsp *mcbsp;
792 const struct of_device_id *match;
744 int ret; 793 int ret;
745 794
746 if (!pdata) { 795 match = of_match_device(omap_mcbsp_of_match, &pdev->dev);
796 if (match) {
797 struct device_node *node = pdev->dev.of_node;
798 int buffer_size;
799
800 pdata = devm_kzalloc(&pdev->dev,
801 sizeof(struct omap_mcbsp_platform_data),
802 GFP_KERNEL);
803 if (!pdata)
804 return -ENOMEM;
805
806 memcpy(pdata, match->data, sizeof(*pdata));
807 if (!of_property_read_u32(node, "ti,buffer-size", &buffer_size))
808 pdata->buffer_size = buffer_size;
809 } else if (!pdata) {
747 dev_err(&pdev->dev, "missing platform data.\n"); 810 dev_err(&pdev->dev, "missing platform data.\n");
748 return -EINVAL; 811 return -EINVAL;
749 } 812 }
@@ -785,6 +848,7 @@ static struct platform_driver asoc_mcbsp_driver = {
785 .driver = { 848 .driver = {
786 .name = "omap-mcbsp", 849 .name = "omap-mcbsp",
787 .owner = THIS_MODULE, 850 .owner = THIS_MODULE,
851 .of_match_table = omap_mcbsp_of_match,
788 }, 852 },
789 853
790 .probe = asoc_mcbsp_probe, 854 .probe = asoc_mcbsp_probe,