[alsa-devel] [PATCH 0/5] ASoC: OMAP4: Device tree support for DMIC, McPDM
Hello,
The following series adds device tree support for omap-dmic, omap-mcpdm ASoC DAI drivers.
The OMAP4 platform patches have dependency on the DMIC driver series: http://www.mail-archive.com/linux-omap@vger.kernel.org/msg59161.html
Regards, Peter --- Peter Ujfalusi (5): ASoC: omap-dmic: Add device tree bindings ASoC: omap-mcpdm: Add device tree bindings OMAP4: devices: Do not create dmic device if the dtb has been provided OMAP4: devices: Do not create mcpdm device if the dtb has been provided ARM: OMAP4: DTS: Support for dmic, and McPDM in device tree
.../bindings/sound/soc/omap/omap-dmic.txt | 13 +++++++++++++ .../bindings/sound/soc/omap/omap-mcpdm.txt | 13 +++++++++++++ arch/arm/boot/dts/omap4-panda.dts | 4 ++++ arch/arm/boot/dts/omap4.dtsi | 9 +++++++++ arch/arm/mach-omap2/devices.c | 8 ++++++++ sound/soc/omap/omap-dmic.c | 8 ++++++++ sound/soc/omap/omap-mcpdm.c | 8 ++++++++ 7 files changed, 63 insertions(+), 0 deletions(-) create mode 100644 Documentation/devicetree/bindings/sound/soc/omap/omap-dmic.txt create mode 100644 Documentation/devicetree/bindings/sound/soc/omap/omap-mcpdm.txt
Signed-off-by: Peter Ujfalusi peter.ujfalusi@ti.com --- .../bindings/sound/soc/omap/omap-dmic.txt | 13 +++++++++++++ sound/soc/omap/omap-dmic.c | 8 ++++++++ 2 files changed, 21 insertions(+), 0 deletions(-) create mode 100644 Documentation/devicetree/bindings/sound/soc/omap/omap-dmic.txt
diff --git a/Documentation/devicetree/bindings/sound/soc/omap/omap-dmic.txt b/Documentation/devicetree/bindings/sound/soc/omap/omap-dmic.txt new file mode 100644 index 0000000..f6d9e66 --- /dev/null +++ b/Documentation/devicetree/bindings/sound/soc/omap/omap-dmic.txt @@ -0,0 +1,13 @@ +* Texas Instruments OMAP4 Digital Microphone Module + +Required properties: + - compatible : "ti,omap4-dmic" + - ti,hwmods : List of hwmod names associated with DMIC, in most case + it is "dmic". + +Example: + +dmic_dai: dmic@4012e000 { + compatible = "ti,omap4-dmic"; + ti,hwmods = "dmic"; +}; diff --git a/sound/soc/omap/omap-dmic.c b/sound/soc/omap/omap-dmic.c index 9c73c0c..b71bd11 100644 --- a/sound/soc/omap/omap-dmic.c +++ b/sound/soc/omap/omap-dmic.c @@ -32,6 +32,7 @@ #include <linux/io.h> #include <linux/slab.h> #include <linux/pm_runtime.h> +#include <linux/of_device.h> #include <plat/dma.h>
#include <sound/core.h> @@ -532,10 +533,17 @@ static int __devexit asoc_dmic_remove(struct platform_device *pdev) return 0; }
+static const struct of_device_id omap_dmic_of_match[] = { + { .compatible = "ti,omap4-dmic", }, + { } +}; +MODULE_DEVICE_TABLE(of, omap_dmic_of_match); + static struct platform_driver asoc_dmic_driver = { .driver = { .name = "omap-dmic", .owner = THIS_MODULE, + .of_match_table = omap_dmic_of_match, }, .probe = asoc_dmic_probe, .remove = __devexit_p(asoc_dmic_remove),
On Fri, Dec 02, 2011 at 11:52:56AM +0200, Peter Ujfalusi wrote:
+Required properties:
- compatible : "ti,omap4-dmic"
- ti,hwmods : List of hwmod names associated with DMIC, in most case
it is "dmic".
Shouldn't there also be a regs property giving the register window?
On 12/02/2011 02:25 PM, Mark Brown wrote:
On Fri, Dec 02, 2011 at 11:52:56AM +0200, Peter Ujfalusi wrote:
+Required properties:
- compatible : "ti,omap4-dmic"
- ti,hwmods : List of hwmod names associated with DMIC, in most case
it is "dmic".
Shouldn't there also be a regs property giving the register window?
As of now we receive all these information via OMAP hwmod. All the properties (addresses, irq, etc) of the HW IP will be coming from DT as soon as I can remove the ti,hwmod property.
On Fri, Dec 02, 2011 at 02:32:59PM +0200, Peter Ujfalusi wrote:
As of now we receive all these information via OMAP hwmod. All the properties (addresses, irq, etc) of the HW IP will be coming from DT as soon as I can remove the ti,hwmod property.
Oh, right. We should really be churning the device tree like this - the idea is that the device tree should be stable and independant of kernel versions. It would be better if we were able to go straight to the one without hwmod, especially if Benoit is able to get the underlying changes done soon (which sounded like it might be the case). Could we define and implement the "real" version now (it should be reasonable to code blind except possibly for the DMA channel as it's such a direct mapping) with hwmod left in there as something that's legacy for old kernels?
On Fri, Dec 02, 2011 at 11:52:56AM +0200, Peter Ujfalusi wrote:
@@ -0,0 +1,13 @@ +* Texas Instruments OMAP4 Digital Microphone Module
+Required properties:
- compatible : "ti,omap4-dmic"
- ti,hwmods : List of hwmod names associated with DMIC, in most case
it is "dmic".
Actually thinking about this some more I think what's concerning me is the documentation as much as anything else - if it was just an internal, unpublished interface of the OMAP core code which happened to use device tree I probably wouldn't have worried about it churning.
On 12/03/2011 01:22 PM, Mark Brown wrote:
On Fri, Dec 02, 2011 at 11:52:56AM +0200, Peter Ujfalusi wrote:
@@ -0,0 +1,13 @@ +* Texas Instruments OMAP4 Digital Microphone Module
+Required properties:
- compatible : "ti,omap4-dmic"
- ti,hwmods : List of hwmod names associated with DMIC, in most case
it is "dmic".
Actually thinking about this some more I think what's concerning me is the documentation as much as anything else - if it was just an internal, unpublished interface of the OMAP core code which happened to use device tree I probably wouldn't have worried about it churning.
Actually it is documented here: Documentation/devicetree/bindings/arm/omap/omap.txt
In order to move all OMAP drivers to DT - as Benoit already mentioned - we need additional work in DT. At this point of time if we add the DT representation we anyways need to change it as the core will receive the features, and we still need to fall back to hwmod to get the drivers working. As soon as we can migrate away from the hwmod we will do, but having this in place helps us to migrate other parts to DT.
On Mon, Dec 05, 2011 at 03:45:04PM +0200, Peter Ujfalusi wrote:
On 12/03/2011 01:22 PM, Mark Brown wrote:
Actually thinking about this some more I think what's concerning me is the documentation as much as anything else - if it was just an internal, unpublished interface of the OMAP core code which happened to use device tree I probably wouldn't have worried about it churning.
Actually it is documented here: Documentation/devicetree/bindings/arm/omap/omap.txt
That's not exactly the point...
In order to move all OMAP drivers to DT - as Benoit already mentioned - we need additional work in DT. At this point of time if we add the DT representation we anyways need to change it as the core will receive the features, and we still need to fall back to hwmod to get the drivers working. As soon as we can migrate away from the hwmod we will do, but having this in place helps us to migrate other parts to DT.
And what I'm saying is that my main concern is that you're publishing documenting a binding which isn't intended to be the the final binding and which there's no intention that anyone should use directly anyway.
On 12/05/2011 05:46 PM, Mark Brown wrote:
And what I'm saying is that my main concern is that you're publishing documenting a binding which isn't intended to be the the final binding and which there's no intention that anyone should use directly anyway.
I felt it is the right thing to document the current situation. The documentation will be updated as we can move away from the "ti,hwmods" tag from DT. I can place comment in the documentation for omap-dmic, omap-mcpdm stating that the use of "ti,hwmods" is required at the moment, but it is temporally solution.
On Wed, Dec 07, 2011 at 10:45:25AM +0200, Peter Ujfalusi wrote:
I felt it is the right thing to document the current situation.
If we're going to document bindings like this it feels like we should have a split in the directories in the same way that we handle the different stability levels for sysfs documentation.
The documentation will be updated as we can move away from the "ti,hwmods" tag from DT. I can place comment in the documentation for omap-dmic, omap-mcpdm stating that the use of "ti,hwmods" is required at the moment, but it is temporally solution.
At the very least, yes.
Signed-off-by: Peter Ujfalusi peter.ujfalusi@ti.com --- .../bindings/sound/soc/omap/omap-mcpdm.txt | 13 +++++++++++++ sound/soc/omap/omap-mcpdm.c | 8 ++++++++ 2 files changed, 21 insertions(+), 0 deletions(-) create mode 100644 Documentation/devicetree/bindings/sound/soc/omap/omap-mcpdm.txt
diff --git a/Documentation/devicetree/bindings/sound/soc/omap/omap-mcpdm.txt b/Documentation/devicetree/bindings/sound/soc/omap/omap-mcpdm.txt new file mode 100644 index 0000000..e94bb96 --- /dev/null +++ b/Documentation/devicetree/bindings/sound/soc/omap/omap-mcpdm.txt @@ -0,0 +1,13 @@ +* Texas Instruments OMAP4 McPDM + +Required properties: + - compatible : "ti,omap4-mcpdm" + - ti,hwmods : List of hwmod names associated with McPDM, in most case + it is "mcpdm". + +Example: + +mcpdm_dai: mcpdm@40132000 { + compatible = "ti,omap4-mcpdm"; + ti,hwmods = "mcpdm"; +}; diff --git a/sound/soc/omap/omap-mcpdm.c b/sound/soc/omap/omap-mcpdm.c index b50ac60..c95fc70 100644 --- a/sound/soc/omap/omap-mcpdm.c +++ b/sound/soc/omap/omap-mcpdm.c @@ -33,6 +33,7 @@ #include <linux/irq.h> #include <linux/slab.h> #include <linux/pm_runtime.h> +#include <linux/of_device.h>
#include <sound/core.h> #include <sound/pcm.h> @@ -510,10 +511,17 @@ static int __devexit asoc_mcpdm_remove(struct platform_device *pdev) return 0; }
+static const struct of_device_id omap_mcpdm_of_match[] = { + { .compatible = "ti,omap4-mcpdm", }, + { } +}; +MODULE_DEVICE_TABLE(of, omap_mcpdm_of_match); + static struct platform_driver asoc_mcpdm_driver = { .driver = { .name = "omap-mcpdm", .owner = THIS_MODULE, + .of_match_table = omap_mcpdm_of_match, },
.probe = asoc_mcpdm_probe,
If dtb is provided of will create the needed devices dynamically so there is no need to create the platform device for DMIC here.
Signed-off-by: Peter Ujfalusi peter.ujfalusi@ti.com --- arch/arm/mach-omap2/devices.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c index 35d5dff..d7ca473 100644 --- a/arch/arm/mach-omap2/devices.c +++ b/arch/arm/mach-omap2/devices.c @@ -344,6 +344,10 @@ static void omap_init_dmic(void) struct omap_hwmod *oh; struct platform_device *pdev;
+ /* If dtb is there, the devices will be created dynamically */ + if (of_have_populated_dt()) + return; + oh = omap_hwmod_lookup("dmic"); if (!oh) { printk(KERN_ERR "Could not look up mcpdm hw_mod\n");
If dtb is provided of will create the needed devices dynamically so there is no need to create the platform device for McPDM here.
Signed-off-by: Peter Ujfalusi peter.ujfalusi@ti.com --- arch/arm/mach-omap2/devices.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c index d7ca473..469f875 100644 --- a/arch/arm/mach-omap2/devices.c +++ b/arch/arm/mach-omap2/devices.c @@ -323,6 +323,10 @@ static void omap_init_mcpdm(void) struct omap_hwmod *oh; struct platform_device *pdev;
+ /* If dtb is there, the devices will be created dynamically */ + if (of_have_populated_dt()) + return; + oh = omap_hwmod_lookup("mcpdm"); if (!oh) { printk(KERN_ERR "Could not look up mcpdm hw_mod\n");
Add DT support for dmic, and McPDM on OMAP4 platforms. Panda board does not have DMIC lines accessable, so disable the dmic on panda.
Signed-off-by: Peter Ujfalusi peter.ujfalusi@ti.com --- arch/arm/boot/dts/omap4-panda.dts | 4 ++++ arch/arm/boot/dts/omap4.dtsi | 9 +++++++++ 2 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/arch/arm/boot/dts/omap4-panda.dts b/arch/arm/boot/dts/omap4-panda.dts index c702657..b73b641 100644 --- a/arch/arm/boot/dts/omap4-panda.dts +++ b/arch/arm/boot/dts/omap4-panda.dts @@ -27,3 +27,7 @@ reg = <0x80000000 0x40000000>; /* 1 GB */ }; }; + +&dmic_dai { + status = "disabled"; +}; diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi index 4c61c82..00cfb73 100644 --- a/arch/arm/boot/dts/omap4.dtsi +++ b/arch/arm/boot/dts/omap4.dtsi @@ -99,5 +99,14 @@ reg = <0x48241000 0x1000>, <0x48240100 0x0100>; }; + + dmic_dai: dmic@4012e000 { + compatible = "ti,omap4-dmic"; + ti,hwmods = "dmic"; + }; + mcpdm_dai: mcpdm@40132000 { + compatible = "ti,omap4-mcpdm"; + ti,hwmods = "mcpdm"; + }; }; };
participants (2)
-
Mark Brown
-
Peter Ujfalusi