summaryrefslogtreecommitdiff
path: root/target/linux/s3c24xx/patches-2.6.26/0035-gta02-bt-fixes.patch.patch
blob: e04723f4bff8a6e007b4d08ec6d166e0b294f833 (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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
From d4d6e6229c94cfe2bd8f29b4ebc0d60b8ad29455 Mon Sep 17 00:00:00 2001
From: mokopatches <mokopatches@openmoko.org>
Date: Wed, 16 Jul 2008 14:46:57 +0100
Subject: [PATCH] gta02-bt-fixes.patch
 Modify GTA02 power manager for bluetooth.

1. Default power value isn't correct. Now we set pcf50633 LDO4 to 3.2 voltage.

2. Separate GTA01 and GTA02 source code.

3. Add pcf50633 API for enable register.
---
 arch/arm/mach-s3c2440/mach-gta02.c    |    4 +-
 arch/arm/plat-s3c24xx/neo1973_pm_bt.c |   71 ++++++++++++++++++++++++++++----
 include/linux/pcf50633.h              |    1 +
 3 files changed, 65 insertions(+), 11 deletions(-)

diff --git a/arch/arm/mach-s3c2440/mach-gta02.c b/arch/arm/mach-s3c2440/mach-gta02.c
index 3fbb131..46acede 100644
--- a/arch/arm/mach-s3c2440/mach-gta02.c
+++ b/arch/arm/mach-s3c2440/mach-gta02.c
@@ -213,10 +213,10 @@ static struct pcf50633_platform_data gta02_pcf_pdata = {
 			},
 		},
 		[PCF50633_REGULATOR_LDO4] = {
-			.name		= "gl_2v5",
+			.name		= "bt_3v2",
 			.voltage	= {
 				.init	= 2500,
-				.max	= 2500,
+				.max	= 3300,
 			},
 		},
 		[PCF50633_REGULATOR_LDO5] = {
diff --git a/arch/arm/plat-s3c24xx/neo1973_pm_bt.c b/arch/arm/plat-s3c24xx/neo1973_pm_bt.c
index d685ef7..8f5be88 100644
--- a/arch/arm/plat-s3c24xx/neo1973_pm_bt.c
+++ b/arch/arm/plat-s3c24xx/neo1973_pm_bt.c
@@ -16,12 +16,19 @@
 #include <linux/kernel.h>
 #include <linux/platform_device.h>
 
-#include <linux/pcf50606.h>
-
 #include <asm/hardware.h>
 #include <asm/mach-types.h>
+
+#ifdef CONFIG_MACH_NEO1973_GTA01
 #include <asm/arch/gta01.h>
+#include <linux/pcf50606.h>
+#endif
+
+#ifdef CONFIG_MACH_NEO1973_GTA02
 #include <asm/arch/gta02.h>
+#include <linux/pcf50633.h>
+#endif
+
 
 #define DRVMSG "FIC Neo1973 Bluetooth Power Management"
 
@@ -30,6 +37,8 @@ static ssize_t bt_read(struct device *dev, struct device_attribute *attr,
 {
 	if (!strcmp(attr->attr.name, "power_on")) {
 		switch (machine_arch_type) {
+
+#ifdef CONFIG_MACH_NEO1973_GTA01
 		case MACH_TYPE_NEO1973_GTA01:
 			if (pcf50606_onoff_get(pcf50606_global,
 						PCF50606_REGULATOR_D1REG) &&
@@ -37,21 +46,33 @@ static ssize_t bt_read(struct device *dev, struct device_attribute *attr,
 						 PCF50606_REGULATOR_D1REG) == 3100)
 				goto out_1;
 			break;
+#endif /* CONFIG_MACH_NEO1973_GTA01 */
+
+#ifdef CONFIG_MACH_NEO1973_GTA02
 		case MACH_TYPE_NEO1973_GTA02:
 			if (s3c2410_gpio_getpin(GTA02_GPIO_BT_EN))
 				goto out_1;
 			break;
+#endif /* CONFIG_MACH_NEO1973_GTA02 */
+
 		}
 	} else if (!strcmp(attr->attr.name, "reset")) {
 		switch (machine_arch_type) {
+
+#ifdef CONFIG_MACH_NEO1973_GTA01
 		case MACH_TYPE_NEO1973_GTA01:
 			if (s3c2410_gpio_getpin(GTA01_GPIO_BT_EN) == 0)
 				goto out_1;
 			break;
+#endif /* CONFIG_MACH_NEO1973_GTA01 */
+
+#ifdef CONFIG_MACH_NEO1973_GTA02
 		case MACH_TYPE_NEO1973_GTA02:
 			if (s3c2410_gpio_getpin(GTA02_GPIO_BT_EN) == 0)
 				goto out_1;
 			break;
+#endif /* CONFIG_MACH_NEO1973_GTA02 */
+
 		}
 	}
 
@@ -64,9 +85,12 @@ static ssize_t bt_write(struct device *dev, struct device_attribute *attr,
 			const char *buf, size_t count)
 {
 	unsigned long on = simple_strtoul(buf, NULL, 10);
+	unsigned int vol;
 
 	if (!strcmp(attr->attr.name, "power_on")) {
 		switch (machine_arch_type) {
+
+#ifdef CONFIG_MACH_NEO1973_GTA01
 		case MACH_TYPE_NEO1973_GTA01:
 			/* if we are powering up, assert reset, then power,
 			 * then release reset */
@@ -80,22 +104,39 @@ static ssize_t bt_write(struct device *dev, struct device_attribute *attr,
 					   PCF50606_REGULATOR_D1REG, on);
 			s3c2410_gpio_setpin(GTA01_GPIO_BT_EN, on);
 			break;
+#endif /* CONFIG_MACH_NEO1973_GTA01 */
+
+#ifdef CONFIG_MACH_NEO1973_GTA02
 		case MACH_TYPE_NEO1973_GTA02:
+			s3c2410_gpio_setpin(GTA02_GPIO_BT_EN, on ? 0 : 1);
 			if (on)
-				s3c2410_gpio_setpin(GTA02_GPIO_BT_EN, 0);
-			else
-				s3c2410_gpio_setpin(GTA02_GPIO_BT_EN, 1);
+				pcf50633_voltage_set(pcf50633_global,
+					PCF50633_REGULATOR_LDO4, 3200);
+			pcf50633_onoff_set(pcf50633_global,
+				PCF50633_REGULATOR_LDO4, on);
+			vol = pcf50633_voltage_get(pcf50633_global,
+				PCF50633_REGULATOR_LDO4);
+			dev_info(dev, "GTA02 Set PCF50633 LDO4 = %d\n", vol);
 			break;
+#endif /* CONFIG_MACH_NEO1973_GTA02 */
+
 		}
 	} else if (!strcmp(attr->attr.name, "reset")) {
 		/* reset is low-active, so we need to invert */
 		switch (machine_arch_type) {
+
+#ifdef CONFIG_MACH_NEO1973_GTA01
 		case MACH_TYPE_NEO1973_GTA01:
 			s3c2410_gpio_setpin(GTA01_GPIO_BT_EN, on ? 0 : 1);
 			break;
+#endif /* CONFIG_MACH_NEO1973_GTA01 */
+
+#ifdef CONFIG_MACH_NEO1973_GTA02
 		case MACH_TYPE_NEO1973_GTA02:
 			s3c2410_gpio_setpin(GTA02_GPIO_BT_EN, on ? 0 : 1);
 			break;
+#endif /* CONFIG_MACH_NEO1973_GTA02 */
+
 		}
 	}
 
@@ -143,18 +184,30 @@ static int __init gta01_bt_probe(struct platform_device *pdev)
 	dev_info(&pdev->dev, DRVMSG ": starting\n");
 
 	switch (machine_arch_type) {
+
+#ifdef CONFIG_MACH_NEO1973_GTA01
 	case MACH_TYPE_NEO1973_GTA01:
 		/* we make sure that the voltage is off */
 		pcf50606_onoff_set(pcf50606_global,
 				   PCF50606_REGULATOR_D1REG, 0);
+		/* we pull reset to low to make sure that the chip doesn't
+	 	 * drain power through the reset line */
+		s3c2410_gpio_setpin(GTA01_GPIO_BT_EN, 0);
 		break;
+#endif /* CONFIG_MACH_NEO1973_GTA01 */
+
+#ifdef CONFIG_MACH_NEO1973_GTA02
 	case MACH_TYPE_NEO1973_GTA02:
-		/* FIXME: implementation */
+		/* we make sure that the voltage is off */
+		pcf50633_onoff_set(pcf50633_global,
+				     PCF50633_REGULATOR_LDO4, 0);
+		/* we pull reset to low to make sure that the chip doesn't
+	 	 * drain power through the reset line */
+		s3c2410_gpio_setpin(GTA02_GPIO_BT_EN, 0);
 		break;
+#endif /* CONFIG_MACH_NEO1973_GTA02 */
+
 	}
-	/* we pull reset to low to make sure that the chip doesn't
-	 * drain power through the reset line */
-	s3c2410_gpio_setpin(GTA01_GPIO_BT_EN, 0);
 
 	return sysfs_create_group(&pdev->dev.kobj, &gta01_bt_attr_group);
 }
diff --git a/include/linux/pcf50633.h b/include/linux/pcf50633.h
index bf50fe4..b6a67ee 100644
--- a/include/linux/pcf50633.h
+++ b/include/linux/pcf50633.h
@@ -46,6 +46,7 @@ pcf50633_voltage_set(struct pcf50633_data *pcf,
 extern unsigned int
 pcf50633_voltage_get(struct pcf50633_data *pcf,
 		     enum pcf50633_regulator_id reg);
+
 extern int
 pcf50633_onoff_get(struct pcf50633_data *pcf,
 		   enum pcf50633_regulator_id reg);
-- 
1.5.6.3