aboutsummaryrefslogtreecommitdiffstats
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
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>
-rw-r--r--Documentation/devicetree/bindings/sound/omap-mcbsp.txt45
-rw-r--r--sound/soc/omap/omap-mcbsp.c66
2 files changed, 110 insertions, 1 deletions
diff --git a/Documentation/devicetree/bindings/sound/omap-mcbsp.txt b/Documentation/devicetree/bindings/sound/omap-mcbsp.txt
new file mode 100644
index 000000000000..447cb131e909
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/omap-mcbsp.txt
@@ -0,0 +1,45 @@
1* Texas Instruments OMAP2+ McBSP module
2
3Required properties:
4- compatible: "ti,omap2420-mcbsp" for McBSP on OMAP2420
5 "ti,omap2430-mcbsp" for McBSP on OMAP2430
6 "ti,omap3-mcbsp" for McBSP on OMAP3
7 "ti,omap4-mcbsp" for McBSP on OMAP4 and newer SoC
8- reg: Register location and size, for OMAP4+ as an array:
9 <MPU access base address, size>,
10 <L3 interconnect address, size>;
11- interrupts: Interrupt numbers for the McBSP port, as an array in case the
12 McBSP IP have more interrupt lines:
13 <OCP compliant irq>,
14 <TX irq>,
15 <RX irq>;
16- interrupt-parent: The parent interrupt controller
17- ti,buffer-size: Size of the FIFO on the port (OMAP2430 and newer SoC)
18- ti,hwmods: Name of the hwmod associated to the McBSP port
19
20Sidetone support for OMAP3 McBSP2 and 3 ports:
21- sidetone { }: Within this section the following parameters are required:
22- reg: Register location and size for the ST block
23- interrupts: The interrupt number for the ST block
24- interrupt-parent: The parent interrupt controller for the ST block
25
26Example:
27
28mcbsp2: mcbsp@49022000 {
29 compatible = "ti,omap3-mcbsp";
30 #address-cells = <1>;
31 #size-cells = <1>;
32 reg = <0x49022000 0xff>;
33 interrupts = <0 17 0x4>, /* OCP compliant interrup */
34 <0 62 0x4>, /* TX interrup */
35 <0 63 0x4>; /* RX interrup */
36 interrupt-parent = <&intc>;
37 ti,buffer-size = <1280>;
38 ti,hwmods = "mcbsp2";
39
40 sidetone {
41 reg = <0x49028000 0xff>;
42 interrupts = <0 4 0x4>;
43 interrupt-parent = <&intc>;
44 };
45};
diff --git a/sound/soc/omap/omap-mcbsp.c b/sound/soc/omap/omap-mcbsp.c
index b9770eea28a0..2e1750e2ab31 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,