The software stack I am working with assumes:

1) That the powerup of bluetooth is "1" and powerdown is "0".
2) That reading back the value corresponds to the value, not opposite.
3) No reset required.

The following patch does this. Plus I was wondering if there is
something else on LDO4. Can that regulator be reduced when not powering
bt? Is there any power savings doing so? I've knocked it down to 0 when
turning off and haven't seen any problems so far.

Sean

diff --git a/arch/arm/plat-s3c24xx/neo1973_pm_bt.c b/arch/arm/plat-s3c24xx/neo1973_pm_bt.c
index dfc9ae8..e029041 100644
--- a/arch/arm/plat-s3c24xx/neo1973_pm_bt.c
+++ b/arch/arm/plat-s3c24xx/neo1973_pm_bt.c
@@ -51,7 +51,7 @@ static ssize_t bt_read(struct device *dev, struct device_attribute *attr,
 
 #ifdef CONFIG_MACH_NEO1973_GTA02
 		case MACH_TYPE_NEO1973_GTA02:
-			if (s3c2410_gpio_getpin(GTA02_GPIO_BT_EN))
+			if (s3c2410_gpio_getpin(GTA02_GPIO_BT_EN) != 0)
 				goto out_1;
 			break;
 #endif /* CONFIG_MACH_NEO1973_GTA02 */
@@ -69,7 +69,7 @@ static ssize_t bt_read(struct device *dev, struct device_attribute *attr,
 
 #ifdef CONFIG_MACH_NEO1973_GTA02
 		case MACH_TYPE_NEO1973_GTA02:
-			if (s3c2410_gpio_getpin(GTA02_GPIO_BT_EN) == 0)
+			if (s3c2410_gpio_getpin(GTA02_GPIO_BT_EN) != 0)
 				goto out_1;
 			break;
 #endif /* CONFIG_MACH_NEO1973_GTA02 */
@@ -109,15 +109,17 @@ static ssize_t bt_write(struct device *dev, struct device_attribute *attr,
 
 #ifdef CONFIG_MACH_NEO1973_GTA02
 		case MACH_TYPE_NEO1973_GTA02:
-			neo1973_gpb_setpin(GTA02_GPIO_BT_EN, on ? 0 : 1);
-			if (on)
-				pcf50633_voltage_set(pcf50633_global,
-					PCF50633_REGULATOR_LDO4, 3200);
+			if (s3c2410_gpio_getpin(GTA02_GPIO_BT_EN) == on)
+				break;
+			neo1973_gpb_setpin(GTA02_GPIO_BT_EN, !on);
+			pcf50633_voltage_set(pcf50633_global,
+				PCF50633_REGULATOR_LDO4, on ? 3200 : 0);
 			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);
+			neo1973_gpb_setpin(GTA02_GPIO_BT_EN, on);
 			break;
 #endif /* CONFIG_MACH_NEO1973_GTA02 */
 

Reply via email to