17 #include <linux/module.h>
19 #include <linux/slab.h>
29 #include <mach/hardware.h>
35 #define EP93XX_I2S_TXCLKCFG 0x00
36 #define EP93XX_I2S_RXCLKCFG 0x04
37 #define EP93XX_I2S_GLCTRL 0x0C
39 #define EP93XX_I2S_TXLINCTRLDATA 0x28
40 #define EP93XX_I2S_TXCTRL 0x2C
41 #define EP93XX_I2S_TXWRDLEN 0x30
42 #define EP93XX_I2S_TX0EN 0x34
44 #define EP93XX_I2S_RXLINCTRLDATA 0x58
45 #define EP93XX_I2S_RXCTRL 0x5C
46 #define EP93XX_I2S_RXWRDLEN 0x60
47 #define EP93XX_I2S_RX0EN 0x64
49 #define EP93XX_I2S_WRDLEN_16 (0 << 0)
50 #define EP93XX_I2S_WRDLEN_24 (1 << 0)
51 #define EP93XX_I2S_WRDLEN_32 (2 << 0)
53 #define EP93XX_I2S_LINCTRLDATA_R_JUST (1 << 2)
55 #define EP93XX_I2S_CLKCFG_LRS (1 << 0)
56 #define EP93XX_I2S_CLKCFG_CKP (1 << 1)
57 #define EP93XX_I2S_CLKCFG_REL (1 << 2)
58 #define EP93XX_I2S_CLKCFG_MASTER (1 << 3)
59 #define EP93XX_I2S_CLKCFG_NBCG (1 << 4)
71 .name =
"i2s-pcm-out",
81 unsigned reg,
unsigned val)
113 for (i = 0; i < 3; i++)
114 ep93xx_i2s_write_reg(info, base_reg + (i * 4), 1);
117 static void ep93xx_i2s_disable(
struct ep93xx_i2s_info *info,
int stream)
127 for (i = 0; i < 3; i++)
128 ep93xx_i2s_write_reg(info, base_reg + (i * 4), 0);
149 snd_soc_dai_set_dma_data(cpu_dai, substream,
159 ep93xx_i2s_disable(info, substream->
stream);
162 static int ep93xx_i2s_set_dai_fmt(
struct snd_soc_dai *cpu_dai,
166 unsigned int clk_cfg, lin_ctrl;
243 unsigned word_len,
div, sdiv, lrdiv;
278 if (div > (256 + 512) / 2) {
282 if (div < (128 + 256) / 2)
294 ep93xx_i2s_enable(info, substream->
stream);
298 static int ep93xx_i2s_set_sysclk(
struct snd_soc_dai *cpu_dai,
int clk_id,
299 unsigned int freq,
int dir)
336 #define ep93xx_i2s_suspend NULL
337 #define ep93xx_i2s_resume NULL
341 .startup = ep93xx_i2s_startup,
342 .shutdown = ep93xx_i2s_shutdown,
343 .hw_params = ep93xx_i2s_hw_params,
344 .set_sysclk = ep93xx_i2s_set_sysclk,
345 .set_fmt = ep93xx_i2s_set_dai_fmt,
348 #define EP93XX_I2S_FORMATS (SNDRV_PCM_FMTBIT_S32_LE)
366 .ops = &ep93xx_i2s_dai_ops,
388 if (IS_ERR(info->
mclk)) {
389 err = PTR_ERR(info->
mclk);
394 if (IS_ERR(info->
sclk)) {
395 err = PTR_ERR(info->
sclk);
400 if (IS_ERR(info->
lrclk)) {
401 err = PTR_ERR(info->
lrclk);
438 .probe = ep93xx_i2s_probe,
441 .name =
"ep93xx-i2s",