summaryrefslogtreecommitdiff
path: root/recipes/linux/linux-rp-2.6.24/tosa/0051-fix-sound-soc-pxa-tosa.c-to-new-gpio-api.patch
blob: 585f1af288bee95cf914cbb9540a6a75e655790c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
From 38ef1b452cc3138157b92d02b31cad439d12d0ca Mon Sep 17 00:00:00 2001
From: Dmitry Baryshkov <dbaryshkov@gmail.com>
Date: Wed, 9 Jan 2008 02:03:34 +0300
Subject: [PATCH 51/64] fix sound/soc/pxa/tosa.c to new gpio api

Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com>
---
 sound/soc/pxa/tosa.c |   33 ++++++++++++++++++++++++++-------
 1 files changed, 26 insertions(+), 7 deletions(-)

diff --git a/sound/soc/pxa/tosa.c b/sound/soc/pxa/tosa.c
index 21c51b5..b758de8 100644
--- a/sound/soc/pxa/tosa.c
+++ b/sound/soc/pxa/tosa.c
@@ -36,6 +36,7 @@
 #include <asm/arch/hardware.h>
 #include <asm/arch/audio.h>
 #include <asm/arch/tosa.h>
+#include <asm/gpio.h>
 
 #include "../codecs/wm9712.h"
 #include "pxa2xx-pcm.h"
@@ -137,11 +138,11 @@ static int tosa_set_spk(struct snd_kcontrol *kcontrol,
 /* tosa dapm event handlers */
 static int tosa_hp_event(struct snd_soc_dapm_widget *w, int event)
 {
-#if 0
+#ifdef CONFIG_MFD_TC6393XB
 	if (SND_SOC_DAPM_EVENT_ON(event))
-		set_tc6393_gpio(&tc6393_device.dev,TOSA_TC6393_L_MUTE);
+		gpio_set_value(TOSA_TC6393XB_L_MUTE, 1);
 	else
-		reset_tc6393_gpio(&tc6393_device.dev,TOSA_TC6393_L_MUTE);
+		gpio_set_value(TOSA_TC6393XB_L_MUTE, 0);
 #endif
 	return 0;
 }
@@ -262,16 +263,31 @@ static int __init tosa_init(void)
 	if (!machine_is_tosa())
 		return -ENODEV;
 
+#ifdef CONFIG_MFD_TC6393XB
+	ret = gpio_request(TOSA_TC6393XB_L_MUTE, "Headphone Jack");
+	if (ret)
+		return ret;
+	gpio_direction_output(TOSA_TC6393XB_L_MUTE, 0);
+#endif
 	tosa_snd_device = platform_device_alloc("soc-audio", -1);
-	if (!tosa_snd_device)
-		return -ENOMEM;
+	if (!tosa_snd_device) {
+		ret = -ENOMEM;
+		goto err_alloc;
+	}
 
 	platform_set_drvdata(tosa_snd_device, &tosa_snd_devdata);
 	tosa_snd_devdata.dev = &tosa_snd_device->dev;
 	ret = platform_device_add(tosa_snd_device);
 
-	if (ret)
-		platform_device_put(tosa_snd_device);
+	if (!ret)
+		return 0;
+
+	platform_device_put(tosa_snd_device);
+
+err_alloc:
+#ifdef CONFIG_MFD_TC6393XB
+	gpio_free(TOSA_TC6393XB_L_MUTE);
+#endif
 
 	return ret;
 }
@@ -279,6 +295,9 @@ static int __init tosa_init(void)
 static void __exit tosa_exit(void)
 {
 	platform_device_unregister(tosa_snd_device);
+#ifdef CONFIG_MFD_TC6393XB
+	gpio_free(TOSA_TC6393XB_L_MUTE);
+#endif
 }
 
 module_init(tosa_init);
-- 
1.5.3.8