Re: [PATCH 2/2] ASoC: samsung: add support for exynos7 I2S controller

2014-11-07 Thread Mark Brown
On Fri, Nov 07, 2014 at 12:24:40PM +0530, Padmavathi Venna wrote:
 Exynos7 I2S controller has no internal dma, supports more
 no. of root clock sampling frequencies and has more no.of Rx
 fifos to support 7.1CH recording in TDM mode. Due to more no.

Applied, thanks.


signature.asc
Description: Digital signature


[PATCH 2/2] ASoC: samsung: add support for exynos7 I2S controller

2014-11-06 Thread Padmavathi Venna
Exynos7 I2S controller has no internal dma, supports more
no. of root clock sampling frequencies and has more no.of Rx
fifos to support 7.1CH recording in TDM mode. Due to more no.
of root clock frequency values some of the bit offsets got
shifted up by one. Also I2S1 on previous Samsung platforms
uses v3 dai type but on Exynos7 it is upgraded to v5 with
slightly modified register offsets for supporting more no.of
RFS values. Due to the above changes, the driver has to be
modified to handle all versions of I2S controller. For this
I introduced a new structure to hold modified bit offsets and
masks which is passed as dai data.

Signed-off-by: Padmavathi Venna padm...@samsung.com
---
 .../devicetree/bindings/sound/samsung-i2s.txt  |   15 +-
 sound/soc/samsung/Kconfig  |2 +-
 sound/soc/samsung/i2s-regs.h   |   10 +-
 sound/soc/samsung/i2s.c|  218 ++--
 4 files changed, 174 insertions(+), 71 deletions(-)

diff --git a/Documentation/devicetree/bindings/sound/samsung-i2s.txt 
b/Documentation/devicetree/bindings/sound/samsung-i2s.txt
index 7386d44..d188296 100644
--- a/Documentation/devicetree/bindings/sound/samsung-i2s.txt
+++ b/Documentation/devicetree/bindings/sound/samsung-i2s.txt
@@ -6,10 +6,17 @@ Required SoC Specific Properties:
- samsung,s3c6410-i2s: for 8/16/24bit stereo I2S.
- samsung,s5pv210-i2s: for 8/16/24bit multichannel(5.1) I2S with
  secondary fifo, s/w reset control and internal mux for root clk src.
-   - samsung,exynos5420-i2s: for 8/16/24bit multichannel(7.1) I2S with
- secondary fifo, s/w reset control, internal mux for root clk src and
- TDM support. TDM (Time division multiplexing) is to allow transfer of
- multiple channel audio data on single data line.
+   - samsung,exynos5420-i2s: for 8/16/24bit multichannel(5.1) I2S for
+ playback, sterio channel capture, secondary fifo using internal
+ or external dma, s/w reset control, internal mux for root clk src
+ and 7.1 channel TDM support for playback. TDM (Time division multiplexing)
+ is to allow transfer of multiple channel audio data on single data line.
+   - samsung,exynos7-i2s: with all the available features of exynos5 i2s,
+ exynos7 I2S has 7.1 channel TDM support for capture, secondary fifo
+ with only external dma and more no.of root clk sampling frequencies.
+   - samsung,exynos7-i2s1: I2S1 on previous samsung platforms supports
+ stereo channels. exynos7 i2s1 upgraded to 5.1 multichannel with
+ slightly modified bit offsets.
 
 - reg: physical base address of the controller and length of memory mapped
   region.
diff --git a/sound/soc/samsung/Kconfig b/sound/soc/samsung/Kconfig
index 55a3869..e0e737f 100644
--- a/sound/soc/samsung/Kconfig
+++ b/sound/soc/samsung/Kconfig
@@ -1,6 +1,6 @@
 config SND_SOC_SAMSUNG
tristate ASoC support for Samsung
-   depends on PLAT_SAMSUNG
+   depends on (PLAT_SAMSUNG || ARCH_EXYNOS)
depends on S3C64XX_PL080 || !ARCH_S3C64XX
depends on S3C24XX_DMAC || !ARCH_S3C24XX
select SND_SOC_GENERIC_DMAENGINE_PCM
diff --git a/sound/soc/samsung/i2s-regs.h b/sound/soc/samsung/i2s-regs.h
index 821a502..9170c31 100644
--- a/sound/soc/samsung/i2s-regs.h
+++ b/sound/soc/samsung/i2s-regs.h
@@ -33,8 +33,9 @@
 #define I2SLVL3ADDR0x3c
 #define I2SSTR10x40
 #define I2SVER 0x44
-#define I2SFIC20x48
+#define I2SFIC10x48
 #define I2STDM 0x4c
+#define I2SFSTA0x50
 
 #define CON_RSTCLR (1  31)
 #define CON_FRXOFSTATUS(1  26)
@@ -93,8 +94,6 @@
 #define MOD_BLC_24BIT  (2  13)
 #define MOD_BLC_MASK   (3  13)
 
-#define MOD_IMS_SYSMUX (1  10)
-#define MOD_SLAVE  (1  11)
 #define MOD_TXONLY (0  8)
 #define MOD_RXONLY (1  8)
 #define MOD_TXRX   (2  8)
@@ -132,7 +131,10 @@
 #define EXYNOS5420_MOD_BCLK_256FS  8
 #define EXYNOS5420_MOD_BCLK_MASK   0xf
 
-#define MOD_CDCLKCON   (1  12)
+#define EXYNOS7_MOD_RCLK_64FS  4
+#define EXYNOS7_MOD_RCLK_128FS 5
+#define EXYNOS7_MOD_RCLK_96FS  6
+#define EXYNOS7_MOD_RCLK_192FS 7
 
 #define PSR_PSREN  (1  15)
 
diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c
index 38b9a52..947352d 100644
--- a/sound/soc/samsung/i2s.c
+++ b/sound/soc/samsung/i2s.c
@@ -36,9 +36,24 @@ enum samsung_dai_type {
TYPE_SEC,
 };
 
+struct samsung_i2s_variant_regs {
+   unsigned intbfs_off;
+   unsigned intrfs_off;
+   unsigned intsdf_off;
+   unsigned inttxr_off;
+   unsigned intrclksrc_off;
+   unsigned intmss_off;
+   unsigned intcdclkcon_off;
+   unsigned intlrp_off;
+   unsigned intbfs_mask;
+   unsigned intrfs_mask;
+   unsigned intftx0cnt_off;
+};
+
 struct samsung_i2s_dai_data {
int dai_type;