21 #include <linux/module.h>
33 .name =
"I2S PCM Stereo out"
37 .name =
"I2S PCM Stereo in"
41 .client = &s3c24xx_dma_client_out,
48 .client = &s3c24xx_dma_client_in,
64 static void s3c24xx_snd_txctrl(
int on)
76 pr_debug(
"r: IISCON: %x IISMOD: %x IISFCON: %x\n", iiscon, iismod, iisfcon);
106 pr_debug(
"w: IISCON: %x IISMOD: %x IISFCON: %x\n", iiscon, iismod, iisfcon);
109 static void s3c24xx_snd_rxctrl(
int on)
121 pr_debug(
"r: IISCON: %x IISMOD: %x IISFCON: %x\n", iiscon, iismod, iisfcon);
151 pr_debug(
"w: IISCON: %x IISMOD: %x IISFCON: %x\n", iiscon, iismod, iisfcon);
158 static int s3c24xx_snd_lrsync(
void)
181 static inline int s3c24xx_snd_is_clkmaster(
void)
191 static int s3c24xx_i2s_set_fmt(
struct snd_soc_dai *cpu_dai,
199 pr_debug(
"hw_params r: IISMOD: %x \n", iismod);
224 pr_debug(
"hw_params w: IISMOD: %x \n", iismod);
239 dma_data = &s3c24xx_i2s_pcm_stereo_out;
241 dma_data = &s3c24xx_i2s_pcm_stereo_in;
243 snd_soc_dai_set_dma_data(rtd->
cpu_dai, substream, dma_data);
247 pr_debug(
"hw_params r: IISMOD: %x\n", iismod);
263 pr_debug(
"hw_params w: IISMOD: %x\n", iismod);
272 snd_soc_dai_get_dma_data(dai, substream);
280 if (!s3c24xx_snd_is_clkmaster()) {
281 ret = s3c24xx_snd_lrsync();
287 s3c24xx_snd_rxctrl(1);
289 s3c24xx_snd_txctrl(1);
297 s3c24xx_snd_rxctrl(0);
299 s3c24xx_snd_txctrl(0);
313 static int s3c24xx_i2s_set_sysclk(
struct snd_soc_dai *cpu_dai,
314 int clk_id,
unsigned int freq,
int dir)
339 static int s3c24xx_i2s_set_clkdiv(
struct snd_soc_dai *cpu_dai,
377 static int s3c24xx_i2s_probe(
struct snd_soc_dai *dai)
382 if (s3c24xx_i2s.regs ==
NULL)
385 s3c24xx_i2s.iis_clk =
clk_get(dai->
dev,
"iis");
386 if (IS_ERR(s3c24xx_i2s.iis_clk)) {
387 pr_err(
"failed to get iis_clock\n");
389 return PTR_ERR(s3c24xx_i2s.iis_clk);
399 s3c24xx_snd_txctrl(0);
400 s3c24xx_snd_rxctrl(0);
433 #define s3c24xx_i2s_suspend NULL
434 #define s3c24xx_i2s_resume NULL
438 #define S3C24XX_I2S_RATES \
439 (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_11025 | SNDRV_PCM_RATE_16000 | \
440 SNDRV_PCM_RATE_22050 | SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 | \
441 SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000)
444 .trigger = s3c24xx_i2s_trigger,
445 .hw_params = s3c24xx_i2s_hw_params,
446 .set_fmt = s3c24xx_i2s_set_fmt,
447 .set_clkdiv = s3c24xx_i2s_set_clkdiv,
448 .set_sysclk = s3c24xx_i2s_set_sysclk,
452 .probe = s3c24xx_i2s_probe,
465 .ops = &s3c24xx_i2s_dai_ops,
480 .probe = s3c24xx_iis_dev_probe,
483 .name =
"s3c24xx-iis",