aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2009-05-15 04:30:21 -0400
committerTakashi Iwai <tiwai@suse.de>2009-05-15 04:30:21 -0400
commit5f592bb99b2634b2c515bb75d92cae14b1e22c51 (patch)
treecb09f52b2906c50114848bee247e6e7285230045
parentdd4a416442a2fb4bd761163277d37ab6ce75ee4e (diff)
parent81a4275bff16b0a63074669541be6eb4d5279f26 (diff)
Merge branch 'for-2.6.31' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound-2.6 into topic/asoc
-rw-r--r--MAINTAINERS2
-rw-r--r--arch/arm/mach-davinci/include/mach/asp.h25
-rw-r--r--include/sound/soc-dai.h3
-rw-r--r--sound/soc/codecs/wm9712.c2
-rw-r--r--sound/soc/davinci/Kconfig7
-rw-r--r--sound/soc/davinci/davinci-evm.c63
-rw-r--r--sound/soc/davinci/davinci-i2s.c26
-rw-r--r--sound/soc/davinci/davinci-pcm.c71
-rw-r--r--sound/soc/omap/Kconfig8
-rw-r--r--sound/soc/omap/Makefile2
-rw-r--r--sound/soc/omap/omap3evm.c147
-rw-r--r--sound/soc/pxa/pxa2xx-i2s.c38
12 files changed, 330 insertions, 64 deletions
diff --git a/MAINTAINERS b/MAINTAINERS
index b642c21d2f65..1ae5a81f4436 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -5286,7 +5286,7 @@ P: Liam Girdwood
5286M: lrg@slimlogic.co.uk 5286M: lrg@slimlogic.co.uk
5287P: Mark Brown 5287P: Mark Brown
5288M: broonie@opensource.wolfsonmicro.com 5288M: broonie@opensource.wolfsonmicro.com
5289T: git git://opensource.wolfsonmicro.com/linux-2.6-asoc 5289T: git git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound-2.6.git
5290L: alsa-devel@alsa-project.org (subscribers-only) 5290L: alsa-devel@alsa-project.org (subscribers-only)
5291W: http://alsa-project.org/main/index.php/ASoC 5291W: http://alsa-project.org/main/index.php/ASoC
5292S: Supported 5292S: Supported
diff --git a/arch/arm/mach-davinci/include/mach/asp.h b/arch/arm/mach-davinci/include/mach/asp.h
new file mode 100644
index 000000000000..e0abc437d796
--- /dev/null
+++ b/arch/arm/mach-davinci/include/mach/asp.h
@@ -0,0 +1,25 @@
1/*
2 * <mach/asp.h> - DaVinci Audio Serial Port support
3 */
4#ifndef __ASM_ARCH_DAVINCI_ASP_H
5#define __ASM_ARCH_DAVINCI_ASP_H
6
7#include <mach/irqs.h>
8
9/* Bases of register banks */
10#define DAVINCI_ASP0_BASE 0x01E02000
11#define DAVINCI_ASP1_BASE 0x01E04000
12
13/* EDMA channels */
14#define DAVINCI_DMA_ASP0_TX 2
15#define DAVINCI_DMA_ASP0_RX 3
16#define DAVINCI_DMA_ASP1_TX 8
17#define DAVINCI_DMA_ASP1_RX 9
18
19/* Interrupts */
20#define DAVINCI_ASP0_RX_INT IRQ_MBRINT
21#define DAVINCI_ASP0_TX_INT IRQ_MBXINT
22#define DAVINCI_ASP1_RX_INT IRQ_MBRINT
23#define DAVINCI_ASP1_TX_INT IRQ_MBXINT
24
25#endif /* __ASM_ARCH_DAVINCI_ASP_H */
diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h
index 496dc30457b7..352d7eee9b6d 100644
--- a/include/sound/soc-dai.h
+++ b/include/sound/soc-dai.h
@@ -79,7 +79,8 @@ struct snd_pcm_substream;
79#define SND_SOC_CLOCK_OUT 1 79#define SND_SOC_CLOCK_OUT 1
80 80
81#define SND_SOC_STD_AC97_FMTS (SNDRV_PCM_FMTBIT_S16_LE |\ 81#define SND_SOC_STD_AC97_FMTS (SNDRV_PCM_FMTBIT_S16_LE |\
82 SNDRV_PCM_FMTBIT_S32_LE) 82 SNDRV_PCM_FMTBIT_S32_LE |\
83 SNDRV_PCM_FMTBIT_S32_BE)
83 84
84struct snd_soc_dai_ops; 85struct snd_soc_dai_ops;
85struct snd_soc_dai; 86struct snd_soc_dai;
diff --git a/sound/soc/codecs/wm9712.c b/sound/soc/codecs/wm9712.c
index 550c903f23bf..1fd4e88f50cf 100644
--- a/sound/soc/codecs/wm9712.c
+++ b/sound/soc/codecs/wm9712.c
@@ -585,6 +585,8 @@ static int wm9712_reset(struct snd_soc_codec *codec, int try_warm)
585 } 585 }
586 586
587 soc_ac97_ops.reset(codec->ac97); 587 soc_ac97_ops.reset(codec->ac97);
588 if (soc_ac97_ops.warm_reset)
589 soc_ac97_ops.warm_reset(codec->ac97);
588 if (ac97_read(codec, 0) != wm9712_reg[0]) 590 if (ac97_read(codec, 0) != wm9712_reg[0])
589 goto err; 591 goto err;
590 return 0; 592 return 0;
diff --git a/sound/soc/davinci/Kconfig b/sound/soc/davinci/Kconfig
index bd7392c9657e..411a710be660 100644
--- a/sound/soc/davinci/Kconfig
+++ b/sound/soc/davinci/Kconfig
@@ -10,13 +10,14 @@ config SND_DAVINCI_SOC_I2S
10 tristate 10 tristate
11 11
12config SND_DAVINCI_SOC_EVM 12config SND_DAVINCI_SOC_EVM
13 tristate "SoC Audio support for DaVinci EVM" 13 tristate "SoC Audio support for DaVinci DM6446 or DM355 EVM"
14 depends on SND_DAVINCI_SOC && MACH_DAVINCI_EVM 14 depends on SND_DAVINCI_SOC
15 depends on MACH_DAVINCI_EVM || MACH_DAVINCI_DM355_EVM
15 select SND_DAVINCI_SOC_I2S 16 select SND_DAVINCI_SOC_I2S
16 select SND_SOC_TLV320AIC3X 17 select SND_SOC_TLV320AIC3X
17 help 18 help
18 Say Y if you want to add support for SoC audio on TI 19 Say Y if you want to add support for SoC audio on TI
19 DaVinci EVM platform. 20 DaVinci DM6446 or DM355 EVM platforms.
20 21
21config SND_DAVINCI_SOC_SFFSDR 22config SND_DAVINCI_SOC_SFFSDR
22 tristate "SoC Audio support for SFFSDR" 23 tristate "SoC Audio support for SFFSDR"
diff --git a/sound/soc/davinci/davinci-evm.c b/sound/soc/davinci/davinci-evm.c
index 9b90b347007c..58fd1cbedd88 100644
--- a/sound/soc/davinci/davinci-evm.c
+++ b/sound/soc/davinci/davinci-evm.c
@@ -20,7 +20,11 @@
20#include <sound/soc-dapm.h> 20#include <sound/soc-dapm.h>
21 21
22#include <asm/dma.h> 22#include <asm/dma.h>
23#include <mach/hardware.h> 23#include <asm/mach-types.h>
24
25#include <mach/asp.h>
26#include <mach/edma.h>
27#include <mach/mux.h>
24 28
25#include "../codecs/tlv320aic3x.h" 29#include "../codecs/tlv320aic3x.h"
26#include "davinci-pcm.h" 30#include "davinci-pcm.h"
@@ -150,7 +154,7 @@ static struct snd_soc_card snd_soc_card_evm = {
150 154
151/* evm audio private data */ 155/* evm audio private data */
152static struct aic3x_setup_data evm_aic3x_setup = { 156static struct aic3x_setup_data evm_aic3x_setup = {
153 .i2c_bus = 0, 157 .i2c_bus = 1,
154 .i2c_address = 0x1b, 158 .i2c_address = 0x1b,
155}; 159};
156 160
@@ -161,36 +165,73 @@ static struct snd_soc_device evm_snd_devdata = {
161 .codec_data = &evm_aic3x_setup, 165 .codec_data = &evm_aic3x_setup,
162}; 166};
163 167
168/* DM6446 EVM uses ASP0; line-out is a pair of RCA jacks */
164static struct resource evm_snd_resources[] = { 169static struct resource evm_snd_resources[] = {
165 { 170 {
166 .start = DAVINCI_MCBSP_BASE, 171 .start = DAVINCI_ASP0_BASE,
167 .end = DAVINCI_MCBSP_BASE + SZ_8K - 1, 172 .end = DAVINCI_ASP0_BASE + SZ_8K - 1,
168 .flags = IORESOURCE_MEM, 173 .flags = IORESOURCE_MEM,
169 }, 174 },
170}; 175};
171 176
172static struct evm_snd_platform_data evm_snd_data = { 177static struct evm_snd_platform_data evm_snd_data = {
173 .tx_dma_ch = DM644X_DMACH_MCBSP_TX, 178 .tx_dma_ch = DAVINCI_DMA_ASP0_TX,
174 .rx_dma_ch = DM644X_DMACH_MCBSP_RX, 179 .rx_dma_ch = DAVINCI_DMA_ASP0_RX,
180};
181
182/* DM335 EVM uses ASP1; line-out is a stereo mini-jack */
183static struct resource dm335evm_snd_resources[] = {
184 {
185 .start = DAVINCI_ASP1_BASE,
186 .end = DAVINCI_ASP1_BASE + SZ_8K - 1,
187 .flags = IORESOURCE_MEM,
188 },
189};
190
191static struct evm_snd_platform_data dm335evm_snd_data = {
192 .tx_dma_ch = DAVINCI_DMA_ASP1_TX,
193 .rx_dma_ch = DAVINCI_DMA_ASP1_RX,
175}; 194};
176 195
177static struct platform_device *evm_snd_device; 196static struct platform_device *evm_snd_device;
178 197
179static int __init evm_init(void) 198static int __init evm_init(void)
180{ 199{
200 struct resource *resources;
201 unsigned num_resources;
202 struct evm_snd_platform_data *data;
203 int index;
181 int ret; 204 int ret;
182 205
183 evm_snd_device = platform_device_alloc("soc-audio", 0); 206 if (machine_is_davinci_evm()) {
207 davinci_cfg_reg(DM644X_MCBSP);
208
209 resources = evm_snd_resources;
210 num_resources = ARRAY_SIZE(evm_snd_resources);
211 data = &evm_snd_data;
212 index = 0;
213 } else if (machine_is_davinci_dm355_evm()) {
214 /* we don't use ASP1 IRQs, or we'd need to mux them ... */
215 davinci_cfg_reg(DM355_EVT8_ASP1_TX);
216 davinci_cfg_reg(DM355_EVT9_ASP1_RX);
217
218 resources = dm335evm_snd_resources;
219 num_resources = ARRAY_SIZE(dm335evm_snd_resources);
220 data = &dm335evm_snd_data;
221 index = 1;
222 } else
223 return -EINVAL;
224
225 evm_snd_device = platform_device_alloc("soc-audio", index);
184 if (!evm_snd_device) 226 if (!evm_snd_device)
185 return -ENOMEM; 227 return -ENOMEM;
186 228
187 platform_set_drvdata(evm_snd_device, &evm_snd_devdata); 229 platform_set_drvdata(evm_snd_device, &evm_snd_devdata);
188 evm_snd_devdata.dev = &evm_snd_device->dev; 230 evm_snd_devdata.dev = &evm_snd_device->dev;
189 platform_device_add_data(evm_snd_device, &evm_snd_data, 231 platform_device_add_data(evm_snd_device, data, sizeof(*data));
190 sizeof(evm_snd_data));
191 232
192 ret = platform_device_add_resources(evm_snd_device, evm_snd_resources, 233 ret = platform_device_add_resources(evm_snd_device, resources,
193 ARRAY_SIZE(evm_snd_resources)); 234 num_resources);
194 if (ret) { 235 if (ret) {
195 platform_device_put(evm_snd_device); 236 platform_device_put(evm_snd_device);
196 return ret; 237 return ret;
diff --git a/sound/soc/davinci/davinci-i2s.c b/sound/soc/davinci/davinci-i2s.c
index ffdb9439d3d8..b1ea52fc83c7 100644
--- a/sound/soc/davinci/davinci-i2s.c
+++ b/sound/soc/davinci/davinci-i2s.c
@@ -24,6 +24,26 @@
24 24
25#include "davinci-pcm.h" 25#include "davinci-pcm.h"
26 26
27
28/*
29 * NOTE: terminology here is confusing.
30 *
31 * - This driver supports the "Audio Serial Port" (ASP),
32 * found on dm6446, dm355, and other DaVinci chips.
33 *
34 * - But it labels it a "Multi-channel Buffered Serial Port"
35 * (McBSP) as on older chips like the dm642 ... which was
36 * backward-compatible, possibly explaining that confusion.
37 *
38 * - OMAP chips have a controller called McBSP, which is
39 * incompatible with the DaVinci flavor of McBSP.
40 *
41 * - Newer DaVinci chips have a controller called McASP,
42 * incompatible with ASP and with either McBSP.
43 *
44 * In short: this uses ASP to implement I2S, not McBSP.
45 * And it won't be the only DaVinci implemention of I2S.
46 */
27#define DAVINCI_MCBSP_DRR_REG 0x00 47#define DAVINCI_MCBSP_DRR_REG 0x00
28#define DAVINCI_MCBSP_DXR_REG 0x04 48#define DAVINCI_MCBSP_DXR_REG 0x04
29#define DAVINCI_MCBSP_SPCR_REG 0x08 49#define DAVINCI_MCBSP_SPCR_REG 0x08
@@ -421,7 +441,7 @@ static int davinci_i2s_probe(struct platform_device *pdev,
421{ 441{
422 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 442 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
423 struct snd_soc_card *card = socdev->card; 443 struct snd_soc_card *card = socdev->card;
424 struct snd_soc_dai *cpu_dai = card->dai_link[pdev->id].cpu_dai; 444 struct snd_soc_dai *cpu_dai = card->dai_link->cpu_dai;
425 struct davinci_mcbsp_dev *dev; 445 struct davinci_mcbsp_dev *dev;
426 struct resource *mem, *ioarea; 446 struct resource *mem, *ioarea;
427 struct evm_snd_platform_data *pdata; 447 struct evm_snd_platform_data *pdata;
@@ -448,7 +468,7 @@ static int davinci_i2s_probe(struct platform_device *pdev,
448 468
449 cpu_dai->private_data = dev; 469 cpu_dai->private_data = dev;
450 470
451 dev->clk = clk_get(&pdev->dev, "McBSPCLK"); 471 dev->clk = clk_get(&pdev->dev, NULL);
452 if (IS_ERR(dev->clk)) { 472 if (IS_ERR(dev->clk)) {
453 ret = -ENODEV; 473 ret = -ENODEV;
454 goto err_free_mem; 474 goto err_free_mem;
@@ -483,7 +503,7 @@ static void davinci_i2s_remove(struct platform_device *pdev,
483{ 503{
484 struct snd_soc_device *socdev = platform_get_drvdata(pdev); 504 struct snd_soc_device *socdev = platform_get_drvdata(pdev);
485 struct snd_soc_card *card = socdev->card; 505 struct snd_soc_card *card = socdev->card;
486 struct snd_soc_dai *cpu_dai = card->dai_link[pdev->id].cpu_dai; 506 struct snd_soc_dai *cpu_dai = card->dai_link->cpu_dai;
487 struct davinci_mcbsp_dev *dev = cpu_dai->private_data; 507 struct davinci_mcbsp_dev *dev = cpu_dai->private_data;
488 struct resource *mem; 508 struct resource *mem;
489 509
diff --git a/sound/soc/davinci/davinci-pcm.c b/sound/soc/davinci/davinci-pcm.c
index 7af3b5b3a53d..a05996588489 100644
--- a/sound/soc/davinci/davinci-pcm.c
+++ b/sound/soc/davinci/davinci-pcm.c
@@ -22,6 +22,7 @@
22#include <sound/soc.h> 22#include <sound/soc.h>
23 23
24#include <asm/dma.h> 24#include <asm/dma.h>
25#include <mach/edma.h>
25 26
26#include "davinci-pcm.h" 27#include "davinci-pcm.h"
27 28
@@ -51,7 +52,7 @@ struct davinci_runtime_data {
51 spinlock_t lock; 52 spinlock_t lock;
52 int period; /* current DMA period */ 53 int period; /* current DMA period */
53 int master_lch; /* Master DMA channel */ 54 int master_lch; /* Master DMA channel */
54 int slave_lch; /* Slave DMA channel */ 55 int slave_lch; /* linked parameter RAM reload slot */
55 struct davinci_pcm_dma_params *params; /* DMA params */ 56 struct davinci_pcm_dma_params *params; /* DMA params */
56}; 57};
57 58
@@ -90,18 +91,18 @@ static void davinci_pcm_enqueue_dma(struct snd_pcm_substream *substream)
90 dst_bidx = data_type; 91 dst_bidx = data_type;
91 } 92 }
92 93
93 davinci_set_dma_src_params(lch, src, INCR, W8BIT); 94 edma_set_src(lch, src, INCR, W8BIT);
94 davinci_set_dma_dest_params(lch, dst, INCR, W8BIT); 95 edma_set_dest(lch, dst, INCR, W8BIT);
95 davinci_set_dma_src_index(lch, src_bidx, 0); 96 edma_set_src_index(lch, src_bidx, 0);
96 davinci_set_dma_dest_index(lch, dst_bidx, 0); 97 edma_set_dest_index(lch, dst_bidx, 0);
97 davinci_set_dma_transfer_params(lch, data_type, count, 1, 0, ASYNC); 98 edma_set_transfer_params(lch, data_type, count, 1, 0, ASYNC);
98 99
99 prtd->period++; 100 prtd->period++;
100 if (unlikely(prtd->period >= runtime->periods)) 101 if (unlikely(prtd->period >= runtime->periods))
101 prtd->period = 0; 102 prtd->period = 0;
102} 103}
103 104
104static void davinci_pcm_dma_irq(int lch, u16 ch_status, void *data) 105static void davinci_pcm_dma_irq(unsigned lch, u16 ch_status, void *data)
105{ 106{
106 struct snd_pcm_substream *substream = data; 107 struct snd_pcm_substream *substream = data;
107 struct davinci_runtime_data *prtd = substream->runtime->private_data; 108 struct davinci_runtime_data *prtd = substream->runtime->private_data;
@@ -125,7 +126,7 @@ static int davinci_pcm_dma_request(struct snd_pcm_substream *substream)
125 struct davinci_runtime_data *prtd = substream->runtime->private_data; 126 struct davinci_runtime_data *prtd = substream->runtime->private_data;
126 struct snd_soc_pcm_runtime *rtd = substream->private_data; 127 struct snd_soc_pcm_runtime *rtd = substream->private_data;
127 struct davinci_pcm_dma_params *dma_data = rtd->dai->cpu_dai->dma_data; 128 struct davinci_pcm_dma_params *dma_data = rtd->dai->cpu_dai->dma_data;
128 int tcc = TCC_ANY; 129 struct edmacc_param p_ram;
129 int ret; 130 int ret;
130 131
131 if (!dma_data) 132 if (!dma_data)
@@ -134,22 +135,34 @@ static int davinci_pcm_dma_request(struct snd_pcm_substream *substream)
134 prtd->params = dma_data; 135 prtd->params = dma_data;
135 136
136 /* Request master DMA channel */ 137 /* Request master DMA channel */
137 ret = davinci_request_dma(prtd->params->channel, prtd->params->name, 138 ret = edma_alloc_channel(prtd->params->channel,
138 davinci_pcm_dma_irq, substream, 139 davinci_pcm_dma_irq, substream,
139 &prtd->master_lch, &tcc, EVENTQ_0); 140 EVENTQ_0);
140 if (ret) 141 if (ret < 0)
141 return ret; 142 return ret;
143 prtd->master_lch = ret;
142 144
143 /* Request slave DMA channel */ 145 /* Request parameter RAM reload slot */
144 ret = davinci_request_dma(PARAM_ANY, "Link", 146 ret = edma_alloc_slot(EDMA_SLOT_ANY);
145 NULL, NULL, &prtd->slave_lch, &tcc, EVENTQ_0); 147 if (ret < 0) {
146 if (ret) { 148 edma_free_channel(prtd->master_lch);
147 davinci_free_dma(prtd->master_lch);
148 return ret; 149 return ret;
149 } 150 }
150 151 prtd->slave_lch = ret;
151 /* Link slave DMA channel in loopback */ 152
152 davinci_dma_link_lch(prtd->slave_lch, prtd->slave_lch); 153 /* Issue transfer completion IRQ when the channel completes a
154 * transfer, then always reload from the same slot (by a kind
155 * of loopback link). The completion IRQ handler will update
156 * the reload slot with a new buffer.
157 *
158 * REVISIT save p_ram here after setting up everything except
159 * the buffer and its length (ccnt) ... use it as a template
160 * so davinci_pcm_enqueue_dma() takes less time in IRQ.
161 */
162 edma_read_slot(prtd->slave_lch, &p_ram);
163 p_ram.opt |= TCINTEN | EDMA_TCC(prtd->master_lch);
164 p_ram.link_bcntrld = prtd->slave_lch << 5;
165 edma_write_slot(prtd->slave_lch, &p_ram);
153 166
154 return 0; 167 return 0;
155} 168}
@@ -165,12 +178,12 @@ static int davinci_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
165 case SNDRV_PCM_TRIGGER_START: 178 case SNDRV_PCM_TRIGGER_START:
166 case SNDRV_PCM_TRIGGER_RESUME: 179 case SNDRV_PCM_TRIGGER_RESUME:
167 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: 180 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
168 davinci_start_dma(prtd->master_lch); 181 edma_start(prtd->master_lch);
169 break; 182 break;
170 case SNDRV_PCM_TRIGGER_STOP: 183 case SNDRV_PCM_TRIGGER_STOP:
171 case SNDRV_PCM_TRIGGER_SUSPEND: 184 case SNDRV_PCM_TRIGGER_SUSPEND:
172 case SNDRV_PCM_TRIGGER_PAUSE_PUSH: 185 case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
173 davinci_stop_dma(prtd->master_lch); 186 edma_stop(prtd->master_lch);
174 break; 187 break;
175 default: 188 default:
176 ret = -EINVAL; 189 ret = -EINVAL;
@@ -185,14 +198,14 @@ static int davinci_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
185static int davinci_pcm_prepare(struct snd_pcm_substream *substream) 198static int davinci_pcm_prepare(struct snd_pcm_substream *substream)
186{ 199{
187 struct davinci_runtime_data *prtd = substream->runtime->private_data; 200 struct davinci_runtime_data *prtd = substream->runtime->private_data;
188 struct paramentry_descriptor temp; 201 struct edmacc_param temp;
189 202
190 prtd->period = 0; 203 prtd->period = 0;
191 davinci_pcm_enqueue_dma(substream); 204 davinci_pcm_enqueue_dma(substream);
192 205
193 /* Get slave channel dma params for master channel startup */ 206 /* Copy self-linked parameter RAM entry into master channel */
194 davinci_get_dma_params(prtd->slave_lch, &temp); 207 edma_read_slot(prtd->slave_lch, &temp);
195 davinci_set_dma_params(prtd->master_lch, &temp); 208 edma_write_slot(prtd->master_lch, &temp);
196 209
197 return 0; 210 return 0;
198} 211}
@@ -208,7 +221,7 @@ davinci_pcm_pointer(struct snd_pcm_substream *substream)
208 221
209 spin_lock(&prtd->lock); 222 spin_lock(&prtd->lock);
210 223
211 davinci_dma_getposition(prtd->master_lch, &src, &dst); 224 edma_get_position(prtd->master_lch, &src, &dst);
212 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) 225 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
213 count = src - runtime->dma_addr; 226 count = src - runtime->dma_addr;
214 else 227 else
@@ -253,10 +266,10 @@ static int davinci_pcm_close(struct snd_pcm_substream *substream)
253 struct snd_pcm_runtime *runtime = substream->runtime; 266 struct snd_pcm_runtime *runtime = substream->runtime;
254 struct davinci_runtime_data *prtd = runtime->private_data; 267 struct davinci_runtime_data *prtd = runtime->private_data;
255 268
256 davinci_dma_unlink_lch(prtd->slave_lch, prtd->slave_lch); 269 edma_unlink(prtd->slave_lch);
257 270
258 davinci_free_dma(prtd->slave_lch); 271 edma_free_slot(prtd->slave_lch);
259 davinci_free_dma(prtd->master_lch); 272 edma_free_channel(prtd->master_lch);
260 273
261 kfree(prtd); 274 kfree(prtd);
262 275
diff --git a/sound/soc/omap/Kconfig b/sound/soc/omap/Kconfig
index 675732e724d5..b771238662b6 100644
--- a/sound/soc/omap/Kconfig
+++ b/sound/soc/omap/Kconfig
@@ -39,6 +39,14 @@ config SND_OMAP_SOC_OMAP2EVM
39 help 39 help
40 Say Y if you want to add support for SoC audio on the omap2evm board. 40 Say Y if you want to add support for SoC audio on the omap2evm board.
41 41
42config SND_OMAP_SOC_OMAP3EVM
43 tristate "SoC Audio support for OMAP3EVM board"
44 depends on TWL4030_CORE && SND_OMAP_SOC && MACH_OMAP3EVM
45 select SND_OMAP_SOC_MCBSP
46 select SND_SOC_TWL4030
47 help
48 Say Y if you want to add support for SoC audio on the omap3evm board.
49
42config SND_OMAP_SOC_SDP3430 50config SND_OMAP_SOC_SDP3430
43 tristate "SoC Audio support for Texas Instruments SDP3430" 51 tristate "SoC Audio support for Texas Instruments SDP3430"
44 depends on TWL4030_CORE && SND_OMAP_SOC && MACH_OMAP_3430SDP 52 depends on TWL4030_CORE && SND_OMAP_SOC && MACH_OMAP_3430SDP
diff --git a/sound/soc/omap/Makefile b/sound/soc/omap/Makefile
index 0c9e4ac37660..a37f49862389 100644
--- a/sound/soc/omap/Makefile
+++ b/sound/soc/omap/Makefile
@@ -10,6 +10,7 @@ snd-soc-n810-objs := n810.o
10snd-soc-osk5912-objs := osk5912.o 10snd-soc-osk5912-objs := osk5912.o
11snd-soc-overo-objs := overo.o 11snd-soc-overo-objs := overo.o
12snd-soc-omap2evm-objs := omap2evm.o 12snd-soc-omap2evm-objs := omap2evm.o
13snd-soc-omap3evm-objs := omap3evm.o
13snd-soc-sdp3430-objs := sdp3430.o 14snd-soc-sdp3430-objs := sdp3430.o
14snd-soc-omap3pandora-objs := omap3pandora.o 15snd-soc-omap3pandora-objs := omap3pandora.o
15snd-soc-omap3beagle-objs := omap3beagle.o 16snd-soc-omap3beagle-objs := omap3beagle.o
@@ -18,6 +19,7 @@ obj-$(CONFIG_SND_OMAP_SOC_N810) += snd-soc-n810.o
18obj-$(CONFIG_SND_OMAP_SOC_OSK5912) += snd-soc-osk5912.o 19obj-$(CONFIG_SND_OMAP_SOC_OSK5912) += snd-soc-osk5912.o
19obj-$(CONFIG_SND_OMAP_SOC_OVERO) += snd-soc-overo.o 20obj-$(CONFIG_SND_OMAP_SOC_OVERO) += snd-soc-overo.o
20obj-$(CONFIG_MACH_OMAP2EVM) += snd-soc-omap2evm.o 21obj-$(CONFIG_MACH_OMAP2EVM) += snd-soc-omap2evm.o
22obj-$(CONFIG_MACH_OMAP3EVM) += snd-soc-omap3evm.o
21obj-$(CONFIG_SND_OMAP_SOC_SDP3430) += snd-soc-sdp3430.o 23obj-$(CONFIG_SND_OMAP_SOC_SDP3430) += snd-soc-sdp3430.o
22obj-$(CONFIG_SND_OMAP_SOC_OMAP3_PANDORA) += snd-soc-omap3pandora.o 24obj-$(CONFIG_SND_OMAP_SOC_OMAP3_PANDORA) += snd-soc-omap3pandora.o
23obj-$(CONFIG_SND_OMAP_SOC_OMAP3_BEAGLE) += snd-soc-omap3beagle.o 25obj-$(CONFIG_SND_OMAP_SOC_OMAP3_BEAGLE) += snd-soc-omap3beagle.o
diff --git a/sound/soc/omap/omap3evm.c b/sound/soc/omap/omap3evm.c
new file mode 100644
index 000000000000..9114c263077b
--- /dev/null
+++ b/sound/soc/omap/omap3evm.c
@@ -0,0 +1,147 @@
1/*
2 * omap3evm.c -- ALSA SoC support for OMAP3 EVM
3 *
4 * Author: Anuj Aggarwal <anuj.aggarwal@ti.com>
5 *
6 * Based on sound/soc/omap/beagle.c by Steve Sakoman
7 *
8 * Copyright (C) 2008 Texas Instruments, Incorporated
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation version 2.
13 *
14 * This program is distributed "as is" WITHOUT ANY WARRANTY of any kind,
15 * whether express or implied; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
18 */
19
20#include <linux/clk.h>
21#include <linux/platform_device.h>
22#include <sound/core.h>
23#include <sound/pcm.h>
24#include <sound/soc.h>
25#include <sound/soc-dapm.h>
26
27#include <asm/mach-types.h>
28#include <mach/hardware.h>
29#include <mach/gpio.h>
30#include <mach/mcbsp.h>
31
32#include "omap-mcbsp.h"
33#include "omap-pcm.h"
34#include "../codecs/twl4030.h"
35
36static int omap3evm_hw_params(struct snd_pcm_substream *substream,
37 struct snd_pcm_hw_params *params)
38{
39 struct snd_soc_pcm_runtime *rtd = substream->private_data;
40 struct snd_soc_dai *codec_dai = rtd->dai->codec_dai;
41 struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai;
42 int ret;
43
44 /* Set codec DAI configuration */
45 ret = snd_soc_dai_set_fmt(codec_dai,
46 SND_SOC_DAIFMT_I2S |
47 SND_SOC_DAIFMT_NB_NF |
48 SND_SOC_DAIFMT_CBM_CFM);
49 if (ret < 0) {
50 printk(KERN_ERR "Can't set codec DAI configuration\n");
51 return ret;
52 }
53
54 /* Set cpu DAI configuration */
55 ret = snd_soc_dai_set_fmt(cpu_dai,
56 SND_SOC_DAIFMT_I2S |
57 SND_SOC_DAIFMT_NB_NF |
58 SND_SOC_DAIFMT_CBM_CFM);
59 if (ret < 0) {
60 printk(KERN_ERR "Can't set cpu DAI configuration\n");
61 return ret;
62 }
63
64 /* Set the codec system clock for DAC and ADC */
65 ret = snd_soc_dai_set_sysclk(codec_dai, 0, 26000000,
66 SND_SOC_CLOCK_IN);
67 if (ret < 0) {
68 printk(KERN_ERR "Can't set codec system clock\n");
69 return ret;
70 }
71
72 return 0;
73}
74
75static struct snd_soc_ops omap3evm_ops = {
76 .hw_params = omap3evm_hw_params,
77};
78
79/* Digital audio interface glue - connects codec <--> CPU */
80static struct snd_soc_dai_link omap3evm_dai = {
81 .name = "TWL4030",
82 .stream_name = "TWL4030",
83 .cpu_dai = &omap_mcbsp_dai[0],
84 .codec_dai = &twl4030_dai[TWL4030_DAI_HIFI],
85 .ops = &omap3evm_ops,
86};
87
88/* Audio machine driver */
89static struct snd_soc_card snd_soc_omap3evm = {
90 .name = "omap3evm",
91 .platform = &omap_soc_platform,
92 .dai_link = &omap3evm_dai,
93 .num_links = 1,
94};
95
96/* Audio subsystem */
97static struct snd_soc_device omap3evm_snd_devdata = {
98 .card = &snd_soc_omap3evm,
99 .codec_dev = &soc_codec_dev_twl4030,
100};
101
102static struct platform_device *omap3evm_snd_device;
103
104static int __init omap3evm_soc_init(void)
105{
106 int ret;
107
108 if (!machine_is_omap3evm()) {
109 pr_err("Not OMAP3 EVM!\n");
110 return -ENODEV;
111 }
112 pr_info("OMAP3 EVM SoC init\n");
113
114 omap3evm_snd_device = platform_device_alloc("soc-audio", -1);
115 if (!omap3evm_snd_device) {
116 printk(KERN_ERR "Platform device allocation failed\n");
117 return -ENOMEM;
118 }
119
120 platform_set_drvdata(omap3evm_snd_device, &omap3evm_snd_devdata);
121 omap3evm_snd_devdata.dev = &omap3evm_snd_device->dev;
122 *(unsigned int *)omap3evm_dai.cpu_dai->private_data = 1;
123
124 ret = platform_device_add(omap3evm_snd_device);
125 if (ret)
126 goto err1;
127
128 return 0;
129
130err1:
131 printk(KERN_ERR "Unable to add platform device\n");
132 platform_device_put(omap3evm_snd_device);
133
134 return ret;
135}
136
137static void __exit omap3evm_soc_exit(void)
138{
139 platform_device_unregister(omap3evm_snd_device);
140}
141
142module_init(omap3evm_soc_init);
143module_exit(omap3evm_soc_exit);
144
145MODULE_AUTHOR("Anuj Aggarwal <anuj.aggarwal@ti.com>");
146MODULE_DESCRIPTION("ALSA SoC OMAP3 EVM");
147MODULE_LICENSE("GPLv2");
diff --git a/sound/soc/pxa/pxa2xx-i2s.c b/sound/soc/pxa/pxa2xx-i2s.c
index 60145770aeba..4743e262895d 100644
--- a/sound/soc/pxa/pxa2xx-i2s.c
+++ b/sound/soc/pxa/pxa2xx-i2s.c
@@ -106,10 +106,8 @@ static int pxa2xx_i2s_startup(struct snd_pcm_substream *substream,
106 if (IS_ERR(clk_i2s)) 106 if (IS_ERR(clk_i2s))
107 return PTR_ERR(clk_i2s); 107 return PTR_ERR(clk_i2s);
108 108
109 if (!cpu_dai->active) { 109 if (!cpu_dai->active)
110 SACR0 |= SACR0_RST;
111 SACR0 = 0; 110 SACR0 = 0;
112 }
113 111
114 return 0; 112 return 0;
115} 113}
@@ -178,9 +176,7 @@ static int pxa2xx_i2s_hw_params(struct snd_pcm_substream *substream,
178 176
179 /* is port used by another stream */ 177 /* is port used by another stream */
180 if (!(SACR0 & SACR0_ENB)) { 178 if (!(SACR0 & SACR0_ENB)) {
181
182 SACR0 = 0; 179 SACR0 = 0;
183 SACR1 = 0;
184 if (pxa_i2s.master) 180 if (pxa_i2s.master)
185 SACR0 |= SACR0_BCKD; 181 SACR0 |= SACR0_BCKD;
186 182
@@ -226,6 +222,10 @@ static int pxa2xx_i2s_trigger(struct snd_pcm_substream *substream, int cmd,
226 222
227 switch (cmd) { 223 switch (cmd) {
228 case SNDRV_PCM_TRIGGER_START: 224 case SNDRV_PCM_TRIGGER_START:
225 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
226 SACR1 &= ~SACR1_DRPL;
227 else
228 SACR1 &= ~SACR1_DREC;
229 SACR0 |= SACR0_ENB; 229 SACR0 |= SACR0_ENB;
230 break; 230 break;
231 case SNDRV_PCM_TRIGGER_RESUME: 231 case SNDRV_PCM_TRIGGER_RESUME:
@@ -252,21 +252,16 @@ static void pxa2xx_i2s_shutdown(struct snd_pcm_substream *substream,
252 SAIMR &= ~SAIMR_RFS; 252 SAIMR &= ~SAIMR_RFS;
253 } 253 }
254 254
255 if (SACR1 & (SACR1_DREC | SACR1_DRPL)) { 255 if ((SACR1 & (SACR1_DREC | SACR1_DRPL)) == (SACR1_DREC | SACR1_DRPL)) {
256 SACR0 &= ~SACR0_ENB; 256 SACR0 &= ~SACR0_ENB;
257 pxa_i2s_wait(); 257 pxa_i2s_wait();
258 clk_disable(clk_i2s); 258 clk_disable(clk_i2s);
259 } 259 }
260
261 clk_put(clk_i2s);
262} 260}
263 261
264#ifdef CONFIG_PM 262#ifdef CONFIG_PM
265static int pxa2xx_i2s_suspend(struct snd_soc_dai *dai) 263static int pxa2xx_i2s_suspend(struct snd_soc_dai *dai)
266{ 264{
267 if (!dai->active)
268 return 0;
269
270 /* store registers */ 265 /* store registers */
271 pxa_i2s.sacr0 = SACR0; 266 pxa_i2s.sacr0 = SACR0;
272 pxa_i2s.sacr1 = SACR1; 267 pxa_i2s.sacr1 = SACR1;
@@ -281,16 +276,14 @@ static int pxa2xx_i2s_suspend(struct snd_soc_dai *dai)
281 276
282static int pxa2xx_i2s_resume(struct snd_soc_dai *dai) 277static int pxa2xx_i2s_resume(struct snd_soc_dai *dai)
283{ 278{
284 if (!dai->active)
285 return 0;
286
287 pxa_i2s_wait(); 279 pxa_i2s_wait();
288 280
289 SACR0 = pxa_i2s.sacr0 &= ~SACR0_ENB; 281 SACR0 = pxa_i2s.sacr0 & ~SACR0_ENB;
290 SACR1 = pxa_i2s.sacr1; 282 SACR1 = pxa_i2s.sacr1;
291 SAIMR = pxa_i2s.saimr; 283 SAIMR = pxa_i2s.saimr;
292 SADIV = pxa_i2s.sadiv; 284 SADIV = pxa_i2s.sadiv;
293 SACR0 |= SACR0_ENB; 285
286 SACR0 = pxa_i2s.sacr0;
294 287
295 return 0; 288 return 0;
296} 289}
@@ -347,6 +340,19 @@ static int pxa2xx_i2s_probe(struct platform_device *dev)
347 if (ret != 0) 340 if (ret != 0)
348 clk_put(clk_i2s); 341 clk_put(clk_i2s);
349 342
343 /*
344 * PXA Developer's Manual:
345 * If SACR0[ENB] is toggled in the middle of a normal operation,
346 * the SACR0[RST] bit must also be set and cleared to reset all
347 * I2S controller registers.
348 */
349 SACR0 = SACR0_RST;
350 SACR0 = 0;
351 /* Make sure RPL and REC are disabled */
352 SACR1 = SACR1_DRPL | SACR1_DREC;
353 /* Along with FIFO servicing */
354 SAIMR &= ~(SAIMR_RFS | SAIMR_TFS);
355
350 return ret; 356 return ret;
351} 357}
352 358