aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc')
-rw-r--r--sound/soc/atmel/sam9g20_wm8731.c36
-rw-r--r--sound/soc/codecs/wm8753.c6
-rw-r--r--sound/soc/fsl/Kconfig6
-rw-r--r--sound/soc/fsl/mpc5200_dma.c1
-rw-r--r--sound/soc/fsl/mpc5200_dma.h1
-rw-r--r--sound/soc/fsl/mpc5200_psc_ac97.c17
-rw-r--r--sound/soc/omap/omap-pcm.c11
-rw-r--r--sound/soc/pxa/pxa2xx-i2s.c7
8 files changed, 37 insertions, 48 deletions
diff --git a/sound/soc/atmel/sam9g20_wm8731.c b/sound/soc/atmel/sam9g20_wm8731.c
index 173a239a541c..bb0db55e0e98 100644
--- a/sound/soc/atmel/sam9g20_wm8731.c
+++ b/sound/soc/atmel/sam9g20_wm8731.c
@@ -281,38 +281,6 @@ static struct snd_soc_card snd_soc_at91sam9g20ek = {
281 .set_bias_level = at91sam9g20ek_set_bias_level, 281 .set_bias_level = at91sam9g20ek_set_bias_level,
282}; 282};
283 283
284/*
285 * FIXME: This is a temporary bodge to avoid cross-tree merge issues.
286 * New drivers should register the wm8731 I2C device in the machine
287 * setup code (under arch/arm for ARM systems).
288 */
289static int wm8731_i2c_register(void)
290{
291 struct i2c_board_info info;
292 struct i2c_adapter *adapter;
293 struct i2c_client *client;
294
295 memset(&info, 0, sizeof(struct i2c_board_info));
296 info.addr = 0x1b;
297 strlcpy(info.type, "wm8731", I2C_NAME_SIZE);
298
299 adapter = i2c_get_adapter(0);
300 if (!adapter) {
301 printk(KERN_ERR "can't get i2c adapter 0\n");
302 return -ENODEV;
303 }
304
305 client = i2c_new_device(adapter, &info);
306 i2c_put_adapter(adapter);
307 if (!client) {
308 printk(KERN_ERR "can't add i2c device at 0x%x\n",
309 (unsigned int)info.addr);
310 return -ENODEV;
311 }
312
313 return 0;
314}
315
316static struct snd_soc_device at91sam9g20ek_snd_devdata = { 284static struct snd_soc_device at91sam9g20ek_snd_devdata = {
317 .card = &snd_soc_at91sam9g20ek, 285 .card = &snd_soc_at91sam9g20ek,
318 .codec_dev = &soc_codec_dev_wm8731, 286 .codec_dev = &soc_codec_dev_wm8731,
@@ -367,10 +335,6 @@ static int __init at91sam9g20ek_init(void)
367 } 335 }
368 ssc_p->ssc = ssc; 336 ssc_p->ssc = ssc;
369 337
370 ret = wm8731_i2c_register();
371 if (ret != 0)
372 goto err_ssc;
373
374 at91sam9g20ek_snd_device = platform_device_alloc("soc-audio", -1); 338 at91sam9g20ek_snd_device = platform_device_alloc("soc-audio", -1);
375 if (!at91sam9g20ek_snd_device) { 339 if (!at91sam9g20ek_snd_device) {
376 printk(KERN_ERR "ASoC: Platform device allocation failed\n"); 340 printk(KERN_ERR "ASoC: Platform device allocation failed\n");
diff --git a/sound/soc/codecs/wm8753.c b/sound/soc/codecs/wm8753.c
index d28eeaceb857..49c4b2898aff 100644
--- a/sound/soc/codecs/wm8753.c
+++ b/sound/soc/codecs/wm8753.c
@@ -79,7 +79,7 @@ static const u16 wm8753_reg[] = {
79 0x0097, 0x0097, 0x0000, 0x0004, 79 0x0097, 0x0097, 0x0000, 0x0004,
80 0x0000, 0x0083, 0x0024, 0x01ba, 80 0x0000, 0x0083, 0x0024, 0x01ba,
81 0x0000, 0x0083, 0x0024, 0x01ba, 81 0x0000, 0x0083, 0x0024, 0x01ba,
82 0x0000, 0x0000 82 0x0000, 0x0000, 0x0000
83}; 83};
84 84
85/* codec private data */ 85/* codec private data */
@@ -1660,11 +1660,11 @@ static int wm8753_register(struct wm8753_priv *wm8753)
1660 codec->set_bias_level = wm8753_set_bias_level; 1660 codec->set_bias_level = wm8753_set_bias_level;
1661 codec->dai = wm8753_dai; 1661 codec->dai = wm8753_dai;
1662 codec->num_dai = 2; 1662 codec->num_dai = 2;
1663 codec->reg_cache_size = ARRAY_SIZE(wm8753->reg_cache); 1663 codec->reg_cache_size = ARRAY_SIZE(wm8753->reg_cache) + 1;
1664 codec->reg_cache = &wm8753->reg_cache; 1664 codec->reg_cache = &wm8753->reg_cache;
1665 codec->private_data = wm8753; 1665 codec->private_data = wm8753;
1666 1666
1667 memcpy(codec->reg_cache, wm8753_reg, sizeof(codec->reg_cache)); 1667 memcpy(codec->reg_cache, wm8753_reg, sizeof(wm8753->reg_cache));
1668 INIT_DELAYED_WORK(&codec->delayed_work, wm8753_work); 1668 INIT_DELAYED_WORK(&codec->delayed_work, wm8753_work);
1669 1669
1670 ret = wm8753_reset(codec); 1670 ret = wm8753_reset(codec);
diff --git a/sound/soc/fsl/Kconfig b/sound/soc/fsl/Kconfig
index 5dbebf82249c..8cb65ccad35f 100644
--- a/sound/soc/fsl/Kconfig
+++ b/sound/soc/fsl/Kconfig
@@ -33,7 +33,7 @@ config SND_SOC_MPC5200_I2S
33config SND_SOC_MPC5200_AC97 33config SND_SOC_MPC5200_AC97
34 tristate "Freescale MPC5200 PSC in AC97 mode driver" 34 tristate "Freescale MPC5200 PSC in AC97 mode driver"
35 depends on PPC_MPC52xx && PPC_BESTCOMM 35 depends on PPC_MPC52xx && PPC_BESTCOMM
36 select AC97_BUS 36 select SND_SOC_AC97_BUS
37 select SND_MPC52xx_DMA 37 select SND_MPC52xx_DMA
38 select PPC_BESTCOMM_GEN_BD 38 select PPC_BESTCOMM_GEN_BD
39 help 39 help
@@ -41,7 +41,7 @@ config SND_SOC_MPC5200_AC97
41 41
42config SND_MPC52xx_SOC_PCM030 42config SND_MPC52xx_SOC_PCM030
43 tristate "SoC AC97 Audio support for Phytec pcm030 and WM9712" 43 tristate "SoC AC97 Audio support for Phytec pcm030 and WM9712"
44 depends on PPC_MPC5200_SIMPLE && BROKEN 44 depends on PPC_MPC5200_SIMPLE
45 select SND_SOC_MPC5200_AC97 45 select SND_SOC_MPC5200_AC97
46 select SND_SOC_WM9712 46 select SND_SOC_WM9712
47 help 47 help
@@ -50,7 +50,7 @@ config SND_MPC52xx_SOC_PCM030
50 50
51config SND_MPC52xx_SOC_EFIKA 51config SND_MPC52xx_SOC_EFIKA
52 tristate "SoC AC97 Audio support for bbplan Efika and STAC9766" 52 tristate "SoC AC97 Audio support for bbplan Efika and STAC9766"
53 depends on PPC_EFIKA && BROKEN 53 depends on PPC_EFIKA
54 select SND_SOC_MPC5200_AC97 54 select SND_SOC_MPC5200_AC97
55 select SND_SOC_STAC9766 55 select SND_SOC_STAC9766
56 help 56 help
diff --git a/sound/soc/fsl/mpc5200_dma.c b/sound/soc/fsl/mpc5200_dma.c
index efec33a1c5bd..f0a2d4071998 100644
--- a/sound/soc/fsl/mpc5200_dma.c
+++ b/sound/soc/fsl/mpc5200_dma.c
@@ -456,6 +456,7 @@ int mpc5200_audio_dma_create(struct of_device *op)
456 return -ENODEV; 456 return -ENODEV;
457 457
458 spin_lock_init(&psc_dma->lock); 458 spin_lock_init(&psc_dma->lock);
459 mutex_init(&psc_dma->mutex);
459 psc_dma->id = be32_to_cpu(*prop); 460 psc_dma->id = be32_to_cpu(*prop);
460 psc_dma->irq = irq; 461 psc_dma->irq = irq;
461 psc_dma->psc_regs = regs; 462 psc_dma->psc_regs = regs;
diff --git a/sound/soc/fsl/mpc5200_dma.h b/sound/soc/fsl/mpc5200_dma.h
index 2000803f06a7..8d396bb9d9fe 100644
--- a/sound/soc/fsl/mpc5200_dma.h
+++ b/sound/soc/fsl/mpc5200_dma.h
@@ -55,6 +55,7 @@ struct psc_dma {
55 unsigned int irq; 55 unsigned int irq;
56 struct device *dev; 56 struct device *dev;
57 spinlock_t lock; 57 spinlock_t lock;
58 struct mutex mutex;
58 u32 sicr; 59 u32 sicr;
59 uint sysclk; 60 uint sysclk;
60 int imr; 61 int imr;
diff --git a/sound/soc/fsl/mpc5200_psc_ac97.c b/sound/soc/fsl/mpc5200_psc_ac97.c
index 794a247b3eb5..7eb549985d49 100644
--- a/sound/soc/fsl/mpc5200_psc_ac97.c
+++ b/sound/soc/fsl/mpc5200_psc_ac97.c
@@ -34,13 +34,20 @@ static unsigned short psc_ac97_read(struct snd_ac97 *ac97, unsigned short reg)
34 int status; 34 int status;
35 unsigned int val; 35 unsigned int val;
36 36
37 mutex_lock(&psc_dma->mutex);
38
37 /* Wait for command send status zero = ready */ 39 /* Wait for command send status zero = ready */
38 status = spin_event_timeout(!(in_be16(&psc_dma->psc_regs->sr_csr.status) & 40 status = spin_event_timeout(!(in_be16(&psc_dma->psc_regs->sr_csr.status) &
39 MPC52xx_PSC_SR_CMDSEND), 100, 0); 41 MPC52xx_PSC_SR_CMDSEND), 100, 0);
40 if (status == 0) { 42 if (status == 0) {
41 pr_err("timeout on ac97 bus (rdy)\n"); 43 pr_err("timeout on ac97 bus (rdy)\n");
44 mutex_unlock(&psc_dma->mutex);
42 return -ENODEV; 45 return -ENODEV;
43 } 46 }
47
48 /* Force clear the data valid bit */
49 in_be32(&psc_dma->psc_regs->ac97_data);
50
44 /* Send the read */ 51 /* Send the read */
45 out_be32(&psc_dma->psc_regs->ac97_cmd, (1<<31) | ((reg & 0x7f) << 24)); 52 out_be32(&psc_dma->psc_regs->ac97_cmd, (1<<31) | ((reg & 0x7f) << 24));
46 53
@@ -50,16 +57,19 @@ static unsigned short psc_ac97_read(struct snd_ac97 *ac97, unsigned short reg)
50 if (status == 0) { 57 if (status == 0) {
51 pr_err("timeout on ac97 read (val) %x\n", 58 pr_err("timeout on ac97 read (val) %x\n",
52 in_be16(&psc_dma->psc_regs->sr_csr.status)); 59 in_be16(&psc_dma->psc_regs->sr_csr.status));
60 mutex_unlock(&psc_dma->mutex);
53 return -ENODEV; 61 return -ENODEV;
54 } 62 }
55 /* Get the data */ 63 /* Get the data */
56 val = in_be32(&psc_dma->psc_regs->ac97_data); 64 val = in_be32(&psc_dma->psc_regs->ac97_data);
57 if (((val >> 24) & 0x7f) != reg) { 65 if (((val >> 24) & 0x7f) != reg) {
58 pr_err("reg echo error on ac97 read\n"); 66 pr_err("reg echo error on ac97 read\n");
67 mutex_unlock(&psc_dma->mutex);
59 return -ENODEV; 68 return -ENODEV;
60 } 69 }
61 val = (val >> 8) & 0xffff; 70 val = (val >> 8) & 0xffff;
62 71
72 mutex_unlock(&psc_dma->mutex);
63 return (unsigned short) val; 73 return (unsigned short) val;
64} 74}
65 75
@@ -68,16 +78,21 @@ static void psc_ac97_write(struct snd_ac97 *ac97,
68{ 78{
69 int status; 79 int status;
70 80
81 mutex_lock(&psc_dma->mutex);
82
71 /* Wait for command status zero = ready */ 83 /* Wait for command status zero = ready */
72 status = spin_event_timeout(!(in_be16(&psc_dma->psc_regs->sr_csr.status) & 84 status = spin_event_timeout(!(in_be16(&psc_dma->psc_regs->sr_csr.status) &
73 MPC52xx_PSC_SR_CMDSEND), 100, 0); 85 MPC52xx_PSC_SR_CMDSEND), 100, 0);
74 if (status == 0) { 86 if (status == 0) {
75 pr_err("timeout on ac97 bus (write)\n"); 87 pr_err("timeout on ac97 bus (write)\n");
76 return; 88 goto out;
77 } 89 }
78 /* Write data */ 90 /* Write data */
79 out_be32(&psc_dma->psc_regs->ac97_cmd, 91 out_be32(&psc_dma->psc_regs->ac97_cmd,
80 ((reg & 0x7f) << 24) | (val << 8)); 92 ((reg & 0x7f) << 24) | (val << 8));
93
94 out:
95 mutex_unlock(&psc_dma->mutex);
81} 96}
82 97
83static void psc_ac97_warm_reset(struct snd_ac97 *ac97) 98static void psc_ac97_warm_reset(struct snd_ac97 *ac97)
diff --git a/sound/soc/omap/omap-pcm.c b/sound/soc/omap/omap-pcm.c
index 6454e15f7d28..84a1950880eb 100644
--- a/sound/soc/omap/omap-pcm.c
+++ b/sound/soc/omap/omap-pcm.c
@@ -216,12 +216,15 @@ static snd_pcm_uframes_t omap_pcm_pointer(struct snd_pcm_substream *substream)
216 dma_addr_t ptr; 216 dma_addr_t ptr;
217 snd_pcm_uframes_t offset; 217 snd_pcm_uframes_t offset;
218 218
219 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) 219 if (substream->stream == SNDRV_PCM_STREAM_CAPTURE) {
220 ptr = omap_get_dma_src_pos(prtd->dma_ch);
221 else
222 ptr = omap_get_dma_dst_pos(prtd->dma_ch); 220 ptr = omap_get_dma_dst_pos(prtd->dma_ch);
221 offset = bytes_to_frames(runtime, ptr - runtime->dma_addr);
222 } else if (!(cpu_is_omap1510())) {
223 ptr = omap_get_dma_src_pos(prtd->dma_ch);
224 offset = bytes_to_frames(runtime, ptr - runtime->dma_addr);
225 } else
226 offset = prtd->period_index * runtime->period_size;
223 227
224 offset = bytes_to_frames(runtime, ptr - runtime->dma_addr);
225 if (offset >= runtime->buffer_size) 228 if (offset >= runtime->buffer_size)
226 offset = 0; 229 offset = 0;
227 230
diff --git a/sound/soc/pxa/pxa2xx-i2s.c b/sound/soc/pxa/pxa2xx-i2s.c
index 4743e262895d..6b8f655d1ad8 100644
--- a/sound/soc/pxa/pxa2xx-i2s.c
+++ b/sound/soc/pxa/pxa2xx-i2s.c
@@ -167,6 +167,7 @@ static int pxa2xx_i2s_hw_params(struct snd_pcm_substream *substream,
167 167
168 BUG_ON(IS_ERR(clk_i2s)); 168 BUG_ON(IS_ERR(clk_i2s));
169 clk_enable(clk_i2s); 169 clk_enable(clk_i2s);
170 dai->private_data = dai;
170 pxa_i2s_wait(); 171 pxa_i2s_wait();
171 172
172 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) 173 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
@@ -255,7 +256,10 @@ static void pxa2xx_i2s_shutdown(struct snd_pcm_substream *substream,
255 if ((SACR1 & (SACR1_DREC | SACR1_DRPL)) == (SACR1_DREC | SACR1_DRPL)) { 256 if ((SACR1 & (SACR1_DREC | SACR1_DRPL)) == (SACR1_DREC | SACR1_DRPL)) {
256 SACR0 &= ~SACR0_ENB; 257 SACR0 &= ~SACR0_ENB;
257 pxa_i2s_wait(); 258 pxa_i2s_wait();
258 clk_disable(clk_i2s); 259 if (dai->private_data != NULL) {
260 clk_disable(clk_i2s);
261 dai->private_data = NULL;
262 }
259 } 263 }
260} 264}
261 265
@@ -336,6 +340,7 @@ static int pxa2xx_i2s_probe(struct platform_device *dev)
336 return PTR_ERR(clk_i2s); 340 return PTR_ERR(clk_i2s);
337 341
338 pxa_i2s_dai.dev = &dev->dev; 342 pxa_i2s_dai.dev = &dev->dev;
343 pxa_i2s_dai.private_data = NULL;
339 ret = snd_soc_register_dai(&pxa_i2s_dai); 344 ret = snd_soc_register_dai(&pxa_i2s_dai);
340 if (ret != 0) 345 if (ret != 0)
341 clk_put(clk_i2s); 346 clk_put(clk_i2s);