diff options
Diffstat (limited to 'sound/soc/s3c24xx/s3c24xx-i2s.c')
-rw-r--r-- | sound/soc/s3c24xx/s3c24xx-i2s.c | 45 |
1 files changed, 42 insertions, 3 deletions
diff --git a/sound/soc/s3c24xx/s3c24xx-i2s.c b/sound/soc/s3c24xx/s3c24xx-i2s.c index cd89c4105fcd..0a3c630951be 100644 --- a/sound/soc/s3c24xx/s3c24xx-i2s.c +++ b/sound/soc/s3c24xx/s3c24xx-i2s.c | |||
@@ -24,7 +24,7 @@ | |||
24 | #include <linux/device.h> | 24 | #include <linux/device.h> |
25 | #include <linux/delay.h> | 25 | #include <linux/delay.h> |
26 | #include <linux/clk.h> | 26 | #include <linux/clk.h> |
27 | #include <sound/driver.h> | 27 | #include <linux/jiffies.h> |
28 | #include <sound/core.h> | 28 | #include <sound/core.h> |
29 | #include <sound/pcm.h> | 29 | #include <sound/pcm.h> |
30 | #include <sound/pcm_params.h> | 30 | #include <sound/pcm_params.h> |
@@ -33,13 +33,14 @@ | |||
33 | 33 | ||
34 | #include <asm/hardware.h> | 34 | #include <asm/hardware.h> |
35 | #include <asm/io.h> | 35 | #include <asm/io.h> |
36 | #include <asm/arch/regs-iis.h> | ||
37 | #include <asm/arch/regs-gpio.h> | 36 | #include <asm/arch/regs-gpio.h> |
38 | #include <asm/arch/regs-clock.h> | 37 | #include <asm/arch/regs-clock.h> |
39 | #include <asm/arch/audio.h> | 38 | #include <asm/arch/audio.h> |
40 | #include <asm/dma.h> | 39 | #include <asm/dma.h> |
41 | #include <asm/arch/dma.h> | 40 | #include <asm/arch/dma.h> |
42 | 41 | ||
42 | #include <asm/plat-s3c24xx/regs-iis.h> | ||
43 | |||
43 | #include "s3c24xx-pcm.h" | 44 | #include "s3c24xx-pcm.h" |
44 | #include "s3c24xx-i2s.h" | 45 | #include "s3c24xx-i2s.h" |
45 | 46 | ||
@@ -75,6 +76,10 @@ static struct s3c24xx_pcm_dma_params s3c24xx_i2s_pcm_stereo_in = { | |||
75 | struct s3c24xx_i2s_info { | 76 | struct s3c24xx_i2s_info { |
76 | void __iomem *regs; | 77 | void __iomem *regs; |
77 | struct clk *iis_clk; | 78 | struct clk *iis_clk; |
79 | u32 iiscon; | ||
80 | u32 iismod; | ||
81 | u32 iisfcon; | ||
82 | u32 iispsr; | ||
78 | }; | 83 | }; |
79 | static struct s3c24xx_i2s_info s3c24xx_i2s; | 84 | static struct s3c24xx_i2s_info s3c24xx_i2s; |
80 | 85 | ||
@@ -184,7 +189,7 @@ static int s3c24xx_snd_lrsync(void) | |||
184 | if (iiscon & S3C2410_IISCON_LRINDEX) | 189 | if (iiscon & S3C2410_IISCON_LRINDEX) |
185 | break; | 190 | break; |
186 | 191 | ||
187 | if (timeout < jiffies) | 192 | if (time_after(jiffies, timeout)) |
188 | return -ETIMEDOUT; | 193 | return -ETIMEDOUT; |
189 | } | 194 | } |
190 | 195 | ||
@@ -405,6 +410,38 @@ static int s3c24xx_i2s_probe(struct platform_device *pdev) | |||
405 | return 0; | 410 | return 0; |
406 | } | 411 | } |
407 | 412 | ||
413 | #ifdef CONFIG_PM | ||
414 | int s3c24xx_i2s_suspend(struct platform_device *pdev, | ||
415 | struct snd_soc_cpu_dai *cpu_dai) | ||
416 | { | ||
417 | s3c24xx_i2s.iiscon = readl(s3c24xx_i2s.regs + S3C2410_IISCON); | ||
418 | s3c24xx_i2s.iismod = readl(s3c24xx_i2s.regs + S3C2410_IISMOD); | ||
419 | s3c24xx_i2s.iisfcon = readl(s3c24xx_i2s.regs + S3C2410_IISFCON); | ||
420 | s3c24xx_i2s.iispsr = readl(s3c24xx_i2s.regs + S3C2410_IISPSR); | ||
421 | |||
422 | clk_disable(s3c24xx_i2s.iis_clk); | ||
423 | |||
424 | return 0; | ||
425 | } | ||
426 | |||
427 | int s3c24xx_i2s_resume(struct platform_device *pdev, | ||
428 | struct snd_soc_cpu_dai *cpu_dai) | ||
429 | { | ||
430 | clk_enable(s3c24xx_i2s.iis_clk); | ||
431 | |||
432 | writel(s3c24xx_i2s.iiscon, s3c24xx_i2s.regs + S3C2410_IISCON); | ||
433 | writel(s3c24xx_i2s.iismod, s3c24xx_i2s.regs + S3C2410_IISMOD); | ||
434 | writel(s3c24xx_i2s.iisfcon, s3c24xx_i2s.regs + S3C2410_IISFCON); | ||
435 | writel(s3c24xx_i2s.iispsr, s3c24xx_i2s.regs + S3C2410_IISPSR); | ||
436 | |||
437 | return 0; | ||
438 | } | ||
439 | #else | ||
440 | #define s3c24xx_i2s_suspend NULL | ||
441 | #define s3c24xx_i2s_resume NULL | ||
442 | #endif | ||
443 | |||
444 | |||
408 | #define S3C24XX_I2S_RATES \ | 445 | #define S3C24XX_I2S_RATES \ |
409 | (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_11025 | SNDRV_PCM_RATE_16000 | \ | 446 | (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_11025 | SNDRV_PCM_RATE_16000 | \ |
410 | SNDRV_PCM_RATE_22050 | SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 | \ | 447 | SNDRV_PCM_RATE_22050 | SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 | \ |
@@ -415,6 +452,8 @@ struct snd_soc_cpu_dai s3c24xx_i2s_dai = { | |||
415 | .id = 0, | 452 | .id = 0, |
416 | .type = SND_SOC_DAI_I2S, | 453 | .type = SND_SOC_DAI_I2S, |
417 | .probe = s3c24xx_i2s_probe, | 454 | .probe = s3c24xx_i2s_probe, |
455 | .suspend = s3c24xx_i2s_suspend, | ||
456 | .resume = s3c24xx_i2s_resume, | ||
418 | .playback = { | 457 | .playback = { |
419 | .channels_min = 2, | 458 | .channels_min = 2, |
420 | .channels_max = 2, | 459 | .channels_max = 2, |