diff options
Diffstat (limited to 'sound/soc/s3c24xx/s3c24xx-i2s.c')
| -rw-r--r-- | sound/soc/s3c24xx/s3c24xx-i2s.c | 41 |
1 files changed, 22 insertions, 19 deletions
diff --git a/sound/soc/s3c24xx/s3c24xx-i2s.c b/sound/soc/s3c24xx/s3c24xx-i2s.c index 0a3c630951be..4ebcd6a8bf28 100644 --- a/sound/soc/s3c24xx/s3c24xx-i2s.c +++ b/sound/soc/s3c24xx/s3c24xx-i2s.c | |||
| @@ -25,6 +25,7 @@ | |||
| 25 | #include <linux/delay.h> | 25 | #include <linux/delay.h> |
| 26 | #include <linux/clk.h> | 26 | #include <linux/clk.h> |
| 27 | #include <linux/jiffies.h> | 27 | #include <linux/jiffies.h> |
| 28 | #include <linux/io.h> | ||
| 28 | #include <sound/core.h> | 29 | #include <sound/core.h> |
| 29 | #include <sound/pcm.h> | 30 | #include <sound/pcm.h> |
| 30 | #include <sound/pcm_params.h> | 31 | #include <sound/pcm_params.h> |
| @@ -32,7 +33,6 @@ | |||
| 32 | #include <sound/soc.h> | 33 | #include <sound/soc.h> |
| 33 | 34 | ||
| 34 | #include <asm/hardware.h> | 35 | #include <asm/hardware.h> |
| 35 | #include <asm/io.h> | ||
| 36 | #include <asm/arch/regs-gpio.h> | 36 | #include <asm/arch/regs-gpio.h> |
| 37 | #include <asm/arch/regs-clock.h> | 37 | #include <asm/arch/regs-clock.h> |
| 38 | #include <asm/arch/audio.h> | 38 | #include <asm/arch/audio.h> |
| @@ -46,7 +46,7 @@ | |||
| 46 | 46 | ||
| 47 | #define S3C24XX_I2S_DEBUG 0 | 47 | #define S3C24XX_I2S_DEBUG 0 |
| 48 | #if S3C24XX_I2S_DEBUG | 48 | #if S3C24XX_I2S_DEBUG |
| 49 | #define DBG(x...) printk(KERN_DEBUG x) | 49 | #define DBG(x...) printk(KERN_DEBUG "s3c24xx-i2s: " x) |
| 50 | #else | 50 | #else |
| 51 | #define DBG(x...) | 51 | #define DBG(x...) |
| 52 | #endif | 52 | #endif |
| @@ -89,7 +89,7 @@ static void s3c24xx_snd_txctrl(int on) | |||
| 89 | u32 iiscon; | 89 | u32 iiscon; |
| 90 | u32 iismod; | 90 | u32 iismod; |
| 91 | 91 | ||
| 92 | DBG("Entered %s\n", __FUNCTION__); | 92 | DBG("Entered %s\n", __func__); |
| 93 | 93 | ||
| 94 | iisfcon = readl(s3c24xx_i2s.regs + S3C2410_IISFCON); | 94 | iisfcon = readl(s3c24xx_i2s.regs + S3C2410_IISFCON); |
| 95 | iiscon = readl(s3c24xx_i2s.regs + S3C2410_IISCON); | 95 | iiscon = readl(s3c24xx_i2s.regs + S3C2410_IISCON); |
| @@ -134,7 +134,7 @@ static void s3c24xx_snd_rxctrl(int on) | |||
| 134 | u32 iiscon; | 134 | u32 iiscon; |
| 135 | u32 iismod; | 135 | u32 iismod; |
| 136 | 136 | ||
| 137 | DBG("Entered %s\n", __FUNCTION__); | 137 | DBG("Entered %s\n", __func__); |
| 138 | 138 | ||
| 139 | iisfcon = readl(s3c24xx_i2s.regs + S3C2410_IISFCON); | 139 | iisfcon = readl(s3c24xx_i2s.regs + S3C2410_IISFCON); |
| 140 | iiscon = readl(s3c24xx_i2s.regs + S3C2410_IISCON); | 140 | iiscon = readl(s3c24xx_i2s.regs + S3C2410_IISCON); |
| @@ -159,10 +159,10 @@ static void s3c24xx_snd_rxctrl(int on) | |||
| 159 | * DMA engine will simply freeze randomly. | 159 | * DMA engine will simply freeze randomly. |
| 160 | */ | 160 | */ |
| 161 | 161 | ||
| 162 | iisfcon &= ~S3C2410_IISFCON_RXENABLE; | 162 | iisfcon &= ~S3C2410_IISFCON_RXENABLE; |
| 163 | iisfcon &= ~S3C2410_IISFCON_RXDMA; | 163 | iisfcon &= ~S3C2410_IISFCON_RXDMA; |
| 164 | iiscon |= S3C2410_IISCON_RXIDLE; | 164 | iiscon |= S3C2410_IISCON_RXIDLE; |
| 165 | iiscon &= ~S3C2410_IISCON_RXDMAEN; | 165 | iiscon &= ~S3C2410_IISCON_RXDMAEN; |
| 166 | iismod &= ~S3C2410_IISMOD_RXMODE; | 166 | iismod &= ~S3C2410_IISMOD_RXMODE; |
| 167 | 167 | ||
| 168 | writel(iisfcon, s3c24xx_i2s.regs + S3C2410_IISFCON); | 168 | writel(iisfcon, s3c24xx_i2s.regs + S3C2410_IISFCON); |
| @@ -182,7 +182,7 @@ static int s3c24xx_snd_lrsync(void) | |||
| 182 | u32 iiscon; | 182 | u32 iiscon; |
| 183 | unsigned long timeout = jiffies + msecs_to_jiffies(5); | 183 | unsigned long timeout = jiffies + msecs_to_jiffies(5); |
| 184 | 184 | ||
| 185 | DBG("Entered %s\n", __FUNCTION__); | 185 | DBG("Entered %s\n", __func__); |
| 186 | 186 | ||
| 187 | while (1) { | 187 | while (1) { |
| 188 | iiscon = readl(s3c24xx_i2s.regs + S3C2410_IISCON); | 188 | iiscon = readl(s3c24xx_i2s.regs + S3C2410_IISCON); |
| @@ -201,7 +201,7 @@ static int s3c24xx_snd_lrsync(void) | |||
| 201 | */ | 201 | */ |
| 202 | static inline int s3c24xx_snd_is_clkmaster(void) | 202 | static inline int s3c24xx_snd_is_clkmaster(void) |
| 203 | { | 203 | { |
| 204 | DBG("Entered %s\n", __FUNCTION__); | 204 | DBG("Entered %s\n", __func__); |
| 205 | 205 | ||
| 206 | return (readl(s3c24xx_i2s.regs + S3C2410_IISMOD) & S3C2410_IISMOD_SLAVE) ? 0:1; | 206 | return (readl(s3c24xx_i2s.regs + S3C2410_IISMOD) & S3C2410_IISMOD_SLAVE) ? 0:1; |
| 207 | } | 207 | } |
| @@ -214,7 +214,7 @@ static int s3c24xx_i2s_set_fmt(struct snd_soc_cpu_dai *cpu_dai, | |||
| 214 | { | 214 | { |
| 215 | u32 iismod; | 215 | u32 iismod; |
| 216 | 216 | ||
| 217 | DBG("Entered %s\n", __FUNCTION__); | 217 | DBG("Entered %s\n", __func__); |
| 218 | 218 | ||
| 219 | iismod = readl(s3c24xx_i2s.regs + S3C2410_IISMOD); | 219 | iismod = readl(s3c24xx_i2s.regs + S3C2410_IISMOD); |
| 220 | DBG("hw_params r: IISMOD: %lx \n", iismod); | 220 | DBG("hw_params r: IISMOD: %lx \n", iismod); |
| @@ -250,7 +250,7 @@ static int s3c24xx_i2s_hw_params(struct snd_pcm_substream *substream, | |||
| 250 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 250 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
| 251 | u32 iismod; | 251 | u32 iismod; |
| 252 | 252 | ||
| 253 | DBG("Entered %s\n", __FUNCTION__); | 253 | DBG("Entered %s\n", __func__); |
| 254 | 254 | ||
| 255 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) | 255 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) |
| 256 | rtd->dai->cpu_dai->dma_data = &s3c24xx_i2s_pcm_stereo_out; | 256 | rtd->dai->cpu_dai->dma_data = &s3c24xx_i2s_pcm_stereo_out; |
| @@ -278,7 +278,7 @@ static int s3c24xx_i2s_trigger(struct snd_pcm_substream *substream, int cmd) | |||
| 278 | { | 278 | { |
| 279 | int ret = 0; | 279 | int ret = 0; |
| 280 | 280 | ||
| 281 | DBG("Entered %s\n", __FUNCTION__); | 281 | DBG("Entered %s\n", __func__); |
| 282 | 282 | ||
| 283 | switch (cmd) { | 283 | switch (cmd) { |
| 284 | case SNDRV_PCM_TRIGGER_START: | 284 | case SNDRV_PCM_TRIGGER_START: |
| @@ -320,7 +320,7 @@ static int s3c24xx_i2s_set_sysclk(struct snd_soc_cpu_dai *cpu_dai, | |||
| 320 | { | 320 | { |
| 321 | u32 iismod = readl(s3c24xx_i2s.regs + S3C2410_IISMOD); | 321 | u32 iismod = readl(s3c24xx_i2s.regs + S3C2410_IISMOD); |
| 322 | 322 | ||
| 323 | DBG("Entered %s\n", __FUNCTION__); | 323 | DBG("Entered %s\n", __func__); |
| 324 | 324 | ||
| 325 | iismod &= ~S3C2440_IISMOD_MPLL; | 325 | iismod &= ~S3C2440_IISMOD_MPLL; |
| 326 | 326 | ||
| @@ -346,7 +346,7 @@ static int s3c24xx_i2s_set_clkdiv(struct snd_soc_cpu_dai *cpu_dai, | |||
| 346 | { | 346 | { |
| 347 | u32 reg; | 347 | u32 reg; |
| 348 | 348 | ||
| 349 | DBG("Entered %s\n", __FUNCTION__); | 349 | DBG("Entered %s\n", __func__); |
| 350 | 350 | ||
| 351 | switch (div_id) { | 351 | switch (div_id) { |
| 352 | case S3C24XX_DIV_BCLK: | 352 | case S3C24XX_DIV_BCLK: |
| @@ -381,13 +381,13 @@ EXPORT_SYMBOL_GPL(s3c24xx_i2s_get_clockrate); | |||
| 381 | 381 | ||
| 382 | static int s3c24xx_i2s_probe(struct platform_device *pdev) | 382 | static int s3c24xx_i2s_probe(struct platform_device *pdev) |
| 383 | { | 383 | { |
| 384 | DBG("Entered %s\n", __FUNCTION__); | 384 | DBG("Entered %s\n", __func__); |
| 385 | 385 | ||
| 386 | s3c24xx_i2s.regs = ioremap(S3C2410_PA_IIS, 0x100); | 386 | s3c24xx_i2s.regs = ioremap(S3C2410_PA_IIS, 0x100); |
| 387 | if (s3c24xx_i2s.regs == NULL) | 387 | if (s3c24xx_i2s.regs == NULL) |
| 388 | return -ENXIO; | 388 | return -ENXIO; |
| 389 | 389 | ||
| 390 | s3c24xx_i2s.iis_clk=clk_get(&pdev->dev, "iis"); | 390 | s3c24xx_i2s.iis_clk = clk_get(&pdev->dev, "iis"); |
| 391 | if (s3c24xx_i2s.iis_clk == NULL) { | 391 | if (s3c24xx_i2s.iis_clk == NULL) { |
| 392 | DBG("failed to get iis_clock\n"); | 392 | DBG("failed to get iis_clock\n"); |
| 393 | iounmap(s3c24xx_i2s.regs); | 393 | iounmap(s3c24xx_i2s.regs); |
| @@ -411,9 +411,11 @@ static int s3c24xx_i2s_probe(struct platform_device *pdev) | |||
| 411 | } | 411 | } |
| 412 | 412 | ||
| 413 | #ifdef CONFIG_PM | 413 | #ifdef CONFIG_PM |
| 414 | int s3c24xx_i2s_suspend(struct platform_device *pdev, | 414 | static int s3c24xx_i2s_suspend(struct platform_device *pdev, |
| 415 | struct snd_soc_cpu_dai *cpu_dai) | 415 | struct snd_soc_cpu_dai *cpu_dai) |
| 416 | { | 416 | { |
| 417 | DBG("Entered %s\n", __func__); | ||
| 418 | |||
| 417 | s3c24xx_i2s.iiscon = readl(s3c24xx_i2s.regs + S3C2410_IISCON); | 419 | s3c24xx_i2s.iiscon = readl(s3c24xx_i2s.regs + S3C2410_IISCON); |
| 418 | s3c24xx_i2s.iismod = readl(s3c24xx_i2s.regs + S3C2410_IISMOD); | 420 | s3c24xx_i2s.iismod = readl(s3c24xx_i2s.regs + S3C2410_IISMOD); |
| 419 | s3c24xx_i2s.iisfcon = readl(s3c24xx_i2s.regs + S3C2410_IISFCON); | 421 | s3c24xx_i2s.iisfcon = readl(s3c24xx_i2s.regs + S3C2410_IISFCON); |
| @@ -424,9 +426,10 @@ int s3c24xx_i2s_suspend(struct platform_device *pdev, | |||
| 424 | return 0; | 426 | return 0; |
| 425 | } | 427 | } |
| 426 | 428 | ||
| 427 | int s3c24xx_i2s_resume(struct platform_device *pdev, | 429 | static int s3c24xx_i2s_resume(struct platform_device *pdev, |
| 428 | struct snd_soc_cpu_dai *cpu_dai) | 430 | struct snd_soc_cpu_dai *cpu_dai) |
| 429 | { | 431 | { |
| 432 | DBG("Entered %s\n", __func__); | ||
| 430 | clk_enable(s3c24xx_i2s.iis_clk); | 433 | clk_enable(s3c24xx_i2s.iis_clk); |
| 431 | 434 | ||
| 432 | writel(s3c24xx_i2s.iiscon, s3c24xx_i2s.regs + S3C2410_IISCON); | 435 | writel(s3c24xx_i2s.iiscon, s3c24xx_i2s.regs + S3C2410_IISCON); |
