summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorw20740 <w20740@motorola.com>2014-01-13 19:04:58 -0600
committerJames Wylder <jwylder@motorola.com>2014-03-05 17:47:04 -0600
commit7a54560f9e68174afc12c3b49cb0b75624d3090c (patch)
treee309b1057fb836a85650f1d2a8aff88040174257 /drivers
parent3ed2387a28b941fb73dcd87d260c44fa54f9501b (diff)
downloadolio-linux-3.10-7a54560f9e68174afc12c3b49cb0b75624d3090c.tar.xz
olio-linux-3.10-7a54560f9e68174afc12c3b49cb0b75624d3090c.zip
IKXCLOCK-79 Enable regulator when C55 initialized and enable loadswitch when LDO9 is turned on
Author: Jee Su Chang - w20740 Change-Id: I5376c4da70385fccf9cc576df66775f7d25a0ec0 Reviewed-on: http://gerrit.pcs.mot.com/603308 SLTApproved: Slta Waiver <sltawvr@motorola.com> Tested-by: Jira Key <jirakey@motorola.com> Reviewed-by: Douglas Zobel <dzobel1@motorola.com> Reviewed-by: Viditha Hanumanthareddy <ngjq36@motorola.com> Submit-Approved: Jira Key <jirakey@motorola.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/misc/c55_ctrl.c16
-rw-r--r--drivers/regulator/tps65912-regulator.c17
2 files changed, 31 insertions, 2 deletions
diff --git a/drivers/misc/c55_ctrl.c b/drivers/misc/c55_ctrl.c
index 04f29d3ff9a..3c116987e3d 100644
--- a/drivers/misc/c55_ctrl.c
+++ b/drivers/misc/c55_ctrl.c
@@ -17,6 +17,7 @@
#include <linux/irq.h>
#include <linux/module.h>
#include <linux/platform_device.h>
+#include <linux/regulator/consumer.h>
#include <linux/slab.h>
#include <linux/wakelock.h>
#include <linux/of.h>
@@ -26,6 +27,7 @@
struct c55_ctrl_data {
int int_gpio;
struct wake_lock wake_lock;
+ struct regulator *reg;
};
#define NUM_GPIOS 3
@@ -138,6 +140,17 @@ static int c55_ctrl_probe(struct platform_device *pdev)
return ret;
}
+ cdata->reg = regulator_get(&pdev->dev, "c55-ctrl");
+ if (IS_ERR(cdata->reg)) {
+ return PTR_ERR(cdata->reg);
+ }
+ ret = regulator_enable(cdata->reg);
+ if (ret) {
+ dev_err(&pdev->dev, "%s: c55_ctrl regulator_enable failed.\n", __func__);
+ regulator_put(cdata->reg);
+ return ret;
+ }
+
wake_lock_init(&cdata->wake_lock, WAKE_LOCK_SUSPEND, "c55_ctrl");
platform_set_drvdata(pdev, cdata);
@@ -146,6 +159,9 @@ static int c55_ctrl_probe(struct platform_device *pdev)
static int c55_ctrl_remove(struct platform_device *pdev)
{
+ struct c55_ctrl_data *cdata = platform_get_drvdata(pdev);
+
+ regulator_put(cdata->reg);
return 0;
}
diff --git a/drivers/regulator/tps65912-regulator.c b/drivers/regulator/tps65912-regulator.c
index 4a27de44d3c..4e19cc80cfa 100644
--- a/drivers/regulator/tps65912-regulator.c
+++ b/drivers/regulator/tps65912-regulator.c
@@ -274,7 +274,7 @@ static int tps65912_reg_enable(struct regulator_dev *dev)
struct tps65912_reg *pmic = rdev_get_drvdata(dev);
struct tps65912 *mfd = pmic->mfd;
int id = rdev_get_id(dev);
- int reg;
+ int reg, lsw;
if (id < TPS65912_REG_DCDC1 || id > TPS65912_REG_LDO10)
return -EINVAL;
@@ -283,6 +283,13 @@ static int tps65912_reg_enable(struct regulator_dev *dev)
if (reg < 0)
return reg;
+ if (id == TPS65912_REG_LDO9) {
+ lsw = tps65912_reg_read(mfd, TPS65912_LOADSWITCH);
+ lsw &= ~LOADSWITCH_MASK;
+ lsw |= LOADSWITCH_ENABLE;
+ tps65912_reg_write(mfd, TPS65912_LOADSWITCH, lsw);
+ }
+
return tps65912_set_bits(mfd, reg, TPS65912_REG_ENABLED);
}
@@ -290,12 +297,18 @@ static int tps65912_reg_disable(struct regulator_dev *dev)
{
struct tps65912_reg *pmic = rdev_get_drvdata(dev);
struct tps65912 *mfd = pmic->mfd;
- int id = rdev_get_id(dev), reg;
+ int id = rdev_get_id(dev), reg, lsw;
reg = pmic->get_ctrl_reg(id);
if (reg < 0)
return reg;
+ if (id == TPS65912_REG_LDO9) {
+ lsw = tps65912_reg_read(mfd, TPS65912_LOADSWITCH);
+ lsw &= ~LOADSWITCH_MASK;
+ lsw |= LOADSWITCH_DISABLE;
+ tps65912_reg_write(mfd, TPS65912_LOADSWITCH, lsw);
+ }
return tps65912_clear_bits(mfd, reg, TPS65912_REG_ENABLED);
}