All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] ARM/ASoC: Davinci: Add Device Tree Support
@ 2012-08-14 12:42 ` Hebbar, Gururaja
  0 siblings, 0 replies; 40+ messages in thread
From: Hebbar, Gururaja @ 2012-08-14 12:42 UTC (permalink / raw)
  To: tony, lrg, broonie
  Cc: alsa-devel, sudhakar.raj, nsekhar, davinci-linux-open-source,
	gururaja.hebbar, peter.ujfalusi, linux-arm-kernel

This patch-set is a cumulative of below tasks
1. Split asp header into platform and audio specific
   Davinci driver is shared by few OMAP platforms (like TI81xx, AM335x).
   Splitting asp header into Davinci platform specific and Audio specific helps
   to share them across platforms.

2. Add DT support for Davinci Audio Module (McASP, machine, pcm & Codec)


This patch was tested on AM18x Board (Tested to check if the commits doesn't
break on compile or runtime) and is based on repo at 
http://git.kernel.org/?p=linux/kernel/git/broonie/sound.git;
a=shortlog;h=refs/heads/for-3.7

Note:
Matt Porter from TI is working on DMA engine conversion of DaVinci EDMA
support and DT conversion of DMA parts will be taken up post that is
complete.
Since Audio requires DMA to work, this patch set does not yet provide
complete functionality required to use sound on DT-based platforms, but
is a step towards that direction.

Hebbar, Gururaja (5):
  ASoC/ARM: Davinci: McASP: split asp header into platform and audio
    specific
  ASoC: Davinci: McASP: add device tree support for McASP
  ASoC: Davinci: pcm: Add device tree bindings
  ASoC: Davinci: machine: Add device tree binding
  ASoC: tlv320aic3x: Add device tree bindings

 .../bindings/sound/davinci-evm-audio.txt           |   52 ++++++
 .../bindings/sound/davinci-mcasp-audio.txt         |   43 +++++
 .../devicetree/bindings/sound/davinci-pcm.txt      |   13 ++
 .../devicetree/bindings/sound/tlv320aic3x.txt      |   18 ++
 arch/arm/mach-davinci/asp.h                        |   49 +++++
 arch/arm/mach-davinci/davinci.h                    |    3 +-
 arch/arm/mach-davinci/devices-da8xx.c              |    1 +
 arch/arm/mach-davinci/dm355.c                      |    2 +-
 arch/arm/mach-davinci/dm365.c                      |    2 +-
 arch/arm/mach-davinci/dm644x.c                     |    2 +-
 arch/arm/mach-davinci/dm646x.c                     |    2 +-
 arch/arm/mach-davinci/include/mach/da8xx.h         |    2 +-
 .../linux/platform_data/davinci_asp.h              |   73 ++------
 sound/soc/codecs/tlv320aic3x.c                     |   30 +++
 sound/soc/davinci/davinci-evm.c                    |  190 +++++++++++++++++---
 sound/soc/davinci/davinci-i2s.c                    |    3 +-
 sound/soc/davinci/davinci-mcasp.c                  |  113 ++++++++++++-
 sound/soc/davinci/davinci-mcasp.h                  |    3 +-
 sound/soc/davinci/davinci-pcm.c                    |   12 ++-
 sound/soc/davinci/davinci-pcm.h                    |    3 +-
 20 files changed, 527 insertions(+), 89 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/sound/davinci-evm-audio.txt
 create mode 100644 Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt
 create mode 100644 Documentation/devicetree/bindings/sound/davinci-pcm.txt
 create mode 100644 Documentation/devicetree/bindings/sound/tlv320aic3x.txt
 create mode 100644 arch/arm/mach-davinci/asp.h
 rename arch/arm/mach-davinci/include/mach/asp.h => include/linux/platform_data/davinci_asp.h (56%)

^ permalink raw reply	[flat|nested] 40+ messages in thread

* [PATCH 0/5] ARM/ASoC: Davinci: Add Device Tree Support
@ 2012-08-14 12:42 ` Hebbar, Gururaja
  0 siblings, 0 replies; 40+ messages in thread
From: Hebbar, Gururaja @ 2012-08-14 12:42 UTC (permalink / raw)
  To: linux-arm-kernel

This patch-set is a cumulative of below tasks
1. Split asp header into platform and audio specific
   Davinci driver is shared by few OMAP platforms (like TI81xx, AM335x).
   Splitting asp header into Davinci platform specific and Audio specific helps
   to share them across platforms.

2. Add DT support for Davinci Audio Module (McASP, machine, pcm & Codec)


This patch was tested on AM18x Board (Tested to check if the commits doesn't
break on compile or runtime) and is based on repo at 
http://git.kernel.org/?p=linux/kernel/git/broonie/sound.git;
a=shortlog;h=refs/heads/for-3.7

Note:
Matt Porter from TI is working on DMA engine conversion of DaVinci EDMA
support and DT conversion of DMA parts will be taken up post that is
complete.
Since Audio requires DMA to work, this patch set does not yet provide
complete functionality required to use sound on DT-based platforms, but
is a step towards that direction.

Hebbar, Gururaja (5):
  ASoC/ARM: Davinci: McASP: split asp header into platform and audio
    specific
  ASoC: Davinci: McASP: add device tree support for McASP
  ASoC: Davinci: pcm: Add device tree bindings
  ASoC: Davinci: machine: Add device tree binding
  ASoC: tlv320aic3x: Add device tree bindings

 .../bindings/sound/davinci-evm-audio.txt           |   52 ++++++
 .../bindings/sound/davinci-mcasp-audio.txt         |   43 +++++
 .../devicetree/bindings/sound/davinci-pcm.txt      |   13 ++
 .../devicetree/bindings/sound/tlv320aic3x.txt      |   18 ++
 arch/arm/mach-davinci/asp.h                        |   49 +++++
 arch/arm/mach-davinci/davinci.h                    |    3 +-
 arch/arm/mach-davinci/devices-da8xx.c              |    1 +
 arch/arm/mach-davinci/dm355.c                      |    2 +-
 arch/arm/mach-davinci/dm365.c                      |    2 +-
 arch/arm/mach-davinci/dm644x.c                     |    2 +-
 arch/arm/mach-davinci/dm646x.c                     |    2 +-
 arch/arm/mach-davinci/include/mach/da8xx.h         |    2 +-
 .../linux/platform_data/davinci_asp.h              |   73 ++------
 sound/soc/codecs/tlv320aic3x.c                     |   30 +++
 sound/soc/davinci/davinci-evm.c                    |  190 +++++++++++++++++---
 sound/soc/davinci/davinci-i2s.c                    |    3 +-
 sound/soc/davinci/davinci-mcasp.c                  |  113 ++++++++++++-
 sound/soc/davinci/davinci-mcasp.h                  |    3 +-
 sound/soc/davinci/davinci-pcm.c                    |   12 ++-
 sound/soc/davinci/davinci-pcm.h                    |    3 +-
 20 files changed, 527 insertions(+), 89 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/sound/davinci-evm-audio.txt
 create mode 100644 Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt
 create mode 100644 Documentation/devicetree/bindings/sound/davinci-pcm.txt
 create mode 100644 Documentation/devicetree/bindings/sound/tlv320aic3x.txt
 create mode 100644 arch/arm/mach-davinci/asp.h
 rename arch/arm/mach-davinci/include/mach/asp.h => include/linux/platform_data/davinci_asp.h (56%)

^ permalink raw reply	[flat|nested] 40+ messages in thread

* [PATCH 1/5] ASoC/ARM: Davinci: McASP: split asp header into platform and audio specific
  2012-08-14 12:42 ` Hebbar, Gururaja
@ 2012-08-14 12:42   ` Hebbar, Gururaja
  -1 siblings, 0 replies; 40+ messages in thread
From: Hebbar, Gururaja @ 2012-08-14 12:42 UTC (permalink / raw)
  To: tony, lrg, broonie
  Cc: alsa-devel, sudhakar.raj, nsekhar, davinci-linux-open-source,
	gururaja.hebbar, peter.ujfalusi, linux-arm-kernel

Davinci McASP header & driver are shared by few OMAP platforms (like
TI81xx, AM335x). Splitting asp header into Davinci platform specific
header and Audio specific header helps to share them across platforms.

Audio specific defines is moved to to common
<linux/platform_data/davinci_asp.h> so that the header can be
accessed by all related platforms.

While here, correct the header usage (remove multiple header
re-definitions and unused headers) and remove platform names from
structures comments and enum

Signed-off-by: Hebbar, Gururaja <gururaja.hebbar@ti.com>
Acked-by: Vaibhav Bedia <vaibhav.bedia@ti.com>
---
:000000 100644 0000000... 8fd5238... A	arch/arm/mach-davinci/asp.h
:100644 100644 8db0fc6... 8661b20... M	arch/arm/mach-davinci/davinci.h
:100644 100644 783eab6... 593764c... M	arch/arm/mach-davinci/devices-da8xx.c
:100644 100644 678cd99... e47a3f0... M	arch/arm/mach-davinci/dm355.c
:100644 100644 a50d49de.. f473745... M	arch/arm/mach-davinci/dm365.c
:100644 100644 c8b8666... 0755d46... M	arch/arm/mach-davinci/dm644x.c
:100644 100644 9eb87c1... 97c0f8e... M	arch/arm/mach-davinci/dm646x.c
:100644 100644 a2f1f27... c74a6ab... M	arch/arm/mach-davinci/include/mach/da8xx.h
:100644 100644 9aa2409... 79c26aa... R056	arch/arm/mach-davinci/include/mach/asp.h	include/linux/platform_data/davinci_asp.h
:100644 100644 c80c20a... 0a95c0c... M	sound/soc/davinci/davinci-evm.c
:100644 100644 0a74b95... 6e281a7... M	sound/soc/davinci/davinci-i2s.c
:100644 100644 51479f9... 0de9ed6... M	sound/soc/davinci/davinci-mcasp.h
:100644 100644 97d77b2... fefb3d4... M	sound/soc/davinci/davinci-pcm.c
:100644 100644 c0d6c9b... faac225... M	sound/soc/davinci/davinci-pcm.h
 arch/arm/mach-davinci/asp.h                        |   49 +++++++++++++
 arch/arm/mach-davinci/davinci.h                    |    3 +-
 arch/arm/mach-davinci/devices-da8xx.c              |    1 +
 arch/arm/mach-davinci/dm355.c                      |    2 +-
 arch/arm/mach-davinci/dm365.c                      |    2 +-
 arch/arm/mach-davinci/dm644x.c                     |    2 +-
 arch/arm/mach-davinci/dm646x.c                     |    2 +-
 arch/arm/mach-davinci/include/mach/da8xx.h         |    2 +-
 .../linux/platform_data/davinci_asp.h              |   73 ++++++--------------
 sound/soc/davinci/davinci-evm.c                    |    3 -
 sound/soc/davinci/davinci-i2s.c                    |    3 +-
 sound/soc/davinci/davinci-mcasp.h                  |    3 +-
 sound/soc/davinci/davinci-pcm.c                    |    1 -
 sound/soc/davinci/davinci-pcm.h                    |    3 +-
 14 files changed, 81 insertions(+), 68 deletions(-)

diff --git a/arch/arm/mach-davinci/asp.h b/arch/arm/mach-davinci/asp.h
new file mode 100644
index 0000000..8fd5238
--- /dev/null
+++ b/arch/arm/mach-davinci/asp.h
@@ -0,0 +1,49 @@
+/*
+ * TI DaVinci Audio definitions
+ */
+#ifndef __ASM_ARCH_DAVINCI_ASP_H
+#define __ASM_ARCH_DAVINCI_ASP_H
+
+/* Bases of dm644x and dm355 register banks */
+#define DAVINCI_ASP0_BASE	0x01E02000
+#define DAVINCI_ASP1_BASE	0x01E04000
+
+/* Bases of dm365 register banks */
+#define DAVINCI_DM365_ASP0_BASE	0x01D02000
+
+/* Bases of dm646x register banks */
+#define	DAVINCI_DM646X_MCASP0_REG_BASE		0x01D01000
+#define DAVINCI_DM646X_MCASP1_REG_BASE		0x01D01800
+
+/* Bases of da850/da830 McASP0  register banks */
+#define DAVINCI_DA8XX_MCASP0_REG_BASE	0x01D00000
+
+/* Bases of da830 McASP1 register banks */
+#define DAVINCI_DA830_MCASP1_REG_BASE	0x01D04000
+
+/* EDMA channels of dm644x and dm355 */
+#define DAVINCI_DMA_ASP0_TX	2
+#define DAVINCI_DMA_ASP0_RX	3
+#define DAVINCI_DMA_ASP1_TX	8
+#define DAVINCI_DMA_ASP1_RX	9
+
+/* EDMA channels of dm646x */
+#define	DAVINCI_DM646X_DMA_MCASP0_AXEVT0	6
+#define	DAVINCI_DM646X_DMA_MCASP0_AREVT0	9
+#define	DAVINCI_DM646X_DMA_MCASP1_AXEVT1	12
+
+/* EDMA channels of da850/da830 McASP0 */
+#define	DAVINCI_DA8XX_DMA_MCASP0_AREVT	0
+#define	DAVINCI_DA8XX_DMA_MCASP0_AXEVT	1
+
+/* EDMA channels of da830 McASP1 */
+#define	DAVINCI_DA830_DMA_MCASP1_AREVT	2
+#define	DAVINCI_DA830_DMA_MCASP1_AXEVT	3
+
+/* Interrupts */
+#define DAVINCI_ASP0_RX_INT	IRQ_MBRINT
+#define DAVINCI_ASP0_TX_INT	IRQ_MBXINT
+#define DAVINCI_ASP1_RX_INT	IRQ_MBRINT
+#define DAVINCI_ASP1_TX_INT	IRQ_MBXINT
+
+#endif /* __ASM_ARCH_DAVINCI_ASP_H */
diff --git a/arch/arm/mach-davinci/davinci.h b/arch/arm/mach-davinci/davinci.h
index 8db0fc6..8661b20 100644
--- a/arch/arm/mach-davinci/davinci.h
+++ b/arch/arm/mach-davinci/davinci.h
@@ -22,10 +22,11 @@
 #include <linux/davinci_emac.h>
 #include <linux/platform_device.h>
 #include <linux/spi/spi.h>
+#include <linux/platform_data/davinci_asp.h>
 
-#include <mach/asp.h>
 #include <mach/keyscan.h>
 #include <mach/hardware.h>
+#include <mach/edma.h>
 
 #include <media/davinci/vpfe_capture.h>
 #include <media/davinci/vpif_types.h>
diff --git a/arch/arm/mach-davinci/devices-da8xx.c b/arch/arm/mach-davinci/devices-da8xx.c
index 783eab6..593764c 100644
--- a/arch/arm/mach-davinci/devices-da8xx.c
+++ b/arch/arm/mach-davinci/devices-da8xx.c
@@ -24,6 +24,7 @@
 #include <mach/cpuidle.h>
 
 #include "clock.h"
+#include "asp.h"
 
 #define DA8XX_TPCC_BASE			0x01c00000
 #define DA8XX_TPTC0_BASE		0x01c08000
diff --git a/arch/arm/mach-davinci/dm355.c b/arch/arm/mach-davinci/dm355.c
index 678cd99..e47a3f0 100644
--- a/arch/arm/mach-davinci/dm355.c
+++ b/arch/arm/mach-davinci/dm355.c
@@ -26,13 +26,13 @@
 #include <mach/time.h>
 #include <mach/serial.h>
 #include <mach/common.h>
-#include <mach/asp.h>
 #include <mach/spi.h>
 #include <mach/gpio-davinci.h>
 
 #include "davinci.h"
 #include "clock.h"
 #include "mux.h"
+#include "asp.h"
 
 #define DM355_UART2_BASE	(IO_PHYS + 0x206000)
 
diff --git a/arch/arm/mach-davinci/dm365.c b/arch/arm/mach-davinci/dm365.c
index a50d49d..f473745 100644
--- a/arch/arm/mach-davinci/dm365.c
+++ b/arch/arm/mach-davinci/dm365.c
@@ -29,7 +29,6 @@
 #include <mach/time.h>
 #include <mach/serial.h>
 #include <mach/common.h>
-#include <mach/asp.h>
 #include <mach/keyscan.h>
 #include <mach/spi.h>
 #include <mach/gpio-davinci.h>
@@ -37,6 +36,7 @@
 #include "davinci.h"
 #include "clock.h"
 #include "mux.h"
+#include "asp.h"
 
 #define DM365_REF_FREQ		24000000	/* 24 MHz on the DM365 EVM */
 
diff --git a/arch/arm/mach-davinci/dm644x.c b/arch/arm/mach-davinci/dm644x.c
index c8b8666..0755d46 100644
--- a/arch/arm/mach-davinci/dm644x.c
+++ b/arch/arm/mach-davinci/dm644x.c
@@ -23,12 +23,12 @@
 #include <mach/time.h>
 #include <mach/serial.h>
 #include <mach/common.h>
-#include <mach/asp.h>
 #include <mach/gpio-davinci.h>
 
 #include "davinci.h"
 #include "clock.h"
 #include "mux.h"
+#include "asp.h"
 
 /*
  * Device specific clocks
diff --git a/arch/arm/mach-davinci/dm646x.c b/arch/arm/mach-davinci/dm646x.c
index 9eb87c1..97c0f8e 100644
--- a/arch/arm/mach-davinci/dm646x.c
+++ b/arch/arm/mach-davinci/dm646x.c
@@ -24,12 +24,12 @@
 #include <mach/time.h>
 #include <mach/serial.h>
 #include <mach/common.h>
-#include <mach/asp.h>
 #include <mach/gpio-davinci.h>
 
 #include "davinci.h"
 #include "clock.h"
 #include "mux.h"
+#include "asp.h"
 
 #define DAVINCI_VPIF_BASE       (0x01C12000)
 
diff --git a/arch/arm/mach-davinci/include/mach/da8xx.h b/arch/arm/mach-davinci/include/mach/da8xx.h
index a2f1f27..c74a6ab 100644
--- a/arch/arm/mach-davinci/include/mach/da8xx.h
+++ b/arch/arm/mach-davinci/include/mach/da8xx.h
@@ -16,11 +16,11 @@
 #include <linux/platform_device.h>
 #include <linux/davinci_emac.h>
 #include <linux/spi/spi.h>
+#include <linux/platform_data/davinci_asp.h>
 
 #include <mach/serial.h>
 #include <mach/edma.h>
 #include <mach/i2c.h>
-#include <mach/asp.h>
 #include <mach/mmc.h>
 #include <mach/usb.h>
 #include <mach/pm.h>
diff --git a/arch/arm/mach-davinci/include/mach/asp.h b/include/linux/platform_data/davinci_asp.h
similarity index 56%
rename from arch/arm/mach-davinci/include/mach/asp.h
rename to include/linux/platform_data/davinci_asp.h
index 9aa2409..79c26aa 100644
--- a/arch/arm/mach-davinci/include/mach/asp.h
+++ b/include/linux/platform_data/davinci_asp.h
@@ -1,59 +1,26 @@
 /*
- * <mach/asp.h> - DaVinci Audio Serial Port support
+ * TI DaVinci Audio Serial Port support
+ *
+ * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation version 2.
+ *
+ * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ * kind, whether express or implied; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
  */
-#ifndef __ASM_ARCH_DAVINCI_ASP_H
-#define __ASM_ARCH_DAVINCI_ASP_H
 
-#include <mach/irqs.h>
-#include <mach/edma.h>
-
-/* Bases of dm644x and dm355 register banks */
-#define DAVINCI_ASP0_BASE	0x01E02000
-#define DAVINCI_ASP1_BASE	0x01E04000
-
-/* Bases of dm365 register banks */
-#define DAVINCI_DM365_ASP0_BASE	0x01D02000
-
-/* Bases of dm646x register banks */
-#define	DAVINCI_DM646X_MCASP0_REG_BASE		0x01D01000
-#define DAVINCI_DM646X_MCASP1_REG_BASE		0x01D01800
-
-/* Bases of da850/da830 McASP0  register banks */
-#define DAVINCI_DA8XX_MCASP0_REG_BASE	0x01D00000
-
-/* Bases of da830 McASP1 register banks */
-#define DAVINCI_DA830_MCASP1_REG_BASE	0x01D04000
-
-/* EDMA channels of dm644x and dm355 */
-#define DAVINCI_DMA_ASP0_TX	2
-#define DAVINCI_DMA_ASP0_RX	3
-#define DAVINCI_DMA_ASP1_TX	8
-#define DAVINCI_DMA_ASP1_RX	9
-
-/* EDMA channels of dm646x */
-#define	DAVINCI_DM646X_DMA_MCASP0_AXEVT0	6
-#define	DAVINCI_DM646X_DMA_MCASP0_AREVT0	9
-#define	DAVINCI_DM646X_DMA_MCASP1_AXEVT1	12
-
-/* EDMA channels of da850/da830 McASP0 */
-#define	DAVINCI_DA8XX_DMA_MCASP0_AREVT	0
-#define	DAVINCI_DA8XX_DMA_MCASP0_AXEVT	1
-
-/* EDMA channels of da830 McASP1 */
-#define	DAVINCI_DA830_DMA_MCASP1_AREVT	2
-#define	DAVINCI_DA830_DMA_MCASP1_AXEVT	3
-
-/* Interrupts */
-#define DAVINCI_ASP0_RX_INT	IRQ_MBRINT
-#define DAVINCI_ASP0_TX_INT	IRQ_MBXINT
-#define DAVINCI_ASP1_RX_INT	IRQ_MBRINT
-#define DAVINCI_ASP1_TX_INT	IRQ_MBXINT
+#ifndef __DAVINCI_ASP_H
+#define __DAVINCI_ASP_H
 
 struct snd_platform_data {
 	u32 tx_dma_offset;
 	u32 rx_dma_offset;
-	enum dma_event_q asp_chan_q;	/* event queue number for ASP channel */
-	enum dma_event_q ram_chan_q;	/* event queue number for RAM channel */
+	int asp_chan_q;	/* event queue number for ASP channel */
+	int ram_chan_q;	/* event queue number for RAM channel */
 	unsigned int codec_fmt;
 	/*
 	 * Allowing this is more efficient and eliminates left and right swaps
@@ -70,7 +37,7 @@ struct snd_platform_data {
 	 * and MCBSP_CLKS.
 	 * Depending on different hardware connections it is possible
 	 * to use this setting to change the behaviour of McBSP
-	 * driver. The dm365_clk_input_pin enum is available for dm365
+	 * driver.
 	 */
 	int clk_input_pin;
 
@@ -122,8 +89,8 @@ enum {
 	MCASP_VERSION_2,	/* DA8xx/OMAPL1x */
 };
 
-enum dm365_clk_input_pin {
-	MCBSP_CLKR = 0,		/* DM365 */
+enum mcbsp_clk_input_pin {
+	MCBSP_CLKR = 0,		/* as in DM365 */
 	MCBSP_CLKS,
 };
 
@@ -134,4 +101,4 @@ enum dm365_clk_input_pin {
 #define DAVINCI_MCASP_IIS_MODE	0
 #define DAVINCI_MCASP_DIT_MODE	1
 
-#endif /* __ASM_ARCH_DAVINCI_ASP_H */
+#endif
diff --git a/sound/soc/davinci/davinci-evm.c b/sound/soc/davinci/davinci-evm.c
index c80c20a..0a95c0c 100644
--- a/sound/soc/davinci/davinci-evm.c
+++ b/sound/soc/davinci/davinci-evm.c
@@ -22,9 +22,6 @@
 #include <asm/dma.h>
 #include <asm/mach-types.h>
 
-#include <mach/asp.h>
-#include <mach/edma.h>
-
 #include "davinci-pcm.h"
 #include "davinci-i2s.h"
 #include "davinci-mcasp.h"
diff --git a/sound/soc/davinci/davinci-i2s.c b/sound/soc/davinci/davinci-i2s.c
index 0a74b95..6e281a7 100644
--- a/sound/soc/davinci/davinci-i2s.c
+++ b/sound/soc/davinci/davinci-i2s.c
@@ -16,6 +16,7 @@
 #include <linux/delay.h>
 #include <linux/io.h>
 #include <linux/clk.h>
+#include <linux/platform_data/davinci_asp.h>
 
 #include <sound/core.h>
 #include <sound/pcm.h>
@@ -23,8 +24,6 @@
 #include <sound/initval.h>
 #include <sound/soc.h>
 
-#include <mach/asp.h>
-
 #include "davinci-pcm.h"
 #include "davinci-i2s.h"
 
diff --git a/sound/soc/davinci/davinci-mcasp.h b/sound/soc/davinci/davinci-mcasp.h
index 51479f9..0de9ed6 100644
--- a/sound/soc/davinci/davinci-mcasp.h
+++ b/sound/soc/davinci/davinci-mcasp.h
@@ -19,7 +19,8 @@
 #define DAVINCI_MCASP_H
 
 #include <linux/io.h>
-#include <mach/asp.h>
+#include <linux/platform_data/davinci_asp.h>
+
 #include "davinci-pcm.h"
 
 #define DAVINCI_MCASP_RATES	SNDRV_PCM_RATE_8000_96000
diff --git a/sound/soc/davinci/davinci-pcm.c b/sound/soc/davinci/davinci-pcm.c
index 97d77b2..fefb3d4 100644
--- a/sound/soc/davinci/davinci-pcm.c
+++ b/sound/soc/davinci/davinci-pcm.c
@@ -23,7 +23,6 @@
 #include <sound/soc.h>
 
 #include <asm/dma.h>
-#include <mach/edma.h>
 #include <mach/sram.h>
 
 #include "davinci-pcm.h"
diff --git a/sound/soc/davinci/davinci-pcm.h b/sound/soc/davinci/davinci-pcm.h
index c0d6c9b..faac225 100644
--- a/sound/soc/davinci/davinci-pcm.h
+++ b/sound/soc/davinci/davinci-pcm.h
@@ -12,9 +12,8 @@
 #ifndef _DAVINCI_PCM_H
 #define _DAVINCI_PCM_H
 
+#include <linux/platform_data/davinci_asp.h>
 #include <mach/edma.h>
-#include <mach/asp.h>
-
 
 struct davinci_pcm_dma_params {
 	int channel;			/* sync dma channel ID */
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH 1/5] ASoC/ARM: Davinci: McASP: split asp header into platform and audio specific
@ 2012-08-14 12:42   ` Hebbar, Gururaja
  0 siblings, 0 replies; 40+ messages in thread
From: Hebbar, Gururaja @ 2012-08-14 12:42 UTC (permalink / raw)
  To: linux-arm-kernel

Davinci McASP header & driver are shared by few OMAP platforms (like
TI81xx, AM335x). Splitting asp header into Davinci platform specific
header and Audio specific header helps to share them across platforms.

Audio specific defines is moved to to common
<linux/platform_data/davinci_asp.h> so that the header can be
accessed by all related platforms.

While here, correct the header usage (remove multiple header
re-definitions and unused headers) and remove platform names from
structures comments and enum

Signed-off-by: Hebbar, Gururaja <gururaja.hebbar@ti.com>
Acked-by: Vaibhav Bedia <vaibhav.bedia@ti.com>
---
:000000 100644 0000000... 8fd5238... A	arch/arm/mach-davinci/asp.h
:100644 100644 8db0fc6... 8661b20... M	arch/arm/mach-davinci/davinci.h
:100644 100644 783eab6... 593764c... M	arch/arm/mach-davinci/devices-da8xx.c
:100644 100644 678cd99... e47a3f0... M	arch/arm/mach-davinci/dm355.c
:100644 100644 a50d49de.. f473745... M	arch/arm/mach-davinci/dm365.c
:100644 100644 c8b8666... 0755d46... M	arch/arm/mach-davinci/dm644x.c
:100644 100644 9eb87c1... 97c0f8e... M	arch/arm/mach-davinci/dm646x.c
:100644 100644 a2f1f27... c74a6ab... M	arch/arm/mach-davinci/include/mach/da8xx.h
:100644 100644 9aa2409... 79c26aa... R056	arch/arm/mach-davinci/include/mach/asp.h	include/linux/platform_data/davinci_asp.h
:100644 100644 c80c20a... 0a95c0c... M	sound/soc/davinci/davinci-evm.c
:100644 100644 0a74b95... 6e281a7... M	sound/soc/davinci/davinci-i2s.c
:100644 100644 51479f9... 0de9ed6... M	sound/soc/davinci/davinci-mcasp.h
:100644 100644 97d77b2... fefb3d4... M	sound/soc/davinci/davinci-pcm.c
:100644 100644 c0d6c9b... faac225... M	sound/soc/davinci/davinci-pcm.h
 arch/arm/mach-davinci/asp.h                        |   49 +++++++++++++
 arch/arm/mach-davinci/davinci.h                    |    3 +-
 arch/arm/mach-davinci/devices-da8xx.c              |    1 +
 arch/arm/mach-davinci/dm355.c                      |    2 +-
 arch/arm/mach-davinci/dm365.c                      |    2 +-
 arch/arm/mach-davinci/dm644x.c                     |    2 +-
 arch/arm/mach-davinci/dm646x.c                     |    2 +-
 arch/arm/mach-davinci/include/mach/da8xx.h         |    2 +-
 .../linux/platform_data/davinci_asp.h              |   73 ++++++--------------
 sound/soc/davinci/davinci-evm.c                    |    3 -
 sound/soc/davinci/davinci-i2s.c                    |    3 +-
 sound/soc/davinci/davinci-mcasp.h                  |    3 +-
 sound/soc/davinci/davinci-pcm.c                    |    1 -
 sound/soc/davinci/davinci-pcm.h                    |    3 +-
 14 files changed, 81 insertions(+), 68 deletions(-)

diff --git a/arch/arm/mach-davinci/asp.h b/arch/arm/mach-davinci/asp.h
new file mode 100644
index 0000000..8fd5238
--- /dev/null
+++ b/arch/arm/mach-davinci/asp.h
@@ -0,0 +1,49 @@
+/*
+ * TI DaVinci Audio definitions
+ */
+#ifndef __ASM_ARCH_DAVINCI_ASP_H
+#define __ASM_ARCH_DAVINCI_ASP_H
+
+/* Bases of dm644x and dm355 register banks */
+#define DAVINCI_ASP0_BASE	0x01E02000
+#define DAVINCI_ASP1_BASE	0x01E04000
+
+/* Bases of dm365 register banks */
+#define DAVINCI_DM365_ASP0_BASE	0x01D02000
+
+/* Bases of dm646x register banks */
+#define	DAVINCI_DM646X_MCASP0_REG_BASE		0x01D01000
+#define DAVINCI_DM646X_MCASP1_REG_BASE		0x01D01800
+
+/* Bases of da850/da830 McASP0  register banks */
+#define DAVINCI_DA8XX_MCASP0_REG_BASE	0x01D00000
+
+/* Bases of da830 McASP1 register banks */
+#define DAVINCI_DA830_MCASP1_REG_BASE	0x01D04000
+
+/* EDMA channels of dm644x and dm355 */
+#define DAVINCI_DMA_ASP0_TX	2
+#define DAVINCI_DMA_ASP0_RX	3
+#define DAVINCI_DMA_ASP1_TX	8
+#define DAVINCI_DMA_ASP1_RX	9
+
+/* EDMA channels of dm646x */
+#define	DAVINCI_DM646X_DMA_MCASP0_AXEVT0	6
+#define	DAVINCI_DM646X_DMA_MCASP0_AREVT0	9
+#define	DAVINCI_DM646X_DMA_MCASP1_AXEVT1	12
+
+/* EDMA channels of da850/da830 McASP0 */
+#define	DAVINCI_DA8XX_DMA_MCASP0_AREVT	0
+#define	DAVINCI_DA8XX_DMA_MCASP0_AXEVT	1
+
+/* EDMA channels of da830 McASP1 */
+#define	DAVINCI_DA830_DMA_MCASP1_AREVT	2
+#define	DAVINCI_DA830_DMA_MCASP1_AXEVT	3
+
+/* Interrupts */
+#define DAVINCI_ASP0_RX_INT	IRQ_MBRINT
+#define DAVINCI_ASP0_TX_INT	IRQ_MBXINT
+#define DAVINCI_ASP1_RX_INT	IRQ_MBRINT
+#define DAVINCI_ASP1_TX_INT	IRQ_MBXINT
+
+#endif /* __ASM_ARCH_DAVINCI_ASP_H */
diff --git a/arch/arm/mach-davinci/davinci.h b/arch/arm/mach-davinci/davinci.h
index 8db0fc6..8661b20 100644
--- a/arch/arm/mach-davinci/davinci.h
+++ b/arch/arm/mach-davinci/davinci.h
@@ -22,10 +22,11 @@
 #include <linux/davinci_emac.h>
 #include <linux/platform_device.h>
 #include <linux/spi/spi.h>
+#include <linux/platform_data/davinci_asp.h>
 
-#include <mach/asp.h>
 #include <mach/keyscan.h>
 #include <mach/hardware.h>
+#include <mach/edma.h>
 
 #include <media/davinci/vpfe_capture.h>
 #include <media/davinci/vpif_types.h>
diff --git a/arch/arm/mach-davinci/devices-da8xx.c b/arch/arm/mach-davinci/devices-da8xx.c
index 783eab6..593764c 100644
--- a/arch/arm/mach-davinci/devices-da8xx.c
+++ b/arch/arm/mach-davinci/devices-da8xx.c
@@ -24,6 +24,7 @@
 #include <mach/cpuidle.h>
 
 #include "clock.h"
+#include "asp.h"
 
 #define DA8XX_TPCC_BASE			0x01c00000
 #define DA8XX_TPTC0_BASE		0x01c08000
diff --git a/arch/arm/mach-davinci/dm355.c b/arch/arm/mach-davinci/dm355.c
index 678cd99..e47a3f0 100644
--- a/arch/arm/mach-davinci/dm355.c
+++ b/arch/arm/mach-davinci/dm355.c
@@ -26,13 +26,13 @@
 #include <mach/time.h>
 #include <mach/serial.h>
 #include <mach/common.h>
-#include <mach/asp.h>
 #include <mach/spi.h>
 #include <mach/gpio-davinci.h>
 
 #include "davinci.h"
 #include "clock.h"
 #include "mux.h"
+#include "asp.h"
 
 #define DM355_UART2_BASE	(IO_PHYS + 0x206000)
 
diff --git a/arch/arm/mach-davinci/dm365.c b/arch/arm/mach-davinci/dm365.c
index a50d49d..f473745 100644
--- a/arch/arm/mach-davinci/dm365.c
+++ b/arch/arm/mach-davinci/dm365.c
@@ -29,7 +29,6 @@
 #include <mach/time.h>
 #include <mach/serial.h>
 #include <mach/common.h>
-#include <mach/asp.h>
 #include <mach/keyscan.h>
 #include <mach/spi.h>
 #include <mach/gpio-davinci.h>
@@ -37,6 +36,7 @@
 #include "davinci.h"
 #include "clock.h"
 #include "mux.h"
+#include "asp.h"
 
 #define DM365_REF_FREQ		24000000	/* 24 MHz on the DM365 EVM */
 
diff --git a/arch/arm/mach-davinci/dm644x.c b/arch/arm/mach-davinci/dm644x.c
index c8b8666..0755d46 100644
--- a/arch/arm/mach-davinci/dm644x.c
+++ b/arch/arm/mach-davinci/dm644x.c
@@ -23,12 +23,12 @@
 #include <mach/time.h>
 #include <mach/serial.h>
 #include <mach/common.h>
-#include <mach/asp.h>
 #include <mach/gpio-davinci.h>
 
 #include "davinci.h"
 #include "clock.h"
 #include "mux.h"
+#include "asp.h"
 
 /*
  * Device specific clocks
diff --git a/arch/arm/mach-davinci/dm646x.c b/arch/arm/mach-davinci/dm646x.c
index 9eb87c1..97c0f8e 100644
--- a/arch/arm/mach-davinci/dm646x.c
+++ b/arch/arm/mach-davinci/dm646x.c
@@ -24,12 +24,12 @@
 #include <mach/time.h>
 #include <mach/serial.h>
 #include <mach/common.h>
-#include <mach/asp.h>
 #include <mach/gpio-davinci.h>
 
 #include "davinci.h"
 #include "clock.h"
 #include "mux.h"
+#include "asp.h"
 
 #define DAVINCI_VPIF_BASE       (0x01C12000)
 
diff --git a/arch/arm/mach-davinci/include/mach/da8xx.h b/arch/arm/mach-davinci/include/mach/da8xx.h
index a2f1f27..c74a6ab 100644
--- a/arch/arm/mach-davinci/include/mach/da8xx.h
+++ b/arch/arm/mach-davinci/include/mach/da8xx.h
@@ -16,11 +16,11 @@
 #include <linux/platform_device.h>
 #include <linux/davinci_emac.h>
 #include <linux/spi/spi.h>
+#include <linux/platform_data/davinci_asp.h>
 
 #include <mach/serial.h>
 #include <mach/edma.h>
 #include <mach/i2c.h>
-#include <mach/asp.h>
 #include <mach/mmc.h>
 #include <mach/usb.h>
 #include <mach/pm.h>
diff --git a/arch/arm/mach-davinci/include/mach/asp.h b/include/linux/platform_data/davinci_asp.h
similarity index 56%
rename from arch/arm/mach-davinci/include/mach/asp.h
rename to include/linux/platform_data/davinci_asp.h
index 9aa2409..79c26aa 100644
--- a/arch/arm/mach-davinci/include/mach/asp.h
+++ b/include/linux/platform_data/davinci_asp.h
@@ -1,59 +1,26 @@
 /*
- * <mach/asp.h> - DaVinci Audio Serial Port support
+ * TI DaVinci Audio Serial Port support
+ *
+ * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation version 2.
+ *
+ * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ * kind, whether express or implied; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
  */
-#ifndef __ASM_ARCH_DAVINCI_ASP_H
-#define __ASM_ARCH_DAVINCI_ASP_H
 
-#include <mach/irqs.h>
-#include <mach/edma.h>
-
-/* Bases of dm644x and dm355 register banks */
-#define DAVINCI_ASP0_BASE	0x01E02000
-#define DAVINCI_ASP1_BASE	0x01E04000
-
-/* Bases of dm365 register banks */
-#define DAVINCI_DM365_ASP0_BASE	0x01D02000
-
-/* Bases of dm646x register banks */
-#define	DAVINCI_DM646X_MCASP0_REG_BASE		0x01D01000
-#define DAVINCI_DM646X_MCASP1_REG_BASE		0x01D01800
-
-/* Bases of da850/da830 McASP0  register banks */
-#define DAVINCI_DA8XX_MCASP0_REG_BASE	0x01D00000
-
-/* Bases of da830 McASP1 register banks */
-#define DAVINCI_DA830_MCASP1_REG_BASE	0x01D04000
-
-/* EDMA channels of dm644x and dm355 */
-#define DAVINCI_DMA_ASP0_TX	2
-#define DAVINCI_DMA_ASP0_RX	3
-#define DAVINCI_DMA_ASP1_TX	8
-#define DAVINCI_DMA_ASP1_RX	9
-
-/* EDMA channels of dm646x */
-#define	DAVINCI_DM646X_DMA_MCASP0_AXEVT0	6
-#define	DAVINCI_DM646X_DMA_MCASP0_AREVT0	9
-#define	DAVINCI_DM646X_DMA_MCASP1_AXEVT1	12
-
-/* EDMA channels of da850/da830 McASP0 */
-#define	DAVINCI_DA8XX_DMA_MCASP0_AREVT	0
-#define	DAVINCI_DA8XX_DMA_MCASP0_AXEVT	1
-
-/* EDMA channels of da830 McASP1 */
-#define	DAVINCI_DA830_DMA_MCASP1_AREVT	2
-#define	DAVINCI_DA830_DMA_MCASP1_AXEVT	3
-
-/* Interrupts */
-#define DAVINCI_ASP0_RX_INT	IRQ_MBRINT
-#define DAVINCI_ASP0_TX_INT	IRQ_MBXINT
-#define DAVINCI_ASP1_RX_INT	IRQ_MBRINT
-#define DAVINCI_ASP1_TX_INT	IRQ_MBXINT
+#ifndef __DAVINCI_ASP_H
+#define __DAVINCI_ASP_H
 
 struct snd_platform_data {
 	u32 tx_dma_offset;
 	u32 rx_dma_offset;
-	enum dma_event_q asp_chan_q;	/* event queue number for ASP channel */
-	enum dma_event_q ram_chan_q;	/* event queue number for RAM channel */
+	int asp_chan_q;	/* event queue number for ASP channel */
+	int ram_chan_q;	/* event queue number for RAM channel */
 	unsigned int codec_fmt;
 	/*
 	 * Allowing this is more efficient and eliminates left and right swaps
@@ -70,7 +37,7 @@ struct snd_platform_data {
 	 * and MCBSP_CLKS.
 	 * Depending on different hardware connections it is possible
 	 * to use this setting to change the behaviour of McBSP
-	 * driver. The dm365_clk_input_pin enum is available for dm365
+	 * driver.
 	 */
 	int clk_input_pin;
 
@@ -122,8 +89,8 @@ enum {
 	MCASP_VERSION_2,	/* DA8xx/OMAPL1x */
 };
 
-enum dm365_clk_input_pin {
-	MCBSP_CLKR = 0,		/* DM365 */
+enum mcbsp_clk_input_pin {
+	MCBSP_CLKR = 0,		/* as in DM365 */
 	MCBSP_CLKS,
 };
 
@@ -134,4 +101,4 @@ enum dm365_clk_input_pin {
 #define DAVINCI_MCASP_IIS_MODE	0
 #define DAVINCI_MCASP_DIT_MODE	1
 
-#endif /* __ASM_ARCH_DAVINCI_ASP_H */
+#endif
diff --git a/sound/soc/davinci/davinci-evm.c b/sound/soc/davinci/davinci-evm.c
index c80c20a..0a95c0c 100644
--- a/sound/soc/davinci/davinci-evm.c
+++ b/sound/soc/davinci/davinci-evm.c
@@ -22,9 +22,6 @@
 #include <asm/dma.h>
 #include <asm/mach-types.h>
 
-#include <mach/asp.h>
-#include <mach/edma.h>
-
 #include "davinci-pcm.h"
 #include "davinci-i2s.h"
 #include "davinci-mcasp.h"
diff --git a/sound/soc/davinci/davinci-i2s.c b/sound/soc/davinci/davinci-i2s.c
index 0a74b95..6e281a7 100644
--- a/sound/soc/davinci/davinci-i2s.c
+++ b/sound/soc/davinci/davinci-i2s.c
@@ -16,6 +16,7 @@
 #include <linux/delay.h>
 #include <linux/io.h>
 #include <linux/clk.h>
+#include <linux/platform_data/davinci_asp.h>
 
 #include <sound/core.h>
 #include <sound/pcm.h>
@@ -23,8 +24,6 @@
 #include <sound/initval.h>
 #include <sound/soc.h>
 
-#include <mach/asp.h>
-
 #include "davinci-pcm.h"
 #include "davinci-i2s.h"
 
diff --git a/sound/soc/davinci/davinci-mcasp.h b/sound/soc/davinci/davinci-mcasp.h
index 51479f9..0de9ed6 100644
--- a/sound/soc/davinci/davinci-mcasp.h
+++ b/sound/soc/davinci/davinci-mcasp.h
@@ -19,7 +19,8 @@
 #define DAVINCI_MCASP_H
 
 #include <linux/io.h>
-#include <mach/asp.h>
+#include <linux/platform_data/davinci_asp.h>
+
 #include "davinci-pcm.h"
 
 #define DAVINCI_MCASP_RATES	SNDRV_PCM_RATE_8000_96000
diff --git a/sound/soc/davinci/davinci-pcm.c b/sound/soc/davinci/davinci-pcm.c
index 97d77b2..fefb3d4 100644
--- a/sound/soc/davinci/davinci-pcm.c
+++ b/sound/soc/davinci/davinci-pcm.c
@@ -23,7 +23,6 @@
 #include <sound/soc.h>
 
 #include <asm/dma.h>
-#include <mach/edma.h>
 #include <mach/sram.h>
 
 #include "davinci-pcm.h"
diff --git a/sound/soc/davinci/davinci-pcm.h b/sound/soc/davinci/davinci-pcm.h
index c0d6c9b..faac225 100644
--- a/sound/soc/davinci/davinci-pcm.h
+++ b/sound/soc/davinci/davinci-pcm.h
@@ -12,9 +12,8 @@
 #ifndef _DAVINCI_PCM_H
 #define _DAVINCI_PCM_H
 
+#include <linux/platform_data/davinci_asp.h>
 #include <mach/edma.h>
-#include <mach/asp.h>
-
 
 struct davinci_pcm_dma_params {
 	int channel;			/* sync dma channel ID */
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH 2/5] ASoC: Davinci: McASP: add device tree support for McASP
  2012-08-14 12:42 ` Hebbar, Gururaja
@ 2012-08-14 12:42   ` Hebbar, Gururaja
  -1 siblings, 0 replies; 40+ messages in thread
From: Hebbar, Gururaja @ 2012-08-14 12:42 UTC (permalink / raw)
  To: tony, lrg, broonie
  Cc: alsa-devel, sudhakar.raj, nsekhar, davinci-linux-open-source,
	gururaja.hebbar, peter.ujfalusi, linux-arm-kernel

Add device tree probe for McASP driver.

Note:
DMA parameters are not populated from DT and will be done later.

Signed-off-by: Hebbar, Gururaja <gururaja.hebbar@ti.com>
---
:000000 100644 0000000... 692659e... A	Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt
:100644 100644 6a2c54c... db7756a... M	sound/soc/davinci/davinci-mcasp.c
 .../bindings/sound/davinci-mcasp-audio.txt         |   43 ++++++++
 sound/soc/davinci/davinci-mcasp.c                  |  113 +++++++++++++++++++-
 2 files changed, 155 insertions(+), 1 deletions(-)

diff --git a/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt b/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt
new file mode 100644
index 0000000..692659e
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt
@@ -0,0 +1,43 @@
+Texas Instruments McASP controller
+
+Required properties:
+- compatible :
+	"ti,dm646x-mcasp-audio"	: for DM646x platforms
+	"ti,da830-mcasp-audio"	: for both DA830 & DA850 platforms
+
+- reg : Should contain McASP registers offset and length
+- interrupts : Interrupt number for McASP
+- op-mode : I2S/DIT ops mode.
+- tdm-slots : Slots for TDM operation.
+- num-serializer : Serializers used by McASP.
+- serial-dir : A list of serializer pin mode. The list number should be equal
+		to "num-serializer" parameter. Each entry is a number indication
+		serializer pin direction. (0 - INACTIVE, 1 - TX, 2 - RX)
+
+
+Optional properties:
+
+- ti,hwmods : Must be "mcasp<n>", n is controller instance starting 0
+- tx-num-evt : FIFO levels.
+- rx-num-evt : FIFO levels.
+
+
+Example:
+
+mcasp0: mcasp0@1d00000 {
+	compatible = "ti,da830-mcasp-audio";
+	#address-cells = <1>;
+	#size-cells = <0>;
+	reg = <0x100000 0x3000>;
+	interrupts = <82 83>;
+	op-mode = <0>;		/* MCASP_IIS_MODE */
+	tdm-slots = <2>;
+	num-serializer = <16>;
+	serial-dir = <
+			0 0 0 0	/* 0: INACTIVE, 1: TX, 2: RX */
+			0 0 0 0
+			0 0 0 1
+			2 0 0 0 >;
+	tx-num-evt = <1>;
+	rx-num-evt = <1>;
+};
diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c
index 6a2c54c..db7756a 100644
--- a/sound/soc/davinci/davinci-mcasp.c
+++ b/sound/soc/davinci/davinci-mcasp.c
@@ -22,6 +22,9 @@
 #include <linux/delay.h>
 #include <linux/io.h>
 #include <linux/pm_runtime.h>
+#include <linux/of.h>
+#include <linux/of_platform.h>
+#include <linux/of_device.h>
 
 #include <sound/core.h>
 #include <sound/pcm.h>
@@ -862,19 +865,127 @@ static struct snd_soc_dai_driver davinci_mcasp_dai[] = {
 
 };
 
+static const struct of_device_id mcasp_dt_ids[] = {
+	{
+		.compatible = "ti,dm646x-mcasp-audio",
+		.data = (void *)MCASP_VERSION_1,
+	},
+	{
+		.compatible = "ti,da830-mcasp-audio",
+		.data = (void *)MCASP_VERSION_2,
+	},
+	{ /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, mcasp_dt_ids);
+
+static u8 of_serial_dir[16];
+
+static struct snd_platform_data *davinci_mcasp_set_pdata_from_of(
+						struct platform_device *pdev)
+{
+	struct device_node *np = pdev->dev.of_node;
+	struct snd_platform_data *pdata = NULL;
+	const struct of_device_id *match =
+			of_match_device(of_match_ptr(mcasp_dt_ids), &pdev->dev);
+
+	const u32 *of_serial_dir32;
+	u32 val;
+	int i, ret = 0;
+
+	if (pdev->dev.platform_data) {
+		pdata = pdev->dev.platform_data;
+		return pdata;
+	} else if (match) {
+		pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
+		if (!pdata) {
+			ret = -ENOMEM;
+			goto nodata;
+		}
+	} else {
+		/* control shouldn't reach here. something is wrong */
+		ret = -EINVAL;
+		goto nodata;
+	}
+
+	if (match->data)
+		pdata->version = (u8)((int)match->data);
+
+	ret = of_property_read_u32(np, "op-mode", &val);
+	if (ret < 0)
+		goto nodata;
+	pdata->op_mode = val;
+
+	ret = of_property_read_u32(np, "tdm-slots", &pdata->tdm_slots);
+	if (ret < 0)
+		goto nodata;
+
+	ret = of_property_read_u32(np, "num-serializer", &val);
+	if (ret < 0)
+		goto nodata;
+	pdata->num_serializer = val;
+
+	of_serial_dir32 = of_get_property(np, "serial-dir", &val);
+	val /= sizeof(u32);
+	if (val != pdata->num_serializer) {
+		ret = -EINVAL;
+		goto nodata;
+	}
+
+	if (of_serial_dir32) {
+		for (i = 0; i < pdata->num_serializer; i++)
+			of_serial_dir[i] = be32_to_cpup(&of_serial_dir32[i]);
+
+		pdata->serial_dir = of_serial_dir;
+	}
+
+	ret = of_property_read_u32(np, "tx-num-evt", &val);
+	if (ret >= 0)
+		pdata->txnumevt = val;
+
+	ret = of_property_read_u32(np, "rx-num-evt", &val);
+	if (ret >= 0)
+		pdata->rxnumevt = val;
+
+	ret = of_property_read_u32(np, "sram-size-playback", &val);
+	if (ret >= 0)
+		pdata->sram_size_playback = val;
+
+	ret = of_property_read_u32(np, "sram-size-capture", &val);
+	if (ret >= 0)
+		pdata->sram_size_capture = val;
+
+nodata:
+	if (ret < 0)
+		dev_err(&pdev->dev, "Error populating platform data, err %d\n",
+			ret);
+	return  pdata;
+}
+
 static int davinci_mcasp_probe(struct platform_device *pdev)
 {
 	struct davinci_pcm_dma_params *dma_data;
 	struct resource *mem, *ioarea, *res;
 	struct snd_platform_data *pdata;
 	struct davinci_audio_dev *dev;
+
 	int ret;
 
+	if (!pdev->dev.platform_data && !pdev->dev.of_node) {
+		dev_err(&pdev->dev, "No platform data supplied\n");
+		return -EINVAL;
+	}
+
 	dev = devm_kzalloc(&pdev->dev, sizeof(struct davinci_audio_dev),
 			   GFP_KERNEL);
 	if (!dev)
 		return	-ENOMEM;
 
+	pdata = davinci_mcasp_set_pdata_from_of(pdev);
+	if (!pdata) {
+		dev_err(&pdev->dev, "no platform data\n");
+		return -EINVAL;
+	}
+
 	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	if (!mem) {
 		dev_err(&pdev->dev, "no mem resource?\n");
@@ -888,7 +999,6 @@ static int davinci_mcasp_probe(struct platform_device *pdev)
 		return -EBUSY;
 	}
 
-	pdata = pdev->dev.platform_data;
 	pm_runtime_enable(&pdev->dev);
 
 	ret = pm_runtime_get_sync(&pdev->dev);
@@ -976,6 +1086,7 @@ static struct platform_driver davinci_mcasp_driver = {
 	.driver		= {
 		.name	= "davinci-mcasp",
 		.owner	= THIS_MODULE,
+		.of_match_table = of_match_ptr(mcasp_dt_ids),
 	},
 };
 
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH 2/5] ASoC: Davinci: McASP: add device tree support for McASP
@ 2012-08-14 12:42   ` Hebbar, Gururaja
  0 siblings, 0 replies; 40+ messages in thread
From: Hebbar, Gururaja @ 2012-08-14 12:42 UTC (permalink / raw)
  To: linux-arm-kernel

Add device tree probe for McASP driver.

Note:
DMA parameters are not populated from DT and will be done later.

Signed-off-by: Hebbar, Gururaja <gururaja.hebbar@ti.com>
---
:000000 100644 0000000... 692659e... A	Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt
:100644 100644 6a2c54c... db7756a... M	sound/soc/davinci/davinci-mcasp.c
 .../bindings/sound/davinci-mcasp-audio.txt         |   43 ++++++++
 sound/soc/davinci/davinci-mcasp.c                  |  113 +++++++++++++++++++-
 2 files changed, 155 insertions(+), 1 deletions(-)

diff --git a/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt b/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt
new file mode 100644
index 0000000..692659e
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/davinci-mcasp-audio.txt
@@ -0,0 +1,43 @@
+Texas Instruments McASP controller
+
+Required properties:
+- compatible :
+	"ti,dm646x-mcasp-audio"	: for DM646x platforms
+	"ti,da830-mcasp-audio"	: for both DA830 & DA850 platforms
+
+- reg : Should contain McASP registers offset and length
+- interrupts : Interrupt number for McASP
+- op-mode : I2S/DIT ops mode.
+- tdm-slots : Slots for TDM operation.
+- num-serializer : Serializers used by McASP.
+- serial-dir : A list of serializer pin mode. The list number should be equal
+		to "num-serializer" parameter. Each entry is a number indication
+		serializer pin direction. (0 - INACTIVE, 1 - TX, 2 - RX)
+
+
+Optional properties:
+
+- ti,hwmods : Must be "mcasp<n>", n is controller instance starting 0
+- tx-num-evt : FIFO levels.
+- rx-num-evt : FIFO levels.
+
+
+Example:
+
+mcasp0: mcasp0 at 1d00000 {
+	compatible = "ti,da830-mcasp-audio";
+	#address-cells = <1>;
+	#size-cells = <0>;
+	reg = <0x100000 0x3000>;
+	interrupts = <82 83>;
+	op-mode = <0>;		/* MCASP_IIS_MODE */
+	tdm-slots = <2>;
+	num-serializer = <16>;
+	serial-dir = <
+			0 0 0 0	/* 0: INACTIVE, 1: TX, 2: RX */
+			0 0 0 0
+			0 0 0 1
+			2 0 0 0 >;
+	tx-num-evt = <1>;
+	rx-num-evt = <1>;
+};
diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c
index 6a2c54c..db7756a 100644
--- a/sound/soc/davinci/davinci-mcasp.c
+++ b/sound/soc/davinci/davinci-mcasp.c
@@ -22,6 +22,9 @@
 #include <linux/delay.h>
 #include <linux/io.h>
 #include <linux/pm_runtime.h>
+#include <linux/of.h>
+#include <linux/of_platform.h>
+#include <linux/of_device.h>
 
 #include <sound/core.h>
 #include <sound/pcm.h>
@@ -862,19 +865,127 @@ static struct snd_soc_dai_driver davinci_mcasp_dai[] = {
 
 };
 
+static const struct of_device_id mcasp_dt_ids[] = {
+	{
+		.compatible = "ti,dm646x-mcasp-audio",
+		.data = (void *)MCASP_VERSION_1,
+	},
+	{
+		.compatible = "ti,da830-mcasp-audio",
+		.data = (void *)MCASP_VERSION_2,
+	},
+	{ /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, mcasp_dt_ids);
+
+static u8 of_serial_dir[16];
+
+static struct snd_platform_data *davinci_mcasp_set_pdata_from_of(
+						struct platform_device *pdev)
+{
+	struct device_node *np = pdev->dev.of_node;
+	struct snd_platform_data *pdata = NULL;
+	const struct of_device_id *match =
+			of_match_device(of_match_ptr(mcasp_dt_ids), &pdev->dev);
+
+	const u32 *of_serial_dir32;
+	u32 val;
+	int i, ret = 0;
+
+	if (pdev->dev.platform_data) {
+		pdata = pdev->dev.platform_data;
+		return pdata;
+	} else if (match) {
+		pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
+		if (!pdata) {
+			ret = -ENOMEM;
+			goto nodata;
+		}
+	} else {
+		/* control shouldn't reach here. something is wrong */
+		ret = -EINVAL;
+		goto nodata;
+	}
+
+	if (match->data)
+		pdata->version = (u8)((int)match->data);
+
+	ret = of_property_read_u32(np, "op-mode", &val);
+	if (ret < 0)
+		goto nodata;
+	pdata->op_mode = val;
+
+	ret = of_property_read_u32(np, "tdm-slots", &pdata->tdm_slots);
+	if (ret < 0)
+		goto nodata;
+
+	ret = of_property_read_u32(np, "num-serializer", &val);
+	if (ret < 0)
+		goto nodata;
+	pdata->num_serializer = val;
+
+	of_serial_dir32 = of_get_property(np, "serial-dir", &val);
+	val /= sizeof(u32);
+	if (val != pdata->num_serializer) {
+		ret = -EINVAL;
+		goto nodata;
+	}
+
+	if (of_serial_dir32) {
+		for (i = 0; i < pdata->num_serializer; i++)
+			of_serial_dir[i] = be32_to_cpup(&of_serial_dir32[i]);
+
+		pdata->serial_dir = of_serial_dir;
+	}
+
+	ret = of_property_read_u32(np, "tx-num-evt", &val);
+	if (ret >= 0)
+		pdata->txnumevt = val;
+
+	ret = of_property_read_u32(np, "rx-num-evt", &val);
+	if (ret >= 0)
+		pdata->rxnumevt = val;
+
+	ret = of_property_read_u32(np, "sram-size-playback", &val);
+	if (ret >= 0)
+		pdata->sram_size_playback = val;
+
+	ret = of_property_read_u32(np, "sram-size-capture", &val);
+	if (ret >= 0)
+		pdata->sram_size_capture = val;
+
+nodata:
+	if (ret < 0)
+		dev_err(&pdev->dev, "Error populating platform data, err %d\n",
+			ret);
+	return  pdata;
+}
+
 static int davinci_mcasp_probe(struct platform_device *pdev)
 {
 	struct davinci_pcm_dma_params *dma_data;
 	struct resource *mem, *ioarea, *res;
 	struct snd_platform_data *pdata;
 	struct davinci_audio_dev *dev;
+
 	int ret;
 
+	if (!pdev->dev.platform_data && !pdev->dev.of_node) {
+		dev_err(&pdev->dev, "No platform data supplied\n");
+		return -EINVAL;
+	}
+
 	dev = devm_kzalloc(&pdev->dev, sizeof(struct davinci_audio_dev),
 			   GFP_KERNEL);
 	if (!dev)
 		return	-ENOMEM;
 
+	pdata = davinci_mcasp_set_pdata_from_of(pdev);
+	if (!pdata) {
+		dev_err(&pdev->dev, "no platform data\n");
+		return -EINVAL;
+	}
+
 	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 	if (!mem) {
 		dev_err(&pdev->dev, "no mem resource?\n");
@@ -888,7 +999,6 @@ static int davinci_mcasp_probe(struct platform_device *pdev)
 		return -EBUSY;
 	}
 
-	pdata = pdev->dev.platform_data;
 	pm_runtime_enable(&pdev->dev);
 
 	ret = pm_runtime_get_sync(&pdev->dev);
@@ -976,6 +1086,7 @@ static struct platform_driver davinci_mcasp_driver = {
 	.driver		= {
 		.name	= "davinci-mcasp",
 		.owner	= THIS_MODULE,
+		.of_match_table = of_match_ptr(mcasp_dt_ids),
 	},
 };
 
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH 3/5] ASoC: Davinci: pcm: Add device tree bindings
  2012-08-14 12:42 ` Hebbar, Gururaja
@ 2012-08-14 12:42   ` Hebbar, Gururaja
  -1 siblings, 0 replies; 40+ messages in thread
From: Hebbar, Gururaja @ 2012-08-14 12:42 UTC (permalink / raw)
  To: tony, lrg, broonie
  Cc: alsa-devel, sudhakar.raj, nsekhar, davinci-linux-open-source,
	gururaja.hebbar, peter.ujfalusi, linux-arm-kernel

Device tree support for Davinci/OMAP2+ pcm driver.

Signed-off-by: Hebbar, Gururaja <gururaja.hebbar@ti.com>
---
:000000 100644 0000000... be494bb... A	Documentation/devicetree/bindings/sound/davinci-pcm.txt
:100644 100644 fefb3d4... 0765101... M	sound/soc/davinci/davinci-pcm.c
 .../devicetree/bindings/sound/davinci-pcm.txt      |   13 +++++++++++++
 sound/soc/davinci/davinci-pcm.c                    |   11 +++++++++++
 2 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/Documentation/devicetree/bindings/sound/davinci-pcm.txt b/Documentation/devicetree/bindings/sound/davinci-pcm.txt
new file mode 100644
index 0000000..be494bb
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/davinci-pcm.txt
@@ -0,0 +1,13 @@
+Texas Instruments - Davinci/OMAP2+ PCM module
+
+PCM module doesn't use/require any platform data. Hence only
+compatible field needs to be populated.
+
+Required properties:
+- compatible: "ti,davinci-pcm-audio"
+
+Example:
+
+pcm: davinci-pcm-audio {
+	compatible = "ti,davinci-pcm-audio";
+};
diff --git a/sound/soc/davinci/davinci-pcm.c b/sound/soc/davinci/davinci-pcm.c
index fefb3d4..0765101 100644
--- a/sound/soc/davinci/davinci-pcm.c
+++ b/sound/soc/davinci/davinci-pcm.c
@@ -16,6 +16,8 @@
 #include <linux/slab.h>
 #include <linux/dma-mapping.h>
 #include <linux/kernel.h>
+#include <linux/of.h>
+#include <linux/of_platform.h>
 
 #include <sound/core.h>
 #include <sound/pcm.h>
@@ -874,10 +876,19 @@ static int __devexit davinci_soc_platform_remove(struct platform_device *pdev)
 	return 0;
 }
 
+#if defined(CONFIG_OF)
+static const struct of_device_id davinci_pcm_dt_ids[] = {
+	{ .compatible = "ti,davinci-pcm-audio", },
+	{ /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, davinci_pcm_dt_ids);
+#endif
+
 static struct platform_driver davinci_pcm_driver = {
 	.driver = {
 			.name = "davinci-pcm-audio",
 			.owner = THIS_MODULE,
+			.of_match_table = of_match_ptr(davinci_pcm_dt_ids),
 	},
 
 	.probe = davinci_soc_platform_probe,
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH 3/5] ASoC: Davinci: pcm: Add device tree bindings
@ 2012-08-14 12:42   ` Hebbar, Gururaja
  0 siblings, 0 replies; 40+ messages in thread
From: Hebbar, Gururaja @ 2012-08-14 12:42 UTC (permalink / raw)
  To: linux-arm-kernel

Device tree support for Davinci/OMAP2+ pcm driver.

Signed-off-by: Hebbar, Gururaja <gururaja.hebbar@ti.com>
---
:000000 100644 0000000... be494bb... A	Documentation/devicetree/bindings/sound/davinci-pcm.txt
:100644 100644 fefb3d4... 0765101... M	sound/soc/davinci/davinci-pcm.c
 .../devicetree/bindings/sound/davinci-pcm.txt      |   13 +++++++++++++
 sound/soc/davinci/davinci-pcm.c                    |   11 +++++++++++
 2 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/Documentation/devicetree/bindings/sound/davinci-pcm.txt b/Documentation/devicetree/bindings/sound/davinci-pcm.txt
new file mode 100644
index 0000000..be494bb
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/davinci-pcm.txt
@@ -0,0 +1,13 @@
+Texas Instruments - Davinci/OMAP2+ PCM module
+
+PCM module doesn't use/require any platform data. Hence only
+compatible field needs to be populated.
+
+Required properties:
+- compatible: "ti,davinci-pcm-audio"
+
+Example:
+
+pcm: davinci-pcm-audio {
+	compatible = "ti,davinci-pcm-audio";
+};
diff --git a/sound/soc/davinci/davinci-pcm.c b/sound/soc/davinci/davinci-pcm.c
index fefb3d4..0765101 100644
--- a/sound/soc/davinci/davinci-pcm.c
+++ b/sound/soc/davinci/davinci-pcm.c
@@ -16,6 +16,8 @@
 #include <linux/slab.h>
 #include <linux/dma-mapping.h>
 #include <linux/kernel.h>
+#include <linux/of.h>
+#include <linux/of_platform.h>
 
 #include <sound/core.h>
 #include <sound/pcm.h>
@@ -874,10 +876,19 @@ static int __devexit davinci_soc_platform_remove(struct platform_device *pdev)
 	return 0;
 }
 
+#if defined(CONFIG_OF)
+static const struct of_device_id davinci_pcm_dt_ids[] = {
+	{ .compatible = "ti,davinci-pcm-audio", },
+	{ /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, davinci_pcm_dt_ids);
+#endif
+
 static struct platform_driver davinci_pcm_driver = {
 	.driver = {
 			.name = "davinci-pcm-audio",
 			.owner = THIS_MODULE,
+			.of_match_table = of_match_ptr(davinci_pcm_dt_ids),
 	},
 
 	.probe = davinci_soc_platform_probe,
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH 4/5] ASoC: Davinci: machine: Add device tree binding
  2012-08-14 12:42 ` Hebbar, Gururaja
@ 2012-08-14 12:42   ` Hebbar, Gururaja
  -1 siblings, 0 replies; 40+ messages in thread
From: Hebbar, Gururaja @ 2012-08-14 12:42 UTC (permalink / raw)
  To: tony, lrg, broonie
  Cc: alsa-devel, sudhakar.raj, nsekhar, davinci-linux-open-source,
	gururaja.hebbar, peter.ujfalusi, linux-arm-kernel

Device tree support for tlv320aic3x CODEC driver

When the board boots with device tree, the driver will receive card,
codec, dai interface details (like the card name, DAPM routing map,
phandle for the audio components described in the dts file, codec mclk
speed).

The card will be set up based on this information.
Since the routing is provided via DT we can mark the card fully routed
so core can take care of disconnecting the unused pins.

When here, code indentation and comment style is also fixed

Signed-off-by: Hebbar, Gururaja <gururaja.hebbar@ti.com>
---
:000000 100644 0000000... d1cd767... A	Documentation/devicetree/bindings/sound/davinci-evm-audio.txt
:100644 100644 0a95c0c... be8e4ed... M	sound/soc/davinci/davinci-evm.c
 .../bindings/sound/davinci-evm-audio.txt           |   52 ++++++
 sound/soc/davinci/davinci-evm.c                    |  187 +++++++++++++++++--
 2 files changed, 219 insertions(+), 20 deletions(-)

diff --git a/Documentation/devicetree/bindings/sound/davinci-evm-audio.txt b/Documentation/devicetree/bindings/sound/davinci-evm-audio.txt
new file mode 100644
index 0000000..d1cd767
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/davinci-evm-audio.txt
@@ -0,0 +1,52 @@
+* Texas Instruments SoC audio setups with TLV320AIC3X Codec
+
+Required properties:
+- compatible : "ti,davinci-evm-audio"
+- ti,model : The user-visible name of this sound complex.
+- ti,audio-routing : A list of the connections between audio components.
+  Each entry is a pair of strings, the first being the connection's sink,
+  the second being the connection's source. Valid names for sources and
+  sinks are the codec's pins, and the jacks on the board:
+
+  Codec pins:
+
+  * MIC3L
+  * MIC3R
+  * LINE1L
+  * LINE2L
+  * LINE1R
+  * LINE2R
+
+  Board connectors:
+
+  * Headphone Jack
+  * Line Out
+  * Mic Jack
+
+- ti,mcasp-controller : The phandle of the McASP controller
+- ti,audio-codec : The phandle of the TLV320AIC3x audio codec
+- ti,pcm-node : The phandle of the pcm device
+- ti,codec-clock : The Codec Clock from the board
+
+- dai-data		: A list of DAI data used by SOC code to register
+			  DAI, Codecs platform.
+			  The string index "should" be as shown below.
+dai-data =
+"<DAI Name>", 		"<DAI Stream Name>",
+"<CODEC DAI Name>",	"<true if evm_aic3x_init is required, else false>",
+"<evm ops required, evm_ops or evm_spdif_ops>";
+
+Example:
+
+sound {
+	compatible = "ti,davinci-evm-audio";
+	ti,model = "DA830 EVM";
+	ti,audio-codec = <&tlv320aic3x>;
+	ti,mcasp-controller = <&mcasp1>;
+	ti,pcm-node = <&pcm>;
+	ti,codec-clock = <12000000>;
+	dai-data =
+		"TLV320AIC3X", 		"AIC3X",
+		"tlv320aic3x-hifi",	"true",
+		"evm-ops";
+};
diff --git a/sound/soc/davinci/davinci-evm.c b/sound/soc/davinci/davinci-evm.c
index 0a95c0c..be8e4ed 100644
--- a/sound/soc/davinci/davinci-evm.c
+++ b/sound/soc/davinci/davinci-evm.c
@@ -34,27 +34,38 @@ static int evm_hw_params(struct snd_pcm_substream *substream,
 	struct snd_soc_pcm_runtime *rtd = substream->private_data;
 	struct snd_soc_dai *codec_dai = rtd->codec_dai;
 	struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
+	struct snd_soc_codec *codec = rtd->codec;
+	struct snd_soc_card *soc_card = codec->card;
+	struct device_node *np = soc_card->dev->of_node;
 	int ret = 0;
 	unsigned sysclk;
 
-	/* ASP1 on DM355 EVM is clocked by an external oscillator */
-	if (machine_is_davinci_dm355_evm() || machine_is_davinci_dm6467_evm() ||
-	    machine_is_davinci_dm365_evm())
-		sysclk = 27000000;
-
-	/* ASP0 in DM6446 EVM is clocked by U55, as configured by
-	 * board-dm644x-evm.c using GPIOs from U18.  There are six
-	 * options; here we "know" we use a 48 KHz sample rate.
-	 */
-	else if (machine_is_davinci_evm())
-		sysclk = 12288000;
-
-	else if (machine_is_davinci_da830_evm() ||
-				machine_is_davinci_da850_evm())
-		sysclk = 24576000;
-
-	else
-		return -EINVAL;
+	if (np) {
+		ret = of_property_read_u32(np, "ti,codec-clock", &sysclk);
+		if (ret < 0)
+			return ret;
+	} else {
+		/* ASP1 on DM355 EVM is clocked by an external oscillator */
+		if (machine_is_davinci_dm355_evm() ||
+			machine_is_davinci_dm6467_evm() ||
+			machine_is_davinci_dm365_evm())
+			sysclk = 27000000;
+
+		/*
+		 * ASP0 in DM6446 EVM is clocked by U55, as configured by
+		 * board-dm644x-evm.c using GPIOs from U18.  There are six
+		 * options; here we "know" we use a 48 KHz sample rate.
+		 */
+		else if (machine_is_davinci_evm())
+			sysclk = 12288000;
+
+		else if (machine_is_davinci_da830_evm() ||
+					machine_is_davinci_da850_evm())
+			sysclk = 24576000;
+
+		else
+			return -EINVAL;
+	}
 
 	/* set codec DAI configuration */
 	ret = snd_soc_dai_set_fmt(codec_dai, AUDIO_FORMAT);
@@ -127,13 +138,22 @@ static int evm_aic3x_init(struct snd_soc_pcm_runtime *rtd)
 {
 	struct snd_soc_codec *codec = rtd->codec;
 	struct snd_soc_dapm_context *dapm = &codec->dapm;
+	struct device_node *np = codec->card->dev->of_node;
+	int ret;
 
 	/* Add davinci-evm specific widgets */
 	snd_soc_dapm_new_controls(dapm, aic3x_dapm_widgets,
 				  ARRAY_SIZE(aic3x_dapm_widgets));
 
-	/* Set up davinci-evm specific audio path audio_map */
-	snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
+	if (np) {
+		ret = snd_soc_of_parse_audio_routing(codec->card,
+							"ti,audio-routing");
+		if (ret)
+			return ret;
+	} else {
+		/* Set up davinci-evm specific audio path audio_map */
+		snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
+	}
 
 	/* not connected */
 	snd_soc_dapm_disable_pin(dapm, "MONO_LOUT");
@@ -281,6 +301,115 @@ static struct snd_soc_card da850_snd_soc_card = {
 	.num_links = 1,
 };
 
+#if defined(CONFIG_OF)
+/*
+ * This struct is just used as place holder. It will be filled with
+ * data from dt node
+ */
+static struct snd_soc_dai_link evm_dai = {
+};
+
+/* davinci evm audio machine driver */
+static struct snd_soc_card evm_soc_card = {
+	.owner = THIS_MODULE,
+	.dai_link = &evm_dai,
+	.num_links = 1,
+};
+
+static int davinci_evm_probe(struct platform_device *pdev)
+{
+	struct device_node *np = pdev->dev.of_node;
+	const char *stringPtr, *propname;
+	u32 val;
+	int ret = 0;
+
+	propname = "dai-data";
+	val = of_property_count_strings(np, propname);
+	if (val < 0)
+		return val;
+
+	ret = of_property_read_string_index(np, propname, 0, &evm_dai.name);
+	if (ret < 0)
+		return ret;
+
+	ret = of_property_read_string_index(np, propname, 1,
+						&evm_dai.stream_name);
+	if (ret < 0)
+		return ret;
+
+	ret = of_property_read_string_index(np, propname, 2,
+						&evm_dai.codec_dai_name);
+	if (ret < 0)
+		return ret;
+
+	ret = of_property_read_string_index(np, propname, 3, &stringPtr);
+	if (ret < 0)
+		return ret;
+	else
+		if (strcasecmp(stringPtr, "true") == 0)
+			evm_dai.init = evm_aic3x_init;
+
+	ret = of_property_read_string_index(np, propname, 4, &stringPtr);
+	if (ret < 0) {
+		return ret;
+	} else {
+		if (strcasecmp(stringPtr, "evm-ops") == 0)
+			evm_dai.ops = &evm_ops;
+		else if (strcasecmp(stringPtr, "evm-spdif-ops") == 0)
+			evm_dai.ops = &evm_spdif_ops;
+	}
+
+	evm_dai.codec_of_node = of_parse_phandle(np, "ti,audio-codec", 0);
+	if (!evm_dai.codec_of_node)
+		return -EINVAL;
+
+	evm_dai.cpu_dai_of_node = of_parse_phandle(np,
+						"ti,mcasp-controller", 0);
+	if (!evm_dai.cpu_dai_of_node)
+		return -EINVAL;
+
+	evm_dai.platform_of_node = of_parse_phandle(np, "ti,pcm-node", 0);
+	if (!evm_dai.platform_of_node)
+		return -EINVAL;
+
+	evm_soc_card.dev = &pdev->dev;
+	ret = snd_soc_of_parse_card_name(&evm_soc_card, "ti,model");
+	if (ret)
+		return ret;
+
+	ret = snd_soc_register_card(&evm_soc_card);
+	if (ret)
+		dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", ret);
+
+	return ret;
+}
+
+static int __devexit davinci_evm_remove(struct platform_device *pdev)
+{
+	struct snd_soc_card *card = platform_get_drvdata(pdev);
+
+	snd_soc_unregister_card(card);
+
+	return 0;
+}
+
+static const struct of_device_id davinci_evm_dt_ids[] = {
+	{ .compatible = "ti,davinci-evm-audio", },
+	{ /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, davinci_mcasp_dt_ids);
+
+static struct platform_driver davinci_evm_driver = {
+	.probe		= davinci_evm_probe,
+	.remove		= __devexit_p(davinci_evm_remove),
+	.driver		= {
+		.name	= "davinci_evm",
+		.owner	= THIS_MODULE,
+		.of_match_table = of_match_ptr(davinci_evm_dt_ids),
+	},
+};
+#endif
+
 static struct platform_device *evm_snd_device;
 
 static int __init evm_init(void)
@@ -288,6 +417,14 @@ static int __init evm_init(void)
 	struct snd_soc_card *evm_snd_dev_data;
 	int index;
 	int ret;
+#if defined(CONFIG_OF)
+	struct device_node *np;
+
+	np = of_find_compatible_node(NULL, NULL, "ti,davinci-evm-audio");
+	if (np) {
+		return platform_driver_register(&davinci_evm_driver);
+	}
+#endif
 
 	if (machine_is_davinci_evm()) {
 		evm_snd_dev_data = &dm6446_snd_soc_card_evm;
@@ -324,6 +461,16 @@ static int __init evm_init(void)
 
 static void __exit evm_exit(void)
 {
+#if defined(CONFIG_OF)
+	struct device_node *np;
+
+	np = of_find_compatible_node(NULL, NULL, "ti,davinci-evm-audio");
+	if (np) {
+		platform_driver_unregister(&davinci_evm_driver);
+		return;
+	}
+#endif
+
 	platform_device_unregister(evm_snd_device);
 }
 
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH 4/5] ASoC: Davinci: machine: Add device tree binding
@ 2012-08-14 12:42   ` Hebbar, Gururaja
  0 siblings, 0 replies; 40+ messages in thread
From: Hebbar, Gururaja @ 2012-08-14 12:42 UTC (permalink / raw)
  To: linux-arm-kernel

Device tree support for tlv320aic3x CODEC driver

When the board boots with device tree, the driver will receive card,
codec, dai interface details (like the card name, DAPM routing map,
phandle for the audio components described in the dts file, codec mclk
speed).

The card will be set up based on this information.
Since the routing is provided via DT we can mark the card fully routed
so core can take care of disconnecting the unused pins.

When here, code indentation and comment style is also fixed

Signed-off-by: Hebbar, Gururaja <gururaja.hebbar@ti.com>
---
:000000 100644 0000000... d1cd767... A	Documentation/devicetree/bindings/sound/davinci-evm-audio.txt
:100644 100644 0a95c0c... be8e4ed... M	sound/soc/davinci/davinci-evm.c
 .../bindings/sound/davinci-evm-audio.txt           |   52 ++++++
 sound/soc/davinci/davinci-evm.c                    |  187 +++++++++++++++++--
 2 files changed, 219 insertions(+), 20 deletions(-)

diff --git a/Documentation/devicetree/bindings/sound/davinci-evm-audio.txt b/Documentation/devicetree/bindings/sound/davinci-evm-audio.txt
new file mode 100644
index 0000000..d1cd767
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/davinci-evm-audio.txt
@@ -0,0 +1,52 @@
+* Texas Instruments SoC audio setups with TLV320AIC3X Codec
+
+Required properties:
+- compatible : "ti,davinci-evm-audio"
+- ti,model : The user-visible name of this sound complex.
+- ti,audio-routing : A list of the connections between audio components.
+  Each entry is a pair of strings, the first being the connection's sink,
+  the second being the connection's source. Valid names for sources and
+  sinks are the codec's pins, and the jacks on the board:
+
+  Codec pins:
+
+  * MIC3L
+  * MIC3R
+  * LINE1L
+  * LINE2L
+  * LINE1R
+  * LINE2R
+
+  Board connectors:
+
+  * Headphone Jack
+  * Line Out
+  * Mic Jack
+
+- ti,mcasp-controller : The phandle of the McASP controller
+- ti,audio-codec : The phandle of the TLV320AIC3x audio codec
+- ti,pcm-node : The phandle of the pcm device
+- ti,codec-clock : The Codec Clock from the board
+
+- dai-data		: A list of DAI data used by SOC code to register
+			  DAI, Codecs platform.
+			  The string index "should" be as shown below.
+dai-data =
+"<DAI Name>", 		"<DAI Stream Name>",
+"<CODEC DAI Name>",	"<true if evm_aic3x_init is required, else false>",
+"<evm ops required, evm_ops or evm_spdif_ops>";
+
+Example:
+
+sound {
+	compatible = "ti,davinci-evm-audio";
+	ti,model = "DA830 EVM";
+	ti,audio-codec = <&tlv320aic3x>;
+	ti,mcasp-controller = <&mcasp1>;
+	ti,pcm-node = <&pcm>;
+	ti,codec-clock = <12000000>;
+	dai-data =
+		"TLV320AIC3X", 		"AIC3X",
+		"tlv320aic3x-hifi",	"true",
+		"evm-ops";
+};
diff --git a/sound/soc/davinci/davinci-evm.c b/sound/soc/davinci/davinci-evm.c
index 0a95c0c..be8e4ed 100644
--- a/sound/soc/davinci/davinci-evm.c
+++ b/sound/soc/davinci/davinci-evm.c
@@ -34,27 +34,38 @@ static int evm_hw_params(struct snd_pcm_substream *substream,
 	struct snd_soc_pcm_runtime *rtd = substream->private_data;
 	struct snd_soc_dai *codec_dai = rtd->codec_dai;
 	struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
+	struct snd_soc_codec *codec = rtd->codec;
+	struct snd_soc_card *soc_card = codec->card;
+	struct device_node *np = soc_card->dev->of_node;
 	int ret = 0;
 	unsigned sysclk;
 
-	/* ASP1 on DM355 EVM is clocked by an external oscillator */
-	if (machine_is_davinci_dm355_evm() || machine_is_davinci_dm6467_evm() ||
-	    machine_is_davinci_dm365_evm())
-		sysclk = 27000000;
-
-	/* ASP0 in DM6446 EVM is clocked by U55, as configured by
-	 * board-dm644x-evm.c using GPIOs from U18.  There are six
-	 * options; here we "know" we use a 48 KHz sample rate.
-	 */
-	else if (machine_is_davinci_evm())
-		sysclk = 12288000;
-
-	else if (machine_is_davinci_da830_evm() ||
-				machine_is_davinci_da850_evm())
-		sysclk = 24576000;
-
-	else
-		return -EINVAL;
+	if (np) {
+		ret = of_property_read_u32(np, "ti,codec-clock", &sysclk);
+		if (ret < 0)
+			return ret;
+	} else {
+		/* ASP1 on DM355 EVM is clocked by an external oscillator */
+		if (machine_is_davinci_dm355_evm() ||
+			machine_is_davinci_dm6467_evm() ||
+			machine_is_davinci_dm365_evm())
+			sysclk = 27000000;
+
+		/*
+		 * ASP0 in DM6446 EVM is clocked by U55, as configured by
+		 * board-dm644x-evm.c using GPIOs from U18.  There are six
+		 * options; here we "know" we use a 48 KHz sample rate.
+		 */
+		else if (machine_is_davinci_evm())
+			sysclk = 12288000;
+
+		else if (machine_is_davinci_da830_evm() ||
+					machine_is_davinci_da850_evm())
+			sysclk = 24576000;
+
+		else
+			return -EINVAL;
+	}
 
 	/* set codec DAI configuration */
 	ret = snd_soc_dai_set_fmt(codec_dai, AUDIO_FORMAT);
@@ -127,13 +138,22 @@ static int evm_aic3x_init(struct snd_soc_pcm_runtime *rtd)
 {
 	struct snd_soc_codec *codec = rtd->codec;
 	struct snd_soc_dapm_context *dapm = &codec->dapm;
+	struct device_node *np = codec->card->dev->of_node;
+	int ret;
 
 	/* Add davinci-evm specific widgets */
 	snd_soc_dapm_new_controls(dapm, aic3x_dapm_widgets,
 				  ARRAY_SIZE(aic3x_dapm_widgets));
 
-	/* Set up davinci-evm specific audio path audio_map */
-	snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
+	if (np) {
+		ret = snd_soc_of_parse_audio_routing(codec->card,
+							"ti,audio-routing");
+		if (ret)
+			return ret;
+	} else {
+		/* Set up davinci-evm specific audio path audio_map */
+		snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
+	}
 
 	/* not connected */
 	snd_soc_dapm_disable_pin(dapm, "MONO_LOUT");
@@ -281,6 +301,115 @@ static struct snd_soc_card da850_snd_soc_card = {
 	.num_links = 1,
 };
 
+#if defined(CONFIG_OF)
+/*
+ * This struct is just used as place holder. It will be filled with
+ * data from dt node
+ */
+static struct snd_soc_dai_link evm_dai = {
+};
+
+/* davinci evm audio machine driver */
+static struct snd_soc_card evm_soc_card = {
+	.owner = THIS_MODULE,
+	.dai_link = &evm_dai,
+	.num_links = 1,
+};
+
+static int davinci_evm_probe(struct platform_device *pdev)
+{
+	struct device_node *np = pdev->dev.of_node;
+	const char *stringPtr, *propname;
+	u32 val;
+	int ret = 0;
+
+	propname = "dai-data";
+	val = of_property_count_strings(np, propname);
+	if (val < 0)
+		return val;
+
+	ret = of_property_read_string_index(np, propname, 0, &evm_dai.name);
+	if (ret < 0)
+		return ret;
+
+	ret = of_property_read_string_index(np, propname, 1,
+						&evm_dai.stream_name);
+	if (ret < 0)
+		return ret;
+
+	ret = of_property_read_string_index(np, propname, 2,
+						&evm_dai.codec_dai_name);
+	if (ret < 0)
+		return ret;
+
+	ret = of_property_read_string_index(np, propname, 3, &stringPtr);
+	if (ret < 0)
+		return ret;
+	else
+		if (strcasecmp(stringPtr, "true") == 0)
+			evm_dai.init = evm_aic3x_init;
+
+	ret = of_property_read_string_index(np, propname, 4, &stringPtr);
+	if (ret < 0) {
+		return ret;
+	} else {
+		if (strcasecmp(stringPtr, "evm-ops") == 0)
+			evm_dai.ops = &evm_ops;
+		else if (strcasecmp(stringPtr, "evm-spdif-ops") == 0)
+			evm_dai.ops = &evm_spdif_ops;
+	}
+
+	evm_dai.codec_of_node = of_parse_phandle(np, "ti,audio-codec", 0);
+	if (!evm_dai.codec_of_node)
+		return -EINVAL;
+
+	evm_dai.cpu_dai_of_node = of_parse_phandle(np,
+						"ti,mcasp-controller", 0);
+	if (!evm_dai.cpu_dai_of_node)
+		return -EINVAL;
+
+	evm_dai.platform_of_node = of_parse_phandle(np, "ti,pcm-node", 0);
+	if (!evm_dai.platform_of_node)
+		return -EINVAL;
+
+	evm_soc_card.dev = &pdev->dev;
+	ret = snd_soc_of_parse_card_name(&evm_soc_card, "ti,model");
+	if (ret)
+		return ret;
+
+	ret = snd_soc_register_card(&evm_soc_card);
+	if (ret)
+		dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", ret);
+
+	return ret;
+}
+
+static int __devexit davinci_evm_remove(struct platform_device *pdev)
+{
+	struct snd_soc_card *card = platform_get_drvdata(pdev);
+
+	snd_soc_unregister_card(card);
+
+	return 0;
+}
+
+static const struct of_device_id davinci_evm_dt_ids[] = {
+	{ .compatible = "ti,davinci-evm-audio", },
+	{ /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, davinci_mcasp_dt_ids);
+
+static struct platform_driver davinci_evm_driver = {
+	.probe		= davinci_evm_probe,
+	.remove		= __devexit_p(davinci_evm_remove),
+	.driver		= {
+		.name	= "davinci_evm",
+		.owner	= THIS_MODULE,
+		.of_match_table = of_match_ptr(davinci_evm_dt_ids),
+	},
+};
+#endif
+
 static struct platform_device *evm_snd_device;
 
 static int __init evm_init(void)
@@ -288,6 +417,14 @@ static int __init evm_init(void)
 	struct snd_soc_card *evm_snd_dev_data;
 	int index;
 	int ret;
+#if defined(CONFIG_OF)
+	struct device_node *np;
+
+	np = of_find_compatible_node(NULL, NULL, "ti,davinci-evm-audio");
+	if (np) {
+		return platform_driver_register(&davinci_evm_driver);
+	}
+#endif
 
 	if (machine_is_davinci_evm()) {
 		evm_snd_dev_data = &dm6446_snd_soc_card_evm;
@@ -324,6 +461,16 @@ static int __init evm_init(void)
 
 static void __exit evm_exit(void)
 {
+#if defined(CONFIG_OF)
+	struct device_node *np;
+
+	np = of_find_compatible_node(NULL, NULL, "ti,davinci-evm-audio");
+	if (np) {
+		platform_driver_unregister(&davinci_evm_driver);
+		return;
+	}
+#endif
+
 	platform_device_unregister(evm_snd_device);
 }
 
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH 5/5] ASoC: tlv320aic3x: Add device tree bindings
  2012-08-14 12:42 ` Hebbar, Gururaja
@ 2012-08-14 12:42   ` Hebbar, Gururaja
  -1 siblings, 0 replies; 40+ messages in thread
From: Hebbar, Gururaja @ 2012-08-14 12:42 UTC (permalink / raw)
  To: tony, lrg, broonie
  Cc: alsa-devel, sudhakar.raj, nsekhar, davinci-linux-open-source,
	gururaja.hebbar, peter.ujfalusi, linux-arm-kernel

Device tree support for tlv320aic3x CODEC driver.

Signed-off-by: Hebbar, Gururaja <gururaja.hebbar@ti.com>
---
:000000 100644 0000000... f4dee26... A	Documentation/devicetree/bindings/sound/tlv320aic3x.txt
:100644 100644 01485bd... 91fc421... M	sound/soc/codecs/tlv320aic3x.c
 .../devicetree/bindings/sound/tlv320aic3x.txt      |   18 ++++++++++++
 sound/soc/codecs/tlv320aic3x.c                     |   30 ++++++++++++++++++++
 2 files changed, 48 insertions(+), 0 deletions(-)

diff --git a/Documentation/devicetree/bindings/sound/tlv320aic3x.txt b/Documentation/devicetree/bindings/sound/tlv320aic3x.txt
new file mode 100644
index 0000000..f4dee26
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/tlv320aic3x.txt
@@ -0,0 +1,18 @@
+Texas Instruments - tlv320aic3x Codec module
+
+The tlv320aic3x serial control bus communicates through I2C protocols
+
+Required properties:
+- compatible - "string" -  "ti,tlv320aic3x"
+- reg - <int> -  I2C slave address
+- gpio-reset - <int> -  gpio pin number used for codec reset
+- ai3x-gpio-func - <array of 2 int> - AIC3X_GPIO1 & AIC3X_GPIO2 Functionality
+
+Example:
+
+tlv320aic3x: tlv320aic3x@1b {
+	compatible = "ti,tlv320aic3x";
+	reg = <0x1b>;
+	gpio-reset = <60>;
+	ai3x-gpio-func = <0 5>;
+};
diff --git a/sound/soc/codecs/tlv320aic3x.c b/sound/soc/codecs/tlv320aic3x.c
index 01485bd..91fc421 100644
--- a/sound/soc/codecs/tlv320aic3x.c
+++ b/sound/soc/codecs/tlv320aic3x.c
@@ -1457,6 +1457,9 @@ static int aic3x_i2c_probe(struct i2c_client *i2c,
 {
 	struct aic3x_pdata *pdata = i2c->dev.platform_data;
 	struct aic3x_priv *aic3x;
+	struct aic3x_setup_data *ai3x_setup;
+	struct device_node *np = i2c->dev.of_node;
+	u32 val;
 	int ret;
 
 	aic3x = devm_kzalloc(&i2c->dev, sizeof(struct aic3x_priv), GFP_KERNEL);
@@ -1471,6 +1474,24 @@ static int aic3x_i2c_probe(struct i2c_client *i2c,
 	if (pdata) {
 		aic3x->gpio_reset = pdata->gpio_reset;
 		aic3x->setup = pdata->setup;
+	} else if (np) {
+		ai3x_setup = devm_kzalloc(&i2c->dev, sizeof(*ai3x_setup),
+								GFP_KERNEL);
+		if (ai3x_setup == NULL) {
+			dev_err(&i2c->dev, "failed to create private data\n");
+			return -ENOMEM;
+		}
+
+		if (of_property_read_u32(np, "gpio-reset", &val) >= 0)
+			aic3x->gpio_reset = val;
+		else
+			aic3x->gpio_reset = -1;
+
+		if (of_property_read_u32_array(np, "ai3x-gpio-func",
+					ai3x_setup->gpio_func, 2) >= 0) {
+			aic3x->setup = ai3x_setup;
+		}
+
 	} else {
 		aic3x->gpio_reset = -1;
 	}
@@ -1488,11 +1509,20 @@ static int aic3x_i2c_remove(struct i2c_client *client)
 	return 0;
 }
 
+#if defined(CONFIG_OF)
+static const struct of_device_id tlv320aic3x_of_match[] = {
+	{ .compatible = "ti,tlv320aic3x", },
+	{},
+};
+MODULE_DEVICE_TABLE(of, tlv320aic3x_of_match);
+#endif
+
 /* machine i2c codec control layer */
 static struct i2c_driver aic3x_i2c_driver = {
 	.driver = {
 		.name = "tlv320aic3x-codec",
 		.owner = THIS_MODULE,
+		.of_match_table = of_match_ptr(tlv320aic3x_of_match),
 	},
 	.probe	= aic3x_i2c_probe,
 	.remove = aic3x_i2c_remove,
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 40+ messages in thread

* [PATCH 5/5] ASoC: tlv320aic3x: Add device tree bindings
@ 2012-08-14 12:42   ` Hebbar, Gururaja
  0 siblings, 0 replies; 40+ messages in thread
From: Hebbar, Gururaja @ 2012-08-14 12:42 UTC (permalink / raw)
  To: linux-arm-kernel

Device tree support for tlv320aic3x CODEC driver.

Signed-off-by: Hebbar, Gururaja <gururaja.hebbar@ti.com>
---
:000000 100644 0000000... f4dee26... A	Documentation/devicetree/bindings/sound/tlv320aic3x.txt
:100644 100644 01485bd... 91fc421... M	sound/soc/codecs/tlv320aic3x.c
 .../devicetree/bindings/sound/tlv320aic3x.txt      |   18 ++++++++++++
 sound/soc/codecs/tlv320aic3x.c                     |   30 ++++++++++++++++++++
 2 files changed, 48 insertions(+), 0 deletions(-)

diff --git a/Documentation/devicetree/bindings/sound/tlv320aic3x.txt b/Documentation/devicetree/bindings/sound/tlv320aic3x.txt
new file mode 100644
index 0000000..f4dee26
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/tlv320aic3x.txt
@@ -0,0 +1,18 @@
+Texas Instruments - tlv320aic3x Codec module
+
+The tlv320aic3x serial control bus communicates through I2C protocols
+
+Required properties:
+- compatible - "string" -  "ti,tlv320aic3x"
+- reg - <int> -  I2C slave address
+- gpio-reset - <int> -  gpio pin number used for codec reset
+- ai3x-gpio-func - <array of 2 int> - AIC3X_GPIO1 & AIC3X_GPIO2 Functionality
+
+Example:
+
+tlv320aic3x: tlv320aic3x at 1b {
+	compatible = "ti,tlv320aic3x";
+	reg = <0x1b>;
+	gpio-reset = <60>;
+	ai3x-gpio-func = <0 5>;
+};
diff --git a/sound/soc/codecs/tlv320aic3x.c b/sound/soc/codecs/tlv320aic3x.c
index 01485bd..91fc421 100644
--- a/sound/soc/codecs/tlv320aic3x.c
+++ b/sound/soc/codecs/tlv320aic3x.c
@@ -1457,6 +1457,9 @@ static int aic3x_i2c_probe(struct i2c_client *i2c,
 {
 	struct aic3x_pdata *pdata = i2c->dev.platform_data;
 	struct aic3x_priv *aic3x;
+	struct aic3x_setup_data *ai3x_setup;
+	struct device_node *np = i2c->dev.of_node;
+	u32 val;
 	int ret;
 
 	aic3x = devm_kzalloc(&i2c->dev, sizeof(struct aic3x_priv), GFP_KERNEL);
@@ -1471,6 +1474,24 @@ static int aic3x_i2c_probe(struct i2c_client *i2c,
 	if (pdata) {
 		aic3x->gpio_reset = pdata->gpio_reset;
 		aic3x->setup = pdata->setup;
+	} else if (np) {
+		ai3x_setup = devm_kzalloc(&i2c->dev, sizeof(*ai3x_setup),
+								GFP_KERNEL);
+		if (ai3x_setup == NULL) {
+			dev_err(&i2c->dev, "failed to create private data\n");
+			return -ENOMEM;
+		}
+
+		if (of_property_read_u32(np, "gpio-reset", &val) >= 0)
+			aic3x->gpio_reset = val;
+		else
+			aic3x->gpio_reset = -1;
+
+		if (of_property_read_u32_array(np, "ai3x-gpio-func",
+					ai3x_setup->gpio_func, 2) >= 0) {
+			aic3x->setup = ai3x_setup;
+		}
+
 	} else {
 		aic3x->gpio_reset = -1;
 	}
@@ -1488,11 +1509,20 @@ static int aic3x_i2c_remove(struct i2c_client *client)
 	return 0;
 }
 
+#if defined(CONFIG_OF)
+static const struct of_device_id tlv320aic3x_of_match[] = {
+	{ .compatible = "ti,tlv320aic3x", },
+	{},
+};
+MODULE_DEVICE_TABLE(of, tlv320aic3x_of_match);
+#endif
+
 /* machine i2c codec control layer */
 static struct i2c_driver aic3x_i2c_driver = {
 	.driver = {
 		.name = "tlv320aic3x-codec",
 		.owner = THIS_MODULE,
+		.of_match_table = of_match_ptr(tlv320aic3x_of_match),
 	},
 	.probe	= aic3x_i2c_probe,
 	.remove = aic3x_i2c_remove,
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 40+ messages in thread

* Re: [PATCH 1/5] ASoC/ARM: Davinci: McASP: split asp header into platform and audio specific
  2012-08-14 12:42   ` Hebbar, Gururaja
@ 2012-08-17 18:13       ` Sekhar Nori
  -1 siblings, 0 replies; 40+ messages in thread
From: Sekhar Nori @ 2012-08-17 18:13 UTC (permalink / raw)
  To: Hebbar, Gururaja
  Cc: alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw, tony-4v6yS6AI5VpBDgjK7y7TUQ,
	broonie-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E,
	davinci-linux-open-source-VycZQUHpC/PFrsHnngEfi1aTQe2KTcn/,
	peter.ujfalusi-l0cyMroinI0, lrg-l0cyMroinI0,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

Hi Gururaja,

On 8/14/2012 6:12 PM, Hebbar, Gururaja wrote:
> Davinci McASP header & driver are shared by few OMAP platforms (like
> TI81xx, AM335x). Splitting asp header into Davinci platform specific
> header and Audio specific header helps to share them across platforms.
> 
> Audio specific defines is moved to to common
> <linux/platform_data/davinci_asp.h> so that the header can be
> accessed by all related platforms.
> 
> While here, correct the header usage (remove multiple header
> re-definitions and unused headers) and remove platform names from
> structures comments and enum
> 
> Signed-off-by: Hebbar, Gururaja <gururaja.hebbar-l0cyMroinI0@public.gmane.org>
> Acked-by: Vaibhav Bedia <vaibhav.bedia-l0cyMroinI0@public.gmane.org>

This patch looks good to me. See a minor nit below.

Acked-by: Sekhar Nori <nsekhar-l0cyMroinI0@public.gmane.org>

> diff --git a/arch/arm/mach-davinci/asp.h b/arch/arm/mach-davinci/asp.h
> new file mode 100644
> index 0000000..8fd5238
> --- /dev/null
> +++ b/arch/arm/mach-davinci/asp.h
> @@ -0,0 +1,49 @@
> +/*
> + * TI DaVinci Audio definitions
> + */
> +#ifndef __ASM_ARCH_DAVINCI_ASP_H
> +#define __ASM_ARCH_DAVINCI_ASP_H
> +
> +/* Bases of dm644x and dm355 register banks */
> +#define DAVINCI_ASP0_BASE	0x01E02000
> +#define DAVINCI_ASP1_BASE	0x01E04000
> +
> +/* Bases of dm365 register banks */
> +#define DAVINCI_DM365_ASP0_BASE	0x01D02000
> +
> +/* Bases of dm646x register banks */
> +#define	DAVINCI_DM646X_MCASP0_REG_BASE		0x01D01000
> +#define DAVINCI_DM646X_MCASP1_REG_BASE		0x01D01800

Can you remove usage of tabs after 'define'. I understand this is coming
from existing code.

Thanks,
Sekhar

^ permalink raw reply	[flat|nested] 40+ messages in thread

* [PATCH 1/5] ASoC/ARM: Davinci: McASP: split asp header into platform and audio specific
@ 2012-08-17 18:13       ` Sekhar Nori
  0 siblings, 0 replies; 40+ messages in thread
From: Sekhar Nori @ 2012-08-17 18:13 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Gururaja,

On 8/14/2012 6:12 PM, Hebbar, Gururaja wrote:
> Davinci McASP header & driver are shared by few OMAP platforms (like
> TI81xx, AM335x). Splitting asp header into Davinci platform specific
> header and Audio specific header helps to share them across platforms.
> 
> Audio specific defines is moved to to common
> <linux/platform_data/davinci_asp.h> so that the header can be
> accessed by all related platforms.
> 
> While here, correct the header usage (remove multiple header
> re-definitions and unused headers) and remove platform names from
> structures comments and enum
> 
> Signed-off-by: Hebbar, Gururaja <gururaja.hebbar@ti.com>
> Acked-by: Vaibhav Bedia <vaibhav.bedia@ti.com>

This patch looks good to me. See a minor nit below.

Acked-by: Sekhar Nori <nsekhar@ti.com>

> diff --git a/arch/arm/mach-davinci/asp.h b/arch/arm/mach-davinci/asp.h
> new file mode 100644
> index 0000000..8fd5238
> --- /dev/null
> +++ b/arch/arm/mach-davinci/asp.h
> @@ -0,0 +1,49 @@
> +/*
> + * TI DaVinci Audio definitions
> + */
> +#ifndef __ASM_ARCH_DAVINCI_ASP_H
> +#define __ASM_ARCH_DAVINCI_ASP_H
> +
> +/* Bases of dm644x and dm355 register banks */
> +#define DAVINCI_ASP0_BASE	0x01E02000
> +#define DAVINCI_ASP1_BASE	0x01E04000
> +
> +/* Bases of dm365 register banks */
> +#define DAVINCI_DM365_ASP0_BASE	0x01D02000
> +
> +/* Bases of dm646x register banks */
> +#define	DAVINCI_DM646X_MCASP0_REG_BASE		0x01D01000
> +#define DAVINCI_DM646X_MCASP1_REG_BASE		0x01D01800

Can you remove usage of tabs after 'define'. I understand this is coming
from existing code.

Thanks,
Sekhar

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [PATCH 3/5] ASoC: Davinci: pcm: Add device tree bindings
  2012-08-14 12:42   ` Hebbar, Gururaja
@ 2012-08-17 22:31     ` Mark Brown
  -1 siblings, 0 replies; 40+ messages in thread
From: Mark Brown @ 2012-08-17 22:31 UTC (permalink / raw)
  To: Hebbar, Gururaja
  Cc: alsa-devel, sudhakar.raj, tony, nsekhar,
	davinci-linux-open-source, peter.ujfalusi, lrg, linux-arm-kernel


[-- Attachment #1.1: Type: text/plain, Size: 490 bytes --]

On Tue, Aug 14, 2012 at 06:12:03PM +0530, Hebbar, Gururaja wrote:
> Device tree support for Davinci/OMAP2+ pcm driver.

This looks like it's a device which maps a shared DMA controller in the
SoC core into ASoC rather than actual hardware.  Such devices are
usually instantiated automatically from the DAI rather than being
represented in the device tree since they are a Linux internal thing
really - the Tegra and Freescale drivers provide examples of how this
sort of thing can be done.

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 40+ messages in thread

* [PATCH 3/5] ASoC: Davinci: pcm: Add device tree bindings
@ 2012-08-17 22:31     ` Mark Brown
  0 siblings, 0 replies; 40+ messages in thread
From: Mark Brown @ 2012-08-17 22:31 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Aug 14, 2012 at 06:12:03PM +0530, Hebbar, Gururaja wrote:
> Device tree support for Davinci/OMAP2+ pcm driver.

This looks like it's a device which maps a shared DMA controller in the
SoC core into ASoC rather than actual hardware.  Such devices are
usually instantiated automatically from the DAI rather than being
represented in the device tree since they are a Linux internal thing
really - the Tegra and Freescale drivers provide examples of how this
sort of thing can be done.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120817/a4832abd/attachment.sig>

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [PATCH 1/5] ASoC/ARM: Davinci: McASP: split asp header into platform and audio specific
  2012-08-14 12:42   ` Hebbar, Gururaja
@ 2012-08-17 22:33     ` Mark Brown
  -1 siblings, 0 replies; 40+ messages in thread
From: Mark Brown @ 2012-08-17 22:33 UTC (permalink / raw)
  To: Hebbar, Gururaja
  Cc: alsa-devel, sudhakar.raj, tony, nsekhar,
	davinci-linux-open-source, peter.ujfalusi, lrg, linux-arm-kernel


[-- Attachment #1.1: Type: text/plain, Size: 523 bytes --]

On Tue, Aug 14, 2012 at 06:12:01PM +0530, Hebbar, Gururaja wrote:
> Davinci McASP header & driver are shared by few OMAP platforms (like
> TI81xx, AM335x). Splitting asp header into Davinci platform specific
> header and Audio specific header helps to share them across platforms.

This doesn't apply against v3.6-rc2, I suspect there's overlapping
changes in arch/arm.  I was just going to apply it on a separate branch
to allow cross-tree merge if there's overlap with architecture work.
Can you please check and resend?

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 40+ messages in thread

* [PATCH 1/5] ASoC/ARM: Davinci: McASP: split asp header into platform and audio specific
@ 2012-08-17 22:33     ` Mark Brown
  0 siblings, 0 replies; 40+ messages in thread
From: Mark Brown @ 2012-08-17 22:33 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Aug 14, 2012 at 06:12:01PM +0530, Hebbar, Gururaja wrote:
> Davinci McASP header & driver are shared by few OMAP platforms (like
> TI81xx, AM335x). Splitting asp header into Davinci platform specific
> header and Audio specific header helps to share them across platforms.

This doesn't apply against v3.6-rc2, I suspect there's overlapping
changes in arch/arm.  I was just going to apply it on a separate branch
to allow cross-tree merge if there's overlap with architecture work.
Can you please check and resend?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120817/5839c5b0/attachment.sig>

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [PATCH 2/5] ASoC: Davinci: McASP: add device tree support for McASP
  2012-08-14 12:42   ` Hebbar, Gururaja
@ 2012-08-17 22:41     ` Mark Brown
  -1 siblings, 0 replies; 40+ messages in thread
From: Mark Brown @ 2012-08-17 22:41 UTC (permalink / raw)
  To: Hebbar, Gururaja
  Cc: alsa-devel, sudhakar.raj, tony, nsekhar,
	davinci-linux-open-source, peter.ujfalusi, lrg, linux-arm-kernel


[-- Attachment #1.1: Type: text/plain, Size: 567 bytes --]

On Tue, Aug 14, 2012 at 06:12:02PM +0530, Hebbar, Gururaja wrote:

> +- op-mode : I2S/DIT ops mode.

This would normally be part of the machine binding since it needs to be
applied to both ends of the link.  When adding it could you come up with
a generic binding for this in terms of the current ASoC DAI paremeters
please?  That way we'll be able to have other machine drivers be
consistent with this one.

> +- tdm-slots : Slots for TDM operation.

This would normally also be a machine driver thing though it's less
normal to need to configure this on both ends.

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 40+ messages in thread

* [PATCH 2/5] ASoC: Davinci: McASP: add device tree support for McASP
@ 2012-08-17 22:41     ` Mark Brown
  0 siblings, 0 replies; 40+ messages in thread
From: Mark Brown @ 2012-08-17 22:41 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Aug 14, 2012 at 06:12:02PM +0530, Hebbar, Gururaja wrote:

> +- op-mode : I2S/DIT ops mode.

This would normally be part of the machine binding since it needs to be
applied to both ends of the link.  When adding it could you come up with
a generic binding for this in terms of the current ASoC DAI paremeters
please?  That way we'll be able to have other machine drivers be
consistent with this one.

> +- tdm-slots : Slots for TDM operation.

This would normally also be a machine driver thing though it's less
normal to need to configure this on both ends.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120817/2771ff94/attachment.sig>

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [PATCH 4/5] ASoC: Davinci: machine: Add device tree binding
  2012-08-14 12:42   ` Hebbar, Gururaja
@ 2012-08-17 22:43     ` Mark Brown
  -1 siblings, 0 replies; 40+ messages in thread
From: Mark Brown @ 2012-08-17 22:43 UTC (permalink / raw)
  To: Hebbar, Gururaja
  Cc: alsa-devel, sudhakar.raj, tony, nsekhar,
	davinci-linux-open-source, peter.ujfalusi, lrg, linux-arm-kernel


[-- Attachment #1.1: Type: text/plain, Size: 505 bytes --]

On Tue, Aug 14, 2012 at 06:12:04PM +0530, Hebbar, Gururaja wrote:

> +- ti,codec-clock : The Codec Clock from the board

I think this is the clock rate?  Please specify it more specifically.

> +"<CODEC DAI Name>",	"<true if evm_aic3x_init is required, else false>",
> +"<evm ops required, evm_ops or evm_spdif_ops>";

Please be more specific as to what these actually do - consider the user
who is reading the bindings with a view to implementing them for their
board, or writing drivers for another OS.

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 40+ messages in thread

* [PATCH 4/5] ASoC: Davinci: machine: Add device tree binding
@ 2012-08-17 22:43     ` Mark Brown
  0 siblings, 0 replies; 40+ messages in thread
From: Mark Brown @ 2012-08-17 22:43 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Aug 14, 2012 at 06:12:04PM +0530, Hebbar, Gururaja wrote:

> +- ti,codec-clock : The Codec Clock from the board

I think this is the clock rate?  Please specify it more specifically.

> +"<CODEC DAI Name>",	"<true if evm_aic3x_init is required, else false>",
> +"<evm ops required, evm_ops or evm_spdif_ops>";

Please be more specific as to what these actually do - consider the user
who is reading the bindings with a view to implementing them for their
board, or writing drivers for another OS.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120817/ebff4c85/attachment.sig>

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [PATCH 5/5] ASoC: tlv320aic3x: Add device tree bindings
  2012-08-14 12:42   ` Hebbar, Gururaja
@ 2012-08-17 22:45     ` Mark Brown
  -1 siblings, 0 replies; 40+ messages in thread
From: Mark Brown @ 2012-08-17 22:45 UTC (permalink / raw)
  To: Hebbar, Gururaja
  Cc: alsa-devel, sudhakar.raj, tony, nsekhar,
	davinci-linux-open-source, peter.ujfalusi, lrg, linux-arm-kernel


[-- Attachment #1.1: Type: text/plain, Size: 284 bytes --]

On Tue, Aug 14, 2012 at 06:12:05PM +0530, Hebbar, Gururaja wrote:

> +- gpio-reset - <int> -  gpio pin number used for codec reset

This should be a standard DT GPIO reference by phandle like:

	gpio = <&gpio1 16 0>;

There's quite a few examples in tree.

Otherwise this looks good.

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 40+ messages in thread

* [PATCH 5/5] ASoC: tlv320aic3x: Add device tree bindings
@ 2012-08-17 22:45     ` Mark Brown
  0 siblings, 0 replies; 40+ messages in thread
From: Mark Brown @ 2012-08-17 22:45 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Aug 14, 2012 at 06:12:05PM +0530, Hebbar, Gururaja wrote:

> +- gpio-reset - <int> -  gpio pin number used for codec reset

This should be a standard DT GPIO reference by phandle like:

	gpio = <&gpio1 16 0>;

There's quite a few examples in tree.

Otherwise this looks good.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120817/3927f7bd/attachment.sig>

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [PATCH 1/5] ASoC/ARM: Davinci: McASP: split asp header into platform and audio specific
  2012-08-17 18:13       ` Sekhar Nori
@ 2012-08-22  7:06         ` Hebbar, Gururaja
  -1 siblings, 0 replies; 40+ messages in thread
From: Hebbar, Gururaja @ 2012-08-22  7:06 UTC (permalink / raw)
  To: Nori, Sekhar
  Cc: alsa-devel, Rajashekhara, Sudhakar, tony, broonie,
	davinci-linux-open-source, Ujfalusi, Peter, Girdwood, Liam,
	linux-arm-kernel

On Fri, Aug 17, 2012 at 23:43:44, Nori, Sekhar wrote:
> Hi Gururaja,
> 
> On 8/14/2012 6:12 PM, Hebbar, Gururaja wrote:
> > Davinci McASP header & driver are shared by few OMAP platforms (like
> > TI81xx, AM335x). Splitting asp header into Davinci platform specific
> > header and Audio specific header helps to share them across platforms.
> > 
> > Audio specific defines is moved to to common
> > <linux/platform_data/davinci_asp.h> so that the header can be
> > accessed by all related platforms.
> > 
> > While here, correct the header usage (remove multiple header
> > re-definitions and unused headers) and remove platform names from
> > structures comments and enum
> > 
> > Signed-off-by: Hebbar, Gururaja <gururaja.hebbar@ti.com>
> > Acked-by: Vaibhav Bedia <vaibhav.bedia@ti.com>
> 
> This patch looks good to me. See a minor nit below.
> 
> Acked-by: Sekhar Nori <nsekhar@ti.com>
> 
> > diff --git a/arch/arm/mach-davinci/asp.h b/arch/arm/mach-davinci/asp.h
> > new file mode 100644
> > index 0000000..8fd5238
> > --- /dev/null
> > +++ b/arch/arm/mach-davinci/asp.h
> > @@ -0,0 +1,49 @@
> > +/*
> > + * TI DaVinci Audio definitions
> > + */
> > +#ifndef __ASM_ARCH_DAVINCI_ASP_H
> > +#define __ASM_ARCH_DAVINCI_ASP_H
> > +
> > +/* Bases of dm644x and dm355 register banks */
> > +#define DAVINCI_ASP0_BASE	0x01E02000
> > +#define DAVINCI_ASP1_BASE	0x01E04000
> > +
> > +/* Bases of dm365 register banks */
> > +#define DAVINCI_DM365_ASP0_BASE	0x01D02000
> > +
> > +/* Bases of dm646x register banks */
> > +#define	DAVINCI_DM646X_MCASP0_REG_BASE		0x01D01000
> > +#define DAVINCI_DM646X_MCASP1_REG_BASE		0x01D01800
> 
> Can you remove usage of tabs after 'define'. I understand this is coming
> from existing code.

Ok. I have got few more comments from Mark. Will add this into it.

> 
> Thanks,
> Sekhar
> 


Regards, 
Gururaja

^ permalink raw reply	[flat|nested] 40+ messages in thread

* [PATCH 1/5] ASoC/ARM: Davinci: McASP: split asp header into platform and audio specific
@ 2012-08-22  7:06         ` Hebbar, Gururaja
  0 siblings, 0 replies; 40+ messages in thread
From: Hebbar, Gururaja @ 2012-08-22  7:06 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Aug 17, 2012 at 23:43:44, Nori, Sekhar wrote:
> Hi Gururaja,
> 
> On 8/14/2012 6:12 PM, Hebbar, Gururaja wrote:
> > Davinci McASP header & driver are shared by few OMAP platforms (like
> > TI81xx, AM335x). Splitting asp header into Davinci platform specific
> > header and Audio specific header helps to share them across platforms.
> > 
> > Audio specific defines is moved to to common
> > <linux/platform_data/davinci_asp.h> so that the header can be
> > accessed by all related platforms.
> > 
> > While here, correct the header usage (remove multiple header
> > re-definitions and unused headers) and remove platform names from
> > structures comments and enum
> > 
> > Signed-off-by: Hebbar, Gururaja <gururaja.hebbar@ti.com>
> > Acked-by: Vaibhav Bedia <vaibhav.bedia@ti.com>
> 
> This patch looks good to me. See a minor nit below.
> 
> Acked-by: Sekhar Nori <nsekhar@ti.com>
> 
> > diff --git a/arch/arm/mach-davinci/asp.h b/arch/arm/mach-davinci/asp.h
> > new file mode 100644
> > index 0000000..8fd5238
> > --- /dev/null
> > +++ b/arch/arm/mach-davinci/asp.h
> > @@ -0,0 +1,49 @@
> > +/*
> > + * TI DaVinci Audio definitions
> > + */
> > +#ifndef __ASM_ARCH_DAVINCI_ASP_H
> > +#define __ASM_ARCH_DAVINCI_ASP_H
> > +
> > +/* Bases of dm644x and dm355 register banks */
> > +#define DAVINCI_ASP0_BASE	0x01E02000
> > +#define DAVINCI_ASP1_BASE	0x01E04000
> > +
> > +/* Bases of dm365 register banks */
> > +#define DAVINCI_DM365_ASP0_BASE	0x01D02000
> > +
> > +/* Bases of dm646x register banks */
> > +#define	DAVINCI_DM646X_MCASP0_REG_BASE		0x01D01000
> > +#define DAVINCI_DM646X_MCASP1_REG_BASE		0x01D01800
> 
> Can you remove usage of tabs after 'define'. I understand this is coming
> from existing code.

Ok. I have got few more comments from Mark. Will add this into it.

> 
> Thanks,
> Sekhar
> 


Regards, 
Gururaja

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [PATCH 5/5] ASoC: tlv320aic3x: Add device tree bindings
  2012-08-17 22:45     ` Mark Brown
@ 2012-08-22  9:26       ` Hebbar, Gururaja
  -1 siblings, 0 replies; 40+ messages in thread
From: Hebbar, Gururaja @ 2012-08-22  9:26 UTC (permalink / raw)
  To: Mark Brown
  Cc: alsa-devel, Rajashekhara, Sudhakar, tony, Nori, Sekhar,
	davinci-linux-open-source, Ujfalusi, Peter, Girdwood, Liam,
	linux-arm-kernel

On Sat, Aug 18, 2012 at 04:15:13, Mark Brown wrote:
> On Tue, Aug 14, 2012 at 06:12:05PM +0530, Hebbar, Gururaja wrote:
> 
> > +- gpio-reset - <int> -  gpio pin number used for codec reset
> 
> This should be a standard DT GPIO reference by phandle like:
> 
> 	gpio = <&gpio1 16 0>;

I will correct in V2

> 
> There's quite a few examples in tree.
> 
> Otherwise this looks good.
> 

Thanks for all the reviews.

Regards, 
Gururaja

^ permalink raw reply	[flat|nested] 40+ messages in thread

* [PATCH 5/5] ASoC: tlv320aic3x: Add device tree bindings
@ 2012-08-22  9:26       ` Hebbar, Gururaja
  0 siblings, 0 replies; 40+ messages in thread
From: Hebbar, Gururaja @ 2012-08-22  9:26 UTC (permalink / raw)
  To: linux-arm-kernel

On Sat, Aug 18, 2012 at 04:15:13, Mark Brown wrote:
> On Tue, Aug 14, 2012 at 06:12:05PM +0530, Hebbar, Gururaja wrote:
> 
> > +- gpio-reset - <int> -  gpio pin number used for codec reset
> 
> This should be a standard DT GPIO reference by phandle like:
> 
> 	gpio = <&gpio1 16 0>;

I will correct in V2

> 
> There's quite a few examples in tree.
> 
> Otherwise this looks good.
> 

Thanks for all the reviews.

Regards, 
Gururaja

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [PATCH 4/5] ASoC: Davinci: machine: Add device tree binding
  2012-08-17 22:43     ` Mark Brown
@ 2012-08-22 11:35       ` Hebbar, Gururaja
  -1 siblings, 0 replies; 40+ messages in thread
From: Hebbar, Gururaja @ 2012-08-22 11:35 UTC (permalink / raw)
  To: Mark Brown
  Cc: alsa-devel, Rajashekhara, Sudhakar, tony, Nori, Sekhar,
	davinci-linux-open-source, Ujfalusi, Peter, Girdwood, Liam,
	linux-arm-kernel

On Sat, Aug 18, 2012 at 04:13:28, Mark Brown wrote:
> On Tue, Aug 14, 2012 at 06:12:04PM +0530, Hebbar, Gururaja wrote:
> 
> > +- ti,codec-clock : The Codec Clock from the board
> 
> I think this is the clock rate?  Please specify it more specifically.

I will correct it in v2.

> 
> > +"<CODEC DAI Name>",	"<true if evm_aic3x_init is required, else false>",
> > +"<evm ops required, evm_ops or evm_spdif_ops>";
> 
> Please be more specific as to what these actually do - consider the user
> who is reading the bindings with a view to implementing them for their
> board, or writing drivers for another OS.

Will add more detail in V2

> 


Regards, 
Gururaja

^ permalink raw reply	[flat|nested] 40+ messages in thread

* [PATCH 4/5] ASoC: Davinci: machine: Add device tree binding
@ 2012-08-22 11:35       ` Hebbar, Gururaja
  0 siblings, 0 replies; 40+ messages in thread
From: Hebbar, Gururaja @ 2012-08-22 11:35 UTC (permalink / raw)
  To: linux-arm-kernel

On Sat, Aug 18, 2012 at 04:13:28, Mark Brown wrote:
> On Tue, Aug 14, 2012 at 06:12:04PM +0530, Hebbar, Gururaja wrote:
> 
> > +- ti,codec-clock : The Codec Clock from the board
> 
> I think this is the clock rate?  Please specify it more specifically.

I will correct it in v2.

> 
> > +"<CODEC DAI Name>",	"<true if evm_aic3x_init is required, else false>",
> > +"<evm ops required, evm_ops or evm_spdif_ops>";
> 
> Please be more specific as to what these actually do - consider the user
> who is reading the bindings with a view to implementing them for their
> board, or writing drivers for another OS.

Will add more detail in V2

> 


Regards, 
Gururaja

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [PATCH 1/5] ASoC/ARM: Davinci: McASP: split asp header into platform and audio specific
  2012-08-17 22:33     ` Mark Brown
@ 2012-08-22 13:11       ` Hebbar, Gururaja
  -1 siblings, 0 replies; 40+ messages in thread
From: Hebbar, Gururaja @ 2012-08-22 13:11 UTC (permalink / raw)
  To: Mark Brown
  Cc: alsa-devel, Rajashekhara, Sudhakar, tony, Nori, Sekhar,
	davinci-linux-open-source, Ujfalusi, Peter, Girdwood, Liam,
	linux-arm-kernel

On Sat, Aug 18, 2012 at 04:03:58, Mark Brown wrote:
> On Tue, Aug 14, 2012 at 06:12:01PM +0530, Hebbar, Gururaja wrote:
> > Davinci McASP header & driver are shared by few OMAP platforms (like
> > TI81xx, AM335x). Splitting asp header into Davinci platform specific
> > header and Audio specific header helps to share them across platforms.
> 
> This doesn't apply against v3.6-rc2, I suspect there's overlapping
> changes in arch/arm.  I was just going to apply it on a separate branch
> to allow cross-tree merge if there's overlap with architecture work.
> Can you please check and resend?

I will re-apply and send it as v2

> 


Regards, 
Gururaja

^ permalink raw reply	[flat|nested] 40+ messages in thread

* [PATCH 1/5] ASoC/ARM: Davinci: McASP: split asp header into platform and audio specific
@ 2012-08-22 13:11       ` Hebbar, Gururaja
  0 siblings, 0 replies; 40+ messages in thread
From: Hebbar, Gururaja @ 2012-08-22 13:11 UTC (permalink / raw)
  To: linux-arm-kernel

On Sat, Aug 18, 2012 at 04:03:58, Mark Brown wrote:
> On Tue, Aug 14, 2012 at 06:12:01PM +0530, Hebbar, Gururaja wrote:
> > Davinci McASP header & driver are shared by few OMAP platforms (like
> > TI81xx, AM335x). Splitting asp header into Davinci platform specific
> > header and Audio specific header helps to share them across platforms.
> 
> This doesn't apply against v3.6-rc2, I suspect there's overlapping
> changes in arch/arm.  I was just going to apply it on a separate branch
> to allow cross-tree merge if there's overlap with architecture work.
> Can you please check and resend?

I will re-apply and send it as v2

> 


Regards, 
Gururaja

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [PATCH 3/5] ASoC: Davinci: pcm: Add device tree bindings
  2012-08-17 22:31     ` Mark Brown
@ 2012-08-22 13:50       ` Hebbar, Gururaja
  -1 siblings, 0 replies; 40+ messages in thread
From: Hebbar, Gururaja @ 2012-08-22 13:50 UTC (permalink / raw)
  To: Mark Brown
  Cc: alsa-devel, Rajashekhara, Sudhakar, tony, Nori, Sekhar,
	davinci-linux-open-source, Ujfalusi, Peter, Girdwood, Liam,
	linux-arm-kernel

On Sat, Aug 18, 2012 at 04:01:24, Mark Brown wrote:
> On Tue, Aug 14, 2012 at 06:12:03PM +0530, Hebbar, Gururaja wrote:
> > Device tree support for Davinci/OMAP2+ pcm driver.
> 
> This looks like it's a device which maps a shared DMA controller in the
> SoC core into ASoC rather than actual hardware.  Such devices are
> usually instantiated automatically from the DAI rather than being
> represented in the device tree since they are a Linux internal thing
> really - the Tegra and Freescale drivers provide examples of how this
> sort of thing can be done.

>From your for-3.7 branch, I could only find such implementation in Tegra
Platform. 
Most Freescale platforms implements this through a device/driver method.
Exception being sound/soc/mxs/mxs-pcm.c

So should I follow tegra implementation?
> 


Regards, 
Gururaja

^ permalink raw reply	[flat|nested] 40+ messages in thread

* [PATCH 3/5] ASoC: Davinci: pcm: Add device tree bindings
@ 2012-08-22 13:50       ` Hebbar, Gururaja
  0 siblings, 0 replies; 40+ messages in thread
From: Hebbar, Gururaja @ 2012-08-22 13:50 UTC (permalink / raw)
  To: linux-arm-kernel

On Sat, Aug 18, 2012 at 04:01:24, Mark Brown wrote:
> On Tue, Aug 14, 2012 at 06:12:03PM +0530, Hebbar, Gururaja wrote:
> > Device tree support for Davinci/OMAP2+ pcm driver.
> 
> This looks like it's a device which maps a shared DMA controller in the
> SoC core into ASoC rather than actual hardware.  Such devices are
> usually instantiated automatically from the DAI rather than being
> represented in the device tree since they are a Linux internal thing
> really - the Tegra and Freescale drivers provide examples of how this
> sort of thing can be done.

>From your for-3.7 branch, I could only find such implementation in Tegra
Platform. 
Most Freescale platforms implements this through a device/driver method.
Exception being sound/soc/mxs/mxs-pcm.c

So should I follow tegra implementation?
> 


Regards, 
Gururaja

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [PATCH 3/5] ASoC: Davinci: pcm: Add device tree bindings
  2012-08-22 13:50       ` Hebbar, Gururaja
@ 2012-08-22 15:58         ` Mark Brown
  -1 siblings, 0 replies; 40+ messages in thread
From: Mark Brown @ 2012-08-22 15:58 UTC (permalink / raw)
  To: Hebbar, Gururaja
  Cc: alsa-devel, Rajashekhara, Sudhakar, tony, Nori, Sekhar,
	davinci-linux-open-source, Ujfalusi, Peter, Girdwood, Liam,
	linux-arm-kernel


[-- Attachment #1.1: Type: text/plain, Size: 371 bytes --]

On Wed, Aug 22, 2012 at 01:50:09PM +0000, Hebbar, Gururaja wrote:

> From your for-3.7 branch, I could only find such implementation in Tegra
> Platform. 
> Most Freescale platforms implements this through a device/driver method.
> Exception being sound/soc/mxs/mxs-pcm.c

> So should I follow tegra implementation?

Tegra and mxs should be good examples, yes.

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 40+ messages in thread

* [PATCH 3/5] ASoC: Davinci: pcm: Add device tree bindings
@ 2012-08-22 15:58         ` Mark Brown
  0 siblings, 0 replies; 40+ messages in thread
From: Mark Brown @ 2012-08-22 15:58 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Aug 22, 2012 at 01:50:09PM +0000, Hebbar, Gururaja wrote:

> From your for-3.7 branch, I could only find such implementation in Tegra
> Platform. 
> Most Freescale platforms implements this through a device/driver method.
> Exception being sound/soc/mxs/mxs-pcm.c

> So should I follow tegra implementation?

Tegra and mxs should be good examples, yes.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120822/bfc3c9ea/attachment.sig>

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [PATCH 3/5] ASoC: Davinci: pcm: Add device tree bindings
  2012-08-22 15:58         ` Mark Brown
@ 2012-08-23  5:13           ` Hebbar, Gururaja
  -1 siblings, 0 replies; 40+ messages in thread
From: Hebbar, Gururaja @ 2012-08-23  5:13 UTC (permalink / raw)
  To: Mark Brown
  Cc: alsa-devel, Rajashekhara, Sudhakar, tony, Nori, Sekhar,
	davinci-linux-open-source, Ujfalusi, Peter, Girdwood, Liam,
	linux-arm-kernel

On Wed, Aug 22, 2012 at 21:28:08, Mark Brown wrote:
> On Wed, Aug 22, 2012 at 01:50:09PM +0000, Hebbar, Gururaja wrote:
> 
> > From your for-3.7 branch, I could only find such implementation in Tegra
> > Platform. 
> > Most Freescale platforms implements this through a device/driver method.
> > Exception being sound/soc/mxs/mxs-pcm.c
> 
> > So should I follow tegra implementation?
> 
> Tegra and mxs should be good examples, yes.

Ok. Will update in V2

> 


Regards, 
Gururaja

^ permalink raw reply	[flat|nested] 40+ messages in thread

* [PATCH 3/5] ASoC: Davinci: pcm: Add device tree bindings
@ 2012-08-23  5:13           ` Hebbar, Gururaja
  0 siblings, 0 replies; 40+ messages in thread
From: Hebbar, Gururaja @ 2012-08-23  5:13 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Aug 22, 2012 at 21:28:08, Mark Brown wrote:
> On Wed, Aug 22, 2012 at 01:50:09PM +0000, Hebbar, Gururaja wrote:
> 
> > From your for-3.7 branch, I could only find such implementation in Tegra
> > Platform. 
> > Most Freescale platforms implements this through a device/driver method.
> > Exception being sound/soc/mxs/mxs-pcm.c
> 
> > So should I follow tegra implementation?
> 
> Tegra and mxs should be good examples, yes.

Ok. Will update in V2

> 


Regards, 
Gururaja

^ permalink raw reply	[flat|nested] 40+ messages in thread

* Re: [PATCH 2/5] ASoC: Davinci: McASP: add device tree support for McASP
  2012-08-17 22:41     ` Mark Brown
@ 2012-08-23  7:56       ` Hebbar, Gururaja
  -1 siblings, 0 replies; 40+ messages in thread
From: Hebbar, Gururaja @ 2012-08-23  7:56 UTC (permalink / raw)
  To: Mark Brown
  Cc: alsa-devel, Rajashekhara, Sudhakar, tony, Nori, Sekhar,
	davinci-linux-open-source, Ujfalusi, Peter, Girdwood, Liam,
	linux-arm-kernel

On Sat, Aug 18, 2012 at 04:11:32, Mark Brown wrote:
> On Tue, Aug 14, 2012 at 06:12:02PM +0530, Hebbar, Gururaja wrote:
> 
> > +- op-mode : I2S/DIT ops mode.
> 
> This would normally be part of the machine binding since it needs to be
> applied to both ends of the link.

But in case of McASP driver, it is used when calling snd_soc_register_dai()
To pick the proper dai depending on the McASP operation mode.


> When adding it could you come up with
> a generic binding for this in terms of the current ASoC DAI paremeters
> please?  That way we'll be able to have other machine drivers be
> consistent with this one.

Will look into this once I complete the initial DT porting.

> 
> > +- tdm-slots : Slots for TDM operation.
> 
> This would normally also be a machine driver thing though it's less
> normal to need to configure this on both ends.
> 

This parameter is used by McASP hardware controller for managing slots and
Isn't related to any machine modules.

Regards, 
Gururaja

^ permalink raw reply	[flat|nested] 40+ messages in thread

* [PATCH 2/5] ASoC: Davinci: McASP: add device tree support for McASP
@ 2012-08-23  7:56       ` Hebbar, Gururaja
  0 siblings, 0 replies; 40+ messages in thread
From: Hebbar, Gururaja @ 2012-08-23  7:56 UTC (permalink / raw)
  To: linux-arm-kernel

On Sat, Aug 18, 2012 at 04:11:32, Mark Brown wrote:
> On Tue, Aug 14, 2012 at 06:12:02PM +0530, Hebbar, Gururaja wrote:
> 
> > +- op-mode : I2S/DIT ops mode.
> 
> This would normally be part of the machine binding since it needs to be
> applied to both ends of the link.

But in case of McASP driver, it is used when calling snd_soc_register_dai()
To pick the proper dai depending on the McASP operation mode.


> When adding it could you come up with
> a generic binding for this in terms of the current ASoC DAI paremeters
> please?  That way we'll be able to have other machine drivers be
> consistent with this one.

Will look into this once I complete the initial DT porting.

> 
> > +- tdm-slots : Slots for TDM operation.
> 
> This would normally also be a machine driver thing though it's less
> normal to need to configure this on both ends.
> 

This parameter is used by McASP hardware controller for managing slots and
Isn't related to any machine modules.

Regards, 
Gururaja

^ permalink raw reply	[flat|nested] 40+ messages in thread

end of thread, other threads:[~2012-08-23  7:56 UTC | newest]

Thread overview: 40+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-14 12:42 [PATCH 0/5] ARM/ASoC: Davinci: Add Device Tree Support Hebbar, Gururaja
2012-08-14 12:42 ` Hebbar, Gururaja
2012-08-14 12:42 ` [PATCH 1/5] ASoC/ARM: Davinci: McASP: split asp header into platform and audio specific Hebbar, Gururaja
2012-08-14 12:42   ` Hebbar, Gururaja
     [not found]   ` <1344948125-5649-2-git-send-email-gururaja.hebbar-l0cyMroinI0@public.gmane.org>
2012-08-17 18:13     ` Sekhar Nori
2012-08-17 18:13       ` Sekhar Nori
2012-08-22  7:06       ` Hebbar, Gururaja
2012-08-22  7:06         ` Hebbar, Gururaja
2012-08-17 22:33   ` Mark Brown
2012-08-17 22:33     ` Mark Brown
2012-08-22 13:11     ` Hebbar, Gururaja
2012-08-22 13:11       ` Hebbar, Gururaja
2012-08-14 12:42 ` [PATCH 2/5] ASoC: Davinci: McASP: add device tree support for McASP Hebbar, Gururaja
2012-08-14 12:42   ` Hebbar, Gururaja
2012-08-17 22:41   ` Mark Brown
2012-08-17 22:41     ` Mark Brown
2012-08-23  7:56     ` Hebbar, Gururaja
2012-08-23  7:56       ` Hebbar, Gururaja
2012-08-14 12:42 ` [PATCH 3/5] ASoC: Davinci: pcm: Add device tree bindings Hebbar, Gururaja
2012-08-14 12:42   ` Hebbar, Gururaja
2012-08-17 22:31   ` Mark Brown
2012-08-17 22:31     ` Mark Brown
2012-08-22 13:50     ` Hebbar, Gururaja
2012-08-22 13:50       ` Hebbar, Gururaja
2012-08-22 15:58       ` Mark Brown
2012-08-22 15:58         ` Mark Brown
2012-08-23  5:13         ` Hebbar, Gururaja
2012-08-23  5:13           ` Hebbar, Gururaja
2012-08-14 12:42 ` [PATCH 4/5] ASoC: Davinci: machine: Add device tree binding Hebbar, Gururaja
2012-08-14 12:42   ` Hebbar, Gururaja
2012-08-17 22:43   ` Mark Brown
2012-08-17 22:43     ` Mark Brown
2012-08-22 11:35     ` Hebbar, Gururaja
2012-08-22 11:35       ` Hebbar, Gururaja
2012-08-14 12:42 ` [PATCH 5/5] ASoC: tlv320aic3x: Add device tree bindings Hebbar, Gururaja
2012-08-14 12:42   ` Hebbar, Gururaja
2012-08-17 22:45   ` Mark Brown
2012-08-17 22:45     ` Mark Brown
2012-08-22  9:26     ` Hebbar, Gururaja
2012-08-22  9:26       ` Hebbar, Gururaja

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.