2bfef447ba94c4cedcde6caf8e7f45ca44236b78
[openwrt/svn-archive/archive.git] / target / linux / s3c24xx / patches-2.6.30 / 090-sound.patch
1 --- a/sound/soc/s3c24xx/Kconfig
2 +++ b/sound/soc/s3c24xx/Kconfig
3 @@ -42,10 +42,20 @@ config SND_S3C24XX_SOC_JIVE_WM8750
4 tristate "SoC I2S Audio support for Jive"
5 depends on SND_S3C24XX_SOC && MACH_JIVE
6 select SND_SOC_WM8750
7 + select SND_SOC_WM8750_SPI
8 select SND_S3C2412_SOC_I2S
9 help
10 Sat Y if you want to add support for SoC audio on the Jive.
11
12 +config SND_S3C24XX_SOC_NEO1973_GTA02_WM8753
13 + tristate "SoC I2S Audio support for Openmoko Freerunner - WM8753"
14 + depends on SND_S3C24XX_SOC && MACH_NEO1973_GTA02
15 + select SND_S3C24XX_SOC_I2S
16 + select SND_SOC_WM8753
17 + help
18 + Say Y if you want to add support for SoC audio on Openmoko Freerunner
19 + with the WM8753 codec
20 +
21 config SND_S3C24XX_SOC_SMDK2443_WM9710
22 tristate "SoC AC97 Audio support for SMDK2443 - WM9710"
23 depends on SND_S3C24XX_SOC && MACH_SMDK2443
24 --- a/sound/soc/s3c24xx/Makefile
25 +++ b/sound/soc/s3c24xx/Makefile
26 @@ -19,9 +19,11 @@ snd-soc-neo1973-wm8753-objs := neo1973_w
27 snd-soc-smdk2443-wm9710-objs := smdk2443_wm9710.o
28 snd-soc-ln2440sbc-alc650-objs := ln2440sbc_alc650.o
29 snd-soc-s3c24xx-uda134x-objs := s3c24xx_uda134x.o
30 +snd-soc-neo1973-gta02-wm8753-objs := gta02_wm8753.o
31
32 obj-$(CONFIG_SND_S3C24XX_SOC_JIVE_WM8750) += snd-soc-jive-wm8750.o
33 obj-$(CONFIG_SND_S3C24XX_SOC_NEO1973_WM8753) += snd-soc-neo1973-wm8753.o
34 obj-$(CONFIG_SND_S3C24XX_SOC_SMDK2443_WM9710) += snd-soc-smdk2443-wm9710.o
35 obj-$(CONFIG_SND_S3C24XX_SOC_LN2440SBC_ALC650) += snd-soc-ln2440sbc-alc650.o
36 obj-$(CONFIG_SND_S3C24XX_SOC_S3C24XX_UDA134X) += snd-soc-s3c24xx-uda134x.o
37 +obj-$(CONFIG_SND_S3C24XX_SOC_NEO1973_GTA02_WM8753) += snd-soc-neo1973-gta02-wm8753.o
38 --- a/sound/soc/s3c24xx/s3c24xx-i2s.c
39 +++ b/sound/soc/s3c24xx/s3c24xx-i2s.c
40 @@ -284,11 +284,14 @@ static int s3c24xx_i2s_trigger(struct sn
41 case SNDRV_PCM_TRIGGER_START:
42 case SNDRV_PCM_TRIGGER_RESUME:
43 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
44 - if (!s3c24xx_snd_is_clkmaster()) {
45 - ret = s3c24xx_snd_lrsync();
46 - if (ret)
47 - goto exit_err;
48 - }
49 + if (!s3c24xx_snd_is_clkmaster())
50 + /* we ignore the return code, if it sync'd then fine,
51 + * if it didn't sync, which happens after resume the
52 + * first time when there was a live stream at suspend,
53 + * just let it timeout, the stream picks up OK after
54 + * that and LRCK is evidently working again.
55 + */
56 + s3c24xx_snd_lrsync();
57
58 if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
59 s3c24xx_snd_rxctrl(1);
60 @@ -308,7 +311,6 @@ static int s3c24xx_i2s_trigger(struct sn
61 break;
62 }
63
64 -exit_err:
65 return ret;
66 }
67
68 --- a/sound/soc/s3c24xx/s3c24xx-pcm.c
69 +++ b/sound/soc/s3c24xx/s3c24xx-pcm.c
70 @@ -75,11 +75,18 @@ static void s3c24xx_pcm_enqueue(struct s
71 {
72 struct s3c24xx_runtime_data *prtd = substream->runtime->private_data;
73 dma_addr_t pos = prtd->dma_pos;
74 + unsigned int limit;
75 int ret;
76
77 pr_debug("Entered %s\n", __func__);
78
79 - while (prtd->dma_loaded < prtd->dma_limit) {
80 + if (s3c_dma_has_circular()) {
81 + limit = (prtd->dma_end - prtd->dma_start) / prtd->dma_period;
82 + } else
83 + limit = prtd->dma_limit;
84 +
85 +
86 + while (prtd->dma_loaded < limit) {
87 unsigned long len = prtd->dma_period;
88
89 pr_debug("dma_loaded: %d\n", prtd->dma_loaded);
90 @@ -123,7 +130,7 @@ static void s3c24xx_audio_buffdone(struc
91 snd_pcm_period_elapsed(substream);
92
93 spin_lock(&prtd->lock);
94 - if (prtd->state & ST_RUNNING) {
95 + if (prtd->state & ST_RUNNING && !s3c_dma_has_circular()) {
96 prtd->dma_loaded--;
97 s3c24xx_pcm_enqueue(substream);
98 }
99 @@ -164,6 +171,11 @@ static int s3c24xx_pcm_hw_params(struct
100 printk(KERN_ERR "failed to get dma channel\n");
101 return ret;
102 }
103 +
104 + /* use the circular buffering if we have it available. */
105 + if (s3c_dma_has_circular())
106 + s3c2410_dma_setflags(prtd->params->channel,
107 + S3C2410_DMAF_CIRCULAR);
108 }
109
110 s3c2410_dma_set_buffdone_fn(prtd->params->channel,
111 @@ -218,24 +230,17 @@ static int s3c24xx_pcm_prepare(struct sn
112 * sync to pclk, half-word transfers to the IIS-FIFO. */
113 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
114 s3c2410_dma_devconfig(prtd->params->channel,
115 - S3C2410_DMASRC_MEM, S3C2410_DISRCC_INC |
116 - S3C2410_DISRCC_APB, prtd->params->dma_addr);
117 -
118 - s3c2410_dma_config(prtd->params->channel,
119 - prtd->params->dma_size,
120 - S3C2410_DCON_SYNC_PCLK |
121 - S3C2410_DCON_HANDSHAKE);
122 + S3C2410_DMASRC_MEM,
123 + prtd->params->dma_addr);
124 } else {
125 - s3c2410_dma_config(prtd->params->channel,
126 - prtd->params->dma_size,
127 - S3C2410_DCON_HANDSHAKE |
128 - S3C2410_DCON_SYNC_PCLK);
129 -
130 s3c2410_dma_devconfig(prtd->params->channel,
131 - S3C2410_DMASRC_HW, 0x3,
132 - prtd->params->dma_addr);
133 + S3C2410_DMASRC_HW,
134 + prtd->params->dma_addr);
135 }
136
137 + s3c2410_dma_config(prtd->params->channel,
138 + prtd->params->dma_size);
139 +
140 /* flush the DMA channel */
141 s3c2410_dma_ctrl(prtd->params->channel, S3C2410_DMAOP_FLUSH);
142 prtd->dma_loaded = 0;