c97396e2b67d8dee917854caf6e4fa475dd787de
[openwrt/openwrt.git] / target / linux / s3c24xx / patches-2.6.24 / 1059-iis-suspend.patch.patch
1 From 148a1026b1975e3a50981cf7df3d4aae2b34611e Mon Sep 17 00:00:00 2001
2 From: mokopatches <mokopatches@openmoko.org>
3 Date: Sun, 13 Apr 2008 07:23:53 +0100
4 Subject: [PATCH] iis-suspend.patch
5
6 ---
7 sound/soc/s3c24xx/s3c24xx-i2s.c | 38 ++++++++++++++++++++++++++++++++++++++
8 1 files changed, 38 insertions(+), 0 deletions(-)
9
10 diff --git a/sound/soc/s3c24xx/s3c24xx-i2s.c b/sound/soc/s3c24xx/s3c24xx-i2s.c
11 index fe30e0d..4d74cc0 100644
12 --- a/sound/soc/s3c24xx/s3c24xx-i2s.c
13 +++ b/sound/soc/s3c24xx/s3c24xx-i2s.c
14 @@ -76,6 +76,10 @@ static struct s3c24xx_pcm_dma_params s3c24xx_i2s_pcm_stereo_in = {
15 struct s3c24xx_i2s_info {
16 void __iomem *regs;
17 struct clk *iis_clk;
18 + u32 iiscon;
19 + u32 iismod;
20 + u32 iisfcon;
21 + u32 iispsr;
22 };
23 static struct s3c24xx_i2s_info s3c24xx_i2s;
24
25 @@ -406,6 +410,38 @@ static int s3c24xx_i2s_probe(struct platform_device *pdev)
26 return 0;
27 }
28
29 +#ifdef CONFIG_PM
30 +int s3c24xx_i2s_suspend(struct platform_device *pdev,
31 + struct snd_soc_cpu_dai *cpu_dai)
32 +{
33 + s3c24xx_i2s.iiscon = readl(s3c24xx_i2s.regs + S3C2410_IISCON);
34 + s3c24xx_i2s.iismod = readl(s3c24xx_i2s.regs + S3C2410_IISMOD);
35 + s3c24xx_i2s.iisfcon = readl(s3c24xx_i2s.regs + S3C2410_IISFCON);
36 + s3c24xx_i2s.iispsr = readl(s3c24xx_i2s.regs + S3C2410_IISPSR);
37 +
38 + clk_disable(s3c24xx_i2s.iis_clk);
39 +
40 + return 0;
41 +}
42 +
43 +int s3c24xx_i2s_resume(struct platform_device *pdev,
44 + struct snd_soc_cpu_dai *cpu_dai)
45 +{
46 + clk_enable(s3c24xx_i2s.iis_clk);
47 +
48 + writel(s3c24xx_i2s.iiscon, s3c24xx_i2s.regs + S3C2410_IISCON);
49 + writel(s3c24xx_i2s.iismod, s3c24xx_i2s.regs + S3C2410_IISMOD);
50 + writel(s3c24xx_i2s.iisfcon, s3c24xx_i2s.regs + S3C2410_IISFCON);
51 + writel(s3c24xx_i2s.iispsr, s3c24xx_i2s.regs + S3C2410_IISPSR);
52 +
53 + return 0;
54 +}
55 +#else
56 +#define s3c24xx_i2s_suspend NULL
57 +#define s3c24xx_i2s_resume NULL
58 +#endif
59 +
60 +
61 #define S3C24XX_I2S_RATES \
62 (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_11025 | SNDRV_PCM_RATE_16000 | \
63 SNDRV_PCM_RATE_22050 | SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 | \
64 @@ -416,6 +452,8 @@ struct snd_soc_cpu_dai s3c24xx_i2s_dai = {
65 .id = 0,
66 .type = SND_SOC_DAI_I2S,
67 .probe = s3c24xx_i2s_probe,
68 + .suspend = s3c24xx_i2s_suspend,
69 + .resume = s3c24xx_i2s_resume,
70 .playback = {
71 .channels_min = 2,
72 .channels_max = 2,
73 --
74 1.5.6.5
75