aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/pxa/Kconfig1
-rw-r--r--sound/soc/pxa/pxa2xx-i2s.c12
-rw-r--r--sound/soc/pxa/tosa.c29
3 files changed, 31 insertions, 11 deletions
diff --git a/sound/soc/pxa/Kconfig b/sound/soc/pxa/Kconfig
index 484f883459e0..329b33f37ef3 100644
--- a/sound/soc/pxa/Kconfig
+++ b/sound/soc/pxa/Kconfig
@@ -48,6 +48,7 @@ config SND_PXA2XX_SOC_POODLE
48config SND_PXA2XX_SOC_TOSA 48config SND_PXA2XX_SOC_TOSA
49 tristate "SoC AC97 Audio support for Tosa" 49 tristate "SoC AC97 Audio support for Tosa"
50 depends on SND_PXA2XX_SOC && MACH_TOSA 50 depends on SND_PXA2XX_SOC && MACH_TOSA
51 depends on MFD_TC6393XB
51 select SND_PXA2XX_SOC_AC97 52 select SND_PXA2XX_SOC_AC97
52 select SND_SOC_WM9712 53 select SND_SOC_WM9712
53 help 54 help
diff --git a/sound/soc/pxa/pxa2xx-i2s.c b/sound/soc/pxa/pxa2xx-i2s.c
index 425071030970..e130346732ba 100644
--- a/sound/soc/pxa/pxa2xx-i2s.c
+++ b/sound/soc/pxa/pxa2xx-i2s.c
@@ -18,6 +18,7 @@
18#include <linux/module.h> 18#include <linux/module.h>
19#include <linux/device.h> 19#include <linux/device.h>
20#include <linux/delay.h> 20#include <linux/delay.h>
21#include <linux/clk.h>
21#include <sound/core.h> 22#include <sound/core.h>
22#include <sound/pcm.h> 23#include <sound/pcm.h>
23#include <sound/initval.h> 24#include <sound/initval.h>
@@ -40,6 +41,7 @@ struct pxa_i2s_port {
40 u32 fmt; 41 u32 fmt;
41}; 42};
42static struct pxa_i2s_port pxa_i2s; 43static struct pxa_i2s_port pxa_i2s;
44static struct clk *clk_i2s;
43 45
44static struct pxa2xx_pcm_dma_params pxa2xx_i2s_pcm_stereo_out = { 46static struct pxa2xx_pcm_dma_params pxa2xx_i2s_pcm_stereo_out = {
45 .name = "I2S PCM Stereo out", 47 .name = "I2S PCM Stereo out",
@@ -82,6 +84,10 @@ static int pxa2xx_i2s_startup(struct snd_pcm_substream *substream)
82 struct snd_soc_pcm_runtime *rtd = substream->private_data; 84 struct snd_soc_pcm_runtime *rtd = substream->private_data;
83 struct snd_soc_cpu_dai *cpu_dai = rtd->dai->cpu_dai; 85 struct snd_soc_cpu_dai *cpu_dai = rtd->dai->cpu_dai;
84 86
87 clk_i2s = clk_get(NULL, "I2SCLK");
88 if (IS_ERR(clk_i2s))
89 return PTR_ERR(clk_i2s);
90
85 if (!cpu_dai->active) { 91 if (!cpu_dai->active) {
86 SACR0 |= SACR0_RST; 92 SACR0 |= SACR0_RST;
87 SACR0 = 0; 93 SACR0 = 0;
@@ -149,7 +155,7 @@ static int pxa2xx_i2s_hw_params(struct snd_pcm_substream *substream,
149 pxa_gpio_mode(gpio_bus[pxa_i2s.master].tx); 155 pxa_gpio_mode(gpio_bus[pxa_i2s.master].tx);
150 pxa_gpio_mode(gpio_bus[pxa_i2s.master].frm); 156 pxa_gpio_mode(gpio_bus[pxa_i2s.master].frm);
151 pxa_gpio_mode(gpio_bus[pxa_i2s.master].clk); 157 pxa_gpio_mode(gpio_bus[pxa_i2s.master].clk);
152 pxa_set_cken(CKEN_I2S, 1); 158 clk_enable(clk_i2s);
153 pxa_i2s_wait(); 159 pxa_i2s_wait();
154 160
155 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) 161 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
@@ -234,8 +240,10 @@ static void pxa2xx_i2s_shutdown(struct snd_pcm_substream *substream)
234 if (SACR1 & (SACR1_DREC | SACR1_DRPL)) { 240 if (SACR1 & (SACR1_DREC | SACR1_DRPL)) {
235 SACR0 &= ~SACR0_ENB; 241 SACR0 &= ~SACR0_ENB;
236 pxa_i2s_wait(); 242 pxa_i2s_wait();
237 pxa_set_cken(CKEN_I2S, 0); 243 clk_disable(clk_i2s);
238 } 244 }
245
246 clk_put(clk_i2s);
239} 247}
240 248
241#ifdef CONFIG_PM 249#ifdef CONFIG_PM
diff --git a/sound/soc/pxa/tosa.c b/sound/soc/pxa/tosa.c
index 7346d7e5d066..c1462c4d139b 100644
--- a/sound/soc/pxa/tosa.c
+++ b/sound/soc/pxa/tosa.c
@@ -24,6 +24,7 @@
24#include <linux/module.h> 24#include <linux/module.h>
25#include <linux/moduleparam.h> 25#include <linux/moduleparam.h>
26#include <linux/device.h> 26#include <linux/device.h>
27#include <linux/gpio.h>
27 28
28#include <sound/core.h> 29#include <sound/core.h>
29#include <sound/pcm.h> 30#include <sound/pcm.h>
@@ -31,7 +32,7 @@
31#include <sound/soc-dapm.h> 32#include <sound/soc-dapm.h>
32 33
33#include <asm/mach-types.h> 34#include <asm/mach-types.h>
34#include <asm/hardware/tmio.h> 35#include <asm/arch/tosa.h>
35#include <asm/arch/pxa-regs.h> 36#include <asm/arch/pxa-regs.h>
36#include <asm/arch/hardware.h> 37#include <asm/arch/hardware.h>
37#include <asm/arch/audio.h> 38#include <asm/arch/audio.h>
@@ -138,10 +139,7 @@ static int tosa_set_spk(struct snd_kcontrol *kcontrol,
138static int tosa_hp_event(struct snd_soc_dapm_widget *w, 139static int tosa_hp_event(struct snd_soc_dapm_widget *w,
139 struct snd_kcontrol *k, int event) 140 struct snd_kcontrol *k, int event)
140{ 141{
141 if (SND_SOC_DAPM_EVENT_ON(event)) 142 gpio_set_value(TOSA_GPIO_L_MUTE, SND_SOC_DAPM_EVENT_ON(event) ? 1 :0);
142 set_tc6393_gpio(&tc6393_device.dev,TOSA_TC6393_L_MUTE);
143 else
144 reset_tc6393_gpio(&tc6393_device.dev,TOSA_TC6393_L_MUTE);
145 return 0; 143 return 0;
146} 144}
147 145
@@ -261,16 +259,28 @@ static int __init tosa_init(void)
261 if (!machine_is_tosa()) 259 if (!machine_is_tosa())
262 return -ENODEV; 260 return -ENODEV;
263 261
262 ret = gpio_request(TOSA_GPIO_L_MUTE, "Headphone Jack");
263 if (ret)
264 return ret;
265 gpio_direction_output(TOSA_GPIO_L_MUTE, 0);
266
264 tosa_snd_device = platform_device_alloc("soc-audio", -1); 267 tosa_snd_device = platform_device_alloc("soc-audio", -1);
265 if (!tosa_snd_device) 268 if (!tosa_snd_device) {
266 return -ENOMEM; 269 ret = -ENOMEM;
270 goto err_alloc;
271 }
267 272
268 platform_set_drvdata(tosa_snd_device, &tosa_snd_devdata); 273 platform_set_drvdata(tosa_snd_device, &tosa_snd_devdata);
269 tosa_snd_devdata.dev = &tosa_snd_device->dev; 274 tosa_snd_devdata.dev = &tosa_snd_device->dev;
270 ret = platform_device_add(tosa_snd_device); 275 ret = platform_device_add(tosa_snd_device);
271 276
272 if (ret) 277 if (!ret)
273 platform_device_put(tosa_snd_device); 278 return 0;
279
280 platform_device_put(tosa_snd_device);
281
282err_alloc:
283 gpio_free(TOSA_GPIO_L_MUTE);
274 284
275 return ret; 285 return ret;
276} 286}
@@ -278,6 +288,7 @@ static int __init tosa_init(void)
278static void __exit tosa_exit(void) 288static void __exit tosa_exit(void)
279{ 289{
280 platform_device_unregister(tosa_snd_device); 290 platform_device_unregister(tosa_snd_device);
291 gpio_free(TOSA_GPIO_L_MUTE);
281} 292}
282 293
283module_init(tosa_init); 294module_init(tosa_init);