linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v5] ASoC: add imx-sgtl5000 machine driver working with fsl_ssi
@ 2012-03-16  8:56 Shawn Guo
  2012-03-16  8:56 ` [PATCH v5 1/8] ASoC: fsl: separate SSI and DMA Kconfig options Shawn Guo
                   ` (8 more replies)
  0 siblings, 9 replies; 22+ messages in thread
From: Shawn Guo @ 2012-03-16  8:56 UTC (permalink / raw)
  To: linux-arm-kernel

Changes since v4:
 * Add new_binding flag for fsl_ssi driver to support both
   "old binding" and "new binding"

---
Shawn Guo (8):
      ASoC: fsl: separate SSI and DMA Kconfig options
      ASoC: imx: merge sound/soc/imx into sound/soc/fsl
      ASoC: fsl: rename imx-pcm Kconfig options and filename
      ASoC: fsl: create fsl_utils to accommodate the common functions
      ASoC: fsl: remove helper fsl_asoc_get_codec_dev_name
      ASoC: fsl: make fsl_ssi driver compilable on ARM/IMX
      ASoC: fsl: let fsl_ssi work with imx pcm and machine drivers
      ASoC: fsl: add imx-sgtl5000 machine driver

 .../bindings/sound/imx-audio-sgtl5000.txt          |   24 +++
 arch/powerpc/configs/86xx/mpc8610_hpcd_defconfig   |    1 +
 arch/powerpc/configs/mpc85xx_defconfig             |    1 +
 arch/powerpc/configs/mpc85xx_smp_defconfig         |    1 +
 sound/soc/Kconfig                                  |    1 -
 sound/soc/Makefile                                 |    1 -
 sound/soc/fsl/Kconfig                              |  124 +++++++++++++-
 sound/soc/fsl/Makefile                             |   29 +++-
 sound/soc/{imx => fsl}/eukrea-tlv320.c             |    2 +-
 sound/soc/fsl/fsl_ssi.c                            |  141 ++++++++++++----
 sound/soc/fsl/fsl_utils.c                          |   91 ++++++++++
 sound/soc/fsl/fsl_utils.h                          |   26 +++
 sound/soc/{imx => fsl}/imx-audmux.c                |    0
 sound/soc/{imx => fsl}/imx-audmux.h                |    0
 .../{imx/imx-pcm-dma-mx2.c => fsl/imx-pcm-dma.c}   |    0
 sound/soc/{imx => fsl}/imx-pcm-fiq.c               |    0
 sound/soc/{imx => fsl}/imx-pcm.c                   |    0
 sound/soc/{imx => fsl}/imx-pcm.h                   |    0
 sound/soc/fsl/imx-sgtl5000.c                       |  177 ++++++++++++++++++++
 sound/soc/{imx => fsl}/imx-ssi.c                   |    2 +-
 sound/soc/{imx => fsl}/imx-ssi.h                   |    0
 sound/soc/fsl/mpc8610_hpcd.c                       |  166 ++-----------------
 sound/soc/{imx => fsl}/mx27vis-aic32x4.c           |    0
 sound/soc/fsl/p1022_ds.c                           |  158 +----------------
 sound/soc/{imx => fsl}/phycore-ac97.c              |    0
 sound/soc/{imx => fsl}/wm1133-ev1.c                |    0
 sound/soc/imx/Kconfig                              |   79 ---------
 sound/soc/imx/Makefile                             |   22 ---
 28 files changed, 601 insertions(+), 445 deletions(-)

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

* [PATCH v5 1/8] ASoC: fsl: separate SSI and DMA Kconfig options
  2012-03-16  8:56 [PATCH v5] ASoC: add imx-sgtl5000 machine driver working with fsl_ssi Shawn Guo
@ 2012-03-16  8:56 ` Shawn Guo
  2012-03-19 13:56   ` Mark Brown
  2012-03-16  8:56 ` [PATCH v5 2/8] ASoC: imx: merge sound/soc/imx into sound/soc/fsl Shawn Guo
                   ` (7 subsequent siblings)
  8 siblings, 1 reply; 22+ messages in thread
From: Shawn Guo @ 2012-03-16  8:56 UTC (permalink / raw)
  To: linux-arm-kernel

The fsl_ssi driver will possibly be shared between Freescale PowerPC
and ARM/IMX families, so give it a separate Kconfig option.  Then
fsl_ssi driver can possibly be selected independently from selecting
PowerPC DMA based PCM driver.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 sound/soc/fsl/Kconfig  |   15 +++++++++------
 sound/soc/fsl/Makefile |    3 ++-
 2 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/sound/soc/fsl/Kconfig b/sound/soc/fsl/Kconfig
index d754d34..ca693b2 100644
--- a/sound/soc/fsl/Kconfig
+++ b/sound/soc/fsl/Kconfig
@@ -1,10 +1,11 @@
 config SND_MPC52xx_DMA
 	tristate
 
-# ASoC platform support for the Freescale PowerPC SOCs that have an SSI and
-# an Elo DMA controller, such as the MPC8610 and P1022.  You will still need to
-# select a platform driver and a codec driver.
-config SND_SOC_POWERPC_SSI
+config SND_SOC_FSL_SSI
+	tristate
+	depends on FSL_SOC
+
+config SND_SOC_POWERPC_DMA
 	tristate
 	depends on FSL_SOC
 
@@ -12,7 +13,8 @@ config SND_SOC_MPC8610_HPCD
 	tristate "ALSA SoC support for the Freescale MPC8610 HPCD board"
 	# I2C is necessary for the CS4270 driver
 	depends on MPC8610_HPCD && I2C
-	select SND_SOC_POWERPC_SSI
+	select SND_SOC_FSL_SSI
+	select SND_SOC_POWERPC_DMA
 	select SND_SOC_CS4270
 	select SND_SOC_CS4270_VD33_ERRATA
 	default y if MPC8610_HPCD
@@ -23,7 +25,8 @@ config SND_SOC_P1022_DS
 	tristate "ALSA SoC support for the Freescale P1022 DS board"
 	# I2C is necessary for the WM8776 driver
 	depends on P1022_DS && I2C
-	select SND_SOC_POWERPC_SSI
+	select SND_SOC_FSL_SSI
+	select SND_SOC_POWERPC_DMA
 	select SND_SOC_WM8776
 	default y if P1022_DS
 	help
diff --git a/sound/soc/fsl/Makefile b/sound/soc/fsl/Makefile
index b4a38c0..95d483f 100644
--- a/sound/soc/fsl/Makefile
+++ b/sound/soc/fsl/Makefile
@@ -9,7 +9,8 @@ obj-$(CONFIG_SND_SOC_P1022_DS) += snd-soc-p1022-ds.o
 # Freescale PowerPC SSI/DMA Platform Support
 snd-soc-fsl-ssi-objs := fsl_ssi.o
 snd-soc-fsl-dma-objs := fsl_dma.o
-obj-$(CONFIG_SND_SOC_POWERPC_SSI) += snd-soc-fsl-ssi.o snd-soc-fsl-dma.o
+obj-$(CONFIG_SND_SOC_FSL_SSI) += snd-soc-fsl-ssi.o
+obj-$(CONFIG_SND_SOC_POWERPC_DMA) += snd-soc-fsl-dma.o
 
 # MPC5200 Platform Support
 obj-$(CONFIG_SND_MPC52xx_DMA) += mpc5200_dma.o
-- 
1.7.5.4

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

* [PATCH v5 2/8] ASoC: imx: merge sound/soc/imx into sound/soc/fsl
  2012-03-16  8:56 [PATCH v5] ASoC: add imx-sgtl5000 machine driver working with fsl_ssi Shawn Guo
  2012-03-16  8:56 ` [PATCH v5 1/8] ASoC: fsl: separate SSI and DMA Kconfig options Shawn Guo
@ 2012-03-16  8:56 ` Shawn Guo
  2012-03-16 21:21   ` Timur Tabi
  2012-03-27 15:06   ` Philippe Rétornaz
  2012-03-16  8:56 ` [PATCH v5 3/8] ASoC: fsl: rename imx-pcm Kconfig options and filename Shawn Guo
                   ` (6 subsequent siblings)
  8 siblings, 2 replies; 22+ messages in thread
From: Shawn Guo @ 2012-03-16  8:56 UTC (permalink / raw)
  To: linux-arm-kernel

Freescale PowerPC and ARM/IMX families share the same SSI IP block.
The patch merges sound/soc/imx into sound/soc/fsl, so that the possible
code sharing and consolidation can happen.

This is a plain merge, except that menuconfig SND_POWERPC_SOC is added
in Kconfig for PowerPC platform as a correspondence to SND_IMX_SOC for
IMX platform.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/powerpc/configs/86xx/mpc8610_hpcd_defconfig |    1 +
 arch/powerpc/configs/mpc85xx_defconfig           |    1 +
 arch/powerpc/configs/mpc85xx_smp_defconfig       |    1 +
 sound/soc/Kconfig                                |    1 -
 sound/soc/Makefile                               |    1 -
 sound/soc/fsl/Kconfig                            |   92 ++++++++++++++++++++++
 sound/soc/fsl/Makefile                           |   22 +++++
 sound/soc/{imx => fsl}/eukrea-tlv320.c           |    2 +-
 sound/soc/{imx => fsl}/imx-audmux.c              |    0
 sound/soc/{imx => fsl}/imx-audmux.h              |    0
 sound/soc/{imx => fsl}/imx-pcm-dma-mx2.c         |    0
 sound/soc/{imx => fsl}/imx-pcm-fiq.c             |    0
 sound/soc/{imx => fsl}/imx-pcm.c                 |    0
 sound/soc/{imx => fsl}/imx-pcm.h                 |    0
 sound/soc/{imx => fsl}/imx-ssi.c                 |    2 +-
 sound/soc/{imx => fsl}/imx-ssi.h                 |    0
 sound/soc/{imx => fsl}/mx27vis-aic32x4.c         |    0
 sound/soc/{imx => fsl}/phycore-ac97.c            |    0
 sound/soc/{imx => fsl}/wm1133-ev1.c              |    0
 sound/soc/imx/Kconfig                            |   79 -------------------
 sound/soc/imx/Makefile                           |   22 -----
 21 files changed, 119 insertions(+), 105 deletions(-)
 rename sound/soc/{imx => fsl}/eukrea-tlv320.c (99%)
 rename sound/soc/{imx => fsl}/imx-audmux.c (100%)
 rename sound/soc/{imx => fsl}/imx-audmux.h (100%)
 rename sound/soc/{imx => fsl}/imx-pcm-dma-mx2.c (100%)
 rename sound/soc/{imx => fsl}/imx-pcm-fiq.c (100%)
 rename sound/soc/{imx => fsl}/imx-pcm.c (100%)
 rename sound/soc/{imx => fsl}/imx-pcm.h (100%)
 rename sound/soc/{imx => fsl}/imx-ssi.c (99%)
 rename sound/soc/{imx => fsl}/imx-ssi.h (100%)
 rename sound/soc/{imx => fsl}/mx27vis-aic32x4.c (100%)
 rename sound/soc/{imx => fsl}/phycore-ac97.c (100%)
 rename sound/soc/{imx => fsl}/wm1133-ev1.c (100%)
 delete mode 100644 sound/soc/imx/Kconfig
 delete mode 100644 sound/soc/imx/Makefile

diff --git a/arch/powerpc/configs/86xx/mpc8610_hpcd_defconfig b/arch/powerpc/configs/86xx/mpc8610_hpcd_defconfig
index 0db9ba0..c09598b 100644
--- a/arch/powerpc/configs/86xx/mpc8610_hpcd_defconfig
+++ b/arch/powerpc/configs/86xx/mpc8610_hpcd_defconfig
@@ -100,6 +100,7 @@ CONFIG_SND_MIXER_OSS=y
 CONFIG_SND_PCM_OSS=y
 # CONFIG_SND_SUPPORT_OLD_API is not set
 CONFIG_SND_SOC=y
+CONFIG_SND_POWERPC_SOC=y
 CONFIG_RTC_CLASS=y
 CONFIG_RTC_DRV_CMOS=y
 CONFIG_EXT2_FS=y
diff --git a/arch/powerpc/configs/mpc85xx_defconfig b/arch/powerpc/configs/mpc85xx_defconfig
index f37a2ab..44605f8 100644
--- a/arch/powerpc/configs/mpc85xx_defconfig
+++ b/arch/powerpc/configs/mpc85xx_defconfig
@@ -139,6 +139,7 @@ CONFIG_SND_INTEL8X0=y
 # CONFIG_SND_PPC is not set
 # CONFIG_SND_USB is not set
 CONFIG_SND_SOC=y
+CONFIG_SND_POWERPC_SOC=y
 CONFIG_HID_A4TECH=y
 CONFIG_HID_APPLE=y
 CONFIG_HID_BELKIN=y
diff --git a/arch/powerpc/configs/mpc85xx_smp_defconfig b/arch/powerpc/configs/mpc85xx_smp_defconfig
index abdcd31..98e227e 100644
--- a/arch/powerpc/configs/mpc85xx_smp_defconfig
+++ b/arch/powerpc/configs/mpc85xx_smp_defconfig
@@ -141,6 +141,7 @@ CONFIG_SND_INTEL8X0=y
 # CONFIG_SND_PPC is not set
 # CONFIG_SND_USB is not set
 CONFIG_SND_SOC=y
+CONFIG_SND_POWERPC_SOC=y
 CONFIG_HID_A4TECH=y
 CONFIG_HID_APPLE=y
 CONFIG_HID_BELKIN=y
diff --git a/sound/soc/Kconfig b/sound/soc/Kconfig
index 91c9855..0f85f6d 100644
--- a/sound/soc/Kconfig
+++ b/sound/soc/Kconfig
@@ -35,7 +35,6 @@ source "sound/soc/blackfin/Kconfig"
 source "sound/soc/davinci/Kconfig"
 source "sound/soc/ep93xx/Kconfig"
 source "sound/soc/fsl/Kconfig"
-source "sound/soc/imx/Kconfig"
 source "sound/soc/jz4740/Kconfig"
 source "sound/soc/nuc900/Kconfig"
 source "sound/soc/omap/Kconfig"
diff --git a/sound/soc/Makefile b/sound/soc/Makefile
index 2feaf37..363dfd6 100644
--- a/sound/soc/Makefile
+++ b/sound/soc/Makefile
@@ -12,7 +12,6 @@ obj-$(CONFIG_SND_SOC)	+= blackfin/
 obj-$(CONFIG_SND_SOC)	+= davinci/
 obj-$(CONFIG_SND_SOC)	+= ep93xx/
 obj-$(CONFIG_SND_SOC)	+= fsl/
-obj-$(CONFIG_SND_SOC)   += imx/
 obj-$(CONFIG_SND_SOC)	+= jz4740/
 obj-$(CONFIG_SND_SOC)	+= mid-x86/
 obj-$(CONFIG_SND_SOC)	+= mxs/
diff --git a/sound/soc/fsl/Kconfig b/sound/soc/fsl/Kconfig
index ca693b2..19856a0 100644
--- a/sound/soc/fsl/Kconfig
+++ b/sound/soc/fsl/Kconfig
@@ -1,3 +1,15 @@
+config SND_SOC_FSL_SSI
+	tristate
+
+menuconfig SND_POWERPC_SOC
+	tristate "SoC Audio for Freescale PowerPC CPUs"
+	depends on FSL_SOC
+	help
+	  Say Y or M if you want to add support for codecs attached to
+	  the PowerPC CPUs.
+
+if SND_POWERPC_SOC
+
 config SND_MPC52xx_DMA
 	tristate
 
@@ -68,3 +80,83 @@ config SND_MPC52xx_SOC_EFIKA
 	help
 	  Say Y if you want to add support for sound on the Efika.
 
+endif # SND_POWERPC_SOC
+
+menuconfig SND_IMX_SOC
+	tristate "SoC Audio for Freescale i.MX CPUs"
+	depends on ARCH_MXC
+	help
+	  Say Y or M if you want to add support for codecs attached to
+	  the i.MX CPUs.
+
+if SND_IMX_SOC
+
+config SND_SOC_IMX_SSI
+	tristate
+
+config SND_SOC_IMX_PCM
+	tristate
+
+config SND_MXC_SOC_FIQ
+	tristate
+	select FIQ
+	select SND_SOC_IMX_PCM
+
+config SND_MXC_SOC_MX2
+	tristate
+	select SND_SOC_DMAENGINE_PCM
+	select SND_SOC_IMX_PCM
+
+config SND_SOC_IMX_AUDMUX
+	tristate
+
+config SND_MXC_SOC_WM1133_EV1
+	tristate "Audio on the the i.MX31ADS with WM1133-EV1 fitted"
+	depends on MACH_MX31ADS_WM1133_EV1 && EXPERIMENTAL
+	select SND_SOC_WM8350
+	select SND_MXC_SOC_FIQ
+	select SND_SOC_IMX_AUDMUX
+	select SND_SOC_IMX_SSI
+	help
+	  Enable support for audio on the i.MX31ADS with the WM1133-EV1
+	  PMIC board with WM8835x fitted.
+
+config SND_SOC_MX27VIS_AIC32X4
+	tristate "SoC audio support for Visstrim M10 boards"
+	depends on MACH_IMX27_VISSTRIM_M10 && I2C
+	select SND_SOC_TLV320AIC32X4
+	select SND_MXC_SOC_MX2
+	select SND_SOC_IMX_AUDMUX
+	select SND_SOC_IMX_SSI
+	help
+	  Say Y if you want to add support for SoC audio on Visstrim SM10
+	  board with TLV320AIC32X4 codec.
+
+config SND_SOC_PHYCORE_AC97
+	tristate "SoC Audio support for Phytec phyCORE (and phyCARD) boards"
+	depends on MACH_PCM043 || MACH_PCA100
+	select SND_SOC_AC97_BUS
+	select SND_SOC_WM9712
+	select SND_MXC_SOC_FIQ
+	select SND_SOC_IMX_AUDMUX
+	select SND_SOC_IMX_SSI
+	help
+	  Say Y if you want to add support for SoC audio on Phytec phyCORE
+	  and phyCARD boards in AC97 mode
+
+config SND_SOC_EUKREA_TLV320
+	tristate "Eukrea TLV320"
+	depends on MACH_EUKREA_MBIMX27_BASEBOARD \
+		|| MACH_EUKREA_MBIMXSD25_BASEBOARD \
+		|| MACH_EUKREA_MBIMXSD35_BASEBOARD \
+		|| MACH_EUKREA_MBIMXSD51_BASEBOARD
+	depends on I2C
+	select SND_SOC_TLV320AIC23
+	select SND_MXC_SOC_FIQ
+	select SND_SOC_IMX_AUDMUX
+	select SND_SOC_IMX_SSI
+	help
+	  Enable I2S based access to the TLV320AIC23B codec attached
+	  to the SSI interface
+
+endif # SND_IMX_SOC
diff --git a/sound/soc/fsl/Makefile b/sound/soc/fsl/Makefile
index 95d483f..36c257f 100644
--- a/sound/soc/fsl/Makefile
+++ b/sound/soc/fsl/Makefile
@@ -21,3 +21,25 @@ obj-$(CONFIG_SND_SOC_MPC5200_AC97) += mpc5200_psc_ac97.o
 obj-$(CONFIG_SND_MPC52xx_SOC_PCM030) += pcm030-audio-fabric.o
 obj-$(CONFIG_SND_MPC52xx_SOC_EFIKA) += efika-audio-fabric.o
 
+# i.MX Platform Support
+snd-soc-imx-ssi-objs := imx-ssi.o
+snd-soc-imx-audmux-objs := imx-audmux.o
+
+obj-$(CONFIG_SND_SOC_IMX_SSI) += snd-soc-imx-ssi.o
+obj-$(CONFIG_SND_SOC_IMX_AUDMUX) += snd-soc-imx-audmux.o
+
+obj-$(CONFIG_SND_SOC_IMX_PCM) += snd-soc-imx-pcm.o
+snd-soc-imx-pcm-y := imx-pcm.o
+snd-soc-imx-pcm-$(CONFIG_SND_MXC_SOC_FIQ) += imx-pcm-fiq.o
+snd-soc-imx-pcm-$(CONFIG_SND_MXC_SOC_MX2) += imx-pcm-dma-mx2.o
+
+# i.MX Machine Support
+snd-soc-eukrea-tlv320-objs := eukrea-tlv320.o
+snd-soc-phycore-ac97-objs := phycore-ac97.o
+snd-soc-mx27vis-aic32x4-objs := mx27vis-aic32x4.o
+snd-soc-wm1133-ev1-objs := wm1133-ev1.o
+
+obj-$(CONFIG_SND_SOC_EUKREA_TLV320) += snd-soc-eukrea-tlv320.o
+obj-$(CONFIG_SND_SOC_PHYCORE_AC97) += snd-soc-phycore-ac97.o
+obj-$(CONFIG_SND_SOC_MX27VIS_AIC32X4) += snd-soc-mx27vis-aic32x4.o
+obj-$(CONFIG_SND_MXC_SOC_WM1133_EV1) += snd-soc-wm1133-ev1.o
diff --git a/sound/soc/imx/eukrea-tlv320.c b/sound/soc/fsl/eukrea-tlv320.c
similarity index 99%
rename from sound/soc/imx/eukrea-tlv320.c
rename to sound/soc/fsl/eukrea-tlv320.c
index 7d4475c..efb9ede 100644
--- a/sound/soc/imx/eukrea-tlv320.c
+++ b/sound/soc/fsl/eukrea-tlv320.c
@@ -7,7 +7,7 @@
  * which is Copyright 2009 Simtec Electronics
  * and on sound/soc/imx/phycore-ac97.c which is
  * Copyright 2009 Sascha Hauer, Pengutronix <s.hauer@pengutronix.de>
- * 
+ *
  *  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;  either version 2 of the  License, or (at your
diff --git a/sound/soc/imx/imx-audmux.c b/sound/soc/fsl/imx-audmux.c
similarity index 100%
rename from sound/soc/imx/imx-audmux.c
rename to sound/soc/fsl/imx-audmux.c
diff --git a/sound/soc/imx/imx-audmux.h b/sound/soc/fsl/imx-audmux.h
similarity index 100%
rename from sound/soc/imx/imx-audmux.h
rename to sound/soc/fsl/imx-audmux.h
diff --git a/sound/soc/imx/imx-pcm-dma-mx2.c b/sound/soc/fsl/imx-pcm-dma-mx2.c
similarity index 100%
rename from sound/soc/imx/imx-pcm-dma-mx2.c
rename to sound/soc/fsl/imx-pcm-dma-mx2.c
diff --git a/sound/soc/imx/imx-pcm-fiq.c b/sound/soc/fsl/imx-pcm-fiq.c
similarity index 100%
rename from sound/soc/imx/imx-pcm-fiq.c
rename to sound/soc/fsl/imx-pcm-fiq.c
diff --git a/sound/soc/imx/imx-pcm.c b/sound/soc/fsl/imx-pcm.c
similarity index 100%
rename from sound/soc/imx/imx-pcm.c
rename to sound/soc/fsl/imx-pcm.c
diff --git a/sound/soc/imx/imx-pcm.h b/sound/soc/fsl/imx-pcm.h
similarity index 100%
rename from sound/soc/imx/imx-pcm.h
rename to sound/soc/fsl/imx-pcm.h
diff --git a/sound/soc/imx/imx-ssi.c b/sound/soc/fsl/imx-ssi.c
similarity index 99%
rename from sound/soc/imx/imx-ssi.c
rename to sound/soc/fsl/imx-ssi.c
index 9203cdd..3e0dac5a 100644
--- a/sound/soc/imx/imx-ssi.c
+++ b/sound/soc/fsl/imx-ssi.c
@@ -28,7 +28,7 @@
  * value. When we read the same register two times (and the register still
  * contains the same value) these status bits are not set. We work
  * around this by not polling these bits but only wait a fixed delay.
- * 
+ *
  */
 
 #include <linux/clk.h>
diff --git a/sound/soc/imx/imx-ssi.h b/sound/soc/fsl/imx-ssi.h
similarity index 100%
rename from sound/soc/imx/imx-ssi.h
rename to sound/soc/fsl/imx-ssi.h
diff --git a/sound/soc/imx/mx27vis-aic32x4.c b/sound/soc/fsl/mx27vis-aic32x4.c
similarity index 100%
rename from sound/soc/imx/mx27vis-aic32x4.c
rename to sound/soc/fsl/mx27vis-aic32x4.c
diff --git a/sound/soc/imx/phycore-ac97.c b/sound/soc/fsl/phycore-ac97.c
similarity index 100%
rename from sound/soc/imx/phycore-ac97.c
rename to sound/soc/fsl/phycore-ac97.c
diff --git a/sound/soc/imx/wm1133-ev1.c b/sound/soc/fsl/wm1133-ev1.c
similarity index 100%
rename from sound/soc/imx/wm1133-ev1.c
rename to sound/soc/fsl/wm1133-ev1.c
diff --git a/sound/soc/imx/Kconfig b/sound/soc/imx/Kconfig
deleted file mode 100644
index 810acaa..0000000
--- a/sound/soc/imx/Kconfig
+++ /dev/null
@@ -1,79 +0,0 @@
-menuconfig SND_IMX_SOC
-	tristate "SoC Audio for Freescale i.MX CPUs"
-	depends on ARCH_MXC
-	help
-	  Say Y or M if you want to add support for codecs attached to
-	  the i.MX SSI interface.
-
-
-if SND_IMX_SOC
-
-config SND_SOC_IMX_SSI
-	tristate
-
-config SND_SOC_IMX_PCM
-	tristate
-
-config SND_MXC_SOC_FIQ
-	tristate
-	select FIQ
-	select SND_SOC_IMX_PCM
-
-config SND_MXC_SOC_MX2
-	select SND_SOC_DMAENGINE_PCM
-	tristate
-	select SND_SOC_IMX_PCM
-
-config SND_SOC_IMX_AUDMUX
-	tristate
-
-config SND_MXC_SOC_WM1133_EV1
-	tristate "Audio on the the i.MX31ADS with WM1133-EV1 fitted"
-	depends on MACH_MX31ADS_WM1133_EV1 && EXPERIMENTAL
-	select SND_SOC_WM8350
-	select SND_MXC_SOC_FIQ
-	select SND_SOC_IMX_AUDMUX
-	select SND_SOC_IMX_SSI
-	help
-	  Enable support for audio on the i.MX31ADS with the WM1133-EV1
-	  PMIC board with WM8835x fitted.
-
-config SND_SOC_MX27VIS_AIC32X4
-	tristate "SoC audio support for Visstrim M10 boards"
-	depends on MACH_IMX27_VISSTRIM_M10 && I2C
-	select SND_SOC_TLV320AIC32X4
-	select SND_MXC_SOC_MX2
-	select SND_SOC_IMX_AUDMUX
-	select SND_SOC_IMX_SSI
-	help
-	  Say Y if you want to add support for SoC audio on Visstrim SM10
-	  board with TLV320AIC32X4 codec.
-
-config SND_SOC_PHYCORE_AC97
-	tristate "SoC Audio support for Phytec phyCORE (and phyCARD) boards"
-	depends on MACH_PCM043 || MACH_PCA100
-	select SND_SOC_AC97_BUS
-	select SND_SOC_WM9712
-	select SND_MXC_SOC_FIQ
-	select SND_SOC_IMX_AUDMUX
-	select SND_SOC_IMX_SSI
-	help
-	  Say Y if you want to add support for SoC audio on Phytec phyCORE
-	  and phyCARD boards in AC97 mode
-
-config SND_SOC_EUKREA_TLV320
-	tristate "Eukrea TLV320"
-	depends on MACH_EUKREA_MBIMX27_BASEBOARD \
-		|| MACH_EUKREA_MBIMXSD25_BASEBOARD \
-		|| MACH_EUKREA_MBIMXSD35_BASEBOARD \
-		|| MACH_EUKREA_MBIMXSD51_BASEBOARD
-	depends on I2C
-	select SND_SOC_TLV320AIC23
-	select SND_MXC_SOC_FIQ
-	select SND_SOC_IMX_AUDMUX
-	select SND_SOC_IMX_SSI
-	help
-	  Enable I2S based access to the TLV320AIC23B codec attached
-	  to the SSI interface
-
-endif	# SND_IMX_SOC
diff --git a/sound/soc/imx/Makefile b/sound/soc/imx/Makefile
deleted file mode 100644
index f5db3e9..0000000
--- a/sound/soc/imx/Makefile
+++ /dev/null
@@ -1,22 +0,0 @@
-# i.MX Platform Support
-snd-soc-imx-ssi-objs := imx-ssi.o
-snd-soc-imx-audmux-objs := imx-audmux.o
-
-obj-$(CONFIG_SND_SOC_IMX_SSI) += snd-soc-imx-ssi.o
-obj-$(CONFIG_SND_SOC_IMX_AUDMUX) += snd-soc-imx-audmux.o
-
-obj-$(CONFIG_SND_SOC_IMX_PCM) += snd-soc-imx-pcm.o
-snd-soc-imx-pcm-y := imx-pcm.o
-snd-soc-imx-pcm-$(CONFIG_SND_MXC_SOC_FIQ) += imx-pcm-fiq.o
-snd-soc-imx-pcm-$(CONFIG_SND_MXC_SOC_MX2) += imx-pcm-dma-mx2.o
-
-# i.MX Machine Support
-snd-soc-eukrea-tlv320-objs := eukrea-tlv320.o
-snd-soc-phycore-ac97-objs := phycore-ac97.o
-snd-soc-mx27vis-aic32x4-objs := mx27vis-aic32x4.o
-snd-soc-wm1133-ev1-objs := wm1133-ev1.o
-
-obj-$(CONFIG_SND_SOC_EUKREA_TLV320) += snd-soc-eukrea-tlv320.o
-obj-$(CONFIG_SND_SOC_PHYCORE_AC97) += snd-soc-phycore-ac97.o
-obj-$(CONFIG_SND_SOC_MX27VIS_AIC32X4) += snd-soc-mx27vis-aic32x4.o
-obj-$(CONFIG_SND_MXC_SOC_WM1133_EV1) += snd-soc-wm1133-ev1.o
-- 
1.7.5.4

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

* [PATCH v5 3/8] ASoC: fsl: rename imx-pcm Kconfig options and filename
  2012-03-16  8:56 [PATCH v5] ASoC: add imx-sgtl5000 machine driver working with fsl_ssi Shawn Guo
  2012-03-16  8:56 ` [PATCH v5 1/8] ASoC: fsl: separate SSI and DMA Kconfig options Shawn Guo
  2012-03-16  8:56 ` [PATCH v5 2/8] ASoC: imx: merge sound/soc/imx into sound/soc/fsl Shawn Guo
@ 2012-03-16  8:56 ` Shawn Guo
  2012-03-16  8:56 ` [PATCH v5 4/8] ASoC: fsl: create fsl_utils to accommodate the common functions Shawn Guo
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 22+ messages in thread
From: Shawn Guo @ 2012-03-16  8:56 UTC (permalink / raw)
  To: linux-arm-kernel

Rename a couple of imx-pcm Kconfig options and filename to get them
well named and less confusing.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 sound/soc/fsl/Kconfig                              |   12 ++++++------
 sound/soc/fsl/Makefile                             |    4 ++--
 sound/soc/fsl/{imx-pcm-dma-mx2.c => imx-pcm-dma.c} |    0
 3 files changed, 8 insertions(+), 8 deletions(-)
 rename sound/soc/fsl/{imx-pcm-dma-mx2.c => imx-pcm-dma.c} (100%)

diff --git a/sound/soc/fsl/Kconfig b/sound/soc/fsl/Kconfig
index 19856a0..e3f7509 100644
--- a/sound/soc/fsl/Kconfig
+++ b/sound/soc/fsl/Kconfig
@@ -97,12 +97,12 @@ config SND_SOC_IMX_SSI
 config SND_SOC_IMX_PCM
 	tristate
 
-config SND_MXC_SOC_FIQ
+config SND_SOC_IMX_PCM_FIQ
 	tristate
 	select FIQ
 	select SND_SOC_IMX_PCM
 
-config SND_MXC_SOC_MX2
+config SND_SOC_IMX_PCM_DMA
 	tristate
 	select SND_SOC_DMAENGINE_PCM
 	select SND_SOC_IMX_PCM
@@ -114,7 +114,7 @@ config SND_MXC_SOC_WM1133_EV1
 	tristate "Audio on the the i.MX31ADS with WM1133-EV1 fitted"
 	depends on MACH_MX31ADS_WM1133_EV1 && EXPERIMENTAL
 	select SND_SOC_WM8350
-	select SND_MXC_SOC_FIQ
+	select SND_SOC_IMX_PCM_FIQ
 	select SND_SOC_IMX_AUDMUX
 	select SND_SOC_IMX_SSI
 	help
@@ -125,7 +125,7 @@ config SND_SOC_MX27VIS_AIC32X4
 	tristate "SoC audio support for Visstrim M10 boards"
 	depends on MACH_IMX27_VISSTRIM_M10 && I2C
 	select SND_SOC_TLV320AIC32X4
-	select SND_MXC_SOC_MX2
+	select SND_SOC_IMX_PCM_DMA
 	select SND_SOC_IMX_AUDMUX
 	select SND_SOC_IMX_SSI
 	help
@@ -137,7 +137,7 @@ config SND_SOC_PHYCORE_AC97
 	depends on MACH_PCM043 || MACH_PCA100
 	select SND_SOC_AC97_BUS
 	select SND_SOC_WM9712
-	select SND_MXC_SOC_FIQ
+	select SND_SOC_IMX_PCM_FIQ
 	select SND_SOC_IMX_AUDMUX
 	select SND_SOC_IMX_SSI
 	help
@@ -152,7 +152,7 @@ config SND_SOC_EUKREA_TLV320
 		|| MACH_EUKREA_MBIMXSD51_BASEBOARD
 	depends on I2C
 	select SND_SOC_TLV320AIC23
-	select SND_MXC_SOC_FIQ
+	select SND_SOC_IMX_PCM_FIQ
 	select SND_SOC_IMX_AUDMUX
 	select SND_SOC_IMX_SSI
 	help
diff --git a/sound/soc/fsl/Makefile b/sound/soc/fsl/Makefile
index 36c257f..f031409 100644
--- a/sound/soc/fsl/Makefile
+++ b/sound/soc/fsl/Makefile
@@ -30,8 +30,8 @@ obj-$(CONFIG_SND_SOC_IMX_AUDMUX) += snd-soc-imx-audmux.o
 
 obj-$(CONFIG_SND_SOC_IMX_PCM) += snd-soc-imx-pcm.o
 snd-soc-imx-pcm-y := imx-pcm.o
-snd-soc-imx-pcm-$(CONFIG_SND_MXC_SOC_FIQ) += imx-pcm-fiq.o
-snd-soc-imx-pcm-$(CONFIG_SND_MXC_SOC_MX2) += imx-pcm-dma-mx2.o
+snd-soc-imx-pcm-$(CONFIG_SND_SOC_IMX_PCM_FIQ) += imx-pcm-fiq.o
+snd-soc-imx-pcm-$(CONFIG_SND_SOC_IMX_PCM_DMA) += imx-pcm-dma.o
 
 # i.MX Machine Support
 snd-soc-eukrea-tlv320-objs := eukrea-tlv320.o
diff --git a/sound/soc/fsl/imx-pcm-dma-mx2.c b/sound/soc/fsl/imx-pcm-dma.c
similarity index 100%
rename from sound/soc/fsl/imx-pcm-dma-mx2.c
rename to sound/soc/fsl/imx-pcm-dma.c
-- 
1.7.5.4

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

* [PATCH v5 4/8] ASoC: fsl: create fsl_utils to accommodate the common functions
  2012-03-16  8:56 [PATCH v5] ASoC: add imx-sgtl5000 machine driver working with fsl_ssi Shawn Guo
                   ` (2 preceding siblings ...)
  2012-03-16  8:56 ` [PATCH v5 3/8] ASoC: fsl: rename imx-pcm Kconfig options and filename Shawn Guo
@ 2012-03-16  8:56 ` Shawn Guo
  2012-03-16  8:56 ` [PATCH v5 5/8] ASoC: fsl: remove helper fsl_asoc_get_codec_dev_name Shawn Guo
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 22+ messages in thread
From: Shawn Guo @ 2012-03-16  8:56 UTC (permalink / raw)
  To: linux-arm-kernel

There is some amount of code duplication between mpc8610_hpcd and
p1022_ds machine drivers, and the same code will be duplicated again
when another new machine driver is added.  The patch creates fsl_utils
to accommodate the common functions to stop the code duplication.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 sound/soc/fsl/Kconfig        |    5 ++
 sound/soc/fsl/Makefile       |    2 +
 sound/soc/fsl/fsl_utils.c    |  135 ++++++++++++++++++++++++++++++++++++
 sound/soc/fsl/fsl_utils.h    |   27 +++++++
 sound/soc/fsl/mpc8610_hpcd.c |  157 +++---------------------------------------
 sound/soc/fsl/p1022_ds.c     |  149 +++-------------------------------------
 6 files changed, 189 insertions(+), 286 deletions(-)
 create mode 100644 sound/soc/fsl/fsl_utils.c
 create mode 100644 sound/soc/fsl/fsl_utils.h

diff --git a/sound/soc/fsl/Kconfig b/sound/soc/fsl/Kconfig
index e3f7509..535ee73 100644
--- a/sound/soc/fsl/Kconfig
+++ b/sound/soc/fsl/Kconfig
@@ -1,6 +1,9 @@
 config SND_SOC_FSL_SSI
 	tristate
 
+config SND_SOC_FSL_UTILS
+	tristate
+
 menuconfig SND_POWERPC_SOC
 	tristate "SoC Audio for Freescale PowerPC CPUs"
 	depends on FSL_SOC
@@ -26,6 +29,7 @@ config SND_SOC_MPC8610_HPCD
 	# I2C is necessary for the CS4270 driver
 	depends on MPC8610_HPCD && I2C
 	select SND_SOC_FSL_SSI
+	select SND_SOC_FSL_UTILS
 	select SND_SOC_POWERPC_DMA
 	select SND_SOC_CS4270
 	select SND_SOC_CS4270_VD33_ERRATA
@@ -38,6 +42,7 @@ config SND_SOC_P1022_DS
 	# I2C is necessary for the WM8776 driver
 	depends on P1022_DS && I2C
 	select SND_SOC_FSL_SSI
+	select SND_SOC_FSL_UTILS
 	select SND_SOC_POWERPC_DMA
 	select SND_SOC_WM8776
 	default y if P1022_DS
diff --git a/sound/soc/fsl/Makefile b/sound/soc/fsl/Makefile
index f031409..fbdbed0 100644
--- a/sound/soc/fsl/Makefile
+++ b/sound/soc/fsl/Makefile
@@ -8,8 +8,10 @@ obj-$(CONFIG_SND_SOC_P1022_DS) += snd-soc-p1022-ds.o
 
 # Freescale PowerPC SSI/DMA Platform Support
 snd-soc-fsl-ssi-objs := fsl_ssi.o
+snd-soc-fsl-utils-objs := fsl_utils.o
 snd-soc-fsl-dma-objs := fsl_dma.o
 obj-$(CONFIG_SND_SOC_FSL_SSI) += snd-soc-fsl-ssi.o
+obj-$(CONFIG_SND_SOC_FSL_UTILS) += snd-soc-fsl-utils.o
 obj-$(CONFIG_SND_SOC_POWERPC_DMA) += snd-soc-fsl-dma.o
 
 # MPC5200 Platform Support
diff --git a/sound/soc/fsl/fsl_utils.c b/sound/soc/fsl/fsl_utils.c
new file mode 100644
index 0000000..4370c28
--- /dev/null
+++ b/sound/soc/fsl/fsl_utils.c
@@ -0,0 +1,135 @@
+/**
+ * Freescale ALSA SoC Machine driver utility
+ *
+ * Author: Timur Tabi <timur@freescale.com>
+ *
+ * Copyright 2010 Freescale Semiconductor, Inc.
+ *
+ * This file is licensed under the terms of the GNU General Public License
+ * version 2.  This program is licensed "as is" without any warranty of any
+ * kind, whether express or implied.
+ */
+
+#include <linux/module.h>
+#include <linux/of_address.h>
+#include <linux/of_i2c.h>
+#include <sound/soc.h>
+
+#include "fsl_utils.h"
+
+/**
+ * fsl_asoc_get_codec_dev_name - determine the dev_name for a codec node
+ *
+ * @np: pointer to the I2C device tree node
+ * @buf: buffer to be filled with the dev_name of the I2C device
+ * @len: the length of the buffer
+ *
+ * This function determines the dev_name for an I2C node.  This is the name
+ * that would be returned by dev_name() if this device_node were part of a
+ * 'struct device'  It's ugly and hackish, but it works.
+ *
+ * The dev_name for such devices include the bus number and I2C address. For
+ * example, "cs4270.0-004f".
+ */
+int fsl_asoc_get_codec_dev_name(struct device_node *np, char *buf, size_t len)
+{
+	const u32 *iprop;
+	u32 addr;
+	char temp[DAI_NAME_SIZE];
+	struct i2c_client *i2c;
+
+	of_modalias_node(np, temp, DAI_NAME_SIZE);
+
+	iprop = of_get_property(np, "reg", NULL);
+	if (!iprop)
+		return -EINVAL;
+
+	addr = be32_to_cpup(iprop);
+
+	/* We need the adapter number */
+	i2c = of_find_i2c_device_by_node(np);
+	if (!i2c) {
+		put_device(&i2c->dev);
+		return -ENODEV;
+	}
+
+	snprintf(buf, len, "%s.%u-%04x", temp, i2c->adapter->nr, addr);
+	put_device(&i2c->dev);
+
+	return 0;
+}
+EXPORT_SYMBOL(fsl_asoc_get_codec_dev_name);
+
+/**
+ * fsl_asoc_get_dma_channel - determine the dma channel for a SSI node
+ *
+ * @ssi_np: pointer to the SSI device tree node
+ * @name: name of the phandle pointing to the dma channel
+ * @dai: ASoC DAI link pointer to be filled with platform_name
+ * @dma_channel_id: dma channel id to be returned
+ * @dma_id: dma id to be returned
+ *
+ * This function determines the dma and channel id for given SSI node.  It
+ * also discovers the platform_name for the ASoC DAI link.
+ */
+int fsl_asoc_get_dma_channel(struct device_node *ssi_np,
+			     const char *name,
+			     struct snd_soc_dai_link *dai,
+			     unsigned int *dma_channel_id,
+			     unsigned int *dma_id)
+{
+	struct resource res;
+	struct device_node *dma_channel_np, *dma_np;
+	const u32 *iprop;
+	int ret;
+
+	dma_channel_np = of_parse_phandle(ssi_np, name, 0);
+	if (!dma_channel_np)
+		return -EINVAL;
+
+	if (!of_device_is_compatible(dma_channel_np, "fsl,ssi-dma-channel")) {
+		of_node_put(dma_channel_np);
+		return -EINVAL;
+	}
+
+	/* Determine the dev_name for the device_node.  This code mimics the
+	 * behavior of of_device_make_bus_id(). We need this because ASoC uses
+	 * the dev_name() of the device to match the platform (DMA) device with
+	 * the CPU (SSI) device.  It's all ugly and hackish, but it works (for
+	 * now).
+	 *
+	 * dai->platform name should already point to an allocated buffer.
+	 */
+	ret = of_address_to_resource(dma_channel_np, 0, &res);
+	if (ret) {
+		of_node_put(dma_channel_np);
+		return ret;
+	}
+	snprintf((char *)dai->platform_name, DAI_NAME_SIZE, "%llx.%s",
+		 (unsigned long long) res.start, dma_channel_np->name);
+
+	iprop = of_get_property(dma_channel_np, "cell-index", NULL);
+	if (!iprop) {
+		of_node_put(dma_channel_np);
+		return -EINVAL;
+	}
+	*dma_channel_id = be32_to_cpup(iprop);
+
+	dma_np = of_get_parent(dma_channel_np);
+	iprop = of_get_property(dma_np, "cell-index", NULL);
+	if (!iprop) {
+		of_node_put(dma_np);
+		return -EINVAL;
+	}
+	*dma_id = be32_to_cpup(iprop);
+
+	of_node_put(dma_np);
+	of_node_put(dma_channel_np);
+
+	return 0;
+}
+EXPORT_SYMBOL(fsl_asoc_get_dma_channel);
+
+MODULE_AUTHOR("Timur Tabi <timur@freescale.com>");
+MODULE_DESCRIPTION("Freescale ASoC utility code");
+MODULE_LICENSE("GPL v2");
diff --git a/sound/soc/fsl/fsl_utils.h b/sound/soc/fsl/fsl_utils.h
new file mode 100644
index 0000000..44d1436
--- /dev/null
+++ b/sound/soc/fsl/fsl_utils.h
@@ -0,0 +1,27 @@
+/**
+ * Freescale ALSA SoC Machine driver utility
+ *
+ * Author: Timur Tabi <timur@freescale.com>
+ *
+ * Copyright 2010 Freescale Semiconductor, Inc.
+ *
+ * This file is licensed under the terms of the GNU General Public License
+ * version 2.  This program is licensed "as is" without any warranty of any
+ * kind, whether express or implied.
+ */
+
+#ifndef _FSL_UTILS_H
+#define _FSL_UTILS_H
+
+#define DAI_NAME_SIZE	32
+
+struct snd_soc_dai_link;
+struct device_node;
+
+int fsl_asoc_get_codec_dev_name(struct device_node *np, char *buf, size_t len);
+int fsl_asoc_get_dma_channel(struct device_node *ssi_np, const char *name,
+			     struct snd_soc_dai_link *dai,
+			     unsigned int *dma_channel_id,
+			     unsigned int *dma_id);
+
+#endif /* _FSL_UTILS_H */
diff --git a/sound/soc/fsl/mpc8610_hpcd.c b/sound/soc/fsl/mpc8610_hpcd.c
index afbabf4..4195182 100644
--- a/sound/soc/fsl/mpc8610_hpcd.c
+++ b/sound/soc/fsl/mpc8610_hpcd.c
@@ -14,18 +14,16 @@
 #include <linux/interrupt.h>
 #include <linux/of_device.h>
 #include <linux/slab.h>
-#include <linux/of_i2c.h>
 #include <sound/soc.h>
 #include <asm/fsl_guts.h>
 
 #include "fsl_dma.h"
 #include "fsl_ssi.h"
+#include "fsl_utils.h"
 
 /* There's only one global utilities register */
 static phys_addr_t guts_phys;
 
-#define DAI_NAME_SIZE	32
-
 /**
  * mpc8610_hpcd_data: machine-specific ASoC device data
  *
@@ -181,141 +179,6 @@ static struct snd_soc_ops mpc8610_hpcd_ops = {
 };
 
 /**
- * get_node_by_phandle_name - get a node by its phandle name
- *
- * This function takes a node, the name of a property in that node, and a
- * compatible string.  Assuming the property is a phandle to another node,
- * it returns that node, (optionally) if that node is compatible.
- *
- * If the property is not a phandle, or the node it points to is not compatible
- * with the specific string, then NULL is returned.
- */
-static struct device_node *get_node_by_phandle_name(struct device_node *np,
-					       const char *name,
-					       const char *compatible)
-{
-	const phandle *ph;
-	int len;
-
-	ph = of_get_property(np, name, &len);
-	if (!ph || (len != sizeof(phandle)))
-		return NULL;
-
-	np = of_find_node_by_phandle(*ph);
-	if (!np)
-		return NULL;
-
-	if (compatible && !of_device_is_compatible(np, compatible)) {
-		of_node_put(np);
-		return NULL;
-	}
-
-	return np;
-}
-
-/**
- * get_parent_cell_index -- return the cell-index of the parent of a node
- *
- * Return the value of the cell-index property of the parent of the given
- * node.  This is used for DMA channel nodes that need to know the DMA ID
- * of the controller they are on.
- */
-static int get_parent_cell_index(struct device_node *np)
-{
-	struct device_node *parent = of_get_parent(np);
-	const u32 *iprop;
-
-	if (!parent)
-		return -1;
-
-	iprop = of_get_property(parent, "cell-index", NULL);
-	of_node_put(parent);
-
-	if (!iprop)
-		return -1;
-
-	return be32_to_cpup(iprop);
-}
-
-/**
- * codec_node_dev_name - determine the dev_name for a codec node
- *
- * This function determines the dev_name for an I2C node.  This is the name
- * that would be returned by dev_name() if this device_node were part of a
- * 'struct device'  It's ugly and hackish, but it works.
- *
- * The dev_name for such devices include the bus number and I2C address. For
- * example, "cs4270.0-004f".
- */
-static int codec_node_dev_name(struct device_node *np, char *buf, size_t len)
-{
-	const u32 *iprop;
-	int addr;
-	char temp[DAI_NAME_SIZE];
-	struct i2c_client *i2c;
-
-	of_modalias_node(np, temp, DAI_NAME_SIZE);
-
-	iprop = of_get_property(np, "reg", NULL);
-	if (!iprop)
-		return -EINVAL;
-
-	addr = be32_to_cpup(iprop);
-
-	/* We need the adapter number */
-	i2c = of_find_i2c_device_by_node(np);
-	if (!i2c)
-		return -ENODEV;
-
-	snprintf(buf, len, "%s.%u-%04x", temp, i2c->adapter->nr, addr);
-
-	return 0;
-}
-
-static int get_dma_channel(struct device_node *ssi_np,
-			   const char *name,
-			   struct snd_soc_dai_link *dai,
-			   unsigned int *dma_channel_id,
-			   unsigned int *dma_id)
-{
-	struct resource res;
-	struct device_node *dma_channel_np;
-	const u32 *iprop;
-	int ret;
-
-	dma_channel_np = get_node_by_phandle_name(ssi_np, name,
-						  "fsl,ssi-dma-channel");
-	if (!dma_channel_np)
-		return -EINVAL;
-
-	/* Determine the dev_name for the device_node.  This code mimics the
-	 * behavior of of_device_make_bus_id(). We need this because ASoC uses
-	 * the dev_name() of the device to match the platform (DMA) device with
-	 * the CPU (SSI) device.  It's all ugly and hackish, but it works (for
-	 * now).
-	 *
-	 * dai->platform name should already point to an allocated buffer.
-	 */
-	ret = of_address_to_resource(dma_channel_np, 0, &res);
-	if (ret)
-		return ret;
-	snprintf((char *)dai->platform_name, DAI_NAME_SIZE, "%llx.%s",
-		 (unsigned long long) res.start, dma_channel_np->name);
-
-	iprop = of_get_property(dma_channel_np, "cell-index", NULL);
-	if (!iprop) {
-		of_node_put(dma_channel_np);
-		return -EINVAL;
-	}
-
-	*dma_channel_id = be32_to_cpup(iprop);
-	*dma_id = get_parent_cell_index(dma_channel_np);
-	of_node_put(dma_channel_np);
-
-	return 0;
-}
-
-/**
  * mpc8610_hpcd_probe: platform probe function for the machine driver
  *
  * Although this is a machine driver, the SSI node is the "master" node with
@@ -353,8 +216,8 @@ static int mpc8610_hpcd_probe(struct platform_device *pdev)
 	machine_data->dai[0].ops = &mpc8610_hpcd_ops;
 
 	/* Determine the codec name, it will be used as the codec DAI name */
-	ret = codec_node_dev_name(codec_np, machine_data->codec_name,
-				  DAI_NAME_SIZE);
+	ret = fsl_asoc_get_codec_dev_name(codec_np, machine_data->codec_name,
+					  DAI_NAME_SIZE);
 	if (ret) {
 		dev_err(&pdev->dev, "invalid codec node %s\n",
 			codec_np->full_name);
@@ -458,9 +321,10 @@ static int mpc8610_hpcd_probe(struct platform_device *pdev)
 
 	/* Find the playback DMA channel to use. */
 	machine_data->dai[0].platform_name = machine_data->platform_name[0];
-	ret = get_dma_channel(np, "fsl,playback-dma", &machine_data->dai[0],
-			      &machine_data->dma_channel_id[0],
-			      &machine_data->dma_id[0]);
+	ret = fsl_asoc_get_dma_channel(np, "fsl,playback-dma",
+				       &machine_data->dai[0],
+				       &machine_data->dma_channel_id[0],
+				       &machine_data->dma_id[0]);
 	if (ret) {
 		dev_err(&pdev->dev, "missing/invalid playback DMA phandle\n");
 		goto error;
@@ -468,9 +332,10 @@ static int mpc8610_hpcd_probe(struct platform_device *pdev)
 
 	/* Find the capture DMA channel to use. */
 	machine_data->dai[1].platform_name = machine_data->platform_name[1];
-	ret = get_dma_channel(np, "fsl,capture-dma", &machine_data->dai[1],
-			      &machine_data->dma_channel_id[1],
-			      &machine_data->dma_id[1]);
+	ret = fsl_asoc_get_dma_channel(np, "fsl,capture-dma",
+				       &machine_data->dai[1],
+				       &machine_data->dma_channel_id[1],
+				       &machine_data->dma_id[1]);
 	if (ret) {
 		dev_err(&pdev->dev, "missing/invalid capture DMA phandle\n");
 		goto error;
diff --git a/sound/soc/fsl/p1022_ds.c b/sound/soc/fsl/p1022_ds.c
index b889870..e3680ce 100644
--- a/sound/soc/fsl/p1022_ds.c
+++ b/sound/soc/fsl/p1022_ds.c
@@ -14,12 +14,12 @@
 #include <linux/interrupt.h>
 #include <linux/of_device.h>
 #include <linux/slab.h>
-#include <linux/of_i2c.h>
 #include <sound/soc.h>
 #include <asm/fsl_guts.h>
 
 #include "fsl_dma.h"
 #include "fsl_ssi.h"
+#include "fsl_utils.h"
 
 /* P1022-specific PMUXCR and DMUXCR bit definitions */
 
@@ -57,8 +57,6 @@ static inline void guts_set_dmuxcr(struct ccsr_guts_85xx __iomem *guts,
 /* There's only one global utilities register */
 static phys_addr_t guts_phys;
 
-#define DAI_NAME_SIZE	32
-
 /**
  * machine_data: machine-specific ASoC device data
  *
@@ -191,136 +189,6 @@ static struct snd_soc_ops p1022_ds_ops = {
 };
 
 /**
- * get_node_by_phandle_name - get a node by its phandle name
- *
- * This function takes a node, the name of a property in that node, and a
- * compatible string.  Assuming the property is a phandle to another node,
- * it returns that node, (optionally) if that node is compatible.
- *
- * If the property is not a phandle, or the node it points to is not compatible
- * with the specific string, then NULL is returned.
- */
-static struct device_node *get_node_by_phandle_name(struct device_node *np,
-	const char *name, const char *compatible)
-{
-	np = of_parse_phandle(np, name, 0);
-	if (!np)
-		return NULL;
-
-	if (!of_device_is_compatible(np, compatible)) {
-		of_node_put(np);
-		return NULL;
-	}
-
-	return np;
-}
-
-/**
- * get_parent_cell_index -- return the cell-index of the parent of a node
- *
- * Return the value of the cell-index property of the parent of the given
- * node.  This is used for DMA channel nodes that need to know the DMA ID
- * of the controller they are on.
- */
-static int get_parent_cell_index(struct device_node *np)
-{
-	struct device_node *parent = of_get_parent(np);
-	const u32 *iprop;
-	int ret = -1;
-
-	if (!parent)
-		return -1;
-
-	iprop = of_get_property(parent, "cell-index", NULL);
-	if (iprop)
-		ret = be32_to_cpup(iprop);
-
-	of_node_put(parent);
-
-	return ret;
-}
-
-/**
- * codec_node_dev_name - determine the dev_name for a codec node
- *
- * This function determines the dev_name for an I2C node.  This is the name
- * that would be returned by dev_name() if this device_node were part of a
- * 'struct device'  It's ugly and hackish, but it works.
- *
- * The dev_name for such devices include the bus number and I2C address. For
- * example, "cs4270-codec.0-004f".
- */
-static int codec_node_dev_name(struct device_node *np, char *buf, size_t len)
-{
-	const u32 *iprop;
-	int addr;
-	char temp[DAI_NAME_SIZE];
-	struct i2c_client *i2c;
-
-	of_modalias_node(np, temp, DAI_NAME_SIZE);
-
-	iprop = of_get_property(np, "reg", NULL);
-	if (!iprop)
-		return -EINVAL;
-
-	addr = be32_to_cpup(iprop);
-
-	/* We need the adapter number */
-	i2c = of_find_i2c_device_by_node(np);
-	if (!i2c)
-		return -ENODEV;
-
-	snprintf(buf, len, "%s.%u-%04x", temp, i2c->adapter->nr, addr);
-
-	return 0;
-}
-
-static int get_dma_channel(struct device_node *ssi_np,
-			   const char *name,
-			   struct snd_soc_dai_link *dai,
-			   unsigned int *dma_channel_id,
-			   unsigned int *dma_id)
-{
-	struct resource res;
-	struct device_node *dma_channel_np;
-	const u32 *iprop;
-	int ret;
-
-	dma_channel_np = get_node_by_phandle_name(ssi_np, name,
-						  "fsl,ssi-dma-channel");
-	if (!dma_channel_np)
-		return -EINVAL;
-
-	/* Determine the dev_name for the device_node.  This code mimics the
-	 * behavior of of_device_make_bus_id(). We need this because ASoC uses
-	 * the dev_name() of the device to match the platform (DMA) device with
-	 * the CPU (SSI) device.  It's all ugly and hackish, but it works (for
-	 * now).
-	 *
-	 * dai->platform name should already point to an allocated buffer.
-	 */
-	ret = of_address_to_resource(dma_channel_np, 0, &res);
-	if (ret) {
-		of_node_put(dma_channel_np);
-		return ret;
-	}
-	snprintf((char *)dai->platform_name, DAI_NAME_SIZE, "%llx.%s",
-		 (unsigned long long) res.start, dma_channel_np->name);
-
-	iprop = of_get_property(dma_channel_np, "cell-index", NULL);
-	if (!iprop) {
-		of_node_put(dma_channel_np);
-		return -EINVAL;
-	}
-
-	*dma_channel_id = be32_to_cpup(iprop);
-	*dma_id = get_parent_cell_index(dma_channel_np);
-	of_node_put(dma_channel_np);
-
-	return 0;
-}
-
-/**
  * p1022_ds_probe: platform probe function for the machine driver
  *
  * Although this is a machine driver, the SSI node is the "master" node with
@@ -358,7 +226,8 @@ static int p1022_ds_probe(struct platform_device *pdev)
 	mdata->dai[0].ops = &p1022_ds_ops;
 
 	/* Determine the codec name, it will be used as the codec DAI name */
-	ret = codec_node_dev_name(codec_np, mdata->codec_name, DAI_NAME_SIZE);
+	ret = fsl_asoc_get_codec_dev_name(codec_np, mdata->codec_name,
+					  DAI_NAME_SIZE);
 	if (ret) {
 		dev_err(&pdev->dev, "invalid codec node %s\n",
 			codec_np->full_name);
@@ -454,9 +323,9 @@ static int p1022_ds_probe(struct platform_device *pdev)
 
 	/* Find the playback DMA channel to use. */
 	mdata->dai[0].platform_name = mdata->platform_name[0];
-	ret = get_dma_channel(np, "fsl,playback-dma", &mdata->dai[0],
-			      &mdata->dma_channel_id[0],
-			      &mdata->dma_id[0]);
+	ret = fsl_asoc_get_dma_channel(np, "fsl,playback-dma", &mdata->dai[0],
+				       &mdata->dma_channel_id[0],
+				       &mdata->dma_id[0]);
 	if (ret) {
 		dev_err(&pdev->dev, "missing/invalid playback DMA phandle\n");
 		goto error;
@@ -464,9 +333,9 @@ static int p1022_ds_probe(struct platform_device *pdev)
 
 	/* Find the capture DMA channel to use. */
 	mdata->dai[1].platform_name = mdata->platform_name[1];
-	ret = get_dma_channel(np, "fsl,capture-dma", &mdata->dai[1],
-			      &mdata->dma_channel_id[1],
-			      &mdata->dma_id[1]);
+	ret = fsl_asoc_get_dma_channel(np, "fsl,capture-dma", &mdata->dai[1],
+				       &mdata->dma_channel_id[1],
+				       &mdata->dma_id[1]);
 	if (ret) {
 		dev_err(&pdev->dev, "missing/invalid capture DMA phandle\n");
 		goto error;
-- 
1.7.5.4

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

* [PATCH v5 5/8] ASoC: fsl: remove helper fsl_asoc_get_codec_dev_name
  2012-03-16  8:56 [PATCH v5] ASoC: add imx-sgtl5000 machine driver working with fsl_ssi Shawn Guo
                   ` (3 preceding siblings ...)
  2012-03-16  8:56 ` [PATCH v5 4/8] ASoC: fsl: create fsl_utils to accommodate the common functions Shawn Guo
@ 2012-03-16  8:56 ` Shawn Guo
  2012-03-16  8:56 ` [PATCH v5 6/8] ASoC: fsl: make fsl_ssi driver compilable on ARM/IMX Shawn Guo
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 22+ messages in thread
From: Shawn Guo @ 2012-03-16  8:56 UTC (permalink / raw)
  To: linux-arm-kernel

The ASoC core now can support matching codec with device node besides
name, so we can save helper function fsl_asoc_get_codec_dev_name.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 sound/soc/fsl/fsl_utils.c    |   44 ------------------------------------------
 sound/soc/fsl/fsl_utils.h    |    1 -
 sound/soc/fsl/mpc8610_hpcd.c |   13 +----------
 sound/soc/fsl/p1022_ds.c     |   13 +----------
 4 files changed, 4 insertions(+), 67 deletions(-)

diff --git a/sound/soc/fsl/fsl_utils.c b/sound/soc/fsl/fsl_utils.c
index 4370c28..b9e42b5 100644
--- a/sound/soc/fsl/fsl_utils.c
+++ b/sound/soc/fsl/fsl_utils.c
@@ -12,55 +12,11 @@
 
 #include <linux/module.h>
 #include <linux/of_address.h>
-#include <linux/of_i2c.h>
 #include <sound/soc.h>
 
 #include "fsl_utils.h"
 
 /**
- * fsl_asoc_get_codec_dev_name - determine the dev_name for a codec node
- *
- * @np: pointer to the I2C device tree node
- * @buf: buffer to be filled with the dev_name of the I2C device
- * @len: the length of the buffer
- *
- * This function determines the dev_name for an I2C node.  This is the name
- * that would be returned by dev_name() if this device_node were part of a
- * 'struct device'  It's ugly and hackish, but it works.
- *
- * The dev_name for such devices include the bus number and I2C address. For
- * example, "cs4270.0-004f".
- */
-int fsl_asoc_get_codec_dev_name(struct device_node *np, char *buf, size_t len)
-{
-	const u32 *iprop;
-	u32 addr;
-	char temp[DAI_NAME_SIZE];
-	struct i2c_client *i2c;
-
-	of_modalias_node(np, temp, DAI_NAME_SIZE);
-
-	iprop = of_get_property(np, "reg", NULL);
-	if (!iprop)
-		return -EINVAL;
-
-	addr = be32_to_cpup(iprop);
-
-	/* We need the adapter number */
-	i2c = of_find_i2c_device_by_node(np);
-	if (!i2c) {
-		put_device(&i2c->dev);
-		return -ENODEV;
-	}
-
-	snprintf(buf, len, "%s.%u-%04x", temp, i2c->adapter->nr, addr);
-	put_device(&i2c->dev);
-
-	return 0;
-}
-EXPORT_SYMBOL(fsl_asoc_get_codec_dev_name);
-
-/**
  * fsl_asoc_get_dma_channel - determine the dma channel for a SSI node
  *
  * @ssi_np: pointer to the SSI device tree node
diff --git a/sound/soc/fsl/fsl_utils.h b/sound/soc/fsl/fsl_utils.h
index 44d1436..b295112 100644
--- a/sound/soc/fsl/fsl_utils.h
+++ b/sound/soc/fsl/fsl_utils.h
@@ -18,7 +18,6 @@
 struct snd_soc_dai_link;
 struct device_node;
 
-int fsl_asoc_get_codec_dev_name(struct device_node *np, char *buf, size_t len);
 int fsl_asoc_get_dma_channel(struct device_node *ssi_np, const char *name,
 			     struct snd_soc_dai_link *dai,
 			     unsigned int *dma_channel_id,
diff --git a/sound/soc/fsl/mpc8610_hpcd.c b/sound/soc/fsl/mpc8610_hpcd.c
index 4195182..8fdc430 100644
--- a/sound/soc/fsl/mpc8610_hpcd.c
+++ b/sound/soc/fsl/mpc8610_hpcd.c
@@ -41,7 +41,6 @@ struct mpc8610_hpcd_data {
 	unsigned int dma_id[2];		/* 0 = DMA1, 1 = DMA2, etc */
 	unsigned int dma_channel_id[2]; /* 0 = ch 0, 1 = ch 1, etc*/
 	char codec_dai_name[DAI_NAME_SIZE];
-	char codec_name[DAI_NAME_SIZE];
 	char platform_name[2][DAI_NAME_SIZE]; /* One for each DMA channel */
 };
 
@@ -215,16 +214,8 @@ static int mpc8610_hpcd_probe(struct platform_device *pdev)
 	machine_data->dai[0].cpu_dai_name = dev_name(&ssi_pdev->dev);
 	machine_data->dai[0].ops = &mpc8610_hpcd_ops;
 
-	/* Determine the codec name, it will be used as the codec DAI name */
-	ret = fsl_asoc_get_codec_dev_name(codec_np, machine_data->codec_name,
-					  DAI_NAME_SIZE);
-	if (ret) {
-		dev_err(&pdev->dev, "invalid codec node %s\n",
-			codec_np->full_name);
-		ret = -EINVAL;
-		goto error;
-	}
-	machine_data->dai[0].codec_name = machine_data->codec_name;
+	/* ASoC core can match codec with device node */
+	machine_data->dai[0].codec_of_node = codec_np;
 
 	/* The DAI name from the codec (snd_soc_dai_driver.name) */
 	machine_data->dai[0].codec_dai_name = "cs4270-hifi";
diff --git a/sound/soc/fsl/p1022_ds.c b/sound/soc/fsl/p1022_ds.c
index e3680ce..0f42f31 100644
--- a/sound/soc/fsl/p1022_ds.c
+++ b/sound/soc/fsl/p1022_ds.c
@@ -73,7 +73,6 @@ struct machine_data {
 	unsigned int ssi_id;		/* 0 = SSI1, 1 = SSI2, etc */
 	unsigned int dma_id[2];		/* 0 = DMA1, 1 = DMA2, etc */
 	unsigned int dma_channel_id[2]; /* 0 = ch 0, 1 = ch 1, etc*/
-	char codec_name[DAI_NAME_SIZE];
 	char platform_name[2][DAI_NAME_SIZE]; /* One for each DMA channel */
 };
 
@@ -225,16 +224,8 @@ static int p1022_ds_probe(struct platform_device *pdev)
 	mdata->dai[0].cpu_dai_name = dev_name(&ssi_pdev->dev);
 	mdata->dai[0].ops = &p1022_ds_ops;
 
-	/* Determine the codec name, it will be used as the codec DAI name */
-	ret = fsl_asoc_get_codec_dev_name(codec_np, mdata->codec_name,
-					  DAI_NAME_SIZE);
-	if (ret) {
-		dev_err(&pdev->dev, "invalid codec node %s\n",
-			codec_np->full_name);
-		ret = -EINVAL;
-		goto error;
-	}
-	mdata->dai[0].codec_name = mdata->codec_name;
+	/* ASoC core can match codec with device node */
+	mdata->dai[0].codec_of_node = codec_np;
 
 	/* We register two DAIs per SSI, one for playback and the other for
 	 * capture.  We support codecs that have separate DAIs for both playback
-- 
1.7.5.4

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

* [PATCH v5 6/8] ASoC: fsl: make fsl_ssi driver compilable on ARM/IMX
  2012-03-16  8:56 [PATCH v5] ASoC: add imx-sgtl5000 machine driver working with fsl_ssi Shawn Guo
                   ` (4 preceding siblings ...)
  2012-03-16  8:56 ` [PATCH v5 5/8] ASoC: fsl: remove helper fsl_asoc_get_codec_dev_name Shawn Guo
@ 2012-03-16  8:56 ` Shawn Guo
  2012-03-16  8:56 ` [PATCH v5 7/8] ASoC: fsl: let fsl_ssi work with imx pcm and machine drivers Shawn Guo
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 22+ messages in thread
From: Shawn Guo @ 2012-03-16  8:56 UTC (permalink / raw)
  To: linux-arm-kernel

Provide different pair of accessors for accessing SSI registers on
PowerPC and ARM/IMX, so that fsl_ssi driver can be built on both
architectures.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 sound/soc/fsl/fsl_ssi.c |   64 ++++++++++++++++++++++++++++++----------------
 1 files changed, 42 insertions(+), 22 deletions(-)

diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
index 2eb407f..db9a734 100644
--- a/sound/soc/fsl/fsl_ssi.c
+++ b/sound/soc/fsl/fsl_ssi.c
@@ -11,11 +11,14 @@
  */
 
 #include <linux/init.h>
+#include <linux/io.h>
 #include <linux/module.h>
 #include <linux/interrupt.h>
 #include <linux/device.h>
 #include <linux/delay.h>
 #include <linux/slab.h>
+#include <linux/of_address.h>
+#include <linux/of_irq.h>
 #include <linux/of_platform.h>
 
 #include <sound/core.h>
@@ -26,6 +29,25 @@
 
 #include "fsl_ssi.h"
 
+#ifdef PPC
+#define read_ssi(addr)			 in_be32(addr)
+#define write_ssi(val, addr)		 out_be32(addr, val)
+#define write_ssi_mask(addr, clear, set) clrsetbits_be32(addr, clear, set)
+#elif defined ARM
+#define read_ssi(addr)			 readl(addr)
+#define write_ssi(val, addr)		 writel(val, addr)
+/*
+ * FIXME: Proper locking should be added at write_ssi_mask caller level
+ * to ensure this register read/modify/write sequence is race free.
+ */
+static inline void write_ssi_mask(u32 __iomem *addr, u32 clear, u32 set)
+{
+	u32 val = readl(addr);
+	val = (val & ~clear) | set;
+	writel(val, addr);
+}
+#endif
+
 /**
  * FSLSSI_I2S_RATES: sample rates supported by the I2S
  *
@@ -145,7 +167,7 @@ static irqreturn_t fsl_ssi_isr(int irq, void *dev_id)
 	   were interrupted for.  We mask it with the Interrupt Enable register
 	   so that we only check for events that we're interested in.
 	 */
-	sisr = in_be32(&ssi->sisr) & SIER_FLAGS;
+	sisr = read_ssi(&ssi->sisr) & SIER_FLAGS;
 
 	if (sisr & CCSR_SSI_SISR_RFRC) {
 		ssi_private->stats.rfrc++;
@@ -260,7 +282,7 @@ static irqreturn_t fsl_ssi_isr(int irq, void *dev_id)
 
 	/* Clear the bits that we set */
 	if (sisr2)
-		out_be32(&ssi->sisr, sisr2);
+		write_ssi(sisr2, &ssi->sisr);
 
 	return ret;
 }
@@ -295,7 +317,7 @@ static int fsl_ssi_startup(struct snd_pcm_substream *substream,
 		 * SSI needs to be disabled before updating the registers we set
 		 * here.
 		 */
-		clrbits32(&ssi->scr, CCSR_SSI_SCR_SSIEN);
+		write_ssi_mask(&ssi->scr, CCSR_SSI_SCR_SSIEN, 0);
 
 		/*
 		 * Program the SSI into I2S Slave Non-Network Synchronous mode.
@@ -303,20 +325,18 @@ static int fsl_ssi_startup(struct snd_pcm_substream *substream,
 		 *
 		 * FIXME: Little-endian samples require a different shift dir
 		 */
-		clrsetbits_be32(&ssi->scr,
+		write_ssi_mask(&ssi->scr,
 			CCSR_SSI_SCR_I2S_MODE_MASK | CCSR_SSI_SCR_SYN,
 			CCSR_SSI_SCR_TFR_CLK_DIS | CCSR_SSI_SCR_I2S_MODE_SLAVE
 			| (synchronous ? CCSR_SSI_SCR_SYN : 0));
 
-		out_be32(&ssi->stcr,
-			 CCSR_SSI_STCR_TXBIT0 | CCSR_SSI_STCR_TFEN0 |
+		write_ssi(CCSR_SSI_STCR_TXBIT0 | CCSR_SSI_STCR_TFEN0 |
 			 CCSR_SSI_STCR_TFSI | CCSR_SSI_STCR_TEFS |
-			 CCSR_SSI_STCR_TSCKP);
+			 CCSR_SSI_STCR_TSCKP, &ssi->stcr);
 
-		out_be32(&ssi->srcr,
-			 CCSR_SSI_SRCR_RXBIT0 | CCSR_SSI_SRCR_RFEN0 |
+		write_ssi(CCSR_SSI_SRCR_RXBIT0 | CCSR_SSI_SRCR_RFEN0 |
 			 CCSR_SSI_SRCR_RFSI | CCSR_SSI_SRCR_REFS |
-			 CCSR_SSI_SRCR_RSCKP);
+			 CCSR_SSI_SRCR_RSCKP, &ssi->srcr);
 
 		/*
 		 * The DC and PM bits are only used if the SSI is the clock
@@ -324,7 +344,7 @@ static int fsl_ssi_startup(struct snd_pcm_substream *substream,
 		 */
 
 		/* Enable the interrupts and DMA requests */
-		out_be32(&ssi->sier, SIER_FLAGS);
+		write_ssi(SIER_FLAGS, &ssi->sier);
 
 		/*
 		 * Set the watermark for transmit FIFI 0 and receive FIFO 0. We
@@ -339,9 +359,9 @@ static int fsl_ssi_startup(struct snd_pcm_substream *substream,
 		 * make this value larger (and maybe we should), but this way
 		 * data will be written to memory as soon as it's available.
 		 */
-		out_be32(&ssi->sfcsr,
-			CCSR_SSI_SFCSR_TFWM0(ssi_private->fifo_depth - 2) |
-			CCSR_SSI_SFCSR_RFWM0(ssi_private->fifo_depth - 2));
+		write_ssi(CCSR_SSI_SFCSR_TFWM0(ssi_private->fifo_depth - 2) |
+			CCSR_SSI_SFCSR_RFWM0(ssi_private->fifo_depth - 2),
+			&ssi->sfcsr);
 
 		/*
 		 * We keep the SSI disabled because if we enable it, then the
@@ -417,7 +437,7 @@ static int fsl_ssi_hw_params(struct snd_pcm_substream *substream,
 	unsigned int sample_size =
 		snd_pcm_format_width(params_format(hw_params));
 	u32 wl = CCSR_SSI_SxCCR_WL(sample_size);
-	int enabled = in_be32(&ssi->scr) & CCSR_SSI_SCR_SSIEN;
+	int enabled = read_ssi(&ssi->scr) & CCSR_SSI_SCR_SSIEN;
 
 	/*
 	 * If we're in synchronous mode, and the SSI is already enabled,
@@ -439,9 +459,9 @@ static int fsl_ssi_hw_params(struct snd_pcm_substream *substream,
 	/* In synchronous mode, the SSI uses STCCR for capture */
 	if ((substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ||
 	    ssi_private->cpu_dai_drv.symmetric_rates)
-		clrsetbits_be32(&ssi->stccr, CCSR_SSI_SxCCR_WL_MASK, wl);
+		write_ssi_mask(&ssi->stccr, CCSR_SSI_SxCCR_WL_MASK, wl);
 	else
-		clrsetbits_be32(&ssi->srccr, CCSR_SSI_SxCCR_WL_MASK, wl);
+		write_ssi_mask(&ssi->srccr, CCSR_SSI_SxCCR_WL_MASK, wl);
 
 	return 0;
 }
@@ -466,19 +486,19 @@ static int fsl_ssi_trigger(struct snd_pcm_substream *substream, int cmd,
 	case SNDRV_PCM_TRIGGER_START:
 	case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
 		if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
-			setbits32(&ssi->scr,
+			write_ssi_mask(&ssi->scr, 0,
 				CCSR_SSI_SCR_SSIEN | CCSR_SSI_SCR_TE);
 		else
-			setbits32(&ssi->scr,
+			write_ssi_mask(&ssi->scr, 0,
 				CCSR_SSI_SCR_SSIEN | CCSR_SSI_SCR_RE);
 		break;
 
 	case SNDRV_PCM_TRIGGER_STOP:
 	case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
 		if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
-			clrbits32(&ssi->scr, CCSR_SSI_SCR_TE);
+			write_ssi_mask(&ssi->scr, CCSR_SSI_SCR_TE, 0);
 		else
-			clrbits32(&ssi->scr, CCSR_SSI_SCR_RE);
+			write_ssi_mask(&ssi->scr, CCSR_SSI_SCR_RE, 0);
 		break;
 
 	default:
@@ -510,7 +530,7 @@ static void fsl_ssi_shutdown(struct snd_pcm_substream *substream,
 	if (!ssi_private->first_stream) {
 		struct ccsr_ssi __iomem *ssi = ssi_private->ssi;
 
-		clrbits32(&ssi->scr, CCSR_SSI_SCR_SSIEN);
+		write_ssi_mask(&ssi->scr, CCSR_SSI_SCR_SSIEN, 0);
 	}
 }
 
-- 
1.7.5.4

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

* [PATCH v5 7/8] ASoC: fsl: let fsl_ssi work with imx pcm and machine drivers
  2012-03-16  8:56 [PATCH v5] ASoC: add imx-sgtl5000 machine driver working with fsl_ssi Shawn Guo
                   ` (5 preceding siblings ...)
  2012-03-16  8:56 ` [PATCH v5 6/8] ASoC: fsl: make fsl_ssi driver compilable on ARM/IMX Shawn Guo
@ 2012-03-16  8:56 ` Shawn Guo
  2012-03-16  8:56 ` [PATCH v5 8/8] ASoC: fsl: add imx-sgtl5000 machine driver Shawn Guo
  2012-03-16 21:25 ` [PATCH v5] ASoC: add imx-sgtl5000 machine driver working with fsl_ssi Timur Tabi
  8 siblings, 0 replies; 22+ messages in thread
From: Shawn Guo @ 2012-03-16  8:56 UTC (permalink / raw)
  To: linux-arm-kernel

Makes necessary changes on fsl_ssi to let it work with imx pcm and
machine drivers.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 sound/soc/fsl/fsl_ssi.c |   77 ++++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 70 insertions(+), 7 deletions(-)

diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
index db9a734..30ff605 100644
--- a/sound/soc/fsl/fsl_ssi.c
+++ b/sound/soc/fsl/fsl_ssi.c
@@ -28,6 +28,7 @@
 #include <sound/soc.h>
 
 #include "fsl_ssi.h"
+#include "imx-pcm.h"
 
 #ifdef PPC
 #define read_ssi(addr)			 in_be32(addr)
@@ -116,6 +117,12 @@ struct fsl_ssi_private {
 	struct device_attribute dev_attr;
 	struct platform_device *pdev;
 
+	bool new_binding;
+	bool ssi_on_imx;
+	struct platform_device *imx_pcm_pdev;
+	struct imx_pcm_dma_params dma_params_tx;
+	struct imx_pcm_dma_params dma_params_rx;
+
 	struct {
 		unsigned int rfrc;
 		unsigned int tfrc;
@@ -413,6 +420,12 @@ static int fsl_ssi_startup(struct snd_pcm_substream *substream,
 		ssi_private->second_stream = substream;
 	}
 
+	if (ssi_private->ssi_on_imx)
+		snd_soc_dai_set_dma_data(dai, substream,
+			(substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ?
+				&ssi_private->dma_params_tx :
+				&ssi_private->dma_params_rx);
+
 	return 0;
 }
 
@@ -642,12 +655,6 @@ static int __devinit fsl_ssi_probe(struct platform_device *pdev)
 	if (!of_device_is_available(np))
 		return -ENODEV;
 
-	/* Check for a codec-handle property. */
-	if (!of_get_property(np, "codec-handle", NULL)) {
-		dev_err(&pdev->dev, "missing codec-handle property\n");
-		return -ENODEV;
-	}
-
 	/* We only support the SSI in "I2S Slave" mode */
 	sprop = of_get_property(np, "fsl,mode", NULL);
 	if (!sprop || strcmp(sprop, "i2s-slave")) {
@@ -712,6 +719,35 @@ static int __devinit fsl_ssi_probe(struct platform_device *pdev)
                 /* Older 8610 DTs didn't have the fifo-depth property */
 		ssi_private->fifo_depth = 8;
 
+	if (of_device_is_compatible(pdev->dev.of_node, "fsl,imx21-ssi")) {
+		u32 dma_events[2];
+		ssi_private->ssi_on_imx = true;
+		/*
+		 * We have burstsize be "fifo_depth - 2" to match the SSI
+		 * watermark setting in fsl_ssi_startup().
+		 */
+		ssi_private->dma_params_tx.burstsize =
+			ssi_private->fifo_depth - 2;
+		ssi_private->dma_params_rx.burstsize =
+			ssi_private->fifo_depth - 2;
+		ssi_private->dma_params_tx.dma_addr =
+			ssi_private->ssi_phys + offsetof(struct ccsr_ssi, stx0);
+		ssi_private->dma_params_rx.dma_addr =
+			ssi_private->ssi_phys + offsetof(struct ccsr_ssi, srx0);
+		/*
+		 * TODO: This is a temporary solution and should be changed
+		 * to use generic DMA binding later when the helplers get in.
+		 */
+		ret = of_property_read_u32_array(pdev->dev.of_node,
+					"fsl,ssi-dma-events", dma_events, 2);
+		if (ret) {
+			dev_err(&pdev->dev, "could not get dma events\n");
+			goto error_irq;
+		}
+		ssi_private->dma_params_tx.dma = dma_events[0];
+		ssi_private->dma_params_rx.dma = dma_events[1];
+	}
+
 	/* Initialize the the device_attribute structure */
 	dev_attr = &ssi_private->dev_attr;
 	sysfs_attr_init(&dev_attr->attr);
@@ -735,6 +771,26 @@ static int __devinit fsl_ssi_probe(struct platform_device *pdev)
 		goto error_dev;
 	}
 
+	if (ssi_private->ssi_on_imx) {
+		ssi_private->imx_pcm_pdev =
+			platform_device_register_simple("imx-pcm-audio",
+							-1, NULL, 0);
+		if (IS_ERR(ssi_private->imx_pcm_pdev)) {
+			ret = PTR_ERR(ssi_private->imx_pcm_pdev);
+			goto error_dev;
+		}
+	}
+
+	/*
+	 * If codec-handle property is missing from SSI node, we assume
+	 * that the machine driver uses new binding which does not require
+	 * SSI driver to trigger machine driver's probe.
+	 */
+	if (!of_get_property(np, "codec-handle", NULL)) {
+		ssi_private->new_binding = true;
+		goto done;
+	}
+
 	/* Trigger the machine driver's probe function.  The platform driver
 	 * name of the machine driver is taken from /compatible property of the
 	 * device tree.  We also pass the address of the CPU DAI driver
@@ -756,9 +812,12 @@ static int __devinit fsl_ssi_probe(struct platform_device *pdev)
 		goto error_dai;
 	}
 
+done:
 	return 0;
 
 error_dai:
+	if (ssi_private->ssi_on_imx)
+		platform_device_unregister(ssi_private->imx_pcm_pdev);
 	snd_soc_unregister_dai(&pdev->dev);
 
 error_dev:
@@ -784,7 +843,10 @@ static int fsl_ssi_remove(struct platform_device *pdev)
 {
 	struct fsl_ssi_private *ssi_private = dev_get_drvdata(&pdev->dev);
 
-	platform_device_unregister(ssi_private->pdev);
+	if (!ssi_private->new_binding)
+		platform_device_unregister(ssi_private->pdev);
+	if (ssi_private->ssi_on_imx)
+		platform_device_unregister(ssi_private->imx_pcm_pdev);
 	snd_soc_unregister_dai(&pdev->dev);
 	device_remove_file(&pdev->dev, &ssi_private->dev_attr);
 
@@ -799,6 +861,7 @@ static int fsl_ssi_remove(struct platform_device *pdev)
 
 static const struct of_device_id fsl_ssi_ids[] = {
 	{ .compatible = "fsl,mpc8610-ssi", },
+	{ .compatible = "fsl,imx21-ssi", },
 	{}
 };
 MODULE_DEVICE_TABLE(of, fsl_ssi_ids);
-- 
1.7.5.4

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

* [PATCH v5 8/8] ASoC: fsl: add imx-sgtl5000 machine driver
  2012-03-16  8:56 [PATCH v5] ASoC: add imx-sgtl5000 machine driver working with fsl_ssi Shawn Guo
                   ` (6 preceding siblings ...)
  2012-03-16  8:56 ` [PATCH v5 7/8] ASoC: fsl: let fsl_ssi work with imx pcm and machine drivers Shawn Guo
@ 2012-03-16  8:56 ` Shawn Guo
  2012-03-16 10:16   ` [alsa-devel] " Trent Piepho
  2012-03-16 21:25 ` [PATCH v5] ASoC: add imx-sgtl5000 machine driver working with fsl_ssi Timur Tabi
  8 siblings, 1 reply; 22+ messages in thread
From: Shawn Guo @ 2012-03-16  8:56 UTC (permalink / raw)
  To: linux-arm-kernel

This is the initial imx-sgtl5000 machine driver support with only
playback dai link implemented.  More features can be added on top
of it later.

It's a device tree only machine driver working with fsl_ssi driver.

Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 .../bindings/sound/imx-audio-sgtl5000.txt          |   24 +++
 sound/soc/fsl/Kconfig                              |   12 ++
 sound/soc/fsl/Makefile                             |    2 +
 sound/soc/fsl/imx-sgtl5000.c                       |  177 ++++++++++++++++++++
 4 files changed, 215 insertions(+), 0 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/sound/imx-audio-sgtl5000.txt
 create mode 100644 sound/soc/fsl/imx-sgtl5000.c

diff --git a/Documentation/devicetree/bindings/sound/imx-audio-sgtl5000.txt b/Documentation/devicetree/bindings/sound/imx-audio-sgtl5000.txt
new file mode 100644
index 0000000..421a374
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/imx-audio-sgtl5000.txt
@@ -0,0 +1,24 @@
+Freescale i.MX audio complex with SGTL5000 codec
+
+Required properties:
+- compatible : "fsl,imx-audio-sgtl5000"
+- model : The user-visible name of this sound complex
+- ssi-controller : The phandle of the i.MX SSI controller
+- audio-codec : The phandle of the SGTL5000 audio codec
+- mux-int-port : The internal port of the i.MX audio muxer (AUDMUX)
+- mux-ext-port : The external port of the i.MX audio muxer
+
+Note: The AUDMUX port numbering should start at 1, which is consistent with
+hardware manual.
+
+Example:
+
+sound {
+	compatible = "fsl,imx51-babbage-sgtl5000",
+		     "fsl,imx-audio-sgtl5000";
+	model = "imx51-babbage-sgtl5000";
+	ssi-controller = <&ssi1>;
+	audio-codec = <&sgtl5000>;
+	mux-int-port = <1>;
+	mux-ext-port = <3>;
+};
diff --git a/sound/soc/fsl/Kconfig b/sound/soc/fsl/Kconfig
index 535ee73..aa14fc9 100644
--- a/sound/soc/fsl/Kconfig
+++ b/sound/soc/fsl/Kconfig
@@ -164,4 +164,16 @@ config SND_SOC_EUKREA_TLV320
 	  Enable I2S based access to the TLV320AIC23B codec attached
 	  to the SSI interface
 
+config SND_SOC_IMX_SGTL5000
+	tristate "SoC Audio support for i.MX boards with sgtl5000"
+	depends on OF && I2C
+	select SND_SOC_SGTL5000
+	select SND_SOC_IMX_PCM_DMA
+	select SND_SOC_IMX_AUDMUX
+	select SND_SOC_FSL_SSI
+	select SND_SOC_FSL_UTILS
+	help
+	  Say Y if you want to add support for SoC audio on an i.MX board with
+	  a sgtl5000 codec.
+
 endif # SND_IMX_SOC
diff --git a/sound/soc/fsl/Makefile b/sound/soc/fsl/Makefile
index fbdbed0..638d385 100644
--- a/sound/soc/fsl/Makefile
+++ b/sound/soc/fsl/Makefile
@@ -40,8 +40,10 @@ snd-soc-eukrea-tlv320-objs := eukrea-tlv320.o
 snd-soc-phycore-ac97-objs := phycore-ac97.o
 snd-soc-mx27vis-aic32x4-objs := mx27vis-aic32x4.o
 snd-soc-wm1133-ev1-objs := wm1133-ev1.o
+snd-soc-imx-sgtl5000-objs := imx-sgtl5000.o
 
 obj-$(CONFIG_SND_SOC_EUKREA_TLV320) += snd-soc-eukrea-tlv320.o
 obj-$(CONFIG_SND_SOC_PHYCORE_AC97) += snd-soc-phycore-ac97.o
 obj-$(CONFIG_SND_SOC_MX27VIS_AIC32X4) += snd-soc-mx27vis-aic32x4.o
 obj-$(CONFIG_SND_MXC_SOC_WM1133_EV1) += snd-soc-wm1133-ev1.o
+obj-$(CONFIG_SND_SOC_IMX_SGTL5000) += snd-soc-imx-sgtl5000.o
diff --git a/sound/soc/fsl/imx-sgtl5000.c b/sound/soc/fsl/imx-sgtl5000.c
new file mode 100644
index 0000000..3786b61
--- /dev/null
+++ b/sound/soc/fsl/imx-sgtl5000.c
@@ -0,0 +1,177 @@
+/*
+ * Copyright 2012 Freescale Semiconductor, Inc.
+ * Copyright 2012 Linaro Ltd.
+ *
+ * The code contained herein is licensed under the GNU General Public
+ * License. You may obtain a copy of the GNU General Public License
+ * Version 2 or later at the following locations:
+ *
+ * http://www.opensource.org/licenses/gpl-license.html
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/of_platform.h>
+#include <sound/soc.h>
+
+#include "../codecs/sgtl5000.h"
+#include "imx-audmux.h"
+
+#define DAI_NAME_SIZE	32
+
+struct imx_sgtl5000_data {
+	struct snd_soc_dai_link dai;
+	struct snd_soc_card card;
+	char codec_dai_name[DAI_NAME_SIZE];
+	char platform_name[DAI_NAME_SIZE];
+	unsigned int clk_frequency;
+};
+
+static int imx_sgtl5000_dai_init(struct snd_soc_pcm_runtime *rtd)
+{
+	struct imx_sgtl5000_data *data = container_of(rtd->card,
+					struct imx_sgtl5000_data, card);
+	struct device *dev = rtd->card->dev;
+	int ret;
+
+	ret = snd_soc_dai_set_sysclk(rtd->codec_dai, SGTL5000_SYSCLK,
+				     data->clk_frequency, SND_SOC_CLOCK_IN);
+	if (ret) {
+		dev_err(dev, "could not set codec driver clock params\n");
+		return ret;
+	}
+
+	return 0;
+}
+
+static int __devinit imx_sgtl5000_probe(struct platform_device *pdev)
+{
+	struct device_node *np = pdev->dev.of_node;
+	struct device_node *ssi_np, *codec_np;
+	struct platform_device *ssi_pdev;
+	struct imx_sgtl5000_data *data;
+	int int_port, ext_port;
+	int ret;
+
+	ret = of_property_read_u32(np, "mux-int-port", &int_port);
+	if (ret) {
+		dev_err(&pdev->dev, "mux-int-port missing or invalid\n");
+		return ret;
+	}
+	ret = of_property_read_u32(np, "mux-ext-port", &ext_port);
+	if (ret) {
+		dev_err(&pdev->dev, "mux-ext-port missing or invalid\n");
+		return ret;
+	}
+
+	/*
+	 * The port numbering in the hardware manual starts at 1, while
+	 * the audmux API expects it starts at 0.
+	 */
+	int_port--;
+	ext_port--;
+	ret = imx_audmux_v2_configure_port(int_port,
+			IMX_AUDMUX_V2_PTCR_SYN |
+			IMX_AUDMUX_V2_PTCR_TFSEL(ext_port) |
+			IMX_AUDMUX_V2_PTCR_TCSEL(ext_port) |
+			IMX_AUDMUX_V2_PTCR_TFSDIR |
+			IMX_AUDMUX_V2_PTCR_TCLKDIR,
+			IMX_AUDMUX_V2_PDCR_RXDSEL(ext_port));
+	if (ret) {
+		dev_err(&pdev->dev, "audmux internal port setup failed\n");
+		return ret;
+	}
+	imx_audmux_v2_configure_port(ext_port,
+			IMX_AUDMUX_V2_PTCR_SYN |
+			IMX_AUDMUX_V2_PTCR_TCSEL(int_port),
+			IMX_AUDMUX_V2_PDCR_RXDSEL(int_port));
+	if (ret) {
+		dev_err(&pdev->dev, "audmux external port setup failed\n");
+		return ret;
+	}
+
+	ssi_np = of_parse_phandle(pdev->dev.of_node, "ssi-controller", 0);
+	codec_np = of_parse_phandle(pdev->dev.of_node, "audio-codec", 0);
+	if (!ssi_np || !codec_np) {
+		dev_err(&pdev->dev, "phandle missing or invalid\n");
+		return -EINVAL;
+	}
+
+	ssi_pdev = of_find_device_by_node(ssi_np);
+	if (!ssi_pdev) {
+		dev_err(&pdev->dev, "failed to find SSI platform device\n");
+		return -EINVAL;
+	}
+
+	data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
+	if (!data)
+		return -ENOMEM;
+
+	ret = of_property_read_u32(codec_np, "clock-frequency",
+				   &data->clk_frequency);
+	if (ret) {
+		dev_err(&pdev->dev, "clock-frequency missing or invalid\n");
+		return ret;
+	}
+
+	data->dai.name = "HiFi";
+	data->dai.stream_name = "HiFi";
+	data->dai.codec_dai_name = "sgtl5000";
+	data->dai.codec_of_node = codec_np;
+	data->dai.cpu_dai_name = dev_name(&ssi_pdev->dev);
+	data->dai.platform_name = "imx-pcm-audio";
+	data->dai.init = &imx_sgtl5000_dai_init;
+	data->dai.dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
+			    SND_SOC_DAIFMT_CBM_CFM;
+
+	data->card.dev = &pdev->dev;
+	ret = snd_soc_of_parse_card_name(&data->card, "model");
+	if (ret)
+		return ret;
+	data->card.num_links = 1;
+	data->card.dai_link = &data->dai;
+
+	ret = snd_soc_register_card(&data->card);
+	if (ret) {
+		dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", ret);
+		return ret;
+	}
+
+	platform_set_drvdata(pdev, data);
+	of_node_put(ssi_np);
+	of_node_put(codec_np);
+
+	return 0;
+}
+
+static int __devexit imx_sgtl5000_remove(struct platform_device *pdev)
+{
+	struct imx_sgtl5000_data *data = platform_get_drvdata(pdev);
+
+	snd_soc_unregister_card(&data->card);
+
+	return 0;
+}
+
+static const struct of_device_id imx_sgtl5000_dt_ids[] = {
+	{ .compatible = "fsl,imx-audio-sgtl5000", },
+	{ /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, imx_sgtl5000_dt_ids);
+
+static struct platform_driver imx_sgtl5000_driver = {
+	.driver = {
+		.name = "imx-sgtl5000",
+		.owner = THIS_MODULE,
+		.of_match_table = imx_sgtl5000_dt_ids,
+	},
+	.probe = imx_sgtl5000_probe,
+	.remove = __devexit_p(imx_sgtl5000_remove),
+};
+module_platform_driver(imx_sgtl5000_driver);
+
+MODULE_AUTHOR("Shawn Guo <shawn.guo@linaro.org>");
+MODULE_DESCRIPTION("Freescale i.MX SGTL5000 ASoC machine driver");
+MODULE_LICENSE("GPL v2");
+MODULE_ALIAS("platform:imx-sgtl5000");
-- 
1.7.5.4

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

* [alsa-devel] [PATCH v5 8/8] ASoC: fsl: add imx-sgtl5000 machine driver
  2012-03-16  8:56 ` [PATCH v5 8/8] ASoC: fsl: add imx-sgtl5000 machine driver Shawn Guo
@ 2012-03-16 10:16   ` Trent Piepho
  2012-03-16 11:18     ` Shawn Guo
  0 siblings, 1 reply; 22+ messages in thread
From: Trent Piepho @ 2012-03-16 10:16 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Mar 16, 2012 at 4:56 AM, Shawn Guo <shawn.guo@linaro.org> wrote:
> +Required properties:
> +- compatible : "fsl,imx-audio-sgtl5000"
> +- model : The user-visible name of this sound complex
> +- ssi-controller : The phandle of the i.MX SSI controller
> +- audio-codec : The phandle of the SGTL5000 audio codec
> +- mux-int-port : The internal port of the i.MX audio muxer (AUDMUX)
> +- mux-ext-port : The external port of the i.MX audio muxer
> +
> +Note: The AUDMUX port numbering should start at 1, which is consistent with
> +hardware manual.
> +
> +Example:
> +
> +sound {
> + ? ? ? compatible = "fsl,imx51-babbage-sgtl5000",
> + ? ? ? ? ? ? ? ? ? ?"fsl,imx-audio-sgtl5000";
> + ? ? ? model = "imx51-babbage-sgtl5000";
> + ? ? ? ssi-controller = <&ssi1>;
> + ? ? ? audio-codec = <&sgtl5000>;
> + ? ? ? mux-int-port = <1>;
> + ? ? ? mux-ext-port = <3>;
> +};

What would the device node look like for the ESAI controller?  I've
got a board here based on an iMX53 with two of three SSI controllers
and the ESAI controller in use.  It used the nullcodec codec driver
for SSI and ESAI.  The ESAI driver was since replaced with an entirely
new custom driver that doesn't use ASoC at all.  But ignoring that
detail, what would the sound node(s) look like for some hardware that
isn't so simple?  It seems like there would be three sound nodes, but
what would compatible and model be set to?  I'm having a hard time
seeing how "fsl,imx-audio-sgtl5000" would be changed into something
for either SSI or ESAI.

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

* [alsa-devel] [PATCH v5 8/8] ASoC: fsl: add imx-sgtl5000 machine driver
  2012-03-16 10:16   ` [alsa-devel] " Trent Piepho
@ 2012-03-16 11:18     ` Shawn Guo
  2012-03-16 19:21       ` Mark Brown
  0 siblings, 1 reply; 22+ messages in thread
From: Shawn Guo @ 2012-03-16 11:18 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Mar 16, 2012 at 06:16:13AM -0400, Trent Piepho wrote:
> On Fri, Mar 16, 2012 at 4:56 AM, Shawn Guo <shawn.guo@linaro.org> wrote:
> > +Required properties:
> > +- compatible : "fsl,imx-audio-sgtl5000"
> > +- model : The user-visible name of this sound complex
> > +- ssi-controller : The phandle of the i.MX SSI controller
> > +- audio-codec : The phandle of the SGTL5000 audio codec
> > +- mux-int-port : The internal port of the i.MX audio muxer (AUDMUX)
> > +- mux-ext-port : The external port of the i.MX audio muxer
> > +
> > +Note: The AUDMUX port numbering should start at 1, which is consistent with
> > +hardware manual.
> > +
> > +Example:
> > +
> > +sound {
> > + ? ? ? compatible = "fsl,imx51-babbage-sgtl5000",
> > + ? ? ? ? ? ? ? ? ? ?"fsl,imx-audio-sgtl5000";
> > + ? ? ? model = "imx51-babbage-sgtl5000";
> > + ? ? ? ssi-controller = <&ssi1>;
> > + ? ? ? audio-codec = <&sgtl5000>;
> > + ? ? ? mux-int-port = <1>;
> > + ? ? ? mux-ext-port = <3>;
> > +};
> 
> What would the device node look like for the ESAI controller?  I've
> got a board here based on an iMX53 with two of three SSI controllers
> and the ESAI controller in use.  It used the nullcodec codec driver
> for SSI and ESAI.  The ESAI driver was since replaced with an entirely
> new custom driver that doesn't use ASoC at all.  But ignoring that
> detail, what would the sound node(s) look like for some hardware that
> isn't so simple?  It seems like there would be three sound nodes, but
> what would compatible and model be set to?  I'm having a hard time
> seeing how "fsl,imx-audio-sgtl5000" would be changed into something
> for either SSI or ESAI.

Maybe having "fsl,imx-audio-xxx" for machine drivers backed by SSI,
and "fsl,imx-esai-audio-xxx" for the ones backed by ESAI?

-- 
Regards,
Shawn

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

* [alsa-devel] [PATCH v5 8/8] ASoC: fsl: add imx-sgtl5000 machine driver
  2012-03-16 11:18     ` Shawn Guo
@ 2012-03-16 19:21       ` Mark Brown
  2012-03-16 21:28         ` Trent Piepho
  0 siblings, 1 reply; 22+ messages in thread
From: Mark Brown @ 2012-03-16 19:21 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Mar 16, 2012 at 07:18:18PM +0800, Shawn Guo wrote:

> Maybe having "fsl,imx-audio-xxx" for machine drivers backed by SSI,
> and "fsl,imx-esai-audio-xxx" for the ones backed by ESAI?

Alternatively if the SSI and ESAI devices are compatible enough at the
ASoC API level (or can be identified by the driver just by looking at
the DAI that's referenced without too much pain) the CPU DAI could just
be linked to either type of DAI (probably with a more generic name for
the property).

But either way works fine, and obviously you're going to end up with
more complex systems which use a completely custom binding anyway.
-------------- 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/20120316/7c12c8c2/attachment.sig>

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

* [PATCH v5 2/8] ASoC: imx: merge sound/soc/imx into sound/soc/fsl
  2012-03-16  8:56 ` [PATCH v5 2/8] ASoC: imx: merge sound/soc/imx into sound/soc/fsl Shawn Guo
@ 2012-03-16 21:21   ` Timur Tabi
  2012-03-17  0:21     ` Shawn Guo
  2012-03-27 15:06   ` Philippe Rétornaz
  1 sibling, 1 reply; 22+ messages in thread
From: Timur Tabi @ 2012-03-16 21:21 UTC (permalink / raw)
  To: linux-arm-kernel

Shawn Guo wrote:
> Freescale PowerPC and ARM/IMX families share the same SSI IP block.
> The patch merges sound/soc/imx into sound/soc/fsl, so that the possible
> code sharing and consolidation can happen.
> 
> This is a plain merge, except that menuconfig SND_POWERPC_SOC is added
> in Kconfig for PowerPC platform as a correspondence to SND_IMX_SOC for
> IMX platform.
> 
> Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
> Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
> ---

I'm okay with this patch, but you will need an Ack from Kumar Gala to
carry the defconfig portions through the ASoC tree.  Or, he might want you
to split the patch up.

>  arch/powerpc/configs/86xx/mpc8610_hpcd_defconfig |    1 +
>  arch/powerpc/configs/mpc85xx_defconfig           |    1 +
>  arch/powerpc/configs/mpc85xx_smp_defconfig       |    1 +
>  sound/soc/Kconfig                                |    1 -
>  sound/soc/Makefile                               |    1 -
>  sound/soc/fsl/Kconfig                            |   92 ++++++++++++++++++++++
>  sound/soc/fsl/Makefile                           |   22 +++++
>  sound/soc/{imx => fsl}/eukrea-tlv320.c           |    2 +-
>  sound/soc/{imx => fsl}/imx-audmux.c              |    0
>  sound/soc/{imx => fsl}/imx-audmux.h              |    0
>  sound/soc/{imx => fsl}/imx-pcm-dma-mx2.c         |    0
>  sound/soc/{imx => fsl}/imx-pcm-fiq.c             |    0
>  sound/soc/{imx => fsl}/imx-pcm.c                 |    0
>  sound/soc/{imx => fsl}/imx-pcm.h                 |    0
>  sound/soc/{imx => fsl}/imx-ssi.c                 |    2 +-
>  sound/soc/{imx => fsl}/imx-ssi.h                 |    0
>  sound/soc/{imx => fsl}/mx27vis-aic32x4.c         |    0
>  sound/soc/{imx => fsl}/phycore-ac97.c            |    0
>  sound/soc/{imx => fsl}/wm1133-ev1.c              |    0
>  sound/soc/imx/Kconfig                            |   79 -------------------
>  sound/soc/imx/Makefile                           |   22 -----
>  21 files changed, 119 insertions(+), 105 deletions(-)
>  rename sound/soc/{imx => fsl}/eukrea-tlv320.c (99%)
>  rename sound/soc/{imx => fsl}/imx-audmux.c (100%)
>  rename sound/soc/{imx => fsl}/imx-audmux.h (100%)
>  rename sound/soc/{imx => fsl}/imx-pcm-dma-mx2.c (100%)
>  rename sound/soc/{imx => fsl}/imx-pcm-fiq.c (100%)
>  rename sound/soc/{imx => fsl}/imx-pcm.c (100%)
>  rename sound/soc/{imx => fsl}/imx-pcm.h (100%)
>  rename sound/soc/{imx => fsl}/imx-ssi.c (99%)
>  rename sound/soc/{imx => fsl}/imx-ssi.h (100%)
>  rename sound/soc/{imx => fsl}/mx27vis-aic32x4.c (100%)
>  rename sound/soc/{imx => fsl}/phycore-ac97.c (100%)
>  rename sound/soc/{imx => fsl}/wm1133-ev1.c (100%)
>  delete mode 100644 sound/soc/imx/Kconfig
>  delete mode 100644 sound/soc/imx/Makefile
> 
> diff --git a/arch/powerpc/configs/86xx/mpc8610_hpcd_defconfig b/arch/powerpc/configs/86xx/mpc8610_hpcd_defconfig
> index 0db9ba0..c09598b 100644
> --- a/arch/powerpc/configs/86xx/mpc8610_hpcd_defconfig
> +++ b/arch/powerpc/configs/86xx/mpc8610_hpcd_defconfig
> @@ -100,6 +100,7 @@ CONFIG_SND_MIXER_OSS=y
>  CONFIG_SND_PCM_OSS=y
>  # CONFIG_SND_SUPPORT_OLD_API is not set
>  CONFIG_SND_SOC=y
> +CONFIG_SND_POWERPC_SOC=y
>  CONFIG_RTC_CLASS=y
>  CONFIG_RTC_DRV_CMOS=y
>  CONFIG_EXT2_FS=y
> diff --git a/arch/powerpc/configs/mpc85xx_defconfig b/arch/powerpc/configs/mpc85xx_defconfig
> index f37a2ab..44605f8 100644
> --- a/arch/powerpc/configs/mpc85xx_defconfig
> +++ b/arch/powerpc/configs/mpc85xx_defconfig
> @@ -139,6 +139,7 @@ CONFIG_SND_INTEL8X0=y
>  # CONFIG_SND_PPC is not set
>  # CONFIG_SND_USB is not set
>  CONFIG_SND_SOC=y
> +CONFIG_SND_POWERPC_SOC=y
>  CONFIG_HID_A4TECH=y
>  CONFIG_HID_APPLE=y
>  CONFIG_HID_BELKIN=y
> diff --git a/arch/powerpc/configs/mpc85xx_smp_defconfig b/arch/powerpc/configs/mpc85xx_smp_defconfig
> index abdcd31..98e227e 100644
> --- a/arch/powerpc/configs/mpc85xx_smp_defconfig
> +++ b/arch/powerpc/configs/mpc85xx_smp_defconfig
> @@ -141,6 +141,7 @@ CONFIG_SND_INTEL8X0=y
>  # CONFIG_SND_PPC is not set
>  # CONFIG_SND_USB is not set
>  CONFIG_SND_SOC=y
> +CONFIG_SND_POWERPC_SOC=y
>  CONFIG_HID_A4TECH=y
>  CONFIG_HID_APPLE=y
>  CONFIG_HID_BELKIN=y
> diff --git a/sound/soc/Kconfig b/sound/soc/Kconfig
> index 91c9855..0f85f6d 100644
> --- a/sound/soc/Kconfig
> +++ b/sound/soc/Kconfig
> @@ -35,7 +35,6 @@ source "sound/soc/blackfin/Kconfig"
>  source "sound/soc/davinci/Kconfig"
>  source "sound/soc/ep93xx/Kconfig"
>  source "sound/soc/fsl/Kconfig"
> -source "sound/soc/imx/Kconfig"
>  source "sound/soc/jz4740/Kconfig"
>  source "sound/soc/nuc900/Kconfig"
>  source "sound/soc/omap/Kconfig"
> diff --git a/sound/soc/Makefile b/sound/soc/Makefile
> index 2feaf37..363dfd6 100644
> --- a/sound/soc/Makefile
> +++ b/sound/soc/Makefile
> @@ -12,7 +12,6 @@ obj-$(CONFIG_SND_SOC)	+= blackfin/
>  obj-$(CONFIG_SND_SOC)	+= davinci/
>  obj-$(CONFIG_SND_SOC)	+= ep93xx/
>  obj-$(CONFIG_SND_SOC)	+= fsl/
> -obj-$(CONFIG_SND_SOC)   += imx/
>  obj-$(CONFIG_SND_SOC)	+= jz4740/
>  obj-$(CONFIG_SND_SOC)	+= mid-x86/
>  obj-$(CONFIG_SND_SOC)	+= mxs/
> diff --git a/sound/soc/fsl/Kconfig b/sound/soc/fsl/Kconfig
> index ca693b2..19856a0 100644
> --- a/sound/soc/fsl/Kconfig
> +++ b/sound/soc/fsl/Kconfig
> @@ -1,3 +1,15 @@
> +config SND_SOC_FSL_SSI
> +	tristate
> +
> +menuconfig SND_POWERPC_SOC
> +	tristate "SoC Audio for Freescale PowerPC CPUs"
> +	depends on FSL_SOC
> +	help
> +	  Say Y or M if you want to add support for codecs attached to
> +	  the PowerPC CPUs.
> +
> +if SND_POWERPC_SOC
> +
>  config SND_MPC52xx_DMA
>  	tristate
>  
> @@ -68,3 +80,83 @@ config SND_MPC52xx_SOC_EFIKA
>  	help
>  	  Say Y if you want to add support for sound on the Efika.
>  
> +endif # SND_POWERPC_SOC
> +
> +menuconfig SND_IMX_SOC
> +	tristate "SoC Audio for Freescale i.MX CPUs"
> +	depends on ARCH_MXC
> +	help
> +	  Say Y or M if you want to add support for codecs attached to
> +	  the i.MX CPUs.
> +
> +if SND_IMX_SOC
> +
> +config SND_SOC_IMX_SSI
> +	tristate
> +
> +config SND_SOC_IMX_PCM
> +	tristate
> +
> +config SND_MXC_SOC_FIQ
> +	tristate
> +	select FIQ
> +	select SND_SOC_IMX_PCM
> +
> +config SND_MXC_SOC_MX2
> +	tristate
> +	select SND_SOC_DMAENGINE_PCM
> +	select SND_SOC_IMX_PCM
> +
> +config SND_SOC_IMX_AUDMUX
> +	tristate
> +
> +config SND_MXC_SOC_WM1133_EV1
> +	tristate "Audio on the the i.MX31ADS with WM1133-EV1 fitted"
> +	depends on MACH_MX31ADS_WM1133_EV1 && EXPERIMENTAL
> +	select SND_SOC_WM8350
> +	select SND_MXC_SOC_FIQ
> +	select SND_SOC_IMX_AUDMUX
> +	select SND_SOC_IMX_SSI
> +	help
> +	  Enable support for audio on the i.MX31ADS with the WM1133-EV1
> +	  PMIC board with WM8835x fitted.
> +
> +config SND_SOC_MX27VIS_AIC32X4
> +	tristate "SoC audio support for Visstrim M10 boards"
> +	depends on MACH_IMX27_VISSTRIM_M10 && I2C
> +	select SND_SOC_TLV320AIC32X4
> +	select SND_MXC_SOC_MX2
> +	select SND_SOC_IMX_AUDMUX
> +	select SND_SOC_IMX_SSI
> +	help
> +	  Say Y if you want to add support for SoC audio on Visstrim SM10
> +	  board with TLV320AIC32X4 codec.
> +
> +config SND_SOC_PHYCORE_AC97
> +	tristate "SoC Audio support for Phytec phyCORE (and phyCARD) boards"
> +	depends on MACH_PCM043 || MACH_PCA100
> +	select SND_SOC_AC97_BUS
> +	select SND_SOC_WM9712
> +	select SND_MXC_SOC_FIQ
> +	select SND_SOC_IMX_AUDMUX
> +	select SND_SOC_IMX_SSI
> +	help
> +	  Say Y if you want to add support for SoC audio on Phytec phyCORE
> +	  and phyCARD boards in AC97 mode
> +
> +config SND_SOC_EUKREA_TLV320
> +	tristate "Eukrea TLV320"
> +	depends on MACH_EUKREA_MBIMX27_BASEBOARD \
> +		|| MACH_EUKREA_MBIMXSD25_BASEBOARD \
> +		|| MACH_EUKREA_MBIMXSD35_BASEBOARD \
> +		|| MACH_EUKREA_MBIMXSD51_BASEBOARD
> +	depends on I2C
> +	select SND_SOC_TLV320AIC23
> +	select SND_MXC_SOC_FIQ
> +	select SND_SOC_IMX_AUDMUX
> +	select SND_SOC_IMX_SSI
> +	help
> +	  Enable I2S based access to the TLV320AIC23B codec attached
> +	  to the SSI interface
> +
> +endif # SND_IMX_SOC
> diff --git a/sound/soc/fsl/Makefile b/sound/soc/fsl/Makefile
> index 95d483f..36c257f 100644
> --- a/sound/soc/fsl/Makefile
> +++ b/sound/soc/fsl/Makefile
> @@ -21,3 +21,25 @@ obj-$(CONFIG_SND_SOC_MPC5200_AC97) += mpc5200_psc_ac97.o
>  obj-$(CONFIG_SND_MPC52xx_SOC_PCM030) += pcm030-audio-fabric.o
>  obj-$(CONFIG_SND_MPC52xx_SOC_EFIKA) += efika-audio-fabric.o
>  
> +# i.MX Platform Support
> +snd-soc-imx-ssi-objs := imx-ssi.o
> +snd-soc-imx-audmux-objs := imx-audmux.o
> +
> +obj-$(CONFIG_SND_SOC_IMX_SSI) += snd-soc-imx-ssi.o
> +obj-$(CONFIG_SND_SOC_IMX_AUDMUX) += snd-soc-imx-audmux.o
> +
> +obj-$(CONFIG_SND_SOC_IMX_PCM) += snd-soc-imx-pcm.o
> +snd-soc-imx-pcm-y := imx-pcm.o
> +snd-soc-imx-pcm-$(CONFIG_SND_MXC_SOC_FIQ) += imx-pcm-fiq.o
> +snd-soc-imx-pcm-$(CONFIG_SND_MXC_SOC_MX2) += imx-pcm-dma-mx2.o
> +
> +# i.MX Machine Support
> +snd-soc-eukrea-tlv320-objs := eukrea-tlv320.o
> +snd-soc-phycore-ac97-objs := phycore-ac97.o
> +snd-soc-mx27vis-aic32x4-objs := mx27vis-aic32x4.o
> +snd-soc-wm1133-ev1-objs := wm1133-ev1.o
> +
> +obj-$(CONFIG_SND_SOC_EUKREA_TLV320) += snd-soc-eukrea-tlv320.o
> +obj-$(CONFIG_SND_SOC_PHYCORE_AC97) += snd-soc-phycore-ac97.o
> +obj-$(CONFIG_SND_SOC_MX27VIS_AIC32X4) += snd-soc-mx27vis-aic32x4.o
> +obj-$(CONFIG_SND_MXC_SOC_WM1133_EV1) += snd-soc-wm1133-ev1.o
> diff --git a/sound/soc/imx/eukrea-tlv320.c b/sound/soc/fsl/eukrea-tlv320.c
> similarity index 99%
> rename from sound/soc/imx/eukrea-tlv320.c
> rename to sound/soc/fsl/eukrea-tlv320.c
> index 7d4475c..efb9ede 100644
> --- a/sound/soc/imx/eukrea-tlv320.c
> +++ b/sound/soc/fsl/eukrea-tlv320.c
> @@ -7,7 +7,7 @@
>   * which is Copyright 2009 Simtec Electronics
>   * and on sound/soc/imx/phycore-ac97.c which is
>   * Copyright 2009 Sascha Hauer, Pengutronix <s.hauer@pengutronix.de>
> - * 
> + *
>   *  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;  either version 2 of the  License, or (at your
> diff --git a/sound/soc/imx/imx-audmux.c b/sound/soc/fsl/imx-audmux.c
> similarity index 100%
> rename from sound/soc/imx/imx-audmux.c
> rename to sound/soc/fsl/imx-audmux.c
> diff --git a/sound/soc/imx/imx-audmux.h b/sound/soc/fsl/imx-audmux.h
> similarity index 100%
> rename from sound/soc/imx/imx-audmux.h
> rename to sound/soc/fsl/imx-audmux.h
> diff --git a/sound/soc/imx/imx-pcm-dma-mx2.c b/sound/soc/fsl/imx-pcm-dma-mx2.c
> similarity index 100%
> rename from sound/soc/imx/imx-pcm-dma-mx2.c
> rename to sound/soc/fsl/imx-pcm-dma-mx2.c
> diff --git a/sound/soc/imx/imx-pcm-fiq.c b/sound/soc/fsl/imx-pcm-fiq.c
> similarity index 100%
> rename from sound/soc/imx/imx-pcm-fiq.c
> rename to sound/soc/fsl/imx-pcm-fiq.c
> diff --git a/sound/soc/imx/imx-pcm.c b/sound/soc/fsl/imx-pcm.c
> similarity index 100%
> rename from sound/soc/imx/imx-pcm.c
> rename to sound/soc/fsl/imx-pcm.c
> diff --git a/sound/soc/imx/imx-pcm.h b/sound/soc/fsl/imx-pcm.h
> similarity index 100%
> rename from sound/soc/imx/imx-pcm.h
> rename to sound/soc/fsl/imx-pcm.h
> diff --git a/sound/soc/imx/imx-ssi.c b/sound/soc/fsl/imx-ssi.c
> similarity index 99%
> rename from sound/soc/imx/imx-ssi.c
> rename to sound/soc/fsl/imx-ssi.c
> index 9203cdd..3e0dac5a 100644
> --- a/sound/soc/imx/imx-ssi.c
> +++ b/sound/soc/fsl/imx-ssi.c
> @@ -28,7 +28,7 @@
>   * value. When we read the same register two times (and the register still
>   * contains the same value) these status bits are not set. We work
>   * around this by not polling these bits but only wait a fixed delay.
> - * 
> + *
>   */
>  
>  #include <linux/clk.h>
> diff --git a/sound/soc/imx/imx-ssi.h b/sound/soc/fsl/imx-ssi.h
> similarity index 100%
> rename from sound/soc/imx/imx-ssi.h
> rename to sound/soc/fsl/imx-ssi.h
> diff --git a/sound/soc/imx/mx27vis-aic32x4.c b/sound/soc/fsl/mx27vis-aic32x4.c
> similarity index 100%
> rename from sound/soc/imx/mx27vis-aic32x4.c
> rename to sound/soc/fsl/mx27vis-aic32x4.c
> diff --git a/sound/soc/imx/phycore-ac97.c b/sound/soc/fsl/phycore-ac97.c
> similarity index 100%
> rename from sound/soc/imx/phycore-ac97.c
> rename to sound/soc/fsl/phycore-ac97.c
> diff --git a/sound/soc/imx/wm1133-ev1.c b/sound/soc/fsl/wm1133-ev1.c
> similarity index 100%
> rename from sound/soc/imx/wm1133-ev1.c
> rename to sound/soc/fsl/wm1133-ev1.c
> diff --git a/sound/soc/imx/Kconfig b/sound/soc/imx/Kconfig
> deleted file mode 100644
> index 810acaa..0000000
> --- a/sound/soc/imx/Kconfig
> +++ /dev/null
> @@ -1,79 +0,0 @@
> -menuconfig SND_IMX_SOC
> -	tristate "SoC Audio for Freescale i.MX CPUs"
> -	depends on ARCH_MXC
> -	help
> -	  Say Y or M if you want to add support for codecs attached to
> -	  the i.MX SSI interface.
> -
> -
> -if SND_IMX_SOC
> -
> -config SND_SOC_IMX_SSI
> -	tristate
> -
> -config SND_SOC_IMX_PCM
> -	tristate
> -
> -config SND_MXC_SOC_FIQ
> -	tristate
> -	select FIQ
> -	select SND_SOC_IMX_PCM
> -
> -config SND_MXC_SOC_MX2
> -	select SND_SOC_DMAENGINE_PCM
> -	tristate
> -	select SND_SOC_IMX_PCM
> -
> -config SND_SOC_IMX_AUDMUX
> -	tristate
> -
> -config SND_MXC_SOC_WM1133_EV1
> -	tristate "Audio on the the i.MX31ADS with WM1133-EV1 fitted"
> -	depends on MACH_MX31ADS_WM1133_EV1 && EXPERIMENTAL
> -	select SND_SOC_WM8350
> -	select SND_MXC_SOC_FIQ
> -	select SND_SOC_IMX_AUDMUX
> -	select SND_SOC_IMX_SSI
> -	help
> -	  Enable support for audio on the i.MX31ADS with the WM1133-EV1
> -	  PMIC board with WM8835x fitted.
> -
> -config SND_SOC_MX27VIS_AIC32X4
> -	tristate "SoC audio support for Visstrim M10 boards"
> -	depends on MACH_IMX27_VISSTRIM_M10 && I2C
> -	select SND_SOC_TLV320AIC32X4
> -	select SND_MXC_SOC_MX2
> -	select SND_SOC_IMX_AUDMUX
> -	select SND_SOC_IMX_SSI
> -	help
> -	  Say Y if you want to add support for SoC audio on Visstrim SM10
> -	  board with TLV320AIC32X4 codec.
> -
> -config SND_SOC_PHYCORE_AC97
> -	tristate "SoC Audio support for Phytec phyCORE (and phyCARD) boards"
> -	depends on MACH_PCM043 || MACH_PCA100
> -	select SND_SOC_AC97_BUS
> -	select SND_SOC_WM9712
> -	select SND_MXC_SOC_FIQ
> -	select SND_SOC_IMX_AUDMUX
> -	select SND_SOC_IMX_SSI
> -	help
> -	  Say Y if you want to add support for SoC audio on Phytec phyCORE
> -	  and phyCARD boards in AC97 mode
> -
> -config SND_SOC_EUKREA_TLV320
> -	tristate "Eukrea TLV320"
> -	depends on MACH_EUKREA_MBIMX27_BASEBOARD \
> -		|| MACH_EUKREA_MBIMXSD25_BASEBOARD \
> -		|| MACH_EUKREA_MBIMXSD35_BASEBOARD \
> -		|| MACH_EUKREA_MBIMXSD51_BASEBOARD
> -	depends on I2C
> -	select SND_SOC_TLV320AIC23
> -	select SND_MXC_SOC_FIQ
> -	select SND_SOC_IMX_AUDMUX
> -	select SND_SOC_IMX_SSI
> -	help
> -	  Enable I2S based access to the TLV320AIC23B codec attached
> -	  to the SSI interface
> -
> -endif	# SND_IMX_SOC
> diff --git a/sound/soc/imx/Makefile b/sound/soc/imx/Makefile
> deleted file mode 100644
> index f5db3e9..0000000
> --- a/sound/soc/imx/Makefile
> +++ /dev/null
> @@ -1,22 +0,0 @@
> -# i.MX Platform Support
> -snd-soc-imx-ssi-objs := imx-ssi.o
> -snd-soc-imx-audmux-objs := imx-audmux.o
> -
> -obj-$(CONFIG_SND_SOC_IMX_SSI) += snd-soc-imx-ssi.o
> -obj-$(CONFIG_SND_SOC_IMX_AUDMUX) += snd-soc-imx-audmux.o
> -
> -obj-$(CONFIG_SND_SOC_IMX_PCM) += snd-soc-imx-pcm.o
> -snd-soc-imx-pcm-y := imx-pcm.o
> -snd-soc-imx-pcm-$(CONFIG_SND_MXC_SOC_FIQ) += imx-pcm-fiq.o
> -snd-soc-imx-pcm-$(CONFIG_SND_MXC_SOC_MX2) += imx-pcm-dma-mx2.o
> -
> -# i.MX Machine Support
> -snd-soc-eukrea-tlv320-objs := eukrea-tlv320.o
> -snd-soc-phycore-ac97-objs := phycore-ac97.o
> -snd-soc-mx27vis-aic32x4-objs := mx27vis-aic32x4.o
> -snd-soc-wm1133-ev1-objs := wm1133-ev1.o
> -
> -obj-$(CONFIG_SND_SOC_EUKREA_TLV320) += snd-soc-eukrea-tlv320.o
> -obj-$(CONFIG_SND_SOC_PHYCORE_AC97) += snd-soc-phycore-ac97.o
> -obj-$(CONFIG_SND_SOC_MX27VIS_AIC32X4) += snd-soc-mx27vis-aic32x4.o
> -obj-$(CONFIG_SND_MXC_SOC_WM1133_EV1) += snd-soc-wm1133-ev1.o


-- 
Timur Tabi
Linux kernel developer at Freescale

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

* [PATCH v5] ASoC: add imx-sgtl5000 machine driver working with fsl_ssi
  2012-03-16  8:56 [PATCH v5] ASoC: add imx-sgtl5000 machine driver working with fsl_ssi Shawn Guo
                   ` (7 preceding siblings ...)
  2012-03-16  8:56 ` [PATCH v5 8/8] ASoC: fsl: add imx-sgtl5000 machine driver Shawn Guo
@ 2012-03-16 21:25 ` Timur Tabi
  8 siblings, 0 replies; 22+ messages in thread
From: Timur Tabi @ 2012-03-16 21:25 UTC (permalink / raw)
  To: linux-arm-kernel

Shawn Guo wrote:
> Changes since v4:
>  * Add new_binding flag for fsl_ssi driver to support both
>    "old binding" and "new binding"
> 
> ---
> Shawn Guo (8):
>       ASoC: fsl: separate SSI and DMA Kconfig options
>       ASoC: imx: merge sound/soc/imx into sound/soc/fsl
>       ASoC: fsl: rename imx-pcm Kconfig options and filename
>       ASoC: fsl: create fsl_utils to accommodate the common functions
>       ASoC: fsl: remove helper fsl_asoc_get_codec_dev_name
>       ASoC: fsl: make fsl_ssi driver compilable on ARM/IMX
>       ASoC: fsl: let fsl_ssi work with imx pcm and machine drivers
>       ASoC: fsl: add imx-sgtl5000 machine driver

Entire patchset:

Acked-by: Timur Tabi <timur@freescale.com>

-- 
Timur Tabi
Linux kernel developer at Freescale

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

* [alsa-devel] [PATCH v5 8/8] ASoC: fsl: add imx-sgtl5000 machine driver
  2012-03-16 19:21       ` Mark Brown
@ 2012-03-16 21:28         ` Trent Piepho
  2012-03-16 21:31           ` Timur Tabi
  2012-03-17  0:07           ` Shawn Guo
  0 siblings, 2 replies; 22+ messages in thread
From: Trent Piepho @ 2012-03-16 21:28 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Mar 16, 2012 at 3:21 PM, Mark Brown
<broonie@opensource.wolfsonmicro.com> wrote:
> On Fri, Mar 16, 2012 at 07:18:18PM +0800, Shawn Guo wrote:
>
>> Maybe having "fsl,imx-audio-xxx" for machine drivers backed by SSI,
>> and "fsl,imx-esai-audio-xxx" for the ones backed by ESAI?

It seems non-orthogonal to me that ESAI has esai in the name but SSI
does not have ssi.

> Alternatively if the SSI and ESAI devices are compatible enough at the
> ASoC API level (or can be identified by the driver just by looking at
> the DAI that's referenced without too much pain) the CPU DAI could just
> be linked to either type of DAI (probably with a more generic name for
> the property).
>
> But either way works fine, and obviously you're going to end up with
> more complex systems which use a completely custom binding anyway.

The ESAI and SSI hardware are totally different.  SSI gives you a
playback and a record stream in an I2S, or I2S like, interface.  A
stream is mono or stereo. ESAI has IIRC up to six output and four
inputs streams.  Each stream is in parallel on the same clock, and can
have one or more channels.  So it's sort of like six SSI devices
combined into one.  Except all the streams share a single FIFO and DMA
channel, so you can not independently turn the streams on and off in
ALSA like you could with six distinct SSI devices.  The hardware does
have the ability to turn streams on and off on the fly, but ALSA
models the device as something like a 12 channel PCM stream and
doesn't provide a way to change the hw_params on the fly between
periods.  Hence why we have a custom driver that does ugly things so
we can do this.

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

* [alsa-devel] [PATCH v5 8/8] ASoC: fsl: add imx-sgtl5000 machine driver
  2012-03-16 21:28         ` Trent Piepho
@ 2012-03-16 21:31           ` Timur Tabi
  2012-03-16 21:45             ` Trent Piepho
  2012-03-17  0:07           ` Shawn Guo
  1 sibling, 1 reply; 22+ messages in thread
From: Timur Tabi @ 2012-03-16 21:31 UTC (permalink / raw)
  To: linux-arm-kernel

Trent Piepho wrote:
> The ESAI and SSI hardware are totally different.  SSI gives you a
> playback and a record stream in an I2S, or I2S like, interface.  A
> stream is mono or stereo. ESAI has IIRC up to six output and four
> inputs streams.  Each stream is in parallel on the same clock, and can
> have one or more channels. 

Are these channels on the same wire in a time-division multiplexing, or on
six different wires?  If it's a TDM, then the SSI can actually do this
using "network mode", but I don't enable that in the driver, since it's
not really I2S compliant.

Well, this point is not really relevant to the discussion.

-- 
Timur Tabi
Linux kernel developer at Freescale

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

* [alsa-devel] [PATCH v5 8/8] ASoC: fsl: add imx-sgtl5000 machine driver
  2012-03-16 21:31           ` Timur Tabi
@ 2012-03-16 21:45             ` Trent Piepho
  0 siblings, 0 replies; 22+ messages in thread
From: Trent Piepho @ 2012-03-16 21:45 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Mar 16, 2012 at 5:31 PM, Timur Tabi <timur@freescale.com> wrote:
> Trent Piepho wrote:
>> The ESAI and SSI hardware are totally different. ?SSI gives you a
>> playback and a record stream in an I2S, or I2S like, interface. ?A
>> stream is mono or stereo. ESAI has IIRC up to six output and four
>> inputs streams. ?Each stream is in parallel on the same clock, and can
>> have one or more channels.
>
> Are these channels on the same wire in a time-division multiplexing, or on
> six different wires? ?If it's a TDM, then the SSI can actually do this
> using "network mode", but I don't enable that in the driver, since it's
> not really I2S compliant.

Six different wires.  Each wire can have multiple channels, or
"slots", to do mono, stereo, 5.1, etc.  Each wire needs the same
number of slots, since there is only one frame sync.  And only one bit
clock too.  RX and TX can be synchronous or async.  I know it has
network mode too, but our hardware is I2S so I never bothered to look
into exactly what network mode is.

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

* [alsa-devel] [PATCH v5 8/8] ASoC: fsl: add imx-sgtl5000 machine driver
  2012-03-16 21:28         ` Trent Piepho
  2012-03-16 21:31           ` Timur Tabi
@ 2012-03-17  0:07           ` Shawn Guo
  1 sibling, 0 replies; 22+ messages in thread
From: Shawn Guo @ 2012-03-17  0:07 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Mar 16, 2012 at 05:28:54PM -0400, Trent Piepho wrote:
> On Fri, Mar 16, 2012 at 3:21 PM, Mark Brown
> <broonie@opensource.wolfsonmicro.com> wrote:
> > On Fri, Mar 16, 2012 at 07:18:18PM +0800, Shawn Guo wrote:
> >
> >> Maybe having "fsl,imx-audio-xxx" for machine drivers backed by SSI,
> >> and "fsl,imx-esai-audio-xxx" for the ones backed by ESAI?
> 
> It seems non-orthogonal to me that ESAI has esai in the name but SSI
> does not have ssi.
> 
SSI comes first and so takes the "default and shorter" name :)

-- 
Regards,
Shawn

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

* [PATCH v5 2/8] ASoC: imx: merge sound/soc/imx into sound/soc/fsl
  2012-03-16 21:21   ` Timur Tabi
@ 2012-03-17  0:21     ` Shawn Guo
  0 siblings, 0 replies; 22+ messages in thread
From: Shawn Guo @ 2012-03-17  0:21 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Mar 16, 2012 at 04:21:43PM -0500, Timur Tabi wrote:
> Shawn Guo wrote:
> > Freescale PowerPC and ARM/IMX families share the same SSI IP block.
> > The patch merges sound/soc/imx into sound/soc/fsl, so that the possible
> > code sharing and consolidation can happen.
> > 
> > This is a plain merge, except that menuconfig SND_POWERPC_SOC is added
> > in Kconfig for PowerPC platform as a correspondence to SND_IMX_SOC for
> > IMX platform.
> > 
> > Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
> > Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
> > ---
> 
> I'm okay with this patch, but you will need an Ack from Kumar Gala to
> carry the defconfig portions through the ASoC tree.  Or, he might want you
> to split the patch up.
> 
Splitting the patch up will introduce a dependency between PowerPC tree
and sound tree.  Since the change is trivial enough (one line change),
even if there is a merge conflict (very unlikely, just tried linux-next
and did not see), Linus will be able to handle it.  So I'd rather not
split.  What'd you say, Kumar?

> >  arch/powerpc/configs/86xx/mpc8610_hpcd_defconfig |    1 +
> >  arch/powerpc/configs/mpc85xx_defconfig           |    1 +
> >  arch/powerpc/configs/mpc85xx_smp_defconfig       |    1 +

-- 
Regards,
Shawn

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

* [PATCH v5 1/8] ASoC: fsl: separate SSI and DMA Kconfig options
  2012-03-16  8:56 ` [PATCH v5 1/8] ASoC: fsl: separate SSI and DMA Kconfig options Shawn Guo
@ 2012-03-19 13:56   ` Mark Brown
  0 siblings, 0 replies; 22+ messages in thread
From: Mark Brown @ 2012-03-19 13:56 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Mar 16, 2012 at 04:56:37PM +0800, Shawn Guo wrote:
> The fsl_ssi driver will possibly be shared between Freescale PowerPC
> and ARM/IMX families, so give it a separate Kconfig option.  Then
> fsl_ssi driver can possibly be selected independently from selecting
> PowerPC DMA based PCM driver.

Applied all, thanks for doing all this work!  They'll have to wait for
3.5 at this point sadly.
-------------- 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/20120319/b4421d9d/attachment.sig>

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

* [PATCH v5 2/8] ASoC: imx: merge sound/soc/imx into sound/soc/fsl
  2012-03-16  8:56 ` [PATCH v5 2/8] ASoC: imx: merge sound/soc/imx into sound/soc/fsl Shawn Guo
  2012-03-16 21:21   ` Timur Tabi
@ 2012-03-27 15:06   ` Philippe Rétornaz
  2012-03-28  2:42     ` Shawn Guo
  1 sibling, 1 reply; 22+ messages in thread
From: Philippe Rétornaz @ 2012-03-27 15:06 UTC (permalink / raw)
  To: linux-arm-kernel

Le vendredi 16 mars 2012 16:56:38 Shawn Guo a ?crit :
> Freescale PowerPC and ARM/IMX families share the same SSI IP block.
> The patch merges sound/soc/imx into sound/soc/fsl, so that the possible
> code sharing and consolidation can happen.
> 
> This is a plain merge, except that menuconfig SND_POWERPC_SOC is added
> in Kconfig for PowerPC platform as a correspondence to SND_IMX_SOC for
> IMX platform.
> 
> Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
> Acked-by: Sascha Hauer <s.hauer@pengutronix.de>

This patch has been merged ? If yes in which tree is it available ? 

Thanks,

Philippe

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

* [PATCH v5 2/8] ASoC: imx: merge sound/soc/imx into sound/soc/fsl
  2012-03-27 15:06   ` Philippe Rétornaz
@ 2012-03-28  2:42     ` Shawn Guo
  0 siblings, 0 replies; 22+ messages in thread
From: Shawn Guo @ 2012-03-28  2:42 UTC (permalink / raw)
  To: linux-arm-kernel

2012/3/27 Philippe R?tornaz <philippe.retornaz@epfl.ch>:
> Le vendredi 16 mars 2012 16:56:38 Shawn Guo a ?crit :
>> Freescale PowerPC and ARM/IMX families share the same SSI IP block.
>> The patch merges sound/soc/imx into sound/soc/fsl, so that the possible
>> code sharing and consolidation can happen.
>>
>> This is a plain merge, except that menuconfig SND_POWERPC_SOC is added
>> in Kconfig for PowerPC platform as a correspondence to SND_IMX_SOC for
>> IMX platform.
>>
>> Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
>> Acked-by: Sascha Hauer <s.hauer@pengutronix.de>
>
> This patch has been merged ? If yes in which tree is it available ?
>
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-3.5

Regards,
Shawn

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

end of thread, other threads:[~2012-03-28  2:42 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-16  8:56 [PATCH v5] ASoC: add imx-sgtl5000 machine driver working with fsl_ssi Shawn Guo
2012-03-16  8:56 ` [PATCH v5 1/8] ASoC: fsl: separate SSI and DMA Kconfig options Shawn Guo
2012-03-19 13:56   ` Mark Brown
2012-03-16  8:56 ` [PATCH v5 2/8] ASoC: imx: merge sound/soc/imx into sound/soc/fsl Shawn Guo
2012-03-16 21:21   ` Timur Tabi
2012-03-17  0:21     ` Shawn Guo
2012-03-27 15:06   ` Philippe Rétornaz
2012-03-28  2:42     ` Shawn Guo
2012-03-16  8:56 ` [PATCH v5 3/8] ASoC: fsl: rename imx-pcm Kconfig options and filename Shawn Guo
2012-03-16  8:56 ` [PATCH v5 4/8] ASoC: fsl: create fsl_utils to accommodate the common functions Shawn Guo
2012-03-16  8:56 ` [PATCH v5 5/8] ASoC: fsl: remove helper fsl_asoc_get_codec_dev_name Shawn Guo
2012-03-16  8:56 ` [PATCH v5 6/8] ASoC: fsl: make fsl_ssi driver compilable on ARM/IMX Shawn Guo
2012-03-16  8:56 ` [PATCH v5 7/8] ASoC: fsl: let fsl_ssi work with imx pcm and machine drivers Shawn Guo
2012-03-16  8:56 ` [PATCH v5 8/8] ASoC: fsl: add imx-sgtl5000 machine driver Shawn Guo
2012-03-16 10:16   ` [alsa-devel] " Trent Piepho
2012-03-16 11:18     ` Shawn Guo
2012-03-16 19:21       ` Mark Brown
2012-03-16 21:28         ` Trent Piepho
2012-03-16 21:31           ` Timur Tabi
2012-03-16 21:45             ` Trent Piepho
2012-03-17  0:07           ` Shawn Guo
2012-03-16 21:25 ` [PATCH v5] ASoC: add imx-sgtl5000 machine driver working with fsl_ssi Timur Tabi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).