aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/pxa/tosa.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/pxa/tosa.c')
-rw-r--r--sound/soc/pxa/tosa.c29
1 files changed, 20 insertions, 9 deletions
diff --git a/sound/soc/pxa/tosa.c b/sound/soc/pxa/tosa.c
index b6edb61a3a30..fe6cca9c9e76 100644
--- a/sound/soc/pxa/tosa.c
+++ b/sound/soc/pxa/tosa.c
@@ -21,6 +21,7 @@
21#include <linux/module.h> 21#include <linux/module.h>
22#include <linux/moduleparam.h> 22#include <linux/moduleparam.h>
23#include <linux/device.h> 23#include <linux/device.h>
24#include <linux/gpio.h>
24 25
25#include <sound/core.h> 26#include <sound/core.h>
26#include <sound/pcm.h> 27#include <sound/pcm.h>
@@ -28,7 +29,7 @@
28#include <sound/soc-dapm.h> 29#include <sound/soc-dapm.h>
29 30
30#include <asm/mach-types.h> 31#include <asm/mach-types.h>
31#include <asm/hardware/tmio.h> 32#include <asm/arch/tosa.h>
32#include <asm/arch/pxa-regs.h> 33#include <asm/arch/pxa-regs.h>
33#include <asm/arch/hardware.h> 34#include <asm/arch/hardware.h>
34#include <asm/arch/audio.h> 35#include <asm/arch/audio.h>
@@ -137,10 +138,7 @@ static int tosa_set_spk(struct snd_kcontrol *kcontrol,
137static int tosa_hp_event(struct snd_soc_dapm_widget *w, 138static int tosa_hp_event(struct snd_soc_dapm_widget *w,
138 struct snd_kcontrol *k, int event) 139 struct snd_kcontrol *k, int event)
139{ 140{
140 if (SND_SOC_DAPM_EVENT_ON(event)) 141 gpio_set_value(TOSA_GPIO_L_MUTE, SND_SOC_DAPM_EVENT_ON(event) ? 1 :0);
141 set_tc6393_gpio(&tc6393_device.dev,TOSA_TC6393_L_MUTE);
142 else
143 reset_tc6393_gpio(&tc6393_device.dev,TOSA_TC6393_L_MUTE);
144 return 0; 142 return 0;
145} 143}
146 144
@@ -254,16 +252,28 @@ static int __init tosa_init(void)
254 if (!machine_is_tosa()) 252 if (!machine_is_tosa())
255 return -ENODEV; 253 return -ENODEV;
256 254
255 ret = gpio_request(TOSA_GPIO_L_MUTE, "Headphone Jack");
256 if (ret)
257 return ret;
258 gpio_direction_output(TOSA_GPIO_L_MUTE, 0);
259
257 tosa_snd_device = platform_device_alloc("soc-audio", -1); 260 tosa_snd_device = platform_device_alloc("soc-audio", -1);
258 if (!tosa_snd_device) 261 if (!tosa_snd_device) {
259 return -ENOMEM; 262 ret = -ENOMEM;
263 goto err_alloc;
264 }
260 265
261 platform_set_drvdata(tosa_snd_device, &tosa_snd_devdata); 266 platform_set_drvdata(tosa_snd_device, &tosa_snd_devdata);
262 tosa_snd_devdata.dev = &tosa_snd_device->dev; 267 tosa_snd_devdata.dev = &tosa_snd_device->dev;
263 ret = platform_device_add(tosa_snd_device); 268 ret = platform_device_add(tosa_snd_device);
264 269
265 if (ret) 270 if (!ret)
266 platform_device_put(tosa_snd_device); 271 return 0;
272
273 platform_device_put(tosa_snd_device);
274
275err_alloc:
276 gpio_free(TOSA_GPIO_L_MUTE);
267 277
268 return ret; 278 return ret;
269} 279}
@@ -271,6 +281,7 @@ static int __init tosa_init(void)
271static void __exit tosa_exit(void) 281static void __exit tosa_exit(void)
272{ 282{
273 platform_device_unregister(tosa_snd_device); 283 platform_device_unregister(tosa_snd_device);
284 gpio_free(TOSA_GPIO_L_MUTE);
274} 285}
275 286
276module_init(tosa_init); 287module_init(tosa_init);