diff mbox

[01/12] ASoC: DaVinci: Added support for stereo I2S

Message ID AANLkTilymkorrpTzUcxSNks7RsP7XqrkedESFUF_psqD@mail.gmail.com (mailing list archive)
State Superseded
Headers show

Commit Message

Raffaele Recalcati June 7, 2010, 10:15 a.m. UTC
None
diff mbox

Patch

diff --git a/sound/soc/davinci/davinci-i2s.c
b/sound/soc/davinci/davinci-i2s.c
index adadcd3..c1281c5 100644
--- a/sound/soc/davinci/davinci-i2s.c
+++ b/sound/soc/davinci/davinci-i2s.c
@@ -9,6 +9,8 @@ 
  * published by the Free Software Foundation.
  */

+#define DEBUG 3
+
 #include <linux/init.h>
 #include <linux/module.h>
 #include <linux/device.h>
@@ -68,16 +70,23 @@ 
 #define DAVINCI_MCBSP_RCR_RDATDLY(v)    ((v) << 16)
 #define DAVINCI_MCBSP_RCR_RFIG        (1 << 18)
 #define DAVINCI_MCBSP_RCR_RWDLEN2(v)    ((v) << 21)
+#define DAVINCI_MCBSP_RCR_RFRLEN2(v)    ((v) << 24)
+#define DAVINCI_MCBSP_RCR_RPHASE        (1 << 31)

 #define DAVINCI_MCBSP_XCR_XWDLEN1(v)    ((v) << 5)
 #define DAVINCI_MCBSP_XCR_XFRLEN1(v)    ((v) << 8)
 #define DAVINCI_MCBSP_XCR_XDATDLY(v)    ((v) << 16)
 #define DAVINCI_MCBSP_XCR_XFIG        (1 << 18)
 #define DAVINCI_MCBSP_XCR_XWDLEN2(v)    ((v) << 21)
+#define DAVINCI_MCBSP_XCR_XFRLEN2(v)    ((v) << 24)
+#define DAVINCI_MCBSP_XCR_XPHASE    (1 << 31)
+

+#define CLKGDV(v)                (v)     /* Bits 0:7 */
 #define DAVINCI_MCBSP_SRGR_FWID(v)    ((v) << 8)
 #define DAVINCI_MCBSP_SRGR_FPER(v)    ((v) << 16)
 #define DAVINCI_MCBSP_SRGR_FSGM        (1 << 28)
+#define DAVINCI_MCBSP_SRGR_CLKSM    (1 << 29)

 #define DAVINCI_MCBSP_PCR_CLKRP        (1 << 0)
 #define DAVINCI_MCBSP_PCR_CLKXP        (1 << 1)
@@ -89,6 +98,11 @@ 
 #define DAVINCI_MCBSP_PCR_FSRM        (1 << 10)
 #define DAVINCI_MCBSP_PCR_FSXM        (1 << 11)

+/* this define works when both clock and FS are output for the cpu
+   and makes clock very fast (FS is not simmetrical, but sampling
+   frequency is better approximated */
+#define I2S_FAST_CLOCK
+
 enum {
     DAVINCI_MCBSP_WORD_8 = 0,
     DAVINCI_MCBSP_WORD_12,
@@ -146,6 +160,14 @@  struct davinci_mcbsp_dev {
     unsigned enable_channel_combine:1;
 };

+struct davinci_mcbsp_data {
+    unsigned int    fmt;
+    int             clk_div;
+};
+
+static struct davinci_mcbsp_data mcbsp_data;
+
+
 static inline void davinci_mcbsp_write_reg(struct davinci_mcbsp_dev *dev,
                        int reg, u32 val)
 {
@@ -197,7 +219,7 @@  static void davinci_mcbsp_start(struct davinci_mcbsp_dev
*dev,
             int ret = platform->pcm_ops->trigger(substream,
                 SNDRV_PCM_TRIGGER_STOP);
             if (ret < 0)
-                printk(KERN_DEBUG "Playback DMA stop failed\n");
+                pr_debug("Playback DMA stop failed\n");
         }