From 3f5adf94526e33a9da8193d26a7d511820eb7f4d Mon Sep 17 00:00:00 2001 From: Andy Green Date: Mon, 1 Dec 2008 01:26:30 +0000 Subject: fix-regulators-pm-bt-get-regulator-mutx-on-resume.patch Signed-off-by: Andy Green --- arch/arm/plat-s3c24xx/neo1973_pm_bt.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'arch/arm/plat-s3c24xx/neo1973_pm_bt.c') diff --git a/arch/arm/plat-s3c24xx/neo1973_pm_bt.c b/arch/arm/plat-s3c24xx/neo1973_pm_bt.c index df901a6c437..894651afc12 100644 --- a/arch/arm/plat-s3c24xx/neo1973_pm_bt.c +++ b/arch/arm/plat-s3c24xx/neo1973_pm_bt.c @@ -76,9 +76,7 @@ static int bt_rfkill_toggle_radio(void *data, enum rfkill_state state) { struct device *dev = data; unsigned long on = (state == RFKILL_STATE_ON); - unsigned int vol; struct gta01_pm_bt_data *bt_data; - struct regulator *regulator; if (machine_is_neo1973_gta01()) { /* if we are powering up, assert reset, then power, @@ -98,21 +96,17 @@ static int bt_rfkill_toggle_radio(void *data, enum rfkill_state state) bt_data = dev_get_drvdata(dev); BUG_ON(!bt_data || !bt_data->regulator); - regulator = bt_data->regulator; neo1973_gpb_setpin(GTA02_GPIO_BT_EN, !on); if (on) { - if (!regulator_is_enabled(regulator)) - regulator_enable(regulator); + if (!regulator_is_enabled(bt_data->regulator)) + regulator_enable(bt_data->regulator); } else { - if (regulator_is_enabled(regulator)) - regulator_disable(regulator); + if (regulator_is_enabled(bt_data->regulator)) + regulator_disable(bt_data->regulator); } - vol = regulator_get_voltage(regulator); - - dev_info(dev, "GTA02 Set PCF50633 LDO4 = %d\n", vol); neo1973_gpb_setpin(GTA02_GPIO_BT_EN, on); } @@ -241,9 +235,16 @@ static int __init gta01_bt_probe(struct platform_device *pdev) bt_data->regulator = regulator; dev_set_drvdata(&pdev->dev, bt_data); - /* we make sure that the voltage is off */ - if (regulator_is_enabled(regulator)) + /* this tests the true physical state of the regulator... */ + if (regulator_is_enabled(regulator)) { + /* + * but these only operate on the logical state of the + * regulator... so we need to logicaly "adopt" it on + * to turn it off + */ + regulator_enable(regulator); regulator_disable(regulator); + } /* we pull reset to low to make sure that the chip doesn't * drain power through the reset line */ -- cgit v1.2.3