diff options
Diffstat (limited to 'sound/soc/pxa/tosa.c')
-rw-r--r-- | sound/soc/pxa/tosa.c | 29 |
1 files changed, 20 insertions, 9 deletions
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, | |||
138 | static int tosa_hp_event(struct snd_soc_dapm_widget *w, | 139 | static 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 | |||
282 | err_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) | |||
278 | static void __exit tosa_exit(void) | 288 | static 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 | ||
283 | module_init(tosa_init); | 294 | module_init(tosa_init); |