[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <B567DBAB974C0544994013492B949F8E381301284E@EXMAIL03.scwf.nsc.com>
Date: Thu, 16 Feb 2012 22:41:45 -0800
From: "Kim, Milo" <Milo.Kim@...com>
To: "Mark Brown" <broonie@...nsource.wolfsonmicro.com>
cc: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: [PATCH 2/3] regulator: add set_pulldown in regulator operations
Some PMUs provide programmable active shutdown switches
that help discharge the load if the supply is off.
For providing this feature, set_pulldown() is added in the ops.
The set_pulldown() is not exported function.
This function is called internally when the regulator is disabled.
Then pull-down bits can be programmed in each regulator driver.
* patch base version : linux-3.2.4
Signed-off-by: Milo(Woogyom) Kim <milo.kim@...com>
---
drivers/regulator/core.c | 18 ++++++++++++++++++
include/linux/regulator/driver.h | 2 ++
2 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 938398f..3053f4f 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -1457,6 +1457,15 @@ static int _regulator_disable(struct regulator_dev *rdev)
return ret;
}
+ if (rdev->desc->ops->set_pulldown) {
+ ret = rdev->desc->ops->set_pulldown(rdev);
+ if (ret < 0) {
+ rdev_err(rdev,
+ "failed to set pulldown\n");
+ return ret;
+ }
+ }
+
trace_regulator_disable_complete(rdev_get_name(rdev));
_notifier_call_chain(rdev, REGULATOR_EVENT_DISABLE,
@@ -1518,6 +1527,15 @@ static int _regulator_force_disable(struct regulator_dev *rdev)
rdev_err(rdev, "failed to force disable\n");
return ret;
}
+
+ if (rdev->desc->ops->set_pulldown) {
+ ret = rdev->desc->ops->set_pulldown(rdev);
+ if (ret < 0) {
+ rdev_err(rdev, "failed to set pulldown\n");
+ return ret;
+ }
+ }
+
/* notify other consumers that power has been forced off */
_notifier_call_chain(rdev, REGULATOR_EVENT_FORCE_DISABLE |
REGULATOR_EVENT_DISABLE, NULL);
diff --git a/include/linux/regulator/driver.h b/include/linux/regulator/driver.h
index df6e9ec..081f91d 100644
--- a/include/linux/regulator/driver.h
+++ b/include/linux/regulator/driver.h
@@ -38,6 +38,7 @@ enum regulator_status {
*
* @enable: Configure the regulator as enabled.
* @disable: Configure the regulator as disabled.
+ * @set_pulldown : Configure pulldown setting when the regulator is disabled.
* @is_enabled: Return 1 if the regulator is enabled, 0 if not.
* May also return negative errno.
*
@@ -102,6 +103,7 @@ struct regulator_ops {
/* enable/disable regulator */
int (*enable) (struct regulator_dev *);
int (*disable) (struct regulator_dev *);
+ int (*set_pulldown) (struct regulator_dev *);
int (*is_enabled) (struct regulator_dev *);
/* get/set regulator operating mode (defined in consumer.h) */
--
1.7.4.1
Best Regards,
Milo (Woogyom) Kim
Texas Instruments Incorporated
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists