From: Laxman Dewangan <ldewangan@nvidia.com>
To: <broonie@opensource.wolfsonmicro.com>, <lrg@ti.com>,
<sameo@linux.intel.com>
Cc: <vbyravarasu@nvidia.com>, <axel.lin@gmail.com>,
<linux-kernel@vger.kernel.org>,
Laxman Dewangan <ldewangan@nvidia.com>
Subject: [PATCH 4/5] regulator: tps65090: Add voltage out level in platform data
Date: Sat, 6 Oct 2012 20:47:50 +0530 [thread overview]
Message-ID: <1349536671-31714-6-git-send-email-ldewangan@nvidia.com> (raw)
In-Reply-To: <1349536671-31714-1-git-send-email-ldewangan@nvidia.com>
TPS65090's DCDCs and FETs act as switch and so output
voltage can be enable or disable only. The output voltage
of this regulators depends on the input voltage.
Add the voltage parameter to tell the output voltage value
of these rails.
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
---
drivers/regulator/tps65090-regulator.c | 32 ++++++++++++++++++++++++-
include/linux/regulator/tps65090-regulator.h | 2 +
2 files changed, 32 insertions(+), 2 deletions(-)
diff --git a/drivers/regulator/tps65090-regulator.c b/drivers/regulator/tps65090-regulator.c
index 254ee66..279154b 100644
--- a/drivers/regulator/tps65090-regulator.c
+++ b/drivers/regulator/tps65090-regulator.c
@@ -27,18 +27,44 @@
#include <linux/regulator/tps65090-regulator.h>
struct tps65090_regulator {
+ int microvolts;
struct device *dev;
struct regulator_desc *desc;
struct regulator_dev *rdev;
};
+static int tps65090_voltage_get_voltage(struct regulator_dev *rdev)
+{
+ struct tps65090_regulator *ri = rdev_get_drvdata(rdev);
+
+ if (ri->microvolts)
+ return ri->microvolts;
+ else
+ return -EINVAL;
+}
+
+static int tps65090_voltage_list_voltage(struct regulator_dev *rdev,
+ unsigned selector)
+{
+ struct tps65090_regulator *ri = rdev_get_drvdata(rdev);
+
+ if (selector != 0)
+ return -EINVAL;
+
+ return ri->microvolts;
+}
+
static struct regulator_ops tps65090_ops = {
+ .get_voltage = tps65090_voltage_get_voltage,
+ .list_voltage = tps65090_voltage_list_voltage,
.enable = regulator_enable_regmap,
.disable = regulator_disable_regmap,
.is_enabled = regulator_is_enabled_regmap,
};
static struct regulator_ops tps65090_ldo_ops = {
+ .get_voltage = tps65090_voltage_get_voltage,
+ .list_voltage = tps65090_voltage_list_voltage,
};
#define tps65090_REG_DESC(_id, _sname, _en_reg, _ops) \
@@ -105,10 +131,12 @@ static int __devinit tps65090_regulator_probe(struct platform_device *pdev)
config.dev = &pdev->dev;
config.driver_data = ri;
config.regmap = tps65090_mfd->rmap;
- if (tps_pdata)
+ if (tps_pdata) {
+ ri->microvolts = tps_pdata->microvolts;
config.init_data = tps_pdata->reg_init_data;
- else
+ } else {
config.init_data = NULL;
+ }
rdev = regulator_register(ri->desc, &config);
if (IS_ERR(rdev)) {
diff --git a/include/linux/regulator/tps65090-regulator.h b/include/linux/regulator/tps65090-regulator.h
index 48e3db1..0b29ffa 100644
--- a/include/linux/regulator/tps65090-regulator.h
+++ b/include/linux/regulator/tps65090-regulator.h
@@ -45,10 +45,12 @@ enum {
* struct tps65090_regulator_platform_data
*
* @reg_init_data: The regulator init data.
+ * @microvolts: The rail's voltage level.
*/
struct tps65090_regulator_platform_data {
struct regulator_init_data *reg_init_data;
+ int microvolts;
};
#endif /* __REGULATOR_TPS65090_H */
--
1.7.1.1
next prev parent reply other threads:[~2012-10-06 15:51 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-06 15:17 [PATCH 0/5] regulator: tps65090: fix regulator registration and add external control support Laxman Dewangan
2012-10-06 15:17 ` [PATCH] regulator: TPS51632: Add tps51632 regulator driver Laxman Dewangan
2012-10-09 6:14 ` Mark Brown
2012-10-09 6:07 ` Laxman Dewangan
2012-10-06 15:17 ` [PATCH 1/5] regulator: tps65090: rename driver name and regulator name Laxman Dewangan
2012-10-08 5:53 ` Venu Byravarasu
2012-10-08 6:00 ` Laxman Dewangan
2012-10-06 15:17 ` [PATCH 2/5] regulator; tps65090: Register all regulators in single probe call Laxman Dewangan
2012-10-09 6:22 ` Mark Brown
2012-10-09 6:16 ` Laxman Dewangan
2012-10-06 15:17 ` [PATCH 3/5] regulator: tps65090: Add support for LDO regulators Laxman Dewangan
2012-10-06 15:17 ` Laxman Dewangan [this message]
2012-10-09 6:26 ` [PATCH 4/5] regulator: tps65090: Add voltage out level in platform data Mark Brown
2012-10-06 15:17 ` [PATCH 5/5] regulator: tps65090: add external control support for DCDC Laxman Dewangan
2012-10-08 5:45 ` Venu Byravarasu
2012-10-08 5:58 ` Laxman Dewangan
2012-10-09 6:28 ` Mark Brown
2012-10-09 6:21 ` Laxman Dewangan
2012-10-09 7:04 ` Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1349536671-31714-6-git-send-email-ldewangan@nvidia.com \
--to=ldewangan@nvidia.com \
--cc=axel.lin@gmail.com \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lrg@ti.com \
--cc=sameo@linux.intel.com \
--cc=vbyravarasu@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).