From: Axel Lin <axel.lin@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: David Dajun Chen <dchen@diasemi.com>,
Ashish Jangam <ashish.jangam@kpitcummins.com>,
"Ying-Chun Liu (PaulLiu)" <paul.liu@linaro.org>,
Mark Brown <broonie@opensource.wolfsonmicro.com>,
Liam Girdwood <lrg@ti.com>
Subject: [PATCH RFT 2/3] regulator: da9052: Use regulator_get_voltage_sel_regmap()
Date: Tue, 24 Apr 2012 09:54:38 +0800 [thread overview]
Message-ID: <1335232478.6470.3.camel@phoenix> (raw)
In-Reply-To: <1335232352.6470.1.camel@phoenix>
Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
drivers/regulator/da9052-regulator.c | 32 ++++++++------------------------
1 files changed, 8 insertions(+), 24 deletions(-)
diff --git a/drivers/regulator/da9052-regulator.c b/drivers/regulator/da9052-regulator.c
index 4f2e6f9..16815f1 100644
--- a/drivers/regulator/da9052-regulator.c
+++ b/drivers/regulator/da9052-regulator.c
@@ -70,7 +70,6 @@ struct da9052_regulator_info {
int step_uV;
int min_uV;
int max_uV;
- unsigned char volt_shift;
unsigned char activate_bit;
};
@@ -209,9 +208,8 @@ static int da9052_regulator_set_voltage(struct regulator_dev *rdev,
if (ret < 0)
return ret;
- ret = da9052_reg_update(regulator->da9052,
- DA9052_BUCKCORE_REG + id,
- (1 << info->volt_shift) - 1, *selector);
+ ret = da9052_reg_update(regulator->da9052, rdev->desc->vsel_reg,
+ rdev->desc->vsel_mask, *selector);
if (ret < 0)
return ret;
@@ -232,29 +230,13 @@ static int da9052_regulator_set_voltage(struct regulator_dev *rdev,
return ret;
}
-static int da9052_get_regulator_voltage_sel(struct regulator_dev *rdev)
-{
- struct da9052_regulator *regulator = rdev_get_drvdata(rdev);
- struct da9052_regulator_info *info = regulator->info;
- int offset = rdev_get_id(rdev);
- int ret;
-
- ret = da9052_reg_read(regulator->da9052, DA9052_BUCKCORE_REG + offset);
- if (ret < 0)
- return ret;
-
- ret &= ((1 << info->volt_shift) - 1);
-
- return ret;
-}
-
static struct regulator_ops da9052_dcdc_ops = {
.set_voltage = da9052_regulator_set_voltage,
.get_current_limit = da9052_dcdc_get_current_limit,
.set_current_limit = da9052_dcdc_set_current_limit,
.list_voltage = da9052_list_voltage,
- .get_voltage_sel = da9052_get_regulator_voltage_sel,
+ .get_voltage_sel = regulator_get_voltage_sel_regmap,
.is_enabled = regulator_is_enabled_regmap,
.enable = regulator_enable_regmap,
.disable = regulator_disable_regmap,
@@ -264,7 +246,7 @@ static struct regulator_ops da9052_ldo_ops = {
.set_voltage = da9052_regulator_set_voltage,
.list_voltage = da9052_list_voltage,
- .get_voltage_sel = da9052_get_regulator_voltage_sel,
+ .get_voltage_sel = regulator_get_voltage_sel_regmap,
.is_enabled = regulator_is_enabled_regmap,
.enable = regulator_enable_regmap,
.disable = regulator_disable_regmap,
@@ -279,13 +261,14 @@ static struct regulator_ops da9052_ldo_ops = {
.id = DA9052_ID_##_id,\
.n_voltages = (max - min) / step + 1, \
.owner = THIS_MODULE,\
+ .vsel_reg = DA9052_BUCKCORE_REG + DA9052_ID_##_id, \
+ .vsel_mask = (1 << (sbits)) - 1,\
.enable_reg = DA9052_BUCKCORE_REG + DA9052_ID_##_id, \
.enable_mask = 1 << (ebits),\
},\
.min_uV = (min) * 1000,\
.max_uV = (max) * 1000,\
.step_uV = (step) * 1000,\
- .volt_shift = (sbits),\
.activate_bit = (abits),\
}
@@ -298,13 +281,14 @@ static struct regulator_ops da9052_ldo_ops = {
.id = DA9052_ID_##_id,\
.n_voltages = (max - min) / step + 1, \
.owner = THIS_MODULE,\
+ .vsel_reg = DA9052_BUCKCORE_REG + DA9052_ID_##_id, \
+ .vsel_mask = (1 << (sbits)) - 1,\
.enable_reg = DA9052_BUCKCORE_REG + DA9052_ID_##_id, \
.enable_mask = 1 << (ebits),\
},\
.min_uV = (min) * 1000,\
.max_uV = (max) * 1000,\
.step_uV = (step) * 1000,\
- .volt_shift = (sbits),\
.activate_bit = (abits),\
}
--
1.7.5.4
next prev parent reply other threads:[~2012-04-24 1:54 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-24 1:52 [PATCH RFT 1/3] regulator: 88pm8607: Use regulator_get_voltage_sel_regmap() Axel Lin
2012-04-24 1:54 ` Axel Lin [this message]
2012-05-04 12:30 ` [PATCH RFT 2/3] regulator: da9052: " Mark Brown
2012-04-24 1:56 ` [PATCH RFT 3/3] regulator: rc5t583: " Axel Lin
2012-05-04 12:32 ` Mark Brown
2012-05-04 12:38 ` [PATCH RFT 1/3] regulator: 88pm8607: " 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=1335232478.6470.3.camel@phoenix \
--to=axel.lin@gmail.com \
--cc=ashish.jangam@kpitcummins.com \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=dchen@diasemi.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lrg@ti.com \
--cc=paul.liu@linaro.org \
/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