All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch 0/9] S3C24XX/S3C64XX updates
@ 2009-03-04  0:49 Ben Dooks
  2009-03-04  0:49 ` [patch 1/9] S3C24XX: Move and update IIS headers Ben Dooks
                   ` (9 more replies)
  0 siblings, 10 replies; 24+ messages in thread
From: Ben Dooks @ 2009-03-04  0:49 UTC (permalink / raw)
  To: alsa-devel; +Cc: broonie

This is a set of patches for 2.6.30 to add more
s3c24xx machine support and support for the S3C64XX
series of SoC.

It would be very useful to get the header moves merged
as soon as possible, to help clear out the old ARM
include directories (and make it easier for the merges
from other s3c branches that need to take place in the
merge window). As such, they're only moves and should
not affect the actual build.

-- 
Ben (ben@fluff.org, http://www.fluff.org/)

  'a smiley only costs 4 bytes'

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

* [patch 1/9] S3C24XX: Move and update IIS headers
  2009-03-04  0:49 [patch 0/9] S3C24XX/S3C64XX updates Ben Dooks
@ 2009-03-04  0:49 ` Ben Dooks
  2009-03-04  0:49 ` [patch 2/9] JIVE: Add ASoC audio support Ben Dooks
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 24+ messages in thread
From: Ben Dooks @ 2009-03-04  0:49 UTC (permalink / raw)
  To: alsa-devel; +Cc: broonie

[-- Attachment #1: audio/audio-header-fixes.patch --]
[-- Type: text/plain, Size: 16894 bytes --]

From: Ben Dooks <ben@simtec.co.uk>

Move the IIS headers to their correct place.

Signed-off-by: Ben Dooks <ben@simtec.co.uk>

diff --git a/arch/arm/mach-s3c2410/dma.c b/arch/arm/mach-s3c2410/dma.c
index 552b4c7..440c014 100644
--- a/arch/arm/mach-s3c2410/dma.c
+++ b/arch/arm/mach-s3c2410/dma.c
@@ -28,7 +28,7 @@
 #include <mach/regs-mem.h>
 #include <mach/regs-lcd.h>
 #include <mach/regs-sdi.h>
-#include <asm/plat-s3c24xx/regs-iis.h>
+#include <plat/regs-iis.h>
 #include <plat/regs-spi.h>
 
 static struct s3c24xx_dma_map __initdata s3c2410_dma_mappings[] = {
diff --git a/arch/arm/mach-s3c2410/include/mach/hardware.h b/arch/arm/mach-s3c2410/include/mach/hardware.h
index 74d5a1a..db72beb 100644
--- a/arch/arm/mach-s3c2410/include/mach/hardware.h
+++ b/arch/arm/mach-s3c2410/include/mach/hardware.h
@@ -131,7 +131,4 @@ extern int s3c2412_gpio_set_sleepcfg(unsigned int pin, unsigned int state);
 
 /* machine specific hardware definitions should go after this */
 
-/* currently here until moved into config (todo) */
-#define CONFIG_NO_MULTIWORD_IO
-
 #endif /* __ASM_ARCH_HARDWARE_H */
diff --git a/arch/arm/mach-s3c2410/include/mach/io.h b/arch/arm/mach-s3c2410/include/mach/io.h
index 9813dbf..c477771 100644
--- a/arch/arm/mach-s3c2410/include/mach/io.h
+++ b/arch/arm/mach-s3c2410/include/mach/io.h
@@ -9,7 +9,7 @@
 #ifndef __ASM_ARM_ARCH_IO_H
 #define __ASM_ARM_ARCH_IO_H
 
-#include <mach/hardware.h>
+#include <mach/map.h>
 
 #define IO_SPACE_LIMIT 0xffffffff
 
diff --git a/arch/arm/mach-s3c2412/dma.c b/arch/arm/mach-s3c2412/dma.c
index 919856c..9e34785 100644
--- a/arch/arm/mach-s3c2412/dma.c
+++ b/arch/arm/mach-s3c2412/dma.c
@@ -29,8 +29,8 @@
 #include <mach/regs-mem.h>
 #include <mach/regs-lcd.h>
 #include <mach/regs-sdi.h>
-#include <asm/plat-s3c24xx/regs-s3c2412-iis.h>
-#include <asm/plat-s3c24xx/regs-iis.h>
+#include <plat/regs-s3c2412-iis.h>
+#include <plat/regs-iis.h>
 #include <plat/regs-spi.h>
 
 #define MAP(x) { (x)| DMA_CH_VALID, (x)| DMA_CH_VALID, (x)| DMA_CH_VALID, (x)| DMA_CH_VALID }
diff --git a/arch/arm/mach-s3c2440/dma.c b/arch/arm/mach-s3c2440/dma.c
index 5b5ee0b..69b6cf3 100644
--- a/arch/arm/mach-s3c2440/dma.c
+++ b/arch/arm/mach-s3c2440/dma.c
@@ -28,7 +28,7 @@
 #include <mach/regs-mem.h>
 #include <mach/regs-lcd.h>
 #include <mach/regs-sdi.h>
-#include <asm/plat-s3c24xx/regs-iis.h>
+#include <plat/regs-iis.h>
 #include <plat/regs-spi.h>
 
 static struct s3c24xx_dma_map __initdata s3c2440_dma_mappings[] = {
diff --git a/arch/arm/mach-s3c2443/dma.c b/arch/arm/mach-s3c2443/dma.c
index 2a58a4d..8430e58 100644
--- a/arch/arm/mach-s3c2443/dma.c
+++ b/arch/arm/mach-s3c2443/dma.c
@@ -29,7 +29,7 @@
 #include <mach/regs-mem.h>
 #include <mach/regs-lcd.h>
 #include <mach/regs-sdi.h>
-#include <asm/plat-s3c24xx/regs-iis.h>
+#include <plat/regs-iis.h>
 #include <plat/regs-spi.h>
 
 #define MAP(x) { \
diff --git a/arch/arm/mach-shark/include/mach/io.h b/arch/arm/mach-shark/include/mach/io.h
index c5cee82..8ca7d7f 100644
--- a/arch/arm/mach-shark/include/mach/io.h
+++ b/arch/arm/mach-shark/include/mach/io.h
@@ -14,7 +14,7 @@
 #define PCIO_BASE	0xe0000000
 #define IO_SPACE_LIMIT	0xffffffff
 
-#define __io(a)		((void __iomem *)(PCIO_BASE + (a)))
+#define __io(a)		__typesafe_io(PCIO_BASE + (a))
 #define __mem_pci(addr)	(addr)
 
 #endif
diff --git a/arch/arm/plat-s3c/include/plat/regs-s3c2412-iis.h b/arch/arm/plat-s3c/include/plat/regs-s3c2412-iis.h
new file mode 100644
index 0000000..25d4058
--- /dev/null
+++ b/arch/arm/plat-s3c/include/plat/regs-s3c2412-iis.h
@@ -0,0 +1,72 @@
+/* linux/include/asm-arm/plat-s3c24xx/regs-s3c2412-iis.h
+ *
+ * Copyright 2007 Simtec Electronics <linux@simtec.co.uk>
+ *	http://armlinux.simtec.co.uk/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * S3C2412 IIS register definition
+*/
+
+#ifndef __ASM_ARCH_REGS_S3C2412_IIS_H
+#define __ASM_ARCH_REGS_S3C2412_IIS_H
+
+#define S3C2412_IISCON			(0x00)
+#define S3C2412_IISMOD			(0x04)
+#define S3C2412_IISFIC			(0x08)
+#define S3C2412_IISPSR			(0x0C)
+#define S3C2412_IISTXD			(0x10)
+#define S3C2412_IISRXD			(0x14)
+
+#define S3C2412_IISCON_LRINDEX		(1 << 11)
+#define S3C2412_IISCON_TXFIFO_EMPTY	(1 << 10)
+#define S3C2412_IISCON_RXFIFO_EMPTY	(1 << 9)
+#define S3C2412_IISCON_TXFIFO_FULL	(1 << 8)
+#define S3C2412_IISCON_RXFIFO_FULL	(1 << 7)
+#define S3C2412_IISCON_TXDMA_PAUSE	(1 << 6)
+#define S3C2412_IISCON_RXDMA_PAUSE	(1 << 5)
+#define S3C2412_IISCON_TXCH_PAUSE	(1 << 4)
+#define S3C2412_IISCON_RXCH_PAUSE	(1 << 3)
+#define S3C2412_IISCON_TXDMA_ACTIVE	(1 << 2)
+#define S3C2412_IISCON_RXDMA_ACTIVE	(1 << 1)
+#define S3C2412_IISCON_IIS_ACTIVE	(1 << 0)
+
+#define S3C2412_IISMOD_MASTER_INTERNAL	(0 << 10)
+#define S3C2412_IISMOD_MASTER_EXTERNAL	(1 << 10)
+#define S3C2412_IISMOD_SLAVE		(2 << 10)
+#define S3C2412_IISMOD_MASTER_MASK	(3 << 10)
+#define S3C2412_IISMOD_MODE_TXONLY	(0 << 8)
+#define S3C2412_IISMOD_MODE_RXONLY	(1 << 8)
+#define S3C2412_IISMOD_MODE_TXRX	(2 << 8)
+#define S3C2412_IISMOD_MODE_MASK	(3 << 8)
+#define S3C2412_IISMOD_LR_LLOW		(0 << 7)
+#define S3C2412_IISMOD_LR_RLOW		(1 << 7)
+#define S3C2412_IISMOD_SDF_IIS		(0 << 5)
+#define S3C2412_IISMOD_SDF_MSB		(0 << 5)
+#define S3C2412_IISMOD_SDF_LSB		(0 << 5)
+#define S3C2412_IISMOD_SDF_MASK		(3 << 5)
+#define S3C2412_IISMOD_RCLK_256FS	(0 << 3)
+#define S3C2412_IISMOD_RCLK_512FS	(1 << 3)
+#define S3C2412_IISMOD_RCLK_384FS	(2 << 3)
+#define S3C2412_IISMOD_RCLK_768FS	(3 << 3)
+#define S3C2412_IISMOD_RCLK_MASK 	(3 << 3)
+#define S3C2412_IISMOD_BCLK_32FS	(0 << 1)
+#define S3C2412_IISMOD_BCLK_48FS	(1 << 1)
+#define S3C2412_IISMOD_BCLK_16FS	(2 << 1)
+#define S3C2412_IISMOD_BCLK_24FS	(3 << 1)
+#define S3C2412_IISMOD_BCLK_MASK	(3 << 1)
+#define S3C2412_IISMOD_8BIT		(1 << 0)
+
+#define S3C2412_IISPSR_PSREN		(1 << 15)
+
+#define S3C2412_IISFIC_TXFLUSH		(1 << 15)
+#define S3C2412_IISFIC_RXFLUSH		(1 << 7)
+#define S3C2412_IISFIC_TXCOUNT(x)	(((x) >>  8) & 0xf)
+#define S3C2412_IISFIC_RXCOUNT(x)	(((x) >>  0) & 0xf)
+
+
+
+#endif /* __ASM_ARCH_REGS_S3C2412_IIS_H */
+
diff --git a/arch/arm/plat-s3c24xx/clock-dclk.c b/arch/arm/plat-s3c24xx/clock-dclk.c
index 5b75a79..35219dc 100644
--- a/arch/arm/plat-s3c24xx/clock-dclk.c
+++ b/arch/arm/plat-s3c24xx/clock-dclk.c
@@ -18,6 +18,7 @@
 
 #include <mach/regs-clock.h>
 #include <mach/regs-gpio.h>
+#include <mach/hardware.h>
 
 #include <plat/clock.h>
 #include <plat/cpu.h>
diff --git a/arch/arm/plat-s3c24xx/include/plat/regs-iis.h b/arch/arm/plat-s3c24xx/include/plat/regs-iis.h
new file mode 100644
index 0000000..a6f1d5d
--- /dev/null
+++ b/arch/arm/plat-s3c24xx/include/plat/regs-iis.h
@@ -0,0 +1,77 @@
+/* arch/arm/mach-s3c2410/include/mach/regs-iis.h
+ *
+ * Copyright (c) 2003 Simtec Electronics <linux@simtec.co.uk>
+ *		      http://www.simtec.co.uk/products/SWLINUX/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * S3C2410 IIS register definition
+*/
+
+#ifndef __ASM_ARCH_REGS_IIS_H
+#define __ASM_ARCH_REGS_IIS_H
+
+#define S3C2410_IISCON	 (0x00)
+
+#define S3C2410_IISCON_LRINDEX	  (1<<8)
+#define S3C2410_IISCON_TXFIFORDY  (1<<7)
+#define S3C2410_IISCON_RXFIFORDY  (1<<6)
+#define S3C2410_IISCON_TXDMAEN	  (1<<5)
+#define S3C2410_IISCON_RXDMAEN	  (1<<4)
+#define S3C2410_IISCON_TXIDLE	  (1<<3)
+#define S3C2410_IISCON_RXIDLE	  (1<<2)
+#define S3C2410_IISCON_PSCEN	  (1<<1)
+#define S3C2410_IISCON_IISEN	  (1<<0)
+
+#define S3C2410_IISMOD	 (0x04)
+
+#define S3C2440_IISMOD_MPLL	  (1<<9)
+#define S3C2410_IISMOD_SLAVE	  (1<<8)
+#define S3C2410_IISMOD_NOXFER	  (0<<6)
+#define S3C2410_IISMOD_RXMODE	  (1<<6)
+#define S3C2410_IISMOD_TXMODE	  (2<<6)
+#define S3C2410_IISMOD_TXRXMODE	  (3<<6)
+#define S3C2410_IISMOD_LR_LLOW	  (0<<5)
+#define S3C2410_IISMOD_LR_RLOW	  (1<<5)
+#define S3C2410_IISMOD_IIS	  (0<<4)
+#define S3C2410_IISMOD_MSB	  (1<<4)
+#define S3C2410_IISMOD_8BIT	  (0<<3)
+#define S3C2410_IISMOD_16BIT	  (1<<3)
+#define S3C2410_IISMOD_BITMASK	  (1<<3)
+#define S3C2410_IISMOD_256FS	  (0<<2)
+#define S3C2410_IISMOD_384FS	  (1<<2)
+#define S3C2410_IISMOD_16FS	  (0<<0)
+#define S3C2410_IISMOD_32FS	  (1<<0)
+#define S3C2410_IISMOD_48FS	  (2<<0)
+#define S3C2410_IISMOD_FS_MASK	  (3<<0)
+
+#define S3C2410_IISPSR		(0x08)
+#define S3C2410_IISPSR_INTMASK	(31<<5)
+#define S3C2410_IISPSR_INTSHIFT	(5)
+#define S3C2410_IISPSR_EXTMASK	(31<<0)
+#define S3C2410_IISPSR_EXTSHFIT	(0)
+
+#define S3C2410_IISFCON  (0x0c)
+
+#define S3C2410_IISFCON_TXDMA	  (1<<15)
+#define S3C2410_IISFCON_RXDMA	  (1<<14)
+#define S3C2410_IISFCON_TXENABLE  (1<<13)
+#define S3C2410_IISFCON_RXENABLE  (1<<12)
+#define S3C2410_IISFCON_TXMASK	  (0x3f << 6)
+#define S3C2410_IISFCON_TXSHIFT	  (6)
+#define S3C2410_IISFCON_RXMASK	  (0x3f)
+#define S3C2410_IISFCON_RXSHIFT	  (0)
+
+#define S3C2400_IISFCON_TXDMA     (1<<11)
+#define S3C2400_IISFCON_RXDMA     (1<<10)
+#define S3C2400_IISFCON_TXENABLE  (1<<9)
+#define S3C2400_IISFCON_RXENABLE  (1<<8)
+#define S3C2400_IISFCON_TXMASK	  (0x07 << 4)
+#define S3C2400_IISFCON_TXSHIFT	  (4)
+#define S3C2400_IISFCON_RXMASK	  (0x07)
+#define S3C2400_IISFCON_RXSHIFT	  (0)
+
+#define S3C2410_IISFIFO  (0x10)
+#endif /* __ASM_ARCH_REGS_IIS_H */
diff --git a/include/asm-arm/plat-s3c24xx/regs-iis.h b/include/asm-arm/plat-s3c24xx/regs-iis.h
deleted file mode 100644
index a6f1d5d..0000000
--- a/include/asm-arm/plat-s3c24xx/regs-iis.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/* arch/arm/mach-s3c2410/include/mach/regs-iis.h
- *
- * Copyright (c) 2003 Simtec Electronics <linux@simtec.co.uk>
- *		      http://www.simtec.co.uk/products/SWLINUX/
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * S3C2410 IIS register definition
-*/
-
-#ifndef __ASM_ARCH_REGS_IIS_H
-#define __ASM_ARCH_REGS_IIS_H
-
-#define S3C2410_IISCON	 (0x00)
-
-#define S3C2410_IISCON_LRINDEX	  (1<<8)
-#define S3C2410_IISCON_TXFIFORDY  (1<<7)
-#define S3C2410_IISCON_RXFIFORDY  (1<<6)
-#define S3C2410_IISCON_TXDMAEN	  (1<<5)
-#define S3C2410_IISCON_RXDMAEN	  (1<<4)
-#define S3C2410_IISCON_TXIDLE	  (1<<3)
-#define S3C2410_IISCON_RXIDLE	  (1<<2)
-#define S3C2410_IISCON_PSCEN	  (1<<1)
-#define S3C2410_IISCON_IISEN	  (1<<0)
-
-#define S3C2410_IISMOD	 (0x04)
-
-#define S3C2440_IISMOD_MPLL	  (1<<9)
-#define S3C2410_IISMOD_SLAVE	  (1<<8)
-#define S3C2410_IISMOD_NOXFER	  (0<<6)
-#define S3C2410_IISMOD_RXMODE	  (1<<6)
-#define S3C2410_IISMOD_TXMODE	  (2<<6)
-#define S3C2410_IISMOD_TXRXMODE	  (3<<6)
-#define S3C2410_IISMOD_LR_LLOW	  (0<<5)
-#define S3C2410_IISMOD_LR_RLOW	  (1<<5)
-#define S3C2410_IISMOD_IIS	  (0<<4)
-#define S3C2410_IISMOD_MSB	  (1<<4)
-#define S3C2410_IISMOD_8BIT	  (0<<3)
-#define S3C2410_IISMOD_16BIT	  (1<<3)
-#define S3C2410_IISMOD_BITMASK	  (1<<3)
-#define S3C2410_IISMOD_256FS	  (0<<2)
-#define S3C2410_IISMOD_384FS	  (1<<2)
-#define S3C2410_IISMOD_16FS	  (0<<0)
-#define S3C2410_IISMOD_32FS	  (1<<0)
-#define S3C2410_IISMOD_48FS	  (2<<0)
-#define S3C2410_IISMOD_FS_MASK	  (3<<0)
-
-#define S3C2410_IISPSR		(0x08)
-#define S3C2410_IISPSR_INTMASK	(31<<5)
-#define S3C2410_IISPSR_INTSHIFT	(5)
-#define S3C2410_IISPSR_EXTMASK	(31<<0)
-#define S3C2410_IISPSR_EXTSHFIT	(0)
-
-#define S3C2410_IISFCON  (0x0c)
-
-#define S3C2410_IISFCON_TXDMA	  (1<<15)
-#define S3C2410_IISFCON_RXDMA	  (1<<14)
-#define S3C2410_IISFCON_TXENABLE  (1<<13)
-#define S3C2410_IISFCON_RXENABLE  (1<<12)
-#define S3C2410_IISFCON_TXMASK	  (0x3f << 6)
-#define S3C2410_IISFCON_TXSHIFT	  (6)
-#define S3C2410_IISFCON_RXMASK	  (0x3f)
-#define S3C2410_IISFCON_RXSHIFT	  (0)
-
-#define S3C2400_IISFCON_TXDMA     (1<<11)
-#define S3C2400_IISFCON_RXDMA     (1<<10)
-#define S3C2400_IISFCON_TXENABLE  (1<<9)
-#define S3C2400_IISFCON_RXENABLE  (1<<8)
-#define S3C2400_IISFCON_TXMASK	  (0x07 << 4)
-#define S3C2400_IISFCON_TXSHIFT	  (4)
-#define S3C2400_IISFCON_RXMASK	  (0x07)
-#define S3C2400_IISFCON_RXSHIFT	  (0)
-
-#define S3C2410_IISFIFO  (0x10)
-#endif /* __ASM_ARCH_REGS_IIS_H */
diff --git a/include/asm-arm/plat-s3c24xx/regs-s3c2412-iis.h b/include/asm-arm/plat-s3c24xx/regs-s3c2412-iis.h
deleted file mode 100644
index 25d4058..0000000
--- a/include/asm-arm/plat-s3c24xx/regs-s3c2412-iis.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/* linux/include/asm-arm/plat-s3c24xx/regs-s3c2412-iis.h
- *
- * Copyright 2007 Simtec Electronics <linux@simtec.co.uk>
- *	http://armlinux.simtec.co.uk/
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * S3C2412 IIS register definition
-*/
-
-#ifndef __ASM_ARCH_REGS_S3C2412_IIS_H
-#define __ASM_ARCH_REGS_S3C2412_IIS_H
-
-#define S3C2412_IISCON			(0x00)
-#define S3C2412_IISMOD			(0x04)
-#define S3C2412_IISFIC			(0x08)
-#define S3C2412_IISPSR			(0x0C)
-#define S3C2412_IISTXD			(0x10)
-#define S3C2412_IISRXD			(0x14)
-
-#define S3C2412_IISCON_LRINDEX		(1 << 11)
-#define S3C2412_IISCON_TXFIFO_EMPTY	(1 << 10)
-#define S3C2412_IISCON_RXFIFO_EMPTY	(1 << 9)
-#define S3C2412_IISCON_TXFIFO_FULL	(1 << 8)
-#define S3C2412_IISCON_RXFIFO_FULL	(1 << 7)
-#define S3C2412_IISCON_TXDMA_PAUSE	(1 << 6)
-#define S3C2412_IISCON_RXDMA_PAUSE	(1 << 5)
-#define S3C2412_IISCON_TXCH_PAUSE	(1 << 4)
-#define S3C2412_IISCON_RXCH_PAUSE	(1 << 3)
-#define S3C2412_IISCON_TXDMA_ACTIVE	(1 << 2)
-#define S3C2412_IISCON_RXDMA_ACTIVE	(1 << 1)
-#define S3C2412_IISCON_IIS_ACTIVE	(1 << 0)
-
-#define S3C2412_IISMOD_MASTER_INTERNAL	(0 << 10)
-#define S3C2412_IISMOD_MASTER_EXTERNAL	(1 << 10)
-#define S3C2412_IISMOD_SLAVE		(2 << 10)
-#define S3C2412_IISMOD_MASTER_MASK	(3 << 10)
-#define S3C2412_IISMOD_MODE_TXONLY	(0 << 8)
-#define S3C2412_IISMOD_MODE_RXONLY	(1 << 8)
-#define S3C2412_IISMOD_MODE_TXRX	(2 << 8)
-#define S3C2412_IISMOD_MODE_MASK	(3 << 8)
-#define S3C2412_IISMOD_LR_LLOW		(0 << 7)
-#define S3C2412_IISMOD_LR_RLOW		(1 << 7)
-#define S3C2412_IISMOD_SDF_IIS		(0 << 5)
-#define S3C2412_IISMOD_SDF_MSB		(0 << 5)
-#define S3C2412_IISMOD_SDF_LSB		(0 << 5)
-#define S3C2412_IISMOD_SDF_MASK		(3 << 5)
-#define S3C2412_IISMOD_RCLK_256FS	(0 << 3)
-#define S3C2412_IISMOD_RCLK_512FS	(1 << 3)
-#define S3C2412_IISMOD_RCLK_384FS	(2 << 3)
-#define S3C2412_IISMOD_RCLK_768FS	(3 << 3)
-#define S3C2412_IISMOD_RCLK_MASK 	(3 << 3)
-#define S3C2412_IISMOD_BCLK_32FS	(0 << 1)
-#define S3C2412_IISMOD_BCLK_48FS	(1 << 1)
-#define S3C2412_IISMOD_BCLK_16FS	(2 << 1)
-#define S3C2412_IISMOD_BCLK_24FS	(3 << 1)
-#define S3C2412_IISMOD_BCLK_MASK	(3 << 1)
-#define S3C2412_IISMOD_8BIT		(1 << 0)
-
-#define S3C2412_IISPSR_PSREN		(1 << 15)
-
-#define S3C2412_IISFIC_TXFLUSH		(1 << 15)
-#define S3C2412_IISFIC_RXFLUSH		(1 << 7)
-#define S3C2412_IISFIC_TXCOUNT(x)	(((x) >>  8) & 0xf)
-#define S3C2412_IISFIC_RXCOUNT(x)	(((x) >>  0) & 0xf)
-
-
-
-#endif /* __ASM_ARCH_REGS_S3C2412_IIS_H */
-
diff --git a/sound/soc/s3c24xx/neo1973_wm8753.c b/sound/soc/s3c24xx/neo1973_wm8753.c
index 45bb12e..286ff44 100644
--- a/sound/soc/s3c24xx/neo1973_wm8753.c
+++ b/sound/soc/s3c24xx/neo1973_wm8753.c
@@ -33,7 +33,7 @@
 #include <linux/io.h>
 #include <mach/spi-gpio.h>
 
-#include <asm/plat-s3c24xx/regs-iis.h>
+#include <plat/regs-iis.h>
 
 #include "../codecs/wm8753.h"
 #include "lm4857.h"
diff --git a/sound/soc/s3c24xx/s3c2412-i2s.c b/sound/soc/s3c24xx/s3c2412-i2s.c
index f3fc0ab..36b927d 100644
--- a/sound/soc/s3c24xx/s3c2412-i2s.c
+++ b/sound/soc/s3c24xx/s3c2412-i2s.c
@@ -22,6 +22,7 @@
 #include <linux/delay.h>
 #include <linux/clk.h>
 #include <linux/kernel.h>
+#include <linux/io.h>
 
 #include <sound/core.h>
 #include <sound/pcm.h>
@@ -30,10 +31,7 @@
 #include <sound/soc.h>
 #include <mach/hardware.h>
 
-#include <linux/io.h>
-#include <asm/dma.h>
-
-#include <asm/plat-s3c24xx/regs-s3c2412-iis.h>
+#include <plat/regs-s3c2412-iis.h>
 
 #include <mach/regs-gpio.h>
 #include <mach/audio.h>
diff --git a/sound/soc/s3c24xx/s3c24xx-i2s.c b/sound/soc/s3c24xx/s3c24xx-i2s.c
index 6f4d439..2569b91 100644
--- a/sound/soc/s3c24xx/s3c24xx-i2s.c
+++ b/sound/soc/s3c24xx/s3c24xx-i2s.c
@@ -34,7 +34,7 @@
 #include <asm/dma.h>
 #include <mach/dma.h>
 
-#include <asm/plat-s3c24xx/regs-iis.h>
+#include <plat/regs-iis.h>
 
 #include "s3c24xx-pcm.h"
 #include "s3c24xx-i2s.h"
diff --git a/sound/soc/s3c24xx/s3c24xx_uda134x.c b/sound/soc/s3c24xx/s3c24xx_uda134x.c
index a0a4d18..8e79a41 100644
--- a/sound/soc/s3c24xx/s3c24xx_uda134x.c
+++ b/sound/soc/s3c24xx/s3c24xx_uda134x.c
@@ -22,7 +22,7 @@
 #include <sound/s3c24xx_uda134x.h>
 #include <sound/uda134x.h>
 
-#include <asm/plat-s3c24xx/regs-iis.h>
+#include <plat/regs-iis.h>
 
 #include "s3c24xx-pcm.h"
 #include "s3c24xx-i2s.h"

-- 
Ben (ben@fluff.org, http://www.fluff.org/)

  'a smiley only costs 4 bytes'

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

* [patch 2/9] JIVE: Add ASoC audio support
  2009-03-04  0:49 [patch 0/9] S3C24XX/S3C64XX updates Ben Dooks
  2009-03-04  0:49 ` [patch 1/9] S3C24XX: Move and update IIS headers Ben Dooks
@ 2009-03-04  0:49 ` Ben Dooks
  2009-03-04 14:57   ` Mark Brown
  2009-03-04  0:49 ` [patch 3/9] S3C: Move <mach/audio.h> to <plat/audio.h> Ben Dooks
                   ` (7 subsequent siblings)
  9 siblings, 1 reply; 24+ messages in thread
From: Ben Dooks @ 2009-03-04  0:49 UTC (permalink / raw)
  To: alsa-devel; +Cc: broonie

[-- Attachment #1: audio/jive-audio-alsa.patch --]
[-- Type: text/plain, Size: 7744 bytes --]

From: Ben Dooks <ben@simtec.co.uk>

Add support for the Jive's WM8750 codec attached via the S3C2412 IIS.

Signed-off-by: Ben Dooks <ben@simtec.co.uk>

Index: linux.git/sound/soc/s3c24xx/Kconfig
===================================================================
--- linux.git.orig/sound/soc/s3c24xx/Kconfig	2009-01-24 19:45:32.000000000 +0000
+++ linux.git/sound/soc/s3c24xx/Kconfig	2009-01-24 20:10:46.000000000 +0000
@@ -26,6 +26,15 @@ config SND_S3C24XX_SOC_NEO1973_WM8753
 	  Say Y if you want to add support for SoC audio on smdk2440
 	  with the WM8753.
 
+config SND_S3C24XX_SOC_JIVE_WM8750
+	tristate "SoC I2S Audio support for Jive"
+	depends on SND_S3C24XX_SOC && MACH_JIVE
+	select SND_SOC_WM8750
+	select SND_SOC_WM8750_SPI
+	select SND_S3C2412_SOC_I2S
+	help
+	  Sat Y if you want to add support for SoC audio on the Jive.
+
 config SND_S3C24XX_SOC_SMDK2443_WM9710
 	tristate "SoC AC97 Audio support for SMDK2443 - WM9710"
 	depends on SND_S3C24XX_SOC && MACH_SMDK2443
Index: linux.git/sound/soc/s3c24xx/Makefile
===================================================================
--- linux.git.orig/sound/soc/s3c24xx/Makefile	2009-01-15 21:41:03.000000000 +0000
+++ linux.git/sound/soc/s3c24xx/Makefile	2009-01-24 20:10:46.000000000 +0000
@@ -10,11 +10,13 @@ obj-$(CONFIG_SND_S3C2443_SOC_AC97) += sn
 obj-$(CONFIG_SND_S3C2412_SOC_I2S) += snd-soc-s3c2412-i2s.o
 
 # S3C24XX Machine Support
+snd-soc-jive-wm8750-objs := jive_wm8750.o
 snd-soc-neo1973-wm8753-objs := neo1973_wm8753.o
 snd-soc-smdk2443-wm9710-objs := smdk2443_wm9710.o
 snd-soc-ln2440sbc-alc650-objs := ln2440sbc_alc650.o
 snd-soc-s3c24xx-uda134x-objs := s3c24xx_uda134x.o
 
+obj-$(CONFIG_SND_S3C24XX_SOC_JIVE_WM8750) += snd-soc-jive-wm8750.o
 obj-$(CONFIG_SND_S3C24XX_SOC_NEO1973_WM8753) += snd-soc-neo1973-wm8753.o
 obj-$(CONFIG_SND_S3C24XX_SOC_SMDK2443_WM9710) += snd-soc-smdk2443-wm9710.o
 obj-$(CONFIG_SND_S3C24XX_SOC_LN2440SBC_ALC650) += snd-soc-ln2440sbc-alc650.o
Index: linux.git/sound/soc/s3c24xx/jive_wm8750.c
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ linux.git/sound/soc/s3c24xx/jive_wm8750.c	2009-01-24 20:13:32.000000000 +0000
@@ -0,0 +1,216 @@
+/* sound/soc/s3c24xx/jive_wm8750.c
+ *
+ * Copyright 2007,2008 Simtec Electronics
+ *
+ * Based on sound/soc/pxa/spitz.c
+ *	Copyright 2005 Wolfson Microelectronics PLC.
+ *	Copyright 2005 Openedhand Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+*/
+
+#include <linux/module.h>
+#include <linux/moduleparam.h>
+#include <linux/timer.h>
+#include <linux/interrupt.h>
+#include <linux/platform_device.h>
+#include <linux/clk.h>
+
+#include <sound/core.h>
+#include <sound/pcm.h>
+#include <sound/soc.h>
+#include <sound/soc-dapm.h>
+
+#include <asm/mach-types.h>
+
+#include "s3c24xx-pcm.h"
+#include "s3c2412-i2s.h"
+
+#include "../codecs/wm8750.h"
+
+static const struct snd_soc_dapm_route audio_map[] = {
+	{ "Headphone Jack", NULL, "LOUT1" },
+	{ "Headphone Jack", NULL, "ROUT1" },
+	{ "Internal Speaker", NULL, "LOUT2" },
+	{ "Internal Speaker", NULL, "ROUT2" },
+	{ "LINPUT1", NULL, "Line Input" },
+	{ "RINPUT1", NULL, "Line Input" },
+};
+
+static const struct snd_soc_dapm_widget wm8750_dapm_widgets[] = {
+	SND_SOC_DAPM_HP("Headphone Jack", NULL),
+	SND_SOC_DAPM_SPK("Internal Speaker", NULL),
+	SND_SOC_DAPM_LINE("Line In", NULL),
+};
+
+static int jive_startup(struct snd_pcm_substream *substream)
+{
+	struct snd_soc_pcm_runtime *rtd = substream->private_data;
+	struct snd_soc_codec *codec = rtd->socdev->codec;
+
+	snd_soc_dapm_enable_pin(codec, "Headphone Jack");
+	snd_soc_dapm_enable_pin(codec, "Internal Speaker");
+	snd_soc_dapm_enable_pin(codec, "Line In");
+
+	snd_soc_dapm_sync(codec);
+
+	return 0;
+}
+
+static int jive_hw_params(struct snd_pcm_substream *substream,
+			  struct snd_pcm_hw_params *params)
+{
+	struct snd_soc_pcm_runtime *rtd = substream->private_data;
+	struct snd_soc_dai *codec_dai = rtd->dai->codec_dai;
+	struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai;
+	struct s3c2412_rate_calc div;
+	unsigned int clk = 0;
+	int ret = 0;
+
+	switch (params_rate(params)) {
+	case 8000:
+	case 16000:
+	case 48000:
+	case 96000:
+		clk = 12288000;
+		break;
+	case 11025:
+	case 22050:
+	case 44100:
+		clk = 11289600;
+		break;
+	}
+
+	s3c2412_iis_calc_rate(&div, NULL, params_rate(params),
+			      s3c2412_get_iisclk());
+
+	/* set codec DAI configuration */
+	ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S |
+				  SND_SOC_DAIFMT_NB_NF |
+				  SND_SOC_DAIFMT_CBS_CFS);
+	if (ret < 0)
+		return ret;
+
+	/* set cpu DAI configuration */
+	ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S |
+				  SND_SOC_DAIFMT_NB_NF |
+				  SND_SOC_DAIFMT_CBS_CFS);
+	if (ret < 0)
+		return ret;
+
+	/* set the codec system clock for DAC and ADC */
+	ret = snd_soc_dai_set_sysclk(codec_dai, WM8750_SYSCLK, clk,
+				     SND_SOC_CLOCK_IN);
+	if (ret < 0)
+		return ret;
+
+	ret = snd_soc_dai_set_clkdiv(cpu_dai, S3C2412_DIV_RCLK, div.fs_div);
+	if (ret < 0)
+		return ret;
+
+	ret = snd_soc_dai_set_clkdiv(cpu_dai, S3C2412_DIV_PRESCALER,
+				     div.clk_div - 1);
+	if (ret < 0)
+		return ret;
+
+	return 0;
+}
+
+static struct snd_soc_ops jive_ops = {
+	.startup	= jive_startup,
+	.hw_params	= jive_hw_params,
+};
+
+static int jive_wm8750_init(struct snd_soc_codec *codec)
+{
+	int err;
+
+	/* These endpoints are not being used. */
+	snd_soc_dapm_disable_pin(codec, "LINPUT2");
+	snd_soc_dapm_disable_pin(codec, "RINPUT2");
+	snd_soc_dapm_disable_pin(codec, "LINPUT3");
+	snd_soc_dapm_disable_pin(codec, "RINPUT3");
+	snd_soc_dapm_disable_pin(codec, "OUT3");
+	snd_soc_dapm_disable_pin(codec, "MONO");
+
+	/* Add jive specific widgets */
+	err = snd_soc_dapm_new_controls(codec, wm8750_dapm_widgets,
+					ARRAY_SIZE(wm8750_dapm_widgets));
+	if (err) {
+		printk(KERN_ERR "%s: failed to add widgets (%d)\n",
+		       __func__, err);
+		return err;
+	}
+
+	snd_soc_dapm_add_routes(codec, audio_map, ARRAY_SIZE(audio_map));
+	snd_soc_dapm_sync(codec);
+
+	return 0;
+}
+
+static struct snd_soc_dai_link jive_dai = {
+	.name		= "wm8750",
+	.stream_name	= "WM8750",
+	.cpu_dai	= &s3c2412_i2s_dai,
+	.codec_dai	= &wm8750_dai,
+	.init		= jive_wm8750_init,
+	.ops		= &jive_ops,
+};
+
+/* jive audio machine driver */
+static struct snd_soc_machine snd_soc_machine_jive = {
+	.name		= "Jive",
+	.dai_link	= &jive_dai,
+	.num_links	= 1,
+};
+
+/* jive audio private data */
+static struct wm8750_setup_data jive_wm8750_setup = {
+};
+
+/* jive audio subsystem */
+static struct snd_soc_device jive_snd_devdata = {
+	.machine	= &snd_soc_machine_jive,
+	.platform	= &s3c24xx_soc_platform,
+	.codec_dev	= &soc_codec_dev_wm8750_spi,
+	.codec_data	= &jive_wm8750_setup,
+};
+
+static struct platform_device *jive_snd_device;
+
+static int __init jive_init(void)
+{
+	int ret;
+
+	if (!machine_is_jive())
+		return 0;
+
+	printk("JIVE WM8750 Audio support\n");
+
+	jive_snd_device = platform_device_alloc("soc-audio", -1);
+	if (!jive_snd_device)
+		return -ENOMEM;
+
+	platform_set_drvdata(jive_snd_device, &jive_snd_devdata);
+	jive_snd_devdata.dev = &jive_snd_device->dev;
+	ret = platform_device_add(jive_snd_device);
+
+	if (ret)
+		platform_device_put(jive_snd_device);
+
+	return ret;
+}
+
+static void __exit jive_exit(void)
+{
+	platform_device_unregister(jive_snd_device);
+}
+
+module_init(jive_init);
+module_exit(jive_exit);
+
+MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>");
+MODULE_DESCRIPTION("ALSA SoC Jive Audio support");
+MODULE_LICENSE("GPL");

-- 
Ben (ben@fluff.org, http://www.fluff.org/)

  'a smiley only costs 4 bytes'

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

* [patch 3/9] S3C: Move <mach/audio.h> to <plat/audio.h>
  2009-03-04  0:49 [patch 0/9] S3C24XX/S3C64XX updates Ben Dooks
  2009-03-04  0:49 ` [patch 1/9] S3C24XX: Move and update IIS headers Ben Dooks
  2009-03-04  0:49 ` [patch 2/9] JIVE: Add ASoC audio support Ben Dooks
@ 2009-03-04  0:49 ` Ben Dooks
  2009-03-04  0:49 ` [patch 4/9] S3C24XX ASoC: Fix copyright statements on Simtec files Ben Dooks
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 24+ messages in thread
From: Ben Dooks @ 2009-03-04  0:49 UTC (permalink / raw)
  To: alsa-devel; +Cc: broonie

[-- Attachment #1: audio/move-mach-audio-header.patch --]
[-- Type: text/plain, Size: 6330 bytes --]

From: Ben Dooks <ben@simtec.co.uk>

The <mach/audio.h> file needs to be common to both ARCH_S3C2410 and
ARCH_S3C64XX as they share common driver code, so move it to <plat/audio.h>.

Signed-off-by: Ben Dooks <ben@simtec.co.uk>

 Index: linux.git/arch/arm/mach-s3c2410/include/mach/audio.h
===================================================================
Index: linux.git/arch/arm/mach-s3c2410/include/mach/audio.h
===================================================================
--- linux.git.orig/arch/arm/mach-s3c2410/include/mach/audio.h	2009-01-15 15:17:05.000000000 +0000
+++ /dev/null	1970-01-01 00:00:00.000000000 +0000
@@ -1,45 +0,0 @@
-/* arch/arm/mach-s3c2410/include/mach/audio.h
- *
- * Copyright (c) 2004-2005 Simtec Electronics
- *	http://www.simtec.co.uk/products/SWLINUX/
- *	Ben Dooks <ben@simtec.co.uk>
- *
- * S3C24XX - Audio platfrom_device info
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
-*/
-
-#ifndef __ASM_ARCH_AUDIO_H
-#define __ASM_ARCH_AUDIO_H __FILE__
-
-/* struct s3c24xx_iis_ops
- *
- * called from the s3c24xx audio core to deal with the architecture
- * or the codec's setup and control.
- *
- * the pointer to itself is passed through in case the caller wants to
- * embed this in an larger structure for easy reference to it's context.
-*/
-
-struct s3c24xx_iis_ops {
-	struct module *owner;
-
-	int	(*startup)(struct s3c24xx_iis_ops *me);
-	void	(*shutdown)(struct s3c24xx_iis_ops *me);
-	int	(*suspend)(struct s3c24xx_iis_ops *me);
-	int	(*resume)(struct s3c24xx_iis_ops *me);
-
-	int	(*open)(struct s3c24xx_iis_ops *me, struct snd_pcm_substream *strm);
-	int	(*close)(struct s3c24xx_iis_ops *me, struct snd_pcm_substream *strm);
-	int	(*prepare)(struct s3c24xx_iis_ops *me, struct snd_pcm_substream *strm, struct snd_pcm_runtime *rt);
-};
-
-struct s3c24xx_platdata_iis {
-	const char		*codec_clk;
-	struct s3c24xx_iis_ops	*ops;
-	int			(*match_dev)(struct device *dev);
-};
-
-#endif /* __ASM_ARCH_AUDIO_H */
Index: linux.git/arch/arm/plat-s3c/include/plat/audio.h
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ linux.git/arch/arm/plat-s3c/include/plat/audio.h	2009-01-19 11:56:35.000000000 +0000
@@ -0,0 +1,45 @@
+/* arch/arm/mach-s3c2410/include/mach/audio.h
+ *
+ * Copyright (c) 2004-2005 Simtec Electronics
+ *	http://www.simtec.co.uk/products/SWLINUX/
+ *	Ben Dooks <ben@simtec.co.uk>
+ *
+ * S3C24XX - Audio platfrom_device info
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+*/
+
+#ifndef __ASM_ARCH_AUDIO_H
+#define __ASM_ARCH_AUDIO_H __FILE__
+
+/* struct s3c24xx_iis_ops
+ *
+ * called from the s3c24xx audio core to deal with the architecture
+ * or the codec's setup and control.
+ *
+ * the pointer to itself is passed through in case the caller wants to
+ * embed this in an larger structure for easy reference to it's context.
+*/
+
+struct s3c24xx_iis_ops {
+	struct module *owner;
+
+	int	(*startup)(struct s3c24xx_iis_ops *me);
+	void	(*shutdown)(struct s3c24xx_iis_ops *me);
+	int	(*suspend)(struct s3c24xx_iis_ops *me);
+	int	(*resume)(struct s3c24xx_iis_ops *me);
+
+	int	(*open)(struct s3c24xx_iis_ops *me, struct snd_pcm_substream *strm);
+	int	(*close)(struct s3c24xx_iis_ops *me, struct snd_pcm_substream *strm);
+	int	(*prepare)(struct s3c24xx_iis_ops *me, struct snd_pcm_substream *strm, struct snd_pcm_runtime *rt);
+};
+
+struct s3c24xx_platdata_iis {
+	const char		*codec_clk;
+	struct s3c24xx_iis_ops	*ops;
+	int			(*match_dev)(struct device *dev);
+};
+
+#endif /* __ASM_ARCH_AUDIO_H */
Index: linux.git/sound/soc/s3c24xx/neo1973_wm8753.c
===================================================================
--- linux.git.orig/sound/soc/s3c24xx/neo1973_wm8753.c	2009-01-19 11:56:33.000000000 +0000
+++ linux.git/sound/soc/s3c24xx/neo1973_wm8753.c	2009-01-19 11:56:35.000000000 +0000
@@ -29,7 +29,7 @@
 #include <mach/regs-clock.h>
 #include <mach/regs-gpio.h>
 #include <mach/hardware.h>
-#include <mach/audio.h>
+#include <plat/audio.h>
 #include <linux/io.h>
 #include <mach/spi-gpio.h>
 
Index: linux.git/sound/soc/s3c24xx/s3c2412-i2s.c
===================================================================
--- linux.git.orig/sound/soc/s3c24xx/s3c2412-i2s.c	2009-01-19 11:56:33.000000000 +0000
+++ linux.git/sound/soc/s3c24xx/s3c2412-i2s.c	2009-01-19 11:56:39.000000000 +0000
@@ -34,7 +34,7 @@
 #include <plat/regs-s3c2412-iis.h>
 
 #include <mach/regs-gpio.h>
-#include <mach/audio.h>
+#include <plat/audio.h>
 #include <mach/dma.h>
 
 #include "s3c24xx-pcm.h"
Index: linux.git/sound/soc/s3c24xx/s3c2443-ac97.c
===================================================================
--- linux.git.orig/sound/soc/s3c24xx/s3c2443-ac97.c	2009-01-15 21:41:03.000000000 +0000
+++ linux.git/sound/soc/s3c24xx/s3c2443-ac97.c	2009-01-19 11:56:35.000000000 +0000
@@ -31,7 +31,7 @@
 #include <plat/regs-ac97.h>
 #include <mach/regs-gpio.h>
 #include <mach/regs-clock.h>
-#include <mach/audio.h>
+#include <plat/audio.h>
 #include <asm/dma.h>
 #include <mach/dma.h>
 
Index: linux.git/sound/soc/s3c24xx/s3c24xx-i2s.c
===================================================================
--- linux.git.orig/sound/soc/s3c24xx/s3c24xx-i2s.c	2009-01-19 11:56:33.000000000 +0000
+++ linux.git/sound/soc/s3c24xx/s3c24xx-i2s.c	2009-01-19 11:56:35.000000000 +0000
@@ -30,7 +30,7 @@
 #include <mach/hardware.h>
 #include <mach/regs-gpio.h>
 #include <mach/regs-clock.h>
-#include <mach/audio.h>
+#include <plat/audio.h>
 #include <asm/dma.h>
 #include <mach/dma.h>
 
Index: linux.git/sound/soc/s3c24xx/s3c24xx-pcm.c
===================================================================
--- linux.git.orig/sound/soc/s3c24xx/s3c24xx-pcm.c	2009-01-15 21:41:03.000000000 +0000
+++ linux.git/sound/soc/s3c24xx/s3c24xx-pcm.c	2009-01-19 11:56:35.000000000 +0000
@@ -29,7 +29,7 @@
 #include <asm/dma.h>
 #include <mach/hardware.h>
 #include <mach/dma.h>
-#include <mach/audio.h>
+#include <plat/audio.h>
 
 #include "s3c24xx-pcm.h"
 

-- 
Ben (ben@fluff.org, http://www.fluff.org/)

  'a smiley only costs 4 bytes'

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

* [patch 4/9] S3C24XX ASoC: Fix copyright statements on Simtec files
  2009-03-04  0:49 [patch 0/9] S3C24XX/S3C64XX updates Ben Dooks
                   ` (2 preceding siblings ...)
  2009-03-04  0:49 ` [patch 3/9] S3C: Move <mach/audio.h> to <plat/audio.h> Ben Dooks
@ 2009-03-04  0:49 ` Ben Dooks
  2009-03-04 19:20   ` Mark Brown
  2009-03-04  0:49 ` [patch 5/9] S3C: Split s3c2412-i2s.c into core and SoC specific parts Ben Dooks
                   ` (5 subsequent siblings)
  9 siblings, 1 reply; 24+ messages in thread
From: Ben Dooks @ 2009-03-04  0:49 UTC (permalink / raw)
  To: alsa-devel; +Cc: broonie

[-- Attachment #1: audio/audio-fix-copyright.patch --]
[-- Type: text/plain, Size: 1424 bytes --]

From: Ben Dooks <ben@simtec.co.uk>

Fix the copyright statements in two of the S3C24XX ASoC files
that have (c) when we require the full word.

Signed-off-by: Ben Dooks <ben@simtec.co.uk>

Index: linux.git/sound/soc/s3c24xx/s3c24xx-i2s.c
===================================================================
--- linux.git.orig/sound/soc/s3c24xx/s3c24xx-i2s.c	2009-01-19 12:41:52.000000000 +0000
+++ linux.git/sound/soc/s3c24xx/s3c24xx-i2s.c	2009-01-19 12:41:57.000000000 +0000
@@ -4,7 +4,7 @@
  * (c) 2006 Wolfson Microelectronics PLC.
  * Graeme Gregory graeme.gregory@wolfsonmicro.com or linux@wolfsonmicro.com
  *
- * (c) 2004-2005 Simtec Electronics
+ * Copyright 2004-2005 Simtec Electronics
  *	http://armlinux.simtec.co.uk/
  *	Ben Dooks <ben@simtec.co.uk>
  *
Index: linux.git/sound/soc/s3c24xx/s3c24xx-pcm.c
===================================================================
--- linux.git.orig/sound/soc/s3c24xx/s3c24xx-pcm.c	2009-01-19 12:41:23.000000000 +0000
+++ linux.git/sound/soc/s3c24xx/s3c24xx-pcm.c	2009-01-19 12:41:43.000000000 +0000
@@ -4,7 +4,7 @@
  * (c) 2006 Wolfson Microelectronics PLC.
  * Graeme Gregory graeme.gregory@wolfsonmicro.com or linux@wolfsonmicro.com
  *
- * (c) 2004-2005 Simtec Electronics
+ * Copyright 2004-2005 Simtec Electronics
  *	http://armlinux.simtec.co.uk/
  *	Ben Dooks <ben@simtec.co.uk>
  *

-- 
Ben (ben@fluff.org, http://www.fluff.org/)

  'a smiley only costs 4 bytes'

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

* [patch 5/9] S3C: Split s3c2412-i2s.c into core and SoC specific parts
  2009-03-04  0:49 [patch 0/9] S3C24XX/S3C64XX updates Ben Dooks
                   ` (3 preceding siblings ...)
  2009-03-04  0:49 ` [patch 4/9] S3C24XX ASoC: Fix copyright statements on Simtec files Ben Dooks
@ 2009-03-04  0:49 ` Ben Dooks
  2009-03-04 19:52   ` Mark Brown
  2009-03-04  0:49 ` [patch 6/9] S3C64XX: Add s3c64xx-i2s support Ben Dooks
                   ` (4 subsequent siblings)
  9 siblings, 1 reply; 24+ messages in thread
From: Ben Dooks @ 2009-03-04  0:49 UTC (permalink / raw)
  To: alsa-devel; +Cc: broonie

[-- Attachment #1: audio/split-s3c2412-iis.patch --]
[-- Type: text/plain, Size: 41420 bytes --]

From: Ben Dooks <ben@simtec.co.uk>

The S3C2412 I2S (IIS) interface is replicated on further Samsung SoC
parts in a broadly compatible way, so split the common code out into
a core called s3c-i2s-v2.[ch] so that the newer SoCs such as the
S3C6410 can make use of it.

As such, all the original s3c2412 functions are currently being left
with their original names, and will be renamed later in the series.

Signed-off-by: Ben Dooks <ben@simtec.co.uk>

Index: linux.git/sound/soc/s3c24xx/s3c-i2s-v2.c
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ linux.git/sound/soc/s3c24xx/s3c-i2s-v2.c	2009-02-28 20:58:09.000000000 +0000
@@ -0,0 +1,645 @@
+/* sound/soc/s3c24xx/s3c-i2c-v2.c
+ *
+ * ALSA Soc Audio Layer - I2S core for newer Samsung SoCs.
+ *
+ * Copyright (c) 2006 Wolfson Microelectronics PLC.
+ *	Graeme Gregory graeme.gregory@wolfsonmicro.com
+ *	linux@wolfsonmicro.com
+ *
+ * Copyright (c) 2008, 2007, 2004-2005 Simtec Electronics
+ *	http://armlinux.simtec.co.uk/
+ *	Ben Dooks <ben@simtec.co.uk>
+ *
+ * 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
+ * option) any later version.
+ */
+
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/device.h>
+#include <linux/delay.h>
+#include <linux/clk.h>
+#include <linux/kernel.h>
+#include <linux/io.h>
+
+#include <sound/core.h>
+#include <sound/pcm.h>
+#include <sound/pcm_params.h>
+#include <sound/initval.h>
+#include <sound/soc.h>
+
+#include <plat/regs-s3c2412-iis.h>
+
+#include <plat/audio.h>
+#include <mach/dma.h>
+
+#include "s3c-i2s-v2.h"
+
+#define S3C2412_I2S_DEBUG_CON 0
+#define S3C2412_I2S_DEBUG 0
+
+#if S3C2412_I2S_DEBUG
+#define DBG(x...) printk(KERN_INFO x)
+#else
+#define DBG(x...) do { } while (0)
+#endif
+
+static inline struct s3c_i2sv2_info *to_info(struct snd_soc_dai *cpu_dai)
+{
+	return cpu_dai->private_data;
+}
+
+#define bit_set(v, b) (((v) & (b)) ? 1 : 0)
+
+#if S3C2412_I2S_DEBUG_CON
+static void dbg_showcon(const char *fn, u32 con)
+{
+	printk(KERN_DEBUG "%s: LRI=%d, TXFEMPT=%d, RXFEMPT=%d, TXFFULL=%d, RXFFULL=%d\n", fn,
+	       bit_set(con, S3C2412_IISCON_LRINDEX),
+	       bit_set(con, S3C2412_IISCON_TXFIFO_EMPTY),
+	       bit_set(con, S3C2412_IISCON_RXFIFO_EMPTY),
+	       bit_set(con, S3C2412_IISCON_TXFIFO_FULL),
+	       bit_set(con, S3C2412_IISCON_RXFIFO_FULL));
+
+	printk(KERN_DEBUG "%s: PAUSE: TXDMA=%d, RXDMA=%d, TXCH=%d, RXCH=%d\n",
+	       fn,
+	       bit_set(con, S3C2412_IISCON_TXDMA_PAUSE),
+	       bit_set(con, S3C2412_IISCON_RXDMA_PAUSE),
+	       bit_set(con, S3C2412_IISCON_TXCH_PAUSE),
+	       bit_set(con, S3C2412_IISCON_RXCH_PAUSE));
+	printk(KERN_DEBUG "%s: ACTIVE: TXDMA=%d, RXDMA=%d, IIS=%d\n", fn,
+	       bit_set(con, S3C2412_IISCON_TXDMA_ACTIVE),
+	       bit_set(con, S3C2412_IISCON_RXDMA_ACTIVE),
+	       bit_set(con, S3C2412_IISCON_IIS_ACTIVE));
+}
+#else
+static inline void dbg_showcon(const char *fn, u32 con)
+{
+}
+#endif
+
+
+/* Turn on or off the transmission path. */
+void s3c2412_snd_txctrl(struct s3c_i2sv2_info *i2s, int on)
+{
+	void __iomem *regs = i2s->regs;
+	u32 fic, con, mod;
+
+	DBG("%s(%d)\n", __func__, on);
+
+	fic = readl(regs + S3C2412_IISFIC);
+	con = readl(regs + S3C2412_IISCON);
+	mod = readl(regs + S3C2412_IISMOD);
+
+	DBG("%s: IIS: CON=%x MOD=%x FIC=%x\n", __func__, con, mod, fic);
+
+	if (on) {
+		con |= S3C2412_IISCON_TXDMA_ACTIVE | S3C2412_IISCON_IIS_ACTIVE;
+		con &= ~S3C2412_IISCON_TXDMA_PAUSE;
+		con &= ~S3C2412_IISCON_TXCH_PAUSE;
+
+		switch (mod & S3C2412_IISMOD_MODE_MASK) {
+		case S3C2412_IISMOD_MODE_TXONLY:
+		case S3C2412_IISMOD_MODE_TXRX:
+			/* do nothing, we are in the right mode */
+			break;
+
+		case S3C2412_IISMOD_MODE_RXONLY:
+			mod &= ~S3C2412_IISMOD_MODE_MASK;
+			mod |= S3C2412_IISMOD_MODE_TXRX;
+			break;
+
+		default:
+			dev_err(i2s->dev, "TXEN: Invalid MODE in IISMOD\n");
+		}
+
+		writel(con, regs + S3C2412_IISCON);
+		writel(mod, regs + S3C2412_IISMOD);
+	} else {
+		/* Note, we do not have any indication that the FIFO problems
+		 * tha the S3C2410/2440 had apply here, so we should be able
+		 * to disable the DMA and TX without resetting the FIFOS.
+		 */
+
+		con |=  S3C2412_IISCON_TXDMA_PAUSE;
+		con |=  S3C2412_IISCON_TXCH_PAUSE;
+		con &= ~S3C2412_IISCON_TXDMA_ACTIVE;
+
+		switch (mod & S3C2412_IISMOD_MODE_MASK) {
+		case S3C2412_IISMOD_MODE_TXRX:
+			mod &= ~S3C2412_IISMOD_MODE_MASK;
+			mod |= S3C2412_IISMOD_MODE_RXONLY;
+			break;
+
+		case S3C2412_IISMOD_MODE_TXONLY:
+			mod &= ~S3C2412_IISMOD_MODE_MASK;
+			con &= ~S3C2412_IISCON_IIS_ACTIVE;
+			break;
+
+		default:
+			dev_err(i2s->dev, "TXDIS: Invalid MODE in IISMOD\n");
+		}
+
+		writel(mod, regs + S3C2412_IISMOD);
+		writel(con, regs + S3C2412_IISCON);
+	}
+
+	fic = readl(regs + S3C2412_IISFIC);
+	dbg_showcon(__func__, con);
+	DBG("%s: IIS: CON=%x MOD=%x FIC=%x\n", __func__, con, mod, fic);
+}
+EXPORT_SYMBOL_GPL(s3c2412_snd_txctrl);
+
+void s3c2412_snd_rxctrl(struct s3c_i2sv2_info *i2s, int on)
+{
+	void __iomem *regs = i2s->regs;
+	u32 fic, con, mod;
+
+	DBG("%s(%d)\n", __func__, on);
+
+	fic = readl(regs + S3C2412_IISFIC);
+	con = readl(regs + S3C2412_IISCON);
+	mod = readl(regs + S3C2412_IISMOD);
+
+	DBG("%s: IIS: CON=%x MOD=%x FIC=%x\n", __func__, con, mod, fic);
+
+	if (on) {
+		con |= S3C2412_IISCON_RXDMA_ACTIVE | S3C2412_IISCON_IIS_ACTIVE;
+		con &= ~S3C2412_IISCON_RXDMA_PAUSE;
+		con &= ~S3C2412_IISCON_RXCH_PAUSE;
+
+		switch (mod & S3C2412_IISMOD_MODE_MASK) {
+		case S3C2412_IISMOD_MODE_TXRX:
+		case S3C2412_IISMOD_MODE_RXONLY:
+			/* do nothing, we are in the right mode */
+			break;
+
+		case S3C2412_IISMOD_MODE_TXONLY:
+			mod &= ~S3C2412_IISMOD_MODE_MASK;
+			mod |= S3C2412_IISMOD_MODE_TXRX;
+			break;
+
+		default:
+			dev_err(i2s->dev, "RXEN: Invalid MODE in IISMOD\n");
+		}
+
+		writel(mod, regs + S3C2412_IISMOD);
+		writel(con, regs + S3C2412_IISCON);
+	} else {
+		/* See txctrl notes on FIFOs. */
+
+		con &= ~S3C2412_IISCON_RXDMA_ACTIVE;
+		con |=  S3C2412_IISCON_RXDMA_PAUSE;
+		con |=  S3C2412_IISCON_RXCH_PAUSE;
+
+		switch (mod & S3C2412_IISMOD_MODE_MASK) {
+		case S3C2412_IISMOD_MODE_RXONLY:
+			con &= ~S3C2412_IISCON_IIS_ACTIVE;
+			mod &= ~S3C2412_IISMOD_MODE_MASK;
+			break;
+
+		case S3C2412_IISMOD_MODE_TXRX:
+			mod &= ~S3C2412_IISMOD_MODE_MASK;
+			mod |= S3C2412_IISMOD_MODE_TXONLY;
+			break;
+
+		default:
+			dev_err(i2s->dev, "RXEN: Invalid MODE in IISMOD\n");
+		}
+
+		writel(con, regs + S3C2412_IISCON);
+		writel(mod, regs + S3C2412_IISMOD);
+	}
+
+	fic = readl(regs + S3C2412_IISFIC);
+	DBG("%s: IIS: CON=%x MOD=%x FIC=%x\n", __func__, con, mod, fic);
+}
+EXPORT_SYMBOL_GPL(s3c2412_snd_rxctrl);
+
+/*
+ * Wait for the LR signal to allow synchronisation to the L/R clock
+ * from the codec. May only be needed for slave mode.
+ */
+static int s3c2412_snd_lrsync(struct s3c_i2sv2_info *i2s)
+{
+	u32 iiscon;
+	unsigned long timeout = jiffies + msecs_to_jiffies(5);
+
+	DBG("Entered %s\n", __func__);
+
+	while (1) {
+		iiscon = readl(i2s->regs + S3C2412_IISCON);
+		if (iiscon & S3C2412_IISCON_LRINDEX)
+			break;
+
+		if (timeout < jiffies) {
+			printk(KERN_ERR "%s: timeout\n", __func__);
+			return -ETIMEDOUT;
+		}
+	}
+
+	return 0;
+}
+
+/*
+ * Set S3C2412 I2S DAI format
+ */
+static int s3c2412_i2s_set_fmt(struct snd_soc_dai *cpu_dai,
+			       unsigned int fmt)
+{
+	struct s3c_i2sv2_info *i2s = to_info(cpu_dai);
+	u32 iismod;
+
+	DBG("Entered %s\n", __func__);
+
+	iismod = readl(i2s->regs + S3C2412_IISMOD);
+	DBG("hw_params r: IISMOD: %x \n", iismod);
+
+#if defined(CONFIG_CPU_S3C2412) || defined(CONFIG_CPU_S3C2413)
+#define IISMOD_MASTER_MASK S3C2412_IISMOD_MASTER_MASK
+#define IISMOD_SLAVE S3C2412_IISMOD_SLAVE
+#define IISMOD_MASTER S3C2412_IISMOD_MASTER_INTERNAL
+#endif
+
+#if defined(CONFIG_PLAT_S3C64XX)
+/* From Rev1.1 datasheet, we have two master and two slave modes:
+ * IMS[11:10]:
+ *	00 = master mode, fed from PCLK
+ *	01 = master mode, fed from CLKAUDIO
+ *	10 = slave mode, using PCLK
+ *	11 = slave mode, using I2SCLK
+ */
+#define IISMOD_MASTER_MASK (1 << 11)
+#define IISMOD_SLAVE (1 << 11)
+#define IISMOD_MASTER (0x0)
+#endif
+
+	switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
+	case SND_SOC_DAIFMT_CBM_CFM:
+		i2s->master = 0;
+		iismod &= ~IISMOD_MASTER_MASK;
+		iismod |= IISMOD_SLAVE;
+		break;
+	case SND_SOC_DAIFMT_CBS_CFS:
+		i2s->master = 1;
+		iismod &= ~IISMOD_MASTER_MASK;
+		iismod |= IISMOD_MASTER;
+		break;
+	default:
+		DBG("unknwon master/slave format\n");
+		return -EINVAL;
+	}
+
+	iismod &= ~S3C2412_IISMOD_SDF_MASK;
+
+	switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
+	case SND_SOC_DAIFMT_RIGHT_J:
+		iismod |= S3C2412_IISMOD_SDF_MSB;
+		break;
+	case SND_SOC_DAIFMT_LEFT_J:
+		iismod |= S3C2412_IISMOD_SDF_LSB;
+		break;
+	case SND_SOC_DAIFMT_I2S:
+		iismod |= S3C2412_IISMOD_SDF_IIS;
+		break;
+	default:
+		DBG("Unknown data format\n");
+		return -EINVAL;
+	}
+
+	writel(iismod, i2s->regs + S3C2412_IISMOD);
+	DBG("hw_params w: IISMOD: %x \n", iismod);
+	return 0;
+}
+
+static int s3c2412_i2s_hw_params(struct snd_pcm_substream *substream,
+				 struct snd_pcm_hw_params *params,
+				 struct snd_soc_dai *socdai)
+{
+	struct snd_soc_pcm_runtime *rtd = substream->private_data;
+	struct snd_soc_dai_link *dai = rtd->dai;
+	struct s3c_i2sv2_info *i2s = to_info(dai->cpu_dai);
+	u32 iismod;
+
+	DBG("Entered %s\n", __func__);
+
+	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+		dai->cpu_dai->dma_data = i2s->dma_playback;
+	else
+		dai->cpu_dai->dma_data = i2s->dma_capture;
+
+	/* Working copies of register */
+	iismod = readl(i2s->regs + S3C2412_IISMOD);
+	DBG("%s: r: IISMOD: %x\n", __func__, iismod);
+
+	switch (params_format(params)) {
+	case SNDRV_PCM_FORMAT_S8:
+		iismod |= S3C2412_IISMOD_8BIT;
+		break;
+	case SNDRV_PCM_FORMAT_S16_LE:
+		iismod &= ~S3C2412_IISMOD_8BIT;
+		break;
+	}
+
+	writel(iismod, i2s->regs + S3C2412_IISMOD);
+	DBG("%s: w: IISMOD: %x\n", __func__, iismod);
+	return 0;
+}
+
+static int s3c2412_i2s_trigger(struct snd_pcm_substream *substream, int cmd,
+			       struct snd_soc_dai *dai)
+{
+	struct snd_soc_pcm_runtime *rtd = substream->private_data;
+	struct s3c_i2sv2_info *i2s = to_info(rtd->dai->cpu_dai);
+	int capture = (substream->stream == SNDRV_PCM_STREAM_CAPTURE);
+	unsigned long irqs;
+	int ret = 0;
+
+	DBG("Entered %s\n", __func__);
+
+	switch (cmd) {
+	case SNDRV_PCM_TRIGGER_START:
+		/* On start, ensure that the FIFOs are cleared and reset. */
+
+		writel(capture ? S3C2412_IISFIC_RXFLUSH : S3C2412_IISFIC_TXFLUSH,
+		       i2s->regs + S3C2412_IISFIC);
+
+		/* clear again, just in case */
+		writel(0x0, i2s->regs + S3C2412_IISFIC);
+
+	case SNDRV_PCM_TRIGGER_RESUME:
+	case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
+		if (!i2s->master) {
+			ret = s3c2412_snd_lrsync(i2s);
+			if (ret)
+				goto exit_err;
+		}
+
+		local_irq_save(irqs);
+
+		if (capture)
+			s3c2412_snd_rxctrl(i2s, 1);
+		else
+			s3c2412_snd_txctrl(i2s, 1);
+
+		local_irq_restore(irqs);
+		break;
+
+	case SNDRV_PCM_TRIGGER_STOP:
+	case SNDRV_PCM_TRIGGER_SUSPEND:
+	case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
+		local_irq_save(irqs);
+
+		if (capture)
+			s3c2412_snd_rxctrl(i2s, 0);
+		else
+			s3c2412_snd_txctrl(i2s, 0);
+
+		local_irq_restore(irqs);
+		break;
+	default:
+		ret = -EINVAL;
+		break;
+	}
+
+exit_err:
+	return ret;
+}
+
+/*
+ * Set S3C2412 Clock dividers
+ */
+static int s3c2412_i2s_set_clkdiv(struct snd_soc_dai *cpu_dai,
+				  int div_id, int div)
+{
+	struct s3c_i2sv2_info *i2s = to_info(cpu_dai);
+	u32 reg;
+
+	DBG("%s(%p, %d, %d)\n", __func__, cpu_dai, div_id, div);
+
+	switch (div_id) {
+	case S3C_I2SV2_DIV_BCLK:
+		reg = readl(i2s->regs + S3C2412_IISMOD);
+		reg &= ~S3C2412_IISMOD_BCLK_MASK;
+		writel(reg | div, i2s->regs + S3C2412_IISMOD);
+
+		DBG("%s: MOD=%08x\n", __func__, readl(i2s->regs + S3C2412_IISMOD));
+		break;
+
+	case S3C_I2SV2_DIV_RCLK:
+		if (div > 3) {
+			/* convert value to bit field */
+
+			switch (div) {
+			case 256:
+				div = S3C2412_IISMOD_RCLK_256FS;
+				break;
+
+			case 384:
+				div = S3C2412_IISMOD_RCLK_384FS;
+				break;
+
+			case 512:
+				div = S3C2412_IISMOD_RCLK_512FS;
+				break;
+
+			case 768:
+				div = S3C2412_IISMOD_RCLK_768FS;
+				break;
+
+			default:
+				return -EINVAL;
+			}
+		}
+
+		reg = readl(i2s->regs + S3C2412_IISMOD);
+		reg &= ~S3C2412_IISMOD_RCLK_MASK;
+		writel(reg | div, i2s->regs + S3C2412_IISMOD);
+		DBG("%s: MOD=%08x\n", __func__, readl(i2s->regs + S3C2412_IISMOD));
+		break;
+
+	case S3C_I2SV2_DIV_PRESCALER:
+		if (div >= 0) {
+			writel((div << 8) | S3C2412_IISPSR_PSREN,
+			       i2s->regs + S3C2412_IISPSR);
+		} else {
+			writel(0x0, i2s->regs + S3C2412_IISPSR);
+		}
+		DBG("%s: PSR=%08x\n", __func__, readl(i2s->regs + S3C2412_IISPSR));
+		break;
+
+	default:
+		return -EINVAL;
+	}
+
+	return 0;
+}
+
+/* default table of all avaialable root fs divisors */
+static unsigned int iis_fs_tab[] = { 256, 512, 384, 768 };
+
+int s3c2412_iis_calc_rate(struct s3c_i2sv2_rate_calc *info,
+			  unsigned int *fstab,
+			  unsigned int rate, struct clk *clk)
+{
+	unsigned long clkrate = clk_get_rate(clk);
+	unsigned int div;
+	unsigned int fsclk;
+	unsigned int actual;
+	unsigned int fs;
+	unsigned int fsdiv;
+	signed int deviation = 0;
+	unsigned int best_fs = 0;
+	unsigned int best_div = 0;
+	unsigned int best_rate = 0;
+	unsigned int best_deviation = INT_MAX;
+
+	if (fstab == NULL)
+		fstab = iis_fs_tab;
+
+	for (fs = 0; fs < ARRAY_SIZE(iis_fs_tab); fs++) {
+		fsdiv = iis_fs_tab[fs];
+
+		fsclk = clkrate / fsdiv;
+		div = fsclk / rate;
+
+		if ((fsclk % rate) > (rate / 2))
+			div++;
+
+		if (div <= 1)
+			continue;
+
+		actual = clkrate / (fsdiv * div);
+		deviation = actual - rate;
+
+		printk(KERN_DEBUG "%dfs: div %d => result %d, deviation %d\n",
+		       fsdiv, div, actual, deviation);
+
+		deviation = abs(deviation);
+
+		if (deviation < best_deviation) {
+			best_fs = fsdiv;
+			best_div = div;
+			best_rate = actual;
+			best_deviation = deviation;
+		}
+
+		if (deviation == 0)
+			break;
+	}
+
+	printk(KERN_DEBUG "best: fs=%d, div=%d, rate=%d\n",
+	       best_fs, best_div, best_rate);
+
+	info->fs_div = best_fs;
+	info->clk_div = best_div;
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(s3c2412_iis_calc_rate);
+
+int s3c_i2sv2_probe(struct platform_device *pdev,
+		    struct snd_soc_dai *dai,
+		    struct s3c_i2sv2_info *i2s,
+		    unsigned long base)
+{
+	struct device *dev = &pdev->dev;
+
+	i2s->dev = dev;
+
+	/* record our i2s structure for later use in the callbacks */
+	dai->private_data = i2s;
+
+	i2s->regs = ioremap(base, 0x100);
+	if (i2s->regs == NULL) {
+		dev_err(dev, "cannot ioremap registers\n");
+		return -ENXIO;
+	}
+
+	i2s->iis_pclk = clk_get(dev, "iis");
+	if (i2s->iis_pclk == NULL) {
+		DBG("failed to get iis_clock\n");
+		iounmap(i2s->regs);
+		return -ENOENT;
+	}
+
+	clk_enable(i2s->iis_pclk);
+
+	s3c2412_snd_txctrl(i2s, 0);
+	s3c2412_snd_rxctrl(i2s, 0);
+
+	return 0;
+}
+
+EXPORT_SYMBOL_GPL(s3c_i2sv2_probe);
+
+#ifdef CONFIG_PM
+static int s3c2412_i2s_suspend(struct snd_soc_dai *dai)
+{
+	struct s3c_i2sv2_info *i2s = to_info(dai);
+	u32 iismod;
+
+	if (dai->active) {
+		i2s->suspend_iismod = readl(i2s->regs + S3C2412_IISMOD);
+		i2s->suspend_iiscon = readl(i2s->regs + S3C2412_IISCON);
+		i2s->suspend_iispsr = readl(i2s->regs + S3C2412_IISPSR);
+
+		/* some basic suspend checks */
+
+		iismod = readl(i2s->regs + S3C2412_IISMOD);
+
+		if (iismod & S3C2412_IISCON_RXDMA_ACTIVE)
+			pr_warning("%s: RXDMA active?\n", __func__);
+
+		if (iismod & S3C2412_IISCON_TXDMA_ACTIVE)
+			pr_warning("%s: TXDMA active?\n", __func__);
+
+		if (iismod & S3C2412_IISCON_IIS_ACTIVE)
+			pr_warning("%s: IIS active\n", __func__);
+	}
+
+	return 0;
+}
+
+static int s3c2412_i2s_resume(struct snd_soc_dai *dai)
+{
+	struct s3c_i2sv2_info *i2s = to_info(dai);
+
+	pr_info("dai_active %d, IISMOD %08x, IISCON %08x\n",
+		dai->active, i2s->suspend_iismod, i2s->suspend_iiscon);
+
+	if (dai->active) {
+		writel(i2s->suspend_iiscon, i2s->regs + S3C2412_IISCON);
+		writel(i2s->suspend_iismod, i2s->regs + S3C2412_IISMOD);
+		writel(i2s->suspend_iispsr, i2s->regs + S3C2412_IISPSR);
+
+		writel(S3C2412_IISFIC_RXFLUSH | S3C2412_IISFIC_TXFLUSH,
+		       i2s->regs + S3C2412_IISFIC);
+
+		ndelay(250);
+		writel(0x0, i2s->regs + S3C2412_IISFIC);
+	}
+
+	return 0;
+}
+#else
+#define s3c2412_i2s_suspend NULL
+#define s3c2412_i2s_resume  NULL
+#endif
+
+int s3c_i2sv2_register_dai(struct snd_soc_dai *dai)
+{
+	dai->ops.trigger = s3c2412_i2s_trigger;
+	dai->ops.hw_params = s3c2412_i2s_hw_params;
+	dai->ops.set_fmt = s3c2412_i2s_set_fmt;
+	dai->ops.set_clkdiv = s3c2412_i2s_set_clkdiv;
+
+	dai->suspend = s3c2412_i2s_suspend;
+	dai->resume = s3c2412_i2s_resume;
+
+	return snd_soc_register_dai(dai);
+}
+
+EXPORT_SYMBOL_GPL(s3c_i2sv2_register_dai);
Index: linux.git/sound/soc/s3c24xx/s3c-i2s-v2.h
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ linux.git/sound/soc/s3c24xx/s3c-i2s-v2.h	2009-02-28 20:41:45.000000000 +0000
@@ -0,0 +1,90 @@
+/* sound/soc/s3c24xx/s3c-i2s-v2.h
+ *
+ * ALSA Soc Audio Layer - S3C_I2SV2 I2S driver
+ *
+ * Copyright (c) 2007 Simtec Electronics
+ *	http://armlinux.simtec.co.uk/
+ *	Ben Dooks <ben@simtec.co.uk>
+ *
+ *  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
+ *  option) any later version.
+*/
+
+/* This code is the core support for the I2S block found in a number of
+ * Samsung SoC devices which is unofficially named I2S-V2. Currently the
+ * S3C2412 and the S3C64XX series use this block to provide 1 or 2 I2S
+ * channels via configurable GPIO.
+ */
+
+#ifndef __SND_SOC_S3C24XX_S3C_I2SV2_I2S_H
+#define __SND_SOC_S3C24XX_S3C_I2SV2_I2S_H __FILE__
+
+#define S3C_I2SV2_DIV_BCLK	(1)
+#define S3C_I2SV2_DIV_RCLK	(2)
+#define S3C_I2SV2_DIV_PRESCALER	(3)
+
+/**
+ * struct s3c_i2sv2_info - S3C I2S-V2 information
+ * @dev: The parent device passed to use from the probe.
+ * @regs: The pointer to the device registe block.
+ * @master: True if the I2S core is the I2S bit clock master.
+ * @dma_playback: DMA information for playback channel.
+ * @dma_capture: DMA information for capture channel.
+ * @suspend_iismod: PM save for the IISMOD register.
+ * @suspend_iiscon: PM save for the IISCON register.
+ * @suspend_iispsr: PM save for the IISPSR register.
+ *
+ * This is the private codec state for the hardware associated with an
+ * I2S channel such as the register mappings and clock sources.
+ */
+struct s3c_i2sv2_info {
+	struct device	*dev;
+	void __iomem	*regs;
+
+	struct clk	*iis_pclk;
+	struct clk	*iis_cclk;
+	struct clk	*iis_clk;
+
+	unsigned char	 master;
+
+	struct s3c24xx_pcm_dma_params	*dma_playback;
+	struct s3c24xx_pcm_dma_params	*dma_capture;
+
+	u32		 suspend_iismod;
+	u32		 suspend_iiscon;
+	u32		 suspend_iispsr;
+};
+
+struct s3c_i2sv2_rate_calc {
+	unsigned int	clk_div;	/* for prescaler */
+	unsigned int	fs_div;		/* for root frame clock */
+};
+
+extern int s3c_i2sv2_iis_calc_rate(struct s3c_i2sv2_rate_calc *info,
+				   unsigned int *fstab,
+				   unsigned int rate, struct clk *clk);
+
+/**
+ * s3c_i2sv2_probe - probe for i2s device helper
+ * @pdev: The platform device supplied to the original probe.
+ * @dai: The ASoC DAI structure supplied to the original probe.
+ * @i2s: Our local i2s structure to fill in.
+ * @base: The base address for the registers.
+ */
+extern int s3c_i2sv2_probe(struct platform_device *pdev,
+			   struct snd_soc_dai *dai,
+			   struct s3c_i2sv2_info *i2s,
+			   unsigned long base);
+
+/**
+ * s3c_i2sv2_register_dai - register dai with soc core
+ * @dai: The snd_soc_dai structure to register
+ *
+ * Fill in any missing fields and then register the given dai with the
+ * soc core.
+ */
+extern int s3c_i2sv2_register_dai(struct snd_soc_dai *dai);
+
+#endif /* __SND_SOC_S3C24XX_S3C_I2SV2_I2S_H */
Index: linux.git/sound/soc/s3c24xx/s3c2412-i2s.c
===================================================================
--- linux.git.orig/sound/soc/s3c24xx/s3c2412-i2s.c	2009-02-28 20:41:44.000000000 +0000
+++ linux.git/sound/soc/s3c24xx/s3c2412-i2s.c	2009-02-28 20:41:45.000000000 +0000
@@ -33,7 +33,7 @@
 
 #include <plat/regs-s3c2412-iis.h>
 
-#include <mach/regs-gpio.h>
+#include <plat/regs-gpio.h>
 #include <plat/audio.h>
 #include <mach/dma.h>
 
@@ -41,7 +41,6 @@
 #include "s3c2412-i2s.h"
 
 #define S3C2412_I2S_DEBUG 0
-#define S3C2412_I2S_DEBUG_CON 0
 
 #if S3C2412_I2S_DEBUG
 #define DBG(x...) printk(KERN_INFO x)
@@ -71,431 +70,7 @@ static struct s3c24xx_pcm_dma_params s3c
 	.dma_size	= 4,
 };
 
-struct s3c2412_i2s_info {
-	struct device	*dev;
-	void __iomem	*regs;
-	struct clk	*iis_clk;
-	struct clk	*iis_pclk;
-	struct clk	*iis_cclk;
-
-	u32		 suspend_iismod;
-	u32		 suspend_iiscon;
-	u32		 suspend_iispsr;
-};
-
-static struct s3c2412_i2s_info s3c2412_i2s;
-
-#define bit_set(v, b) (((v) & (b)) ? 1 : 0)
-
-#if S3C2412_I2S_DEBUG_CON
-static void dbg_showcon(const char *fn, u32 con)
-{
-	printk(KERN_DEBUG "%s: LRI=%d, TXFEMPT=%d, RXFEMPT=%d, TXFFULL=%d, RXFFULL=%d\n", fn,
-	       bit_set(con, S3C2412_IISCON_LRINDEX),
-	       bit_set(con, S3C2412_IISCON_TXFIFO_EMPTY),
-	       bit_set(con, S3C2412_IISCON_RXFIFO_EMPTY),
-	       bit_set(con, S3C2412_IISCON_TXFIFO_FULL),
-	       bit_set(con, S3C2412_IISCON_RXFIFO_FULL));
-
-	printk(KERN_DEBUG "%s: PAUSE: TXDMA=%d, RXDMA=%d, TXCH=%d, RXCH=%d\n",
-	       fn,
-	       bit_set(con, S3C2412_IISCON_TXDMA_PAUSE),
-	       bit_set(con, S3C2412_IISCON_RXDMA_PAUSE),
-	       bit_set(con, S3C2412_IISCON_TXCH_PAUSE),
-	       bit_set(con, S3C2412_IISCON_RXCH_PAUSE));
-	printk(KERN_DEBUG "%s: ACTIVE: TXDMA=%d, RXDMA=%d, IIS=%d\n", fn,
-	       bit_set(con, S3C2412_IISCON_TXDMA_ACTIVE),
-	       bit_set(con, S3C2412_IISCON_RXDMA_ACTIVE),
-	       bit_set(con, S3C2412_IISCON_IIS_ACTIVE));
-}
-#else
-static inline void dbg_showcon(const char *fn, u32 con)
-{
-}
-#endif
-
-/* Turn on or off the transmission path. */
-static void s3c2412_snd_txctrl(int on)
-{
-	struct s3c2412_i2s_info *i2s = &s3c2412_i2s;
-	void __iomem *regs = i2s->regs;
-	u32 fic, con, mod;
-
-	DBG("%s(%d)\n", __func__, on);
-
-	fic = readl(regs + S3C2412_IISFIC);
-	con = readl(regs + S3C2412_IISCON);
-	mod = readl(regs + S3C2412_IISMOD);
-
-	DBG("%s: IIS: CON=%x MOD=%x FIC=%x\n", __func__, con, mod, fic);
-
-	if (on) {
-		con |= S3C2412_IISCON_TXDMA_ACTIVE | S3C2412_IISCON_IIS_ACTIVE;
-		con &= ~S3C2412_IISCON_TXDMA_PAUSE;
-		con &= ~S3C2412_IISCON_TXCH_PAUSE;
-
-		switch (mod & S3C2412_IISMOD_MODE_MASK) {
-		case S3C2412_IISMOD_MODE_TXONLY:
-		case S3C2412_IISMOD_MODE_TXRX:
-			/* do nothing, we are in the right mode */
-			break;
-
-		case S3C2412_IISMOD_MODE_RXONLY:
-			mod &= ~S3C2412_IISMOD_MODE_MASK;
-			mod |= S3C2412_IISMOD_MODE_TXRX;
-			break;
-
-		default:
-			dev_err(i2s->dev, "TXEN: Invalid MODE in IISMOD\n");
-		}
-
-		writel(con, regs + S3C2412_IISCON);
-		writel(mod, regs + S3C2412_IISMOD);
-	} else {
-		/* Note, we do not have any indication that the FIFO problems
-		 * tha the S3C2410/2440 had apply here, so we should be able
-		 * to disable the DMA and TX without resetting the FIFOS.
-		 */
-
-		con |=  S3C2412_IISCON_TXDMA_PAUSE;
-		con |=  S3C2412_IISCON_TXCH_PAUSE;
-		con &= ~S3C2412_IISCON_TXDMA_ACTIVE;
-
-		switch (mod & S3C2412_IISMOD_MODE_MASK) {
-		case S3C2412_IISMOD_MODE_TXRX:
-			mod &= ~S3C2412_IISMOD_MODE_MASK;
-			mod |= S3C2412_IISMOD_MODE_RXONLY;
-			break;
-
-		case S3C2412_IISMOD_MODE_TXONLY:
-			mod &= ~S3C2412_IISMOD_MODE_MASK;
-			con &= ~S3C2412_IISCON_IIS_ACTIVE;
-			break;
-
-		default:
-			dev_err(i2s->dev, "TXDIS: Invalid MODE in IISMOD\n");
-		}
-
-		writel(mod, regs + S3C2412_IISMOD);
-		writel(con, regs + S3C2412_IISCON);
-	}
-
-	fic = readl(regs + S3C2412_IISFIC);
-	dbg_showcon(__func__, con);
-	DBG("%s: IIS: CON=%x MOD=%x FIC=%x\n", __func__, con, mod, fic);
-}
-
-static void s3c2412_snd_rxctrl(int on)
-{
-	struct s3c2412_i2s_info *i2s = &s3c2412_i2s;
-	void __iomem *regs = i2s->regs;
-	u32 fic, con, mod;
-
-	DBG("%s(%d)\n", __func__, on);
-
-	fic = readl(regs + S3C2412_IISFIC);
-	con = readl(regs + S3C2412_IISCON);
-	mod = readl(regs + S3C2412_IISMOD);
-
-	DBG("%s: IIS: CON=%x MOD=%x FIC=%x\n", __func__, con, mod, fic);
-
-	if (on) {
-		con |= S3C2412_IISCON_RXDMA_ACTIVE | S3C2412_IISCON_IIS_ACTIVE;
-		con &= ~S3C2412_IISCON_RXDMA_PAUSE;
-		con &= ~S3C2412_IISCON_RXCH_PAUSE;
-
-		switch (mod & S3C2412_IISMOD_MODE_MASK) {
-		case S3C2412_IISMOD_MODE_TXRX:
-		case S3C2412_IISMOD_MODE_RXONLY:
-			/* do nothing, we are in the right mode */
-			break;
-
-		case S3C2412_IISMOD_MODE_TXONLY:
-			mod &= ~S3C2412_IISMOD_MODE_MASK;
-			mod |= S3C2412_IISMOD_MODE_TXRX;
-			break;
-
-		default:
-			dev_err(i2s->dev, "RXEN: Invalid MODE in IISMOD\n");
-		}
-
-		writel(mod, regs + S3C2412_IISMOD);
-		writel(con, regs + S3C2412_IISCON);
-	} else {
-		/* See txctrl notes on FIFOs. */
-
-		con &= ~S3C2412_IISCON_RXDMA_ACTIVE;
-		con |=  S3C2412_IISCON_RXDMA_PAUSE;
-		con |=  S3C2412_IISCON_RXCH_PAUSE;
-
-		switch (mod & S3C2412_IISMOD_MODE_MASK) {
-		case S3C2412_IISMOD_MODE_RXONLY:
-			con &= ~S3C2412_IISCON_IIS_ACTIVE;
-			mod &= ~S3C2412_IISMOD_MODE_MASK;
-			break;
-
-		case S3C2412_IISMOD_MODE_TXRX:
-			mod &= ~S3C2412_IISMOD_MODE_MASK;
-			mod |= S3C2412_IISMOD_MODE_TXONLY;
-			break;
-
-		default:
-			dev_err(i2s->dev, "RXEN: Invalid MODE in IISMOD\n");
-		}
-
-		writel(con, regs + S3C2412_IISCON);
-		writel(mod, regs + S3C2412_IISMOD);
-	}
-
-	fic = readl(regs + S3C2412_IISFIC);
-	DBG("%s: IIS: CON=%x MOD=%x FIC=%x\n", __func__, con, mod, fic);
-}
-
-
-/*
- * Wait for the LR signal to allow synchronisation to the L/R clock
- * from the codec. May only be needed for slave mode.
- */
-static int s3c2412_snd_lrsync(void)
-{
-	u32 iiscon;
-	unsigned long timeout = jiffies + msecs_to_jiffies(5);
-
-	DBG("Entered %s\n", __func__);
-
-	while (1) {
-		iiscon = readl(s3c2412_i2s.regs + S3C2412_IISCON);
-		if (iiscon & S3C2412_IISCON_LRINDEX)
-			break;
-
-		if (timeout < jiffies) {
-			printk(KERN_ERR "%s: timeout\n", __func__);
-			return -ETIMEDOUT;
-		}
-	}
-
-	return 0;
-}
-
-/*
- * Check whether CPU is the master or slave
- */
-static inline int s3c2412_snd_is_clkmaster(void)
-{
-	u32 iismod = readl(s3c2412_i2s.regs + S3C2412_IISMOD);
-
-	DBG("Entered %s\n", __func__);
-
-	iismod &= S3C2412_IISMOD_MASTER_MASK;
-	return !(iismod == S3C2412_IISMOD_SLAVE);
-}
-
-/*
- * Set S3C2412 I2S DAI format
- */
-static int s3c2412_i2s_set_fmt(struct snd_soc_dai *cpu_dai,
-			       unsigned int fmt)
-{
-	u32 iismod;
-
-
-	DBG("Entered %s\n", __func__);
-
-	iismod = readl(s3c2412_i2s.regs + S3C2412_IISMOD);
-	DBG("hw_params r: IISMOD: %x \n", iismod);
-
-	switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
-	case SND_SOC_DAIFMT_CBM_CFM:
-		iismod &= ~S3C2412_IISMOD_MASTER_MASK;
-		iismod |= S3C2412_IISMOD_SLAVE;
-		break;
-	case SND_SOC_DAIFMT_CBS_CFS:
-		iismod &= ~S3C2412_IISMOD_MASTER_MASK;
-		iismod |= S3C2412_IISMOD_MASTER_INTERNAL;
-		break;
-	default:
-		DBG("unknwon master/slave format\n");
-		return -EINVAL;
-	}
-
-	iismod &= ~S3C2412_IISMOD_SDF_MASK;
-
-	switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
-	case SND_SOC_DAIFMT_RIGHT_J:
-		iismod |= S3C2412_IISMOD_SDF_MSB;
-		break;
-	case SND_SOC_DAIFMT_LEFT_J:
-		iismod |= S3C2412_IISMOD_SDF_LSB;
-		break;
-	case SND_SOC_DAIFMT_I2S:
-		iismod |= S3C2412_IISMOD_SDF_IIS;
-		break;
-	default:
-		DBG("Unknown data format\n");
-		return -EINVAL;
-	}
-
-	writel(iismod, s3c2412_i2s.regs + S3C2412_IISMOD);
-	DBG("hw_params w: IISMOD: %x \n", iismod);
-	return 0;
-}
-
-static int s3c2412_i2s_hw_params(struct snd_pcm_substream *substream,
-				 struct snd_pcm_hw_params *params,
-				 struct snd_soc_dai *dai)
-{
-	struct snd_soc_pcm_runtime *rtd = substream->private_data;
-	u32 iismod;
-
-	DBG("Entered %s\n", __func__);
-
-	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
-		rtd->dai->cpu_dai->dma_data = &s3c2412_i2s_pcm_stereo_out;
-	else
-		rtd->dai->cpu_dai->dma_data = &s3c2412_i2s_pcm_stereo_in;
-
-	/* Working copies of register */
-	iismod = readl(s3c2412_i2s.regs + S3C2412_IISMOD);
-	DBG("%s: r: IISMOD: %x\n", __func__, iismod);
-
-	switch (params_format(params)) {
-	case SNDRV_PCM_FORMAT_S8:
-		iismod |= S3C2412_IISMOD_8BIT;
-		break;
-	case SNDRV_PCM_FORMAT_S16_LE:
-		iismod &= ~S3C2412_IISMOD_8BIT;
-		break;
-	}
-
-	writel(iismod, s3c2412_i2s.regs + S3C2412_IISMOD);
-	DBG("%s: w: IISMOD: %x\n", __func__, iismod);
-	return 0;
-}
-
-static int s3c2412_i2s_trigger(struct snd_pcm_substream *substream, int cmd,
-			       struct snd_soc_dai *dai)
-{
-	int capture = (substream->stream == SNDRV_PCM_STREAM_CAPTURE);
-	unsigned long irqs;
-	int ret = 0;
-
-	DBG("Entered %s\n", __func__);
-
-	switch (cmd) {
-	case SNDRV_PCM_TRIGGER_START:
-		/* On start, ensure that the FIFOs are cleared and reset. */
-
-		writel(capture ? S3C2412_IISFIC_RXFLUSH : S3C2412_IISFIC_TXFLUSH,
-		       s3c2412_i2s.regs + S3C2412_IISFIC);
-
-		/* clear again, just in case */
-		writel(0x0, s3c2412_i2s.regs + S3C2412_IISFIC);
-
-	case SNDRV_PCM_TRIGGER_RESUME:
-	case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
-		if (!s3c2412_snd_is_clkmaster()) {
-			ret = s3c2412_snd_lrsync();
-			if (ret)
-				goto exit_err;
-		}
-
-		local_irq_save(irqs);
-
-		if (capture)
-			s3c2412_snd_rxctrl(1);
-		else
-			s3c2412_snd_txctrl(1);
-
-		local_irq_restore(irqs);
-		break;
-
-	case SNDRV_PCM_TRIGGER_STOP:
-	case SNDRV_PCM_TRIGGER_SUSPEND:
-	case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
-		local_irq_save(irqs);
-
-		if (capture)
-			s3c2412_snd_rxctrl(0);
-		else
-			s3c2412_snd_txctrl(0);
-
-		local_irq_restore(irqs);
-		break;
-	default:
-		ret = -EINVAL;
-		break;
-	}
-
-exit_err:
-	return ret;
-}
-
-/* default table of all avaialable root fs divisors */
-static unsigned int s3c2412_iis_fs[] = { 256, 512, 384, 768, 0 };
-
-int s3c2412_iis_calc_rate(struct s3c2412_rate_calc *info,
-			  unsigned int *fstab,
-			  unsigned int rate, struct clk *clk)
-{
-	unsigned long clkrate = clk_get_rate(clk);
-	unsigned int div;
-	unsigned int fsclk;
-	unsigned int actual;
-	unsigned int fs;
-	unsigned int fsdiv;
-	signed int deviation = 0;
-	unsigned int best_fs = 0;
-	unsigned int best_div = 0;
-	unsigned int best_rate = 0;
-	unsigned int best_deviation = INT_MAX;
-
-
-	if (fstab == NULL)
-		fstab = s3c2412_iis_fs;
-
-	for (fs = 0;; fs++) {
-		fsdiv = s3c2412_iis_fs[fs];
-
-		if (fsdiv == 0)
-			break;
-
-		fsclk = clkrate / fsdiv;
-		div = fsclk / rate;
-
-		if ((fsclk % rate) > (rate / 2))
-			div++;
-
-		if (div <= 1)
-			continue;
-
-		actual = clkrate / (fsdiv * div);
-		deviation = actual - rate;
-
-		printk(KERN_DEBUG "%dfs: div %d => result %d, deviation %d\n",
-		       fsdiv, div, actual, deviation);
-
-		deviation = abs(deviation);
-
-		if (deviation < best_deviation) {
-			best_fs = fsdiv;
-			best_div = div;
-			best_rate = actual;
-			best_deviation = deviation;
-		}
-
-		if (deviation == 0)
-			break;
-	}
-
-	printk(KERN_DEBUG "best: fs=%d, div=%d, rate=%d\n",
-	       best_fs, best_div, best_rate);
-
-	info->fs_div = best_fs;
-	info->clk_div = best_div;
-
-	return 0;
-}
-EXPORT_SYMBOL_GPL(s3c2412_iis_calc_rate);
+static struct s3c_i2sv2_info s3c2412_i2s;
 
 /*
  * Set S3C2412 Clock source
@@ -510,10 +85,12 @@ static int s3c2412_i2s_set_sysclk(struct
 
 	switch (clk_id) {
 	case S3C2412_CLKSRC_PCLK:
+		s3c2412_i2s.master = 1;
 		iismod &= ~S3C2412_IISMOD_MASTER_MASK;
 		iismod |= S3C2412_IISMOD_MASTER_INTERNAL;
 		break;
 	case S3C2412_CLKSRC_I2SCLK:
+		s3c2412_i2s.master = 0;
 		iismod &= ~S3C2412_IISMOD_MASTER_MASK;
 		iismod |= S3C2412_IISMOD_MASTER_EXTERNAL;
 		break;
@@ -525,74 +102,6 @@ static int s3c2412_i2s_set_sysclk(struct
 	return 0;
 }
 
-/*
- * Set S3C2412 Clock dividers
- */
-static int s3c2412_i2s_set_clkdiv(struct snd_soc_dai *cpu_dai,
-				  int div_id, int div)
-{
-	struct s3c2412_i2s_info *i2s = &s3c2412_i2s;
-	u32 reg;
-
-	DBG("%s(%p, %d, %d)\n", __func__, cpu_dai, div_id, div);
-
-	switch (div_id) {
-	case S3C2412_DIV_BCLK:
-		reg = readl(i2s->regs + S3C2412_IISMOD);
-		reg &= ~S3C2412_IISMOD_BCLK_MASK;
-		writel(reg | div, i2s->regs + S3C2412_IISMOD);
-
-		DBG("%s: MOD=%08x\n", __func__, readl(i2s->regs + S3C2412_IISMOD));
-		break;
-
-	case S3C2412_DIV_RCLK:
-		if (div > 3) {
-			/* convert value to bit field */
-
-			switch (div) {
-			case 256:
-				div = S3C2412_IISMOD_RCLK_256FS;
-				break;
-
-			case 384:
-				div = S3C2412_IISMOD_RCLK_384FS;
-				break;
-
-			case 512:
-				div = S3C2412_IISMOD_RCLK_512FS;
-				break;
-
-			case 768:
-				div = S3C2412_IISMOD_RCLK_768FS;
-				break;
-
-			default:
-				return -EINVAL;
-			}
-		}
-
-		reg = readl(s3c2412_i2s.regs + S3C2412_IISMOD);
-		reg &= ~S3C2412_IISMOD_RCLK_MASK;
-		writel(reg | div, i2s->regs + S3C2412_IISMOD);
-		DBG("%s: MOD=%08x\n", __func__, readl(i2s->regs + S3C2412_IISMOD));
-		break;
-
-	case S3C2412_DIV_PRESCALER:
-		if (div >= 0) {
-			writel((div << 8) | S3C2412_IISPSR_PSREN,
-			       i2s->regs + S3C2412_IISPSR);
-		} else {
-			writel(0x0, i2s->regs + S3C2412_IISPSR);
-		}
-		DBG("%s: PSR=%08x\n", __func__, readl(i2s->regs + S3C2412_IISPSR));
-		break;
-
-	default:
-		return -EINVAL;
-	}
-
-	return 0;
-}
 
 struct clk *s3c2412_get_iisclk(void)
 {
@@ -604,20 +113,16 @@ EXPORT_SYMBOL_GPL(s3c2412_get_iisclk);
 static int s3c2412_i2s_probe(struct platform_device *pdev,
 			     struct snd_soc_dai *dai)
 {
+	int ret;
+
 	DBG("Entered %s\n", __func__);
 
-	s3c2412_i2s.dev = &pdev->dev;
+	ret = s3c_i2sv2_probe(pdev, dai, &s3c2412_i2s, S3C2410_PA_IIS);
+	if (ret)
+		return ret;
 
-	s3c2412_i2s.regs = ioremap(S3C2410_PA_IIS, 0x100);
-	if (s3c2412_i2s.regs == NULL)
-		return -ENXIO;
-
-	s3c2412_i2s.iis_pclk = clk_get(&pdev->dev, "iis");
-	if (s3c2412_i2s.iis_pclk == NULL) {
-		DBG("failed to get iis_clock\n");
-		iounmap(s3c2412_i2s.regs);
-		return -ENODEV;
-	}
+	s3c2412_i2s.dma_capture = &s3c2412_i2s_pcm_stereo_in;
+	s3c2412_i2s.dma_playback = &s3c2412_i2s_pcm_stereo_out;
 
 	s3c2412_i2s.iis_cclk = clk_get(&pdev->dev, "i2sclk");
 	if (s3c2412_i2s.iis_cclk == NULL) {
@@ -626,12 +131,12 @@ static int s3c2412_i2s_probe(struct plat
 		return -ENODEV;
 	}
 
-	clk_set_parent(s3c2412_i2s.iis_cclk, clk_get(NULL, "mpll"));
+	/* Set MPLL as the source for IIS CLK */
 
-	clk_enable(s3c2412_i2s.iis_pclk);
+	clk_set_parent(s3c2412_i2s.iis_cclk, clk_get(NULL, "mpll"));
 	clk_enable(s3c2412_i2s.iis_cclk);
 
-	s3c2412_i2s.iis_clk = s3c2412_i2s.iis_pclk;
+	s3c2412_i2s.iis_cclk = s3c2412_i2s.iis_pclk;
 
 	/* Configure the I2S pins in correct mode */
 	s3c2410_gpio_cfgpin(S3C2410_GPE0, S3C2410_GPE0_I2SLRCK);
@@ -640,78 +145,18 @@ static int s3c2412_i2s_probe(struct plat
 	s3c2410_gpio_cfgpin(S3C2410_GPE3, S3C2410_GPE3_I2SSDI);
 	s3c2410_gpio_cfgpin(S3C2410_GPE4, S3C2410_GPE4_I2SSDO);
 
-	s3c2412_snd_txctrl(0);
-	s3c2412_snd_rxctrl(0);
-
 	return 0;
 }
 
-#ifdef CONFIG_PM
-static int s3c2412_i2s_suspend(struct snd_soc_dai *dai)
-{
-	struct s3c2412_i2s_info *i2s = &s3c2412_i2s;
-	u32 iismod;
-
-	if (dai->active) {
-		i2s->suspend_iismod = readl(i2s->regs + S3C2412_IISMOD);
-		i2s->suspend_iiscon = readl(i2s->regs + S3C2412_IISCON);
-		i2s->suspend_iispsr = readl(i2s->regs + S3C2412_IISPSR);
-
-		/* some basic suspend checks */
-
-		iismod = readl(i2s->regs + S3C2412_IISMOD);
-
-		if (iismod & S3C2412_IISCON_RXDMA_ACTIVE)
-			pr_warning("%s: RXDMA active?\n", __func__);
-
-		if (iismod & S3C2412_IISCON_TXDMA_ACTIVE)
-			pr_warning("%s: TXDMA active?\n", __func__);
-
-		if (iismod & S3C2412_IISCON_IIS_ACTIVE)
-			pr_warning("%s: IIS active\n", __func__);
-	}
-
-	return 0;
-}
-
-static int s3c2412_i2s_resume(struct snd_soc_dai *dai)
-{
-	struct s3c2412_i2s_info *i2s = &s3c2412_i2s;
-
-	pr_info("dai_active %d, IISMOD %08x, IISCON %08x\n",
-		dai->active, i2s->suspend_iismod, i2s->suspend_iiscon);
-
-	if (dai->active) {
-		writel(i2s->suspend_iiscon, i2s->regs + S3C2412_IISCON);
-		writel(i2s->suspend_iismod, i2s->regs + S3C2412_IISMOD);
-		writel(i2s->suspend_iispsr, i2s->regs + S3C2412_IISPSR);
-
-		writel(S3C2412_IISFIC_RXFLUSH | S3C2412_IISFIC_TXFLUSH,
-		       i2s->regs + S3C2412_IISFIC);
-
-		ndelay(250);
-		writel(0x0, i2s->regs + S3C2412_IISFIC);
-
-	}
-
-	return 0;
-}
-#else
-#define s3c2412_i2s_suspend NULL
-#define s3c2412_i2s_resume  NULL
-#endif /* CONFIG_PM */
-
 #define S3C2412_I2S_RATES \
 	(SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_11025 | SNDRV_PCM_RATE_16000 | \
 	SNDRV_PCM_RATE_22050 | SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 | \
 	SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000)
 
 struct snd_soc_dai s3c2412_i2s_dai = {
-	.name	= "s3c2412-i2s",
-	.id	= 0,
-	.probe	= s3c2412_i2s_probe,
-	.suspend = s3c2412_i2s_suspend,
-	.resume = s3c2412_i2s_resume,
+	.name		= "s3c2412-i2s",
+	.id		= 0,
+	.probe		= s3c2412_i2s_probe,
 	.playback = {
 		.channels_min	= 2,
 		.channels_max	= 2,
@@ -725,10 +170,6 @@ struct snd_soc_dai s3c2412_i2s_dai = {
 		.formats	= SNDRV_PCM_FMTBIT_S8 | SNDRV_PCM_FMTBIT_S16_LE,
 	},
 	.ops = {
-		.trigger	= s3c2412_i2s_trigger,
-		.hw_params	= s3c2412_i2s_hw_params,
-		.set_fmt	= s3c2412_i2s_set_fmt,
-		.set_clkdiv	= s3c2412_i2s_set_clkdiv,
 		.set_sysclk	= s3c2412_i2s_set_sysclk,
 	},
 };
@@ -736,7 +177,7 @@ EXPORT_SYMBOL_GPL(s3c2412_i2s_dai);
 
 static int __init s3c2412_i2s_init(void)
 {
-	return snd_soc_register_dai(&s3c2412_i2s_dai);
+	return  s3c_i2sv2_register_dai(&s3c2412_i2s_dai);
 }
 module_init(s3c2412_i2s_init);
 
@@ -746,7 +187,6 @@ static void __exit s3c2412_i2s_exit(void
 }
 module_exit(s3c2412_i2s_exit);
 
-
 /* Module information */
 MODULE_AUTHOR("Ben Dooks, <ben@simtec.co.uk>");
 MODULE_DESCRIPTION("S3C2412 I2S SoC Interface");
Index: linux.git/sound/soc/s3c24xx/jive_wm8750.c
===================================================================
--- linux.git.orig/sound/soc/s3c24xx/jive_wm8750.c	2009-02-28 20:41:43.000000000 +0000
+++ linux.git/sound/soc/s3c24xx/jive_wm8750.c	2009-02-28 20:41:45.000000000 +0000
@@ -65,7 +65,7 @@ static int jive_hw_params(struct snd_pcm
 	struct snd_soc_pcm_runtime *rtd = substream->private_data;
 	struct snd_soc_dai *codec_dai = rtd->dai->codec_dai;
 	struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai;
-	struct s3c2412_rate_calc div;
+	struct s3c_i2sv2_rate_calc div;
 	unsigned int clk = 0;
 	int ret = 0;
 
@@ -83,8 +83,8 @@ static int jive_hw_params(struct snd_pcm
 		break;
 	}
 
-	s3c2412_iis_calc_rate(&div, NULL, params_rate(params),
-			      s3c2412_get_iisclk());
+	s3c_i2sv2_calc_rate(&div, NULL, params_rate(params),
+			    s3c2412_get_iisclk());
 
 	/* set codec DAI configuration */
 	ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S |
Index: linux.git/sound/soc/s3c24xx/s3c2412-i2s.h
===================================================================
--- linux.git.orig/sound/soc/s3c24xx/s3c2412-i2s.h	2009-02-23 10:41:21.000000000 +0000
+++ linux.git/sound/soc/s3c24xx/s3c2412-i2s.h	2009-02-28 20:41:45.000000000 +0000
@@ -15,9 +15,11 @@
 #ifndef __SND_SOC_S3C24XX_S3C2412_I2S_H
 #define __SND_SOC_S3C24XX_S3C2412_I2S_H __FILE__
 
-#define S3C2412_DIV_BCLK	(1)
-#define S3C2412_DIV_RCLK	(2)
-#define S3C2412_DIV_PRESCALER	(3)
+#include "s3c-i2s-v2.h"
+
+#define S3C2412_DIV_BCLK	S3C_I2SV2_DIV_BCLK
+#define S3C2412_DIV_RCLK	S3C_I2SV2_DIV_RCLK
+#define S3C2412_DIV_PRESCALER	S3C_I2SV2_DIV_PRESCALER
 
 #define S3C2412_CLKSRC_PCLK	(0)
 #define S3C2412_CLKSRC_I2SCLK	(1)
@@ -26,13 +28,4 @@ extern struct clk *s3c2412_get_iisclk(vo
 
 extern struct snd_soc_dai s3c2412_i2s_dai;
 
-struct s3c2412_rate_calc {
-	unsigned int	clk_div;	/* for prescaler */
-	unsigned int	fs_div;		/* for root frame clock */
-};
-
-extern int s3c2412_iis_calc_rate(struct s3c2412_rate_calc *info,
-				 unsigned int *fstab,
-				 unsigned int rate, struct clk *clk);
-
 #endif /* __SND_SOC_S3C24XX_S3C2412_I2S_H */
Index: linux.git/sound/soc/s3c24xx/Kconfig
===================================================================
--- linux.git.orig/sound/soc/s3c24xx/Kconfig	2009-02-28 20:41:43.000000000 +0000
+++ linux.git/sound/soc/s3c24xx/Kconfig	2009-02-28 20:57:34.000000000 +0000
@@ -9,8 +9,12 @@ config SND_S3C24XX_SOC
 config SND_S3C24XX_SOC_I2S
 	tristate
 
+config SND_S3C_I2SV2_SOC
+	tristate
+
 config SND_S3C2412_SOC_I2S
 	tristate
+	select SND_S3C_I2SV2_SOC
 
 config SND_S3C2443_SOC_AC97
 	tristate
Index: linux.git/sound/soc/s3c24xx/Makefile
===================================================================
--- linux.git.orig/sound/soc/s3c24xx/Makefile	2009-02-28 20:41:43.000000000 +0000
+++ linux.git/sound/soc/s3c24xx/Makefile	2009-02-28 20:57:34.000000000 +0000
@@ -3,11 +3,13 @@ snd-soc-s3c24xx-objs := s3c24xx-pcm.o
 snd-soc-s3c24xx-i2s-objs := s3c24xx-i2s.o
 snd-soc-s3c2412-i2s-objs := s3c2412-i2s.o
 snd-soc-s3c2443-ac97-objs := s3c2443-ac97.o
+snd-soc-s3c-i2s-v2-objs := s3c-i2s-v2.o
 
 obj-$(CONFIG_SND_S3C24XX_SOC) += snd-soc-s3c24xx.o
 obj-$(CONFIG_SND_S3C24XX_SOC_I2S) += snd-soc-s3c24xx-i2s.o
 obj-$(CONFIG_SND_S3C2443_SOC_AC97) += snd-soc-s3c2443-ac97.o
 obj-$(CONFIG_SND_S3C2412_SOC_I2S) += snd-soc-s3c2412-i2s.o
+obj-$(CONFIG_SND_S3C_I2SV2_SOC) += snd-soc-s3c-i2s-v2.o
 
 # S3C24XX Machine Support
 snd-soc-jive-wm8750-objs := jive_wm8750.o

-- 
Ben (ben@fluff.org, http://www.fluff.org/)

  'a smiley only costs 4 bytes'

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

* [patch 6/9] S3C64XX: Add s3c64xx-i2s support
  2009-03-04  0:49 [patch 0/9] S3C24XX/S3C64XX updates Ben Dooks
                   ` (4 preceding siblings ...)
  2009-03-04  0:49 ` [patch 5/9] S3C: Split s3c2412-i2s.c into core and SoC specific parts Ben Dooks
@ 2009-03-04  0:49 ` Ben Dooks
  2009-03-04  0:56   ` Ben Dooks
  2009-03-04 19:56   ` Mark Brown
  2009-03-04  0:49 ` [patch 7/9] ASoC: Ensure codec check hw_write error at probe Ben Dooks
                   ` (3 subsequent siblings)
  9 siblings, 2 replies; 24+ messages in thread
From: Ben Dooks @ 2009-03-04  0:49 UTC (permalink / raw)
  To: alsa-devel; +Cc: broonie

[-- Attachment #1: audio/audio-s3c64xx-dai.patch --]
[-- Type: text/plain, Size: 9709 bytes --]

From: Ben Dooks <ben@simtec.co.uk>

Add the initial code to support the S3C64XX I2S hardware using the
s3c-i2s-v2 core code.

Signed-off-by: Ben Dooks <ben@simtec.co.uk>

Index: linux.git/sound/soc/s3c24xx/Makefile
===================================================================
--- linux.git.orig/sound/soc/s3c24xx/Makefile	2009-03-04 00:44:28.000000000 +0000
+++ linux.git/sound/soc/s3c24xx/Makefile	2009-03-04 00:44:31.000000000 +0000
@@ -2,6 +2,7 @@
 snd-soc-s3c24xx-objs := s3c24xx-pcm.o
 snd-soc-s3c24xx-i2s-objs := s3c24xx-i2s.o
 snd-soc-s3c2412-i2s-objs := s3c2412-i2s.o
+snd-soc-s3c64xx-i2s-objs := s3c64xx-i2s.o
 snd-soc-s3c2443-ac97-objs := s3c2443-ac97.o
 snd-soc-s3c-i2s-v2-objs := s3c-i2s-v2.o
 
@@ -9,6 +10,7 @@ obj-$(CONFIG_SND_S3C24XX_SOC) += snd-soc
 obj-$(CONFIG_SND_S3C24XX_SOC_I2S) += snd-soc-s3c24xx-i2s.o
 obj-$(CONFIG_SND_S3C2443_SOC_AC97) += snd-soc-s3c2443-ac97.o
 obj-$(CONFIG_SND_S3C2412_SOC_I2S) += snd-soc-s3c2412-i2s.o
+obj-$(CONFIG_SND_S3C64XX_SOC_I2S) += snd-soc-s3c64xx-i2s.o
 obj-$(CONFIG_SND_S3C_I2SV2_SOC) += snd-soc-s3c-i2s-v2.o
 
 # S3C24XX Machine Support
Index: linux.git/sound/soc/s3c24xx/s3c64xx-i2s.c
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ linux.git/sound/soc/s3c24xx/s3c64xx-i2s.c	2009-03-04 00:44:31.000000000 +0000
@@ -0,0 +1,220 @@
+/* sound/soc/s3c24xx/s3c64xx-i2s.c
+ *
+ * ALSA SoC Audio Layer - S3C64XX I2S driver
+ *
+ * Copyright 2008 Openmoko, Inc.
+ * Copyright 2008 Simtec Electronics
+ *      Ben Dooks <ben@simtec.co.uk>
+ *      http://armlinux.simtec.co.uk/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/device.h>
+#include <linux/delay.h>
+#include <linux/clk.h>
+#include <linux/kernel.h>
+#include <linux/gpio.h>
+#include <linux/io.h>
+
+#include <sound/core.h>
+#include <sound/pcm.h>
+#include <sound/pcm_params.h>
+#include <sound/initval.h>
+#include <sound/soc.h>
+
+#include <plat/regs-s3c2412-iis.h>
+#include <plat/gpio-bank-d.h>
+#include <plat/gpio-bank-e.h>
+#include <plat/gpio-cfg.h>
+#include <plat/audio.h>
+
+#include <mach/map.h>
+#include <mach/dma.h>
+
+#include "s3c24xx-pcm.h"
+#include "s3c64xx-i2s.h"
+
+static struct s3c2410_dma_client s3c64xx_dma_client_out = {
+	.name		= "I2S PCM Stereo out"
+};
+
+static struct s3c2410_dma_client s3c64xx_dma_client_in = {
+	.name		= "I2S PCM Stereo in"
+};
+
+static struct s3c24xx_pcm_dma_params s3c64xx_i2s_pcm_stereo_out[2] = {
+	[0] = {
+		.channel	= DMACH_I2S0_OUT,
+		.client		= &s3c64xx_dma_client_out,
+		.dma_addr	= S3C64XX_PA_IIS0 + S3C2412_IISTXD,
+		.dma_size	= 4,
+	},
+	[1] = {
+		.channel	= DMACH_I2S1_OUT,
+		.client		= &s3c64xx_dma_client_out,
+		.dma_addr	= S3C64XX_PA_IIS1 + S3C2412_IISTXD,
+		.dma_size	= 4,
+	},
+};
+
+static struct s3c24xx_pcm_dma_params s3c64xx_i2s_pcm_stereo_in[2] = {
+	[0] = {
+		.channel	= DMACH_I2S0_IN,
+		.client		= &s3c64xx_dma_client_in,
+		.dma_addr	= S3C64XX_PA_IIS0 + S3C2412_IISRXD,
+		.dma_size	= 4,
+	},
+	[1] = {
+		.channel	= DMACH_I2S1_IN,
+		.client		= &s3c64xx_dma_client_in,
+		.dma_addr	= S3C64XX_PA_IIS1 + S3C2412_IISRXD,
+		.dma_size	= 4,
+	},
+};
+
+static struct s3c_i2sv2_info s3c64xx_i2s[2];
+
+static inline struct s3c_i2sv2_info *to_info(struct snd_soc_dai *cpu_dai)
+{
+	return cpu_dai->private_data;
+}
+
+static int s3c64xx_i2s_set_sysclk(struct snd_soc_dai *cpu_dai,
+				  int clk_id, unsigned int freq, int dir)
+{
+	struct s3c_i2sv2_info *i2s = to_info(cpu_dai);
+	u32 iismod = readl(i2s->regs + S3C2412_IISMOD);
+
+	switch (clk_id) {
+	case S3C64XX_CLKSRC_PCLK:
+		iismod &= ~S3C64XX_IISMOD_IMS_SYSMUX;
+		break;
+
+	case S3C64XX_CLKSRC_MUX:
+		iismod |= S3C64XX_IISMOD_IMS_SYSMUX;
+		break;
+
+	default:
+		return -EINVAL;
+	}
+
+	writel(iismod, i2s->regs + S3C2412_IISMOD);
+
+	return 0;
+}
+
+
+unsigned long s3c64xx_i2s_get_clockrate(struct snd_soc_dai *dai)
+{
+	struct s3c_i2sv2_info *i2s = to_info(dai);
+
+	return clk_get_rate(i2s->iis_cclk);
+}
+EXPORT_SYMBOL_GPL(s3c64xx_i2s_get_clockrate);
+
+static int s3c64xx_i2s_probe(struct platform_device *pdev,
+			     struct snd_soc_dai *dai)
+{
+	struct device *dev = &pdev->dev;
+	struct s3c_i2sv2_info *i2s;
+	int ret;
+
+	dev_dbg(dev, "%s: probing dai %d\n", __func__, pdev->id);
+
+	if (pdev->id < 0 || pdev->id > ARRAY_SIZE(s3c64xx_i2s)) {
+		dev_err(dev, "id %d out of range\n", pdev->id);
+		return -EINVAL;
+	}
+
+	i2s = &s3c64xx_i2s[pdev->id];
+
+	ret = s3c_i2sv2_probe(pdev, dai, i2s,
+			      pdev->id ? S3C64XX_PA_IIS1 : S3C64XX_PA_IIS0);
+	if (ret)
+		return ret;
+
+	i2s->dma_capture = &s3c64xx_i2s_pcm_stereo_in[pdev->id];
+	i2s->dma_playback = &s3c64xx_i2s_pcm_stereo_out[pdev->id];
+
+	i2s->iis_cclk = clk_get(dev, "audio-bus");
+	if (IS_ERR(i2s->iis_cclk)) {
+		dev_err(dev, "failed to get audio-bus");
+		iounmap(i2s->regs);
+		return -ENODEV;
+	}
+
+	/* configure GPIO for i2s port */
+	switch (pdev->id) {
+	case 0:
+		s3c_gpio_cfgpin(S3C64XX_GPD(0), S3C64XX_GPD0_I2S0_CLK);
+		s3c_gpio_cfgpin(S3C64XX_GPD(1), S3C64XX_GPD1_I2S0_CDCLK);
+		s3c_gpio_cfgpin(S3C64XX_GPD(2), S3C64XX_GPD2_I2S0_LRCLK);
+		s3c_gpio_cfgpin(S3C64XX_GPD(3), S3C64XX_GPD3_I2S0_DI);
+		s3c_gpio_cfgpin(S3C64XX_GPD(4), S3C64XX_GPD4_I2S0_D0);
+		break;
+	case 1:
+		s3c_gpio_cfgpin(S3C64XX_GPE(0), S3C64XX_GPE0_I2S1_CLK);
+		s3c_gpio_cfgpin(S3C64XX_GPE(1), S3C64XX_GPE1_I2S1_CDCLK);
+		s3c_gpio_cfgpin(S3C64XX_GPE(2), S3C64XX_GPE2_I2S1_LRCLK);
+		s3c_gpio_cfgpin(S3C64XX_GPE(3), S3C64XX_GPE3_I2S1_DI);
+		s3c_gpio_cfgpin(S3C64XX_GPE(4), S3C64XX_GPE4_I2S1_D0);
+	}
+
+	return 0;
+}
+
+
+#define S3C64XX_I2S_RATES \
+	(SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_11025 | SNDRV_PCM_RATE_16000 | \
+	SNDRV_PCM_RATE_22050 | SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 | \
+	SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000)
+
+#define S3C64XX_I2S_FMTS \
+	(SNDRV_PCM_FMTBIT_S8 | SNDRV_PCM_FMTBIT_S16_LE)
+
+struct snd_soc_dai s3c64xx_i2s_dai = {
+	.name		= "s3c64xx-i2s",
+	.id		= 0,
+	.probe		= s3c64xx_i2s_probe,
+	.playback = {
+		.channels_min	= 2,
+		.channels_max	= 2,
+		.rates		= S3C64XX_I2S_RATES,
+		.formats	= S3C64XX_I2S_FMTS,
+	},
+	.capture = {
+		.channels_min	= 2,
+		.channels_max	= 2,
+		.rates		= S3C64XX_I2S_RATES,
+		.formats	= S3C64XX_I2S_FMTS,
+	},
+	.ops = {
+		.set_sysclk	= s3c64xx_i2s_set_sysclk,
+	},
+};
+EXPORT_SYMBOL_GPL(s3c64xx_i2s_dai);
+
+static int __init s3c64xx_i2s_init(void)
+{
+	return  s3c_i2sv2_register_dai(&s3c64xx_i2s_dai);
+}
+module_init(s3c64xx_i2s_init);
+
+static void __exit s3c64xx_i2s_exit(void)
+{
+	snd_soc_unregister_dai(&s3c64xx_i2s_dai);
+}
+module_exit(s3c64xx_i2s_exit);
+
+/* Module information */
+MODULE_AUTHOR("Ben Dooks, <ben@simtec.co.uk>");
+MODULE_DESCRIPTION("S3C64XX I2S SoC Interface");
+MODULE_LICENSE("GPL");
+
+
+
Index: linux.git/sound/soc/s3c24xx/s3c64xx-i2s.h
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ linux.git/sound/soc/s3c24xx/s3c64xx-i2s.h	2009-03-04 00:44:31.000000000 +0000
@@ -0,0 +1,31 @@
+/* sound/soc/s3c24xx/s3c64xx-i2s.h
+ *
+ * ALSA SoC Audio Layer - S3C64XX I2S driver
+ *
+ * Copyright 2008 Openmoko, Inc.
+ * Copyright 2008 Simtec Electronics
+ *      Ben Dooks <ben@simtec.co.uk>
+ *      http://armlinux.simtec.co.uk/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef __SND_SOC_S3C24XX_S3C64XX_I2S_H
+#define __SND_SOC_S3C24XX_S3C64XX_I2S_H __FILE__
+
+#include "s3c-i2s-v2.h"
+
+#define S3C64XX_DIV_BCLK	S3C_I2SV2_DIV_BCLK
+#define S3C64XX_DIV_RCLK	S3C_I2SV2_DIV_RCLK
+#define S3C64XX_DIV_PRESCALER	S3C_I2SV2_DIV_PRESCALER
+
+#define S3C64XX_CLKSRC_PCLK	(0)
+#define S3C64XX_CLKSRC_MUX	(1)
+
+extern struct snd_soc_dai s3c64xx_i2s_dai;
+
+extern unsigned long s3c64xx_i2s_get_clockrate(struct snd_soc_dai *cpu_dai);
+
+#endif /* __SND_SOC_S3C24XX_S3C64XX_I2S_H */
Index: linux.git/sound/soc/s3c24xx/Kconfig
===================================================================
--- linux.git.orig/sound/soc/s3c24xx/Kconfig	2009-03-04 00:44:28.000000000 +0000
+++ linux.git/sound/soc/s3c24xx/Kconfig	2009-03-04 00:44:31.000000000 +0000
@@ -1,6 +1,6 @@
 config SND_S3C24XX_SOC
 	tristate "SoC Audio for the Samsung S3C24XX chips"
-	depends on ARCH_S3C2410
+	depends on ARCH_S3C2410 || ARCH_S3C64XX
 	help
 	  Say Y or M if you want to add support for codecs attached to
 	  the S3C24XX AC97, I2S or SSP interface. You will also need
@@ -16,6 +16,10 @@ config SND_S3C2412_SOC_I2S
 	tristate
 	select SND_S3C_I2SV2_SOC
 
+config SND_S3C64XX_SOC_I2S
+	tristate
+	select SND_S3C_I2SV2_SOC
+
 config SND_S3C2443_SOC_AC97
 	tristate
 	select AC97_BUS
Index: linux.git/arch/arm/plat-s3c/include/plat/regs-s3c2412-iis.h
===================================================================
--- linux.git.orig/arch/arm/plat-s3c/include/plat/regs-s3c2412-iis.h	2009-03-04 00:44:10.000000000 +0000
+++ linux.git/arch/arm/plat-s3c/include/plat/regs-s3c2412-iis.h	2009-03-04 00:44:31.000000000 +0000
@@ -33,6 +33,9 @@
 #define S3C2412_IISCON_RXDMA_ACTIVE	(1 << 1)
 #define S3C2412_IISCON_IIS_ACTIVE	(1 << 0)
 
+#define S3C64XX_IISMOD_IMS_PCLK		(0 << 10)
+#define S3C64XX_IISMOD_IMS_SYSMUX	(1 << 10)
+
 #define S3C2412_IISMOD_MASTER_INTERNAL	(0 << 10)
 #define S3C2412_IISMOD_MASTER_EXTERNAL	(1 << 10)
 #define S3C2412_IISMOD_SLAVE		(2 << 10)

-- 
Ben (ben@fluff.org, http://www.fluff.org/)

  'a smiley only costs 4 bytes'

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

* [patch 7/9] ASoC: Ensure codec check hw_write error at probe
  2009-03-04  0:49 [patch 0/9] S3C24XX/S3C64XX updates Ben Dooks
                   ` (5 preceding siblings ...)
  2009-03-04  0:49 ` [patch 6/9] S3C64XX: Add s3c64xx-i2s support Ben Dooks
@ 2009-03-04  0:49 ` Ben Dooks
  2009-03-04 19:57   ` Mark Brown
  2009-03-04  0:49 ` [patch 8/9] SMDK6410: Add support for WM8731 on an add-on board Ben Dooks
                   ` (2 subsequent siblings)
  9 siblings, 1 reply; 24+ messages in thread
From: Ben Dooks @ 2009-03-04  0:49 UTC (permalink / raw)
  To: alsa-devel; +Cc: broonie

[-- Attachment #1: audio/fix-i2c-error-returns.patch --]
[-- Type: text/plain, Size: 1627 bytes --]

Add checks to see if wmXXXX_reset() failed and notify
the user of the problem. This is generally due to a
problem on the i2c bus such as an un-powered or 
non-connected codec.

Signed-off-by: Ben Dooks <ben@simtec.co.uk>

Index: linux-2.6.29-rc6-quilt1/sound/soc/codecs/wm8731.c
===================================================================
--- linux-2.6.29-rc6-quilt1.orig/sound/soc/codecs/wm8731.c	2009-02-25 11:14:15.000000000 +0000
+++ linux-2.6.29-rc6-quilt1/sound/soc/codecs/wm8731.c	2009-02-25 11:14:37.000000000 +0000
@@ -521,7 +521,11 @@ static int wm8731_init(struct snd_soc_de
 	if (codec->reg_cache == NULL)
 		return -ENOMEM;
 
-	wm8731_reset(codec);
+	ret = wm8731_reset(codec);
+	if (ret < 0) {
+		printk(KERN_ERR "wm8731: failed to send reset\n");
+		return -EIO;
+	}
 
 	/* register pcms */
 	ret = snd_soc_new_pcms(socdev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1);
Index: linux-2.6.29-rc6-quilt1/sound/soc/codecs/wm8753.c
===================================================================
--- linux-2.6.29-rc6-quilt1.orig/sound/soc/codecs/wm8753.c	2009-02-25 11:14:15.000000000 +0000
+++ linux-2.6.29-rc6-quilt1/sound/soc/codecs/wm8753.c	2009-02-25 11:14:37.000000000 +0000
@@ -1573,7 +1573,11 @@ static int wm8753_init(struct snd_soc_de
 
 	wm8753_set_dai_mode(codec, 0);
 
-	wm8753_reset(codec);
+	ret = wm8753_reset(codec);
+	if (ret < 0) {
+		printk(KERN_ERR "wm8753: failed reset, not present?\n");
+		return -EIO;
+	}
 
 	/* register pcms */
 	ret = snd_soc_new_pcms(socdev, SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1);

-- 
Ben (ben@fluff.org, http://www.fluff.org/)

  'a smiley only costs 4 bytes'

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

* [patch 8/9] SMDK6410: Add support for WM8731 on an add-on board
  2009-03-04  0:49 [patch 0/9] S3C24XX/S3C64XX updates Ben Dooks
                   ` (6 preceding siblings ...)
  2009-03-04  0:49 ` [patch 7/9] ASoC: Ensure codec check hw_write error at probe Ben Dooks
@ 2009-03-04  0:49 ` Ben Dooks
  2009-03-04 20:06   ` Mark Brown
  2009-03-04  0:49 ` [patch 9/9] AUDIO: Select DMA if I2S is configured Ben Dooks
  2009-03-04 20:29 ` [patch 0/9] S3C24XX/S3C64XX updates Mark Brown
  9 siblings, 1 reply; 24+ messages in thread
From: Ben Dooks @ 2009-03-04  0:49 UTC (permalink / raw)
  To: alsa-devel; +Cc: Ben Dooks, broonie

[-- Attachment #1: audio/smdk6410-wm8713-bjd.patch --]
[-- Type: text/plain, Size: 7720 bytes --]

Add support for an WM8731 connected to an SMDK6410 instead
of the onboard codec.

Signed-off-by: Ben Dooks <benb@simtec.co.uk>

Index: linux.git/sound/soc/s3c24xx/Makefile
===================================================================
--- linux.git.orig/sound/soc/s3c24xx/Makefile	2009-03-04 00:44:31.000000000 +0000
+++ linux.git/sound/soc/s3c24xx/Makefile	2009-03-04 00:45:54.000000000 +0000
@@ -19,9 +19,11 @@ snd-soc-neo1973-wm8753-objs := neo1973_w
 snd-soc-smdk2443-wm9710-objs := smdk2443_wm9710.o
 snd-soc-ln2440sbc-alc650-objs := ln2440sbc_alc650.o
 snd-soc-s3c24xx-uda134x-objs := s3c24xx_uda134x.o
+snd-soc-smdk6410-wm8731-objs := smdk6410-wm8731.o
 
 obj-$(CONFIG_SND_S3C24XX_SOC_JIVE_WM8750) += snd-soc-jive-wm8750.o
 obj-$(CONFIG_SND_S3C24XX_SOC_NEO1973_WM8753) += snd-soc-neo1973-wm8753.o
 obj-$(CONFIG_SND_S3C24XX_SOC_SMDK2443_WM9710) += snd-soc-smdk2443-wm9710.o
 obj-$(CONFIG_SND_S3C24XX_SOC_LN2440SBC_ALC650) += snd-soc-ln2440sbc-alc650.o
 obj-$(CONFIG_SND_S3C24XX_SOC_S3C24XX_UDA134X) += snd-soc-s3c24xx-uda134x.o
+obj-$(CONFIG_SND_S3C64XX_SOC_SMDK6410_WM8731) += snd-soc-smdk6410-wm8731.o
Index: linux.git/sound/soc/s3c24xx/smdk6410-wm8731.c
===================================================================
--- /dev/null	1970-01-01 00:00:00.000000000 +0000
+++ linux.git/sound/soc/s3c24xx/smdk6410-wm8731.c	2009-03-04 00:45:04.000000000 +0000
@@ -0,0 +1,227 @@
+
+
+#include <linux/module.h>
+#include <linux/moduleparam.h>
+#include <linux/kernel.h>
+#include <linux/clk.h>
+#include <linux/timer.h>
+#include <linux/interrupt.h>
+#include <linux/platform_device.h>
+
+#include <sound/core.h>
+#include <sound/pcm.h>
+#include <sound/pcm_params.h>
+#include <sound/soc.h>
+#include <sound/soc-dapm.h>
+
+#include <asm/mach-types.h>
+
+#include "../codecs/wm8731.h"
+#include "s3c64xx-i2s.h"
+
+static struct platform_device *socdev;
+
+
+
+static void wm_shutdown(struct snd_pcm_substream *substream)
+{
+	printk(KERN_INFO "%s: substream %p\n", __func__, substream);
+}
+
+static int wm_hw_params(struct snd_pcm_substream *substream,
+			struct snd_pcm_hw_params *params)
+{
+	struct snd_soc_pcm_runtime *rtd = substream->private_data;
+	struct snd_soc_dai *codec_dai = rtd->dai->codec_dai;
+	struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai;
+	unsigned int fmt;
+	int ret;
+
+	printk(KERN_INFO "%s: (%p,%p)\n", __func__, substream, params);
+	printk(KERN_INFO "%s: dai: cpu %p, codec %p\n", __func__, cpu_dai, codec_dai);
+
+	//fmt = SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS;
+	fmt = SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM;
+	fmt |= SND_SOC_DAIFMT_I2S;
+
+	ret = snd_soc_dai_set_fmt(codec_dai, fmt);
+	if (ret < 0)
+		return ret;
+
+	/* set cpu DAI configuration */
+	ret = snd_soc_dai_set_fmt(cpu_dai, fmt);
+	if (ret < 0)
+		return ret;
+
+	if (fmt == (SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM)) {
+		unsigned long iis_clkrate;
+
+		ret = snd_soc_dai_set_sysclk(cpu_dai, S3C64XX_CLKSRC_MUX, 0,
+					     SND_SOC_CLOCK_OUT);
+		if (ret < 0) {
+			printk(KERN_ERR "%s: cpu set_sysclk err\n", __func__);
+			return ret;
+		}
+
+		/* set prescaler division for sample rate */
+		ret = snd_soc_dai_set_clkdiv(cpu_dai, S3C64XX_DIV_PRESCALER, 1);
+		if (ret < 0) {
+			printk(KERN_ERR "%s: codec clkdiv err\n", __func__);
+			return ret;
+		}
+
+		iis_clkrate = s3c64xx_i2s_get_clockrate(cpu_dai) / 2;
+		printk(KERN_INFO "%s: clockrate %ld\n", __func__, iis_clkrate);
+
+		iis_clkrate = 12000000; //tmphack//
+
+		/* set the codec system clock for DAC and ADC */
+		ret = snd_soc_dai_set_sysclk(codec_dai, WM8731_SYSCLK,
+					     iis_clkrate,
+					     SND_SOC_CLOCK_IN);
+		if (ret < 0) {
+			printk(KERN_ERR "%s: codec sysclk err\n", __func__);
+			return ret;
+		}
+
+	} else {
+		/* TODO */
+		BUG();
+	}
+
+	return 0;
+}
+
+static int wm_startup(struct snd_pcm_substream *substream)
+{
+	struct snd_soc_pcm_runtime *rtd = snd_pcm_substream_chip(substream);
+	struct snd_soc_dai *codec_dai = rtd->dai->codec_dai;
+	struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai;
+	int ret;
+
+	ret = snd_soc_dai_set_sysclk(cpu_dai, S3C64XX_CLKSRC_MUX, 0,
+				     SND_SOC_CLOCK_OUT);
+	if (ret < 0) {
+		printk(KERN_ERR "%s: cpu set_sysclk err\n", __func__);
+		return ret;
+	}
+
+	ret = snd_soc_dai_set_clkdiv(cpu_dai, S3C64XX_DIV_PRESCALER, 1);
+	if (ret < 0) {
+		printk(KERN_ERR "%s: cpu set_clkdiv err\n", __func__);
+		return ret;
+	}
+
+	ret = snd_soc_dai_set_sysclk(codec_dai, WM8731_SYSCLK,
+				     12000000, SND_SOC_CLOCK_IN);
+	if (ret < 0) {
+		printk(KERN_ERR "%s: codec sysclk err\n", __func__);
+		return ret;
+	}
+
+	return 0;
+}
+
+static struct snd_soc_ops wm_ops = {
+	.startup	= wm_startup,
+	.hw_params	= wm_hw_params,
+	.shutdown	= wm_shutdown,
+};
+
+static const struct snd_soc_dapm_widget widgets[] = {
+	SND_SOC_DAPM_LINE("Line Out", NULL),
+	SND_SOC_DAPM_HP("Headphone Jack", NULL),
+	SND_SOC_DAPM_INPUT("Line In"),
+};
+
+static const struct snd_soc_dapm_route intercon[] = {
+	/* headphone connected to LHPOUT1, RHPOUT1 */
+	{"Headphone Jack", NULL, "LHPOUT"},
+	{"Headphone Jack", NULL, "RHPOUT"},
+
+	{"Line Out", NULL, "LOUT" },
+	{"Line Out", NULL, "ROUT" },
+
+	{"LLINEIN", NULL, "Line In" },
+	{"RLINEIN", NULL, "Line In" },
+};
+
+static int wm_init(struct snd_soc_codec *codec)
+{
+	printk(KERN_DEBUG "%s: codec %p\n", __func__, codec);
+
+	snd_soc_dapm_new_controls(codec, widgets, ARRAY_SIZE(widgets));
+	snd_soc_dapm_add_routes(codec, intercon, ARRAY_SIZE(intercon));
+
+	snd_soc_dapm_sync(codec);
+
+	return 0;
+}
+
+#include "s3c24xx-pcm.h"
+
+static struct snd_soc_dai_link wm_dai_link = {
+	.name		= "WM8731",
+	.stream_name	= "WM8731",
+	.cpu_dai	= &s3c64xx_i2s_dai,
+	.codec_dai	= &wm8731_dai,
+	.init		= wm_init,
+	.ops		= &wm_ops,
+};
+
+static struct snd_soc_card wm_card = {
+	.name		= "SMDK6410-WM8731",
+	.dai_link	= &wm_dai_link,
+	.platform	= &s3c24xx_soc_platform,
+	.num_links	= 1,
+};
+
+struct wm8731_setup_data wm_setup = {
+	.i2c_bus	= 0,
+	.i2c_address	= 0x1a,
+};
+
+static struct snd_soc_device wm_snd_devdata = {
+	.card		= &wm_card,
+	.codec_dev	= &soc_codec_dev_wm8731,
+	.codec_data	= &wm_setup,
+};
+
+static int __init smdk6410_wm8731_init(void)
+{
+	int ret;
+
+	printk(KERN_INFO "%s: welcome\n", __func__);
+
+	if (!machine_is_smdk6410()) {
+		printk(KERN_INFO "%s: for SMDK6410s\n", __func__);
+		return -ENOENT;
+	}
+
+	socdev = platform_device_alloc("soc-audio", 0);
+	if (!socdev) {
+		printk(KERN_ERR "%s: no device\n", __func__);
+		return -ENOMEM;
+	}
+
+	platform_set_drvdata(socdev, &wm_snd_devdata);
+
+	wm_snd_devdata.dev = &socdev->dev;
+
+	ret = platform_device_add(socdev);
+	if (ret) {
+		printk(KERN_ERR "%s: failed to add\n", __func__);
+		goto err_dev;
+	}
+
+	printk(KERN_INFO "%s: succesfull\n", __func__);
+	return 0;
+
+err_dev:
+	platform_device_put(socdev);
+	return ret;
+}
+
+module_init(smdk6410_wm8731_init);
+MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>");
+MODULE_LICENSE("GPL");
Index: linux.git/sound/soc/s3c24xx/Kconfig
===================================================================
--- linux.git.orig/sound/soc/s3c24xx/Kconfig	2009-03-04 00:44:31.000000000 +0000
+++ linux.git/sound/soc/s3c24xx/Kconfig	2009-03-04 00:45:04.000000000 +0000
@@ -66,3 +66,11 @@ config SND_S3C24XX_SOC_S3C24XX_UDA134X
        	depends on SND_S3C24XX_SOC
        	select SND_S3C24XX_SOC_I2S
        	select SND_SOC_UDA134X
+
+config SND_S3C64XX_SOC_SMDK6410_WM8731
+	tristate "SoC I2S Audio support for WM8731 added to an SMDK6410"
+	depends on SND_S3C24XX_SOC
+	select SND_S3C64XX_SOC_I2S
+	select SND_SOC_WM8731
+	help
+	  Support for an WM8731 add-on board on I2S channel 0 on an SMDK6410

-- 
Ben (ben@fluff.org, http://www.fluff.org/)

  'a smiley only costs 4 bytes'

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

* [patch 9/9] AUDIO: Select DMA if I2S is configured
  2009-03-04  0:49 [patch 0/9] S3C24XX/S3C64XX updates Ben Dooks
                   ` (7 preceding siblings ...)
  2009-03-04  0:49 ` [patch 8/9] SMDK6410: Add support for WM8731 on an add-on board Ben Dooks
@ 2009-03-04  0:49 ` Ben Dooks
  2009-03-04 20:29 ` [patch 0/9] S3C24XX/S3C64XX updates Mark Brown
  9 siblings, 0 replies; 24+ messages in thread
From: Ben Dooks @ 2009-03-04  0:49 UTC (permalink / raw)
  To: alsa-devel; +Cc: broonie

[-- Attachment #1: audio/select-dma-from-kconfig.patch --]
[-- Type: text/plain, Size: 942 bytes --]

Select the relevant DMA implementation when the
sound driver is selected.

Signed-off-by: Ben Dooks <ben@simtec.co.uk>
Index: linux.agit/sound/soc/s3c24xx/Kconfig
===================================================================
--- linux.agit.orig/sound/soc/s3c24xx/Kconfig	2009-02-26 18:07:22.000000000 +0000
+++ linux.agit/sound/soc/s3c24xx/Kconfig	2009-02-26 18:12:29.000000000 +0000
@@ -8,6 +8,7 @@ config SND_S3C24XX_SOC
 
 config SND_S3C24XX_SOC_I2S
 	tristate
+	select S3C2410_DMA
 
 config SND_S3C_I2SV2_SOC
 	tristate
@@ -15,13 +16,16 @@ config SND_S3C_I2SV2_SOC
 config SND_S3C2412_SOC_I2S
 	tristate
 	select SND_S3C_I2SV2_SOC
+	select S3C2410_DMA
 
 config SND_S3C64XX_SOC_I2S
 	tristate
 	select SND_S3C_I2SV2_SOC
+	select S3C64XX_DMA
 
 config SND_S3C2443_SOC_AC97
 	tristate
+	select S3C2410_DMA
 	select AC97_BUS
 	select SND_SOC_AC97_BUS
 	

-- 
Ben (ben@fluff.org, http://www.fluff.org/)

  'a smiley only costs 4 bytes'

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

* Re: [patch 6/9] S3C64XX: Add s3c64xx-i2s support
  2009-03-04  0:49 ` [patch 6/9] S3C64XX: Add s3c64xx-i2s support Ben Dooks
@ 2009-03-04  0:56   ` Ben Dooks
  2009-03-04 19:56   ` Mark Brown
  1 sibling, 0 replies; 24+ messages in thread
From: Ben Dooks @ 2009-03-04  0:56 UTC (permalink / raw)
  To: Ben Dooks; +Cc: alsa-devel, broonie

On Wed, Mar 04, 2009 at 12:49:31AM +0000, Ben Dooks wrote:
> From: Ben Dooks <ben@simtec.co.uk>
> 
> Add the initial code to support the S3C64XX I2S hardware using the
> s3c-i2s-v2 core code.
> 
> Signed-off-by: Ben Dooks <ben@simtec.co.uk>
> 
> Index: linux.git/sound/soc/s3c24xx/Makefile
> ===================================================================
> --- linux.git.orig/sound/soc/s3c24xx/Makefile	2009-03-04 00:44:28.000000000 +0000
> +++ linux.git/sound/soc/s3c24xx/Makefile	2009-03-04 00:44:31.000000000 +0000
> @@ -2,6 +2,7 @@
>  snd-soc-s3c24xx-objs := s3c24xx-pcm.o
>  snd-soc-s3c24xx-i2s-objs := s3c24xx-i2s.o
>  snd-soc-s3c2412-i2s-objs := s3c2412-i2s.o
> +snd-soc-s3c64xx-i2s-objs := s3c64xx-i2s.o
>  snd-soc-s3c2443-ac97-objs := s3c2443-ac97.o
>  snd-soc-s3c-i2s-v2-objs := s3c-i2s-v2.o
>  
> @@ -9,6 +10,7 @@ obj-$(CONFIG_SND_S3C24XX_SOC) += snd-soc
>  obj-$(CONFIG_SND_S3C24XX_SOC_I2S) += snd-soc-s3c24xx-i2s.o
>  obj-$(CONFIG_SND_S3C2443_SOC_AC97) += snd-soc-s3c2443-ac97.o
>  obj-$(CONFIG_SND_S3C2412_SOC_I2S) += snd-soc-s3c2412-i2s.o
> +obj-$(CONFIG_SND_S3C64XX_SOC_I2S) += snd-soc-s3c64xx-i2s.o
>  obj-$(CONFIG_SND_S3C_I2SV2_SOC) += snd-soc-s3c-i2s-v2.o
>  
>  # S3C24XX Machine Support
> Index: linux.git/sound/soc/s3c24xx/s3c64xx-i2s.c
> ===================================================================
> --- /dev/null	1970-01-01 00:00:00.000000000 +0000
> +++ linux.git/sound/soc/s3c24xx/s3c64xx-i2s.c	2009-03-04 00:44:31.000000000 +0000
> @@ -0,0 +1,220 @@
> +/* sound/soc/s3c24xx/s3c64xx-i2s.c
> + *
> + * ALSA SoC Audio Layer - S3C64XX I2S driver
> + *
> + * Copyright 2008 Openmoko, Inc.
> + * Copyright 2008 Simtec Electronics
> + *      Ben Dooks <ben@simtec.co.uk>
> + *      http://armlinux.simtec.co.uk/
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + */

sorry, forgot to update copyright before sending

> +#include <linux/init.h>
> +#include <linux/module.h>
> +#include <linux/device.h>
> +#include <linux/delay.h>
> +#include <linux/clk.h>
> +#include <linux/kernel.h>
> +#include <linux/gpio.h>
> +#include <linux/io.h>
> +
> +#include <sound/core.h>
> +#include <sound/pcm.h>
> +#include <sound/pcm_params.h>
> +#include <sound/initval.h>
> +#include <sound/soc.h>
> +
> +#include <plat/regs-s3c2412-iis.h>
> +#include <plat/gpio-bank-d.h>
> +#include <plat/gpio-bank-e.h>
> +#include <plat/gpio-cfg.h>
> +#include <plat/audio.h>
> +
> +#include <mach/map.h>
> +#include <mach/dma.h>
> +
> +#include "s3c24xx-pcm.h"
> +#include "s3c64xx-i2s.h"
> +
> +static struct s3c2410_dma_client s3c64xx_dma_client_out = {
> +	.name		= "I2S PCM Stereo out"
> +};
> +
> +static struct s3c2410_dma_client s3c64xx_dma_client_in = {
> +	.name		= "I2S PCM Stereo in"
> +};
> +
> +static struct s3c24xx_pcm_dma_params s3c64xx_i2s_pcm_stereo_out[2] = {
> +	[0] = {
> +		.channel	= DMACH_I2S0_OUT,
> +		.client		= &s3c64xx_dma_client_out,
> +		.dma_addr	= S3C64XX_PA_IIS0 + S3C2412_IISTXD,
> +		.dma_size	= 4,
> +	},
> +	[1] = {
> +		.channel	= DMACH_I2S1_OUT,
> +		.client		= &s3c64xx_dma_client_out,
> +		.dma_addr	= S3C64XX_PA_IIS1 + S3C2412_IISTXD,
> +		.dma_size	= 4,
> +	},
> +};
> +
> +static struct s3c24xx_pcm_dma_params s3c64xx_i2s_pcm_stereo_in[2] = {
> +	[0] = {
> +		.channel	= DMACH_I2S0_IN,
> +		.client		= &s3c64xx_dma_client_in,
> +		.dma_addr	= S3C64XX_PA_IIS0 + S3C2412_IISRXD,
> +		.dma_size	= 4,
> +	},
> +	[1] = {
> +		.channel	= DMACH_I2S1_IN,
> +		.client		= &s3c64xx_dma_client_in,
> +		.dma_addr	= S3C64XX_PA_IIS1 + S3C2412_IISRXD,
> +		.dma_size	= 4,
> +	},
> +};
> +
> +static struct s3c_i2sv2_info s3c64xx_i2s[2];
> +
> +static inline struct s3c_i2sv2_info *to_info(struct snd_soc_dai *cpu_dai)
> +{
> +	return cpu_dai->private_data;
> +}
> +
> +static int s3c64xx_i2s_set_sysclk(struct snd_soc_dai *cpu_dai,
> +				  int clk_id, unsigned int freq, int dir)
> +{
> +	struct s3c_i2sv2_info *i2s = to_info(cpu_dai);
> +	u32 iismod = readl(i2s->regs + S3C2412_IISMOD);
> +
> +	switch (clk_id) {
> +	case S3C64XX_CLKSRC_PCLK:
> +		iismod &= ~S3C64XX_IISMOD_IMS_SYSMUX;
> +		break;
> +
> +	case S3C64XX_CLKSRC_MUX:
> +		iismod |= S3C64XX_IISMOD_IMS_SYSMUX;
> +		break;
> +
> +	default:
> +		return -EINVAL;
> +	}
> +
> +	writel(iismod, i2s->regs + S3C2412_IISMOD);
> +
> +	return 0;
> +}
> +
> +
> +unsigned long s3c64xx_i2s_get_clockrate(struct snd_soc_dai *dai)
> +{
> +	struct s3c_i2sv2_info *i2s = to_info(dai);
> +
> +	return clk_get_rate(i2s->iis_cclk);
> +}
> +EXPORT_SYMBOL_GPL(s3c64xx_i2s_get_clockrate);
> +
> +static int s3c64xx_i2s_probe(struct platform_device *pdev,
> +			     struct snd_soc_dai *dai)
> +{
> +	struct device *dev = &pdev->dev;
> +	struct s3c_i2sv2_info *i2s;
> +	int ret;
> +
> +	dev_dbg(dev, "%s: probing dai %d\n", __func__, pdev->id);
> +
> +	if (pdev->id < 0 || pdev->id > ARRAY_SIZE(s3c64xx_i2s)) {
> +		dev_err(dev, "id %d out of range\n", pdev->id);
> +		return -EINVAL;
> +	}
> +
> +	i2s = &s3c64xx_i2s[pdev->id];
> +
> +	ret = s3c_i2sv2_probe(pdev, dai, i2s,
> +			      pdev->id ? S3C64XX_PA_IIS1 : S3C64XX_PA_IIS0);
> +	if (ret)
> +		return ret;
> +
> +	i2s->dma_capture = &s3c64xx_i2s_pcm_stereo_in[pdev->id];
> +	i2s->dma_playback = &s3c64xx_i2s_pcm_stereo_out[pdev->id];
> +
> +	i2s->iis_cclk = clk_get(dev, "audio-bus");
> +	if (IS_ERR(i2s->iis_cclk)) {
> +		dev_err(dev, "failed to get audio-bus");
> +		iounmap(i2s->regs);
> +		return -ENODEV;
> +	}
> +
> +	/* configure GPIO for i2s port */
> +	switch (pdev->id) {
> +	case 0:
> +		s3c_gpio_cfgpin(S3C64XX_GPD(0), S3C64XX_GPD0_I2S0_CLK);
> +		s3c_gpio_cfgpin(S3C64XX_GPD(1), S3C64XX_GPD1_I2S0_CDCLK);
> +		s3c_gpio_cfgpin(S3C64XX_GPD(2), S3C64XX_GPD2_I2S0_LRCLK);
> +		s3c_gpio_cfgpin(S3C64XX_GPD(3), S3C64XX_GPD3_I2S0_DI);
> +		s3c_gpio_cfgpin(S3C64XX_GPD(4), S3C64XX_GPD4_I2S0_D0);
> +		break;
> +	case 1:
> +		s3c_gpio_cfgpin(S3C64XX_GPE(0), S3C64XX_GPE0_I2S1_CLK);
> +		s3c_gpio_cfgpin(S3C64XX_GPE(1), S3C64XX_GPE1_I2S1_CDCLK);
> +		s3c_gpio_cfgpin(S3C64XX_GPE(2), S3C64XX_GPE2_I2S1_LRCLK);
> +		s3c_gpio_cfgpin(S3C64XX_GPE(3), S3C64XX_GPE3_I2S1_DI);
> +		s3c_gpio_cfgpin(S3C64XX_GPE(4), S3C64XX_GPE4_I2S1_D0);
> +	}
> +
> +	return 0;
> +}
> +
> +
> +#define S3C64XX_I2S_RATES \
> +	(SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_11025 | SNDRV_PCM_RATE_16000 | \
> +	SNDRV_PCM_RATE_22050 | SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 | \
> +	SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000)
> +
> +#define S3C64XX_I2S_FMTS \
> +	(SNDRV_PCM_FMTBIT_S8 | SNDRV_PCM_FMTBIT_S16_LE)
> +
> +struct snd_soc_dai s3c64xx_i2s_dai = {
> +	.name		= "s3c64xx-i2s",
> +	.id		= 0,
> +	.probe		= s3c64xx_i2s_probe,
> +	.playback = {
> +		.channels_min	= 2,
> +		.channels_max	= 2,
> +		.rates		= S3C64XX_I2S_RATES,
> +		.formats	= S3C64XX_I2S_FMTS,
> +	},
> +	.capture = {
> +		.channels_min	= 2,
> +		.channels_max	= 2,
> +		.rates		= S3C64XX_I2S_RATES,
> +		.formats	= S3C64XX_I2S_FMTS,
> +	},
> +	.ops = {
> +		.set_sysclk	= s3c64xx_i2s_set_sysclk,
> +	},
> +};
> +EXPORT_SYMBOL_GPL(s3c64xx_i2s_dai);
> +
> +static int __init s3c64xx_i2s_init(void)
> +{
> +	return  s3c_i2sv2_register_dai(&s3c64xx_i2s_dai);
> +}
> +module_init(s3c64xx_i2s_init);
> +
> +static void __exit s3c64xx_i2s_exit(void)
> +{
> +	snd_soc_unregister_dai(&s3c64xx_i2s_dai);
> +}
> +module_exit(s3c64xx_i2s_exit);
> +
> +/* Module information */
> +MODULE_AUTHOR("Ben Dooks, <ben@simtec.co.uk>");
> +MODULE_DESCRIPTION("S3C64XX I2S SoC Interface");
> +MODULE_LICENSE("GPL");
> +
> +
> +
> Index: linux.git/sound/soc/s3c24xx/s3c64xx-i2s.h
> ===================================================================
> --- /dev/null	1970-01-01 00:00:00.000000000 +0000
> +++ linux.git/sound/soc/s3c24xx/s3c64xx-i2s.h	2009-03-04 00:44:31.000000000 +0000
> @@ -0,0 +1,31 @@
> +/* sound/soc/s3c24xx/s3c64xx-i2s.h
> + *
> + * ALSA SoC Audio Layer - S3C64XX I2S driver
> + *
> + * Copyright 2008 Openmoko, Inc.
> + * Copyright 2008 Simtec Electronics
> + *      Ben Dooks <ben@simtec.co.uk>
> + *      http://armlinux.simtec.co.uk/
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + */
> +
> +#ifndef __SND_SOC_S3C24XX_S3C64XX_I2S_H
> +#define __SND_SOC_S3C24XX_S3C64XX_I2S_H __FILE__
> +
> +#include "s3c-i2s-v2.h"
> +
> +#define S3C64XX_DIV_BCLK	S3C_I2SV2_DIV_BCLK
> +#define S3C64XX_DIV_RCLK	S3C_I2SV2_DIV_RCLK
> +#define S3C64XX_DIV_PRESCALER	S3C_I2SV2_DIV_PRESCALER
> +
> +#define S3C64XX_CLKSRC_PCLK	(0)
> +#define S3C64XX_CLKSRC_MUX	(1)
> +
> +extern struct snd_soc_dai s3c64xx_i2s_dai;
> +
> +extern unsigned long s3c64xx_i2s_get_clockrate(struct snd_soc_dai *cpu_dai);
> +
> +#endif /* __SND_SOC_S3C24XX_S3C64XX_I2S_H */
> Index: linux.git/sound/soc/s3c24xx/Kconfig
> ===================================================================
> --- linux.git.orig/sound/soc/s3c24xx/Kconfig	2009-03-04 00:44:28.000000000 +0000
> +++ linux.git/sound/soc/s3c24xx/Kconfig	2009-03-04 00:44:31.000000000 +0000
> @@ -1,6 +1,6 @@
>  config SND_S3C24XX_SOC
>  	tristate "SoC Audio for the Samsung S3C24XX chips"
> -	depends on ARCH_S3C2410
> +	depends on ARCH_S3C2410 || ARCH_S3C64XX
>  	help
>  	  Say Y or M if you want to add support for codecs attached to
>  	  the S3C24XX AC97, I2S or SSP interface. You will also need
> @@ -16,6 +16,10 @@ config SND_S3C2412_SOC_I2S
>  	tristate
>  	select SND_S3C_I2SV2_SOC
>  
> +config SND_S3C64XX_SOC_I2S
> +	tristate
> +	select SND_S3C_I2SV2_SOC
> +
>  config SND_S3C2443_SOC_AC97
>  	tristate
>  	select AC97_BUS
> Index: linux.git/arch/arm/plat-s3c/include/plat/regs-s3c2412-iis.h
> ===================================================================
> --- linux.git.orig/arch/arm/plat-s3c/include/plat/regs-s3c2412-iis.h	2009-03-04 00:44:10.000000000 +0000
> +++ linux.git/arch/arm/plat-s3c/include/plat/regs-s3c2412-iis.h	2009-03-04 00:44:31.000000000 +0000
> @@ -33,6 +33,9 @@
>  #define S3C2412_IISCON_RXDMA_ACTIVE	(1 << 1)
>  #define S3C2412_IISCON_IIS_ACTIVE	(1 << 0)
>  
> +#define S3C64XX_IISMOD_IMS_PCLK		(0 << 10)
> +#define S3C64XX_IISMOD_IMS_SYSMUX	(1 << 10)
> +
>  #define S3C2412_IISMOD_MASTER_INTERNAL	(0 << 10)
>  #define S3C2412_IISMOD_MASTER_EXTERNAL	(1 << 10)
>  #define S3C2412_IISMOD_SLAVE		(2 << 10)
> 
> -- 
> Ben (ben@fluff.org, http://www.fluff.org/)
> 
>   'a smiley only costs 4 bytes'
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

-- 
-- 
Ben

Q:      What's a light-year?
A:      One-third less calories than a regular year.

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

* Re: [patch 2/9] JIVE: Add ASoC audio support
  2009-03-04  0:49 ` [patch 2/9] JIVE: Add ASoC audio support Ben Dooks
@ 2009-03-04 14:57   ` Mark Brown
  0 siblings, 0 replies; 24+ messages in thread
From: Mark Brown @ 2009-03-04 14:57 UTC (permalink / raw)
  To: Ben Dooks; +Cc: alsa-devel

On Wed, Mar 04, 2009 at 12:49:27AM +0000, Ben Dooks wrote:

> +static int jive_startup(struct snd_pcm_substream *substream)
> +{
> +	struct snd_soc_pcm_runtime *rtd = substream->private_data;
> +	struct snd_soc_codec *codec = rtd->socdev->codec;
> +
> +	snd_soc_dapm_enable_pin(codec, "Headphone Jack");
> +	snd_soc_dapm_enable_pin(codec, "Internal Speaker");
> +	snd_soc_dapm_enable_pin(codec, "Line In");
> +
> +	snd_soc_dapm_sync(codec);
> +
> +	return 0;
> +}

As previously mentioned this function should be removed: the default
state of pins is that they're enabled and you never disable these pins
so there will be no effect.

> +	/* These endpoints are not being used. */
> +	snd_soc_dapm_disable_pin(codec, "LINPUT2");
> +	snd_soc_dapm_disable_pin(codec, "RINPUT2");
> +	snd_soc_dapm_disable_pin(codec, "LINPUT3");
> +	snd_soc_dapm_disable_pin(codec, "RINPUT3");
> +	snd_soc_dapm_disable_pin(codec, "OUT3");
> +	snd_soc_dapm_disable_pin(codec, "MONO");

Should be snd_soc_dapm_nc_pin().

> +	printk("JIVE WM8750 Audio support\n");

Should have KERN_INFO or use pr_info().

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

* Re: [patch 4/9] S3C24XX ASoC: Fix copyright statements on Simtec files
  2009-03-04  0:49 ` [patch 4/9] S3C24XX ASoC: Fix copyright statements on Simtec files Ben Dooks
@ 2009-03-04 19:20   ` Mark Brown
  0 siblings, 0 replies; 24+ messages in thread
From: Mark Brown @ 2009-03-04 19:20 UTC (permalink / raw)
  To: Ben Dooks; +Cc: alsa-devel

On Wed, Mar 04, 2009 at 12:49:29AM +0000, Ben Dooks wrote:
> From: Ben Dooks <ben@simtec.co.uk>
> Fix the copyright statements in two of the S3C24XX ASoC files
> that have (c) when we require the full word.
> 
> Signed-off-by: Ben Dooks <ben@simtec.co.uk>

This was merged previously from your presubmission.

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

* Re: [patch 5/9] S3C: Split s3c2412-i2s.c into core and SoC specific parts
  2009-03-04  0:49 ` [patch 5/9] S3C: Split s3c2412-i2s.c into core and SoC specific parts Ben Dooks
@ 2009-03-04 19:52   ` Mark Brown
  0 siblings, 0 replies; 24+ messages in thread
From: Mark Brown @ 2009-03-04 19:52 UTC (permalink / raw)
  To: Ben Dooks; +Cc: alsa-devel

On Wed, Mar 04, 2009 at 12:49:30AM +0000, Ben Dooks wrote:

I'll apply this, just a few comments in passing (I'll probably fix these
up myself).

> The S3C2412 I2S (IIS) interface is replicated on further Samsung SoC
> parts in a broadly compatible way, so split the common code out into
> a core called s3c-i2s-v2.[ch] so that the newer SoCs such as the
> S3C6410 can make use of it.

> As such, all the original s3c2412 functions are currently being left
> with their original names, and will be renamed later in the series.

This does a bit more than the patch description says - it also adds bits
of code for S3C64xx.

> +#if S3C2412_I2S_DEBUG
> +#define DBG(x...) printk(KERN_INFO x)
> +#else
> +#define DBG(x...) do { } while (0)
> +#endif

This should be pr_dbg() (the original file had that fixed).

> +#define bit_set(v, b) (((v) & (b)) ? 1 : 0)

This feels like it should be in some standard header but it isn't.  Ho
hum.

> +	default:
> +		DBG("unknwon master/slave format\n");
> +		return -EINVAL;
> +	}

Should be an unconditional error message.

> +	default:
> +		DBG("Unknown data format\n");
> +		return -EINVAL;
> +	}

Ditto.

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

* Re: [patch 6/9] S3C64XX: Add s3c64xx-i2s support
  2009-03-04  0:49 ` [patch 6/9] S3C64XX: Add s3c64xx-i2s support Ben Dooks
  2009-03-04  0:56   ` Ben Dooks
@ 2009-03-04 19:56   ` Mark Brown
  1 sibling, 0 replies; 24+ messages in thread
From: Mark Brown @ 2009-03-04 19:56 UTC (permalink / raw)
  To: Ben Dooks; +Cc: alsa-devel

On Wed, Mar 04, 2009 at 12:49:31AM +0000, Ben Dooks wrote:
> From: Ben Dooks <ben@simtec.co.uk>

> Add the initial code to support the S3C64XX I2S hardware using the
> s3c-i2s-v2 core code.

> Signed-off-by: Ben Dooks <ben@simtec.co.uk>

I'll apply this, just one little comment for future reference:

> +#define S3C64XX_I2S_RATES \
> +	(SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_11025 | SNDRV_PCM_RATE_16000 | \
> +	SNDRV_PCM_RATE_22050 | SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 | \
> +	SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000)

Could do SNDDRV_PCM_RATE_8000_96000 here.

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

* Re: [patch 7/9] ASoC: Ensure codec check hw_write error at probe
  2009-03-04  0:49 ` [patch 7/9] ASoC: Ensure codec check hw_write error at probe Ben Dooks
@ 2009-03-04 19:57   ` Mark Brown
  0 siblings, 0 replies; 24+ messages in thread
From: Mark Brown @ 2009-03-04 19:57 UTC (permalink / raw)
  To: Ben Dooks; +Cc: alsa-devel

On Wed, Mar 04, 2009 at 12:49:32AM +0000, Ben Dooks wrote:

> Add checks to see if wmXXXX_reset() failed and notify
> the user of the problem. This is generally due to a
> problem on the i2c bus such as an un-powered or 
> non-connected codec.

This doesn't apply against the current branch (and similar changes have
already been merged anyway).

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

* Re: [patch 8/9] SMDK6410: Add support for WM8731 on an add-on board
  2009-03-04  0:49 ` [patch 8/9] SMDK6410: Add support for WM8731 on an add-on board Ben Dooks
@ 2009-03-04 20:06   ` Mark Brown
  0 siblings, 0 replies; 24+ messages in thread
From: Mark Brown @ 2009-03-04 20:06 UTC (permalink / raw)
  To: Ben Dooks; +Cc: Ben Dooks, alsa-devel

On Wed, Mar 04, 2009 at 12:49:33AM +0000, Ben Dooks wrote:
> Add support for an WM8731 connected to an SMDK6410 instead
> of the onboard codec.

> Signed-off-by: Ben Dooks <benb@simtec.co.uk>

Is there any plan to make this board generally available?  IIRC it was a
flying wire board rather than a plugin for the baseband connector on the
SMDK6410.  I'd prefer not to start merging flying wire systems since the
numbers tend to multiply (I do rather a lot myself!).

> +static void wm_shutdown(struct snd_pcm_substream *substream)
> +{
> +	printk(KERN_INFO "%s: substream %p\n", __func__, substream);
> +}

This and several of the other printks in the driver are a bit chatty...
pr_dbg()?

> +	//fmt = SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS;

C++ comment.

> +struct wm8731_setup_data wm_setup = {
> +	.i2c_bus	= 0,
> +	.i2c_address	= 0x1a,
> +};

This won't build with current git - the WM8731 has been refactored to
probe using the standard I2C registration stuff.  See the driver in
atmel/sam9g20_wm8731.c for an example, essentially all that needs doing
is to remove the struct here.

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

* Re: [patch 0/9] S3C24XX/S3C64XX updates
  2009-03-04  0:49 [patch 0/9] S3C24XX/S3C64XX updates Ben Dooks
                   ` (8 preceding siblings ...)
  2009-03-04  0:49 ` [patch 9/9] AUDIO: Select DMA if I2S is configured Ben Dooks
@ 2009-03-04 20:29 ` Mark Brown
  2009-03-05  7:23   ` Takashi Iwai
  9 siblings, 1 reply; 24+ messages in thread
From: Mark Brown @ 2009-03-04 20:29 UTC (permalink / raw)
  To: Ben Dooks, tiwai; +Cc: alsa-devel

On Wed, Mar 04, 2009 at 12:49:25AM +0000, Ben Dooks wrote:
> This is a set of patches for 2.6.30 to add more
> s3c24xx machine support and support for the S3C64XX
> series of SoC.

I've merged everything I didn't specifically comment on, plus some of
the rest.  I also added JIVE and fixed the review issues myself.  Thanks
a lot for doing this!

As previously discussed I'll update my IISv4 driver from the Samsung BSP
for mainline and take care of AC97 and the on board audio for the
SMDK6410 too.

> It would be very useful to get the header moves merged
> as soon as possible, to help clear out the old ARM
> include directories (and make it easier for the merges
> from other s3c branches that need to take place in the
> merge window). As such, they're only moves and should
> not affect the actual build.

Takashi, what do you think about this?  Should I send a 2.6.29 update
(it's very late in the game...) or would it be better to deal with this
by trying to merge ALSA early in the merge window?  Either way works for
me.

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

* Re: [patch 0/9] S3C24XX/S3C64XX updates
  2009-03-04 20:29 ` [patch 0/9] S3C24XX/S3C64XX updates Mark Brown
@ 2009-03-05  7:23   ` Takashi Iwai
  2009-03-05 10:31     ` Mark Brown
  0 siblings, 1 reply; 24+ messages in thread
From: Takashi Iwai @ 2009-03-05  7:23 UTC (permalink / raw)
  To: Mark Brown; +Cc: Ben Dooks, alsa-devel

At Wed, 4 Mar 2009 20:29:54 +0000,
Mark Brown wrote:
> 
> > It would be very useful to get the header moves merged
> > as soon as possible, to help clear out the old ARM
> > include directories (and make it easier for the merges
> > from other s3c branches that need to take place in the
> > merge window). As such, they're only moves and should
> > not affect the actual build.
> 
> Takashi, what do you think about this?  Should I send a 2.6.29 update
> (it's very late in the game...) or would it be better to deal with this
> by trying to merge ALSA early in the merge window?  Either way works for
> me.

Me too :)  I wouldn't take this for 2.6.29 as long as it builds now,
but this particular change should go through ARM tree, so it's rather
Russell's call.  Could you forward this one?

The others are applied fine to sound tree as 2.6.30 changes.


thanks,

Takashi

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

* Re: [patch 0/9] S3C24XX/S3C64XX updates
  2009-03-05  7:23   ` Takashi Iwai
@ 2009-03-05 10:31     ` Mark Brown
  2009-03-05 10:36       ` Takashi Iwai
  0 siblings, 1 reply; 24+ messages in thread
From: Mark Brown @ 2009-03-05 10:31 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: Ben Dooks, alsa-devel

On Thu, Mar 05, 2009 at 08:23:25AM +0100, Takashi Iwai wrote:

> Me too :)  I wouldn't take this for 2.6.29 as long as it builds now,
> but this particular change should go through ARM tree, so it's rather
> Russell's call.  Could you forward this one?

> The others are applied fine to sound tree as 2.6.30 changes.

Ordinarily it should go through the ARM tree but due to the addition of
the S3C64xx support it would create merge issues to separate it out -
most of the other patches in the series depend on this in one way or
another.  Ben is the maintainer for the general Samsung processor
support and this header move is part of a general reorgansation of ARM
headers from include/asm-arm into arch/arm so it was expected and should
be entirely uncontrovesial.

I could separate it out and push a separate branch via Russell as well
but that'd make more work for him and he's been having some very bad
network problems in addition to all the stuff he normally has to do so
I'm not sure he'd welcome more work right now.

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

* Re: [patch 0/9] S3C24XX/S3C64XX updates
  2009-03-05 10:31     ` Mark Brown
@ 2009-03-05 10:36       ` Takashi Iwai
  2009-03-05 11:03         ` Mark Brown
  0 siblings, 1 reply; 24+ messages in thread
From: Takashi Iwai @ 2009-03-05 10:36 UTC (permalink / raw)
  To: Mark Brown; +Cc: Ben Dooks, alsa-devel

At Thu, 5 Mar 2009 10:31:12 +0000,
Mark Brown wrote:
> 
> On Thu, Mar 05, 2009 at 08:23:25AM +0100, Takashi Iwai wrote:
> 
> > Me too :)  I wouldn't take this for 2.6.29 as long as it builds now,
> > but this particular change should go through ARM tree, so it's rather
> > Russell's call.  Could you forward this one?
> 
> > The others are applied fine to sound tree as 2.6.30 changes.
> 
> Ordinarily it should go through the ARM tree but due to the addition of
> the S3C64xx support it would create merge issues to separate it out -
> most of the other patches in the series depend on this in one way or
> another.  Ben is the maintainer for the general Samsung processor
> support and this header move is part of a general reorgansation of ARM
> headers from include/asm-arm into arch/arm so it was expected and should
> be entirely uncontrovesial.

Fair enough.

> I could separate it out and push a separate branch via Russell as well
> but that'd make more work for him and he's been having some very bad
> network problems in addition to all the stuff he normally has to do so
> I'm not sure he'd welcome more work right now.

Then it must be OK to keep the changes in our tree.  Though, it'd be
nice to have Russell's ack beforehand.
Maybe we can separate the header-move patch to another branch so that
he can pull it in easily if needed.


thanks,

Takashi

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

* Re: [patch 0/9] S3C24XX/S3C64XX updates
  2009-03-05 10:36       ` Takashi Iwai
@ 2009-03-05 11:03         ` Mark Brown
  2009-03-11 10:39           ` Ben Dooks
  0 siblings, 1 reply; 24+ messages in thread
From: Mark Brown @ 2009-03-05 11:03 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: Ben Dooks, alsa-devel

On Thu, Mar 05, 2009 at 11:36:34AM +0100, Takashi Iwai wrote:
> Mark Brown wrote:

> > I could separate it out and push a separate branch via Russell as well
> > but that'd make more work for him and he's been having some very bad
> > network problems in addition to all the stuff he normally has to do so
> > I'm not sure he'd welcome more work right now.

> Then it must be OK to keep the changes in our tree.  Though, it'd be
> nice to have Russell's ack beforehand.
> Maybe we can separate the header-move patch to another branch so that
> he can pull it in easily if needed.

OK, I'll create the separate branch and merge it into the branch I push
to you - Ben, I guess it'll be best to merge that one into whatever you
push to Russell?

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

* Re: [patch 0/9] S3C24XX/S3C64XX updates
  2009-03-05 11:03         ` Mark Brown
@ 2009-03-11 10:39           ` Ben Dooks
  2009-03-11 12:47             ` Mark Brown
  0 siblings, 1 reply; 24+ messages in thread
From: Ben Dooks @ 2009-03-11 10:39 UTC (permalink / raw)
  To: Mark Brown; +Cc: Takashi Iwai, Ben Dooks, alsa-devel

On Thu, Mar 05, 2009 at 11:03:00AM +0000, Mark Brown wrote:
> On Thu, Mar 05, 2009 at 11:36:34AM +0100, Takashi Iwai wrote:
> > Mark Brown wrote:
> 
> > > I could separate it out and push a separate branch via Russell as well
> > > but that'd make more work for him and he's been having some very bad
> > > network problems in addition to all the stuff he normally has to do so
> > > I'm not sure he'd welcome more work right now.
> 
> > Then it must be OK to keep the changes in our tree.  Though, it'd be
> > nice to have Russell's ack beforehand.
> > Maybe we can separate the header-move patch to another branch so that
> > he can pull it in easily if needed.
> 
> OK, I'll create the separate branch and merge it into the branch I push
> to you - Ben, I guess it'll be best to merge that one into whatever you
> push to Russell?

At the moment this is still in your for-2.6.30 branch, do I need to look
at doing anything about it?

-- 
Ben

Q:      What's a light-year?
A:      One-third less calories than a regular year.

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

* Re: [patch 0/9] S3C24XX/S3C64XX updates
  2009-03-11 10:39           ` Ben Dooks
@ 2009-03-11 12:47             ` Mark Brown
  0 siblings, 0 replies; 24+ messages in thread
From: Mark Brown @ 2009-03-11 12:47 UTC (permalink / raw)
  To: Ben Dooks; +Cc: Takashi Iwai, alsa-devel

On Wed, Mar 11, 2009 at 10:39:36AM +0000, Ben Dooks wrote:

> At the moment this is still in your for-2.6.30 branch, do I need to look
> at doing anything about it?

I've pushed a revert of the two hunks I mentioned to Takashi already.
If you could comment on the other two hunks I identified and provide a
revert patch for them as well if they're not required that would be
helpful - if they're not essential for this change they should be
submitted separately via the ARM tree.

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

end of thread, other threads:[~2009-03-11 12:47 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-04  0:49 [patch 0/9] S3C24XX/S3C64XX updates Ben Dooks
2009-03-04  0:49 ` [patch 1/9] S3C24XX: Move and update IIS headers Ben Dooks
2009-03-04  0:49 ` [patch 2/9] JIVE: Add ASoC audio support Ben Dooks
2009-03-04 14:57   ` Mark Brown
2009-03-04  0:49 ` [patch 3/9] S3C: Move <mach/audio.h> to <plat/audio.h> Ben Dooks
2009-03-04  0:49 ` [patch 4/9] S3C24XX ASoC: Fix copyright statements on Simtec files Ben Dooks
2009-03-04 19:20   ` Mark Brown
2009-03-04  0:49 ` [patch 5/9] S3C: Split s3c2412-i2s.c into core and SoC specific parts Ben Dooks
2009-03-04 19:52   ` Mark Brown
2009-03-04  0:49 ` [patch 6/9] S3C64XX: Add s3c64xx-i2s support Ben Dooks
2009-03-04  0:56   ` Ben Dooks
2009-03-04 19:56   ` Mark Brown
2009-03-04  0:49 ` [patch 7/9] ASoC: Ensure codec check hw_write error at probe Ben Dooks
2009-03-04 19:57   ` Mark Brown
2009-03-04  0:49 ` [patch 8/9] SMDK6410: Add support for WM8731 on an add-on board Ben Dooks
2009-03-04 20:06   ` Mark Brown
2009-03-04  0:49 ` [patch 9/9] AUDIO: Select DMA if I2S is configured Ben Dooks
2009-03-04 20:29 ` [patch 0/9] S3C24XX/S3C64XX updates Mark Brown
2009-03-05  7:23   ` Takashi Iwai
2009-03-05 10:31     ` Mark Brown
2009-03-05 10:36       ` Takashi Iwai
2009-03-05 11:03         ` Mark Brown
2009-03-11 10:39           ` Ben Dooks
2009-03-11 12:47             ` Mark Brown

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