From: Axel Lin <axel.lin@ingics.com>
To: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: Laxman Dewangan <ldewangan@nvidia.com>,
Liam Girdwood <lrg@ti.com>,
linux-kernel@vger.kernel.org
Subject: [RFC/RFT][PATCH 4/4] regulator: tps51632: Use linear_min_sel and regulator_[map|list]_voltage_linear
Date: Tue, 27 Nov 2012 10:28:47 +0800 [thread overview]
Message-ID: <1353983327.5422.8.camel@phoenix> (raw)
In-Reply-To: <1353983073.5422.2.camel@phoenix>
Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
drivers/regulator/tps51632-regulator.c | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)
diff --git a/drivers/regulator/tps51632-regulator.c b/drivers/regulator/tps51632-regulator.c
index b22c3f2..523b1e5 100644
--- a/drivers/regulator/tps51632-regulator.c
+++ b/drivers/regulator/tps51632-regulator.c
@@ -106,29 +106,23 @@ static int tps51632_dcdc_get_voltage_sel(struct regulator_dev *rdev)
}
vsel = data & TPS51632_VOUT_MASK;
-
- if (vsel < TPS51632_MIN_VSEL)
- return 0;
- else
- return vsel - TPS51632_MIN_VSEL;
+ return vsel;
}
static int tps51632_dcdc_set_voltage_sel(struct regulator_dev *rdev,
unsigned selector)
{
struct tps51632_chip *tps = rdev_get_drvdata(rdev);
- int vsel;
int ret;
unsigned int reg = TPS51632_VOLTAGE_SELECT_REG;
if (tps->enable_pwm_dvfs)
reg = TPS51632_VOLTAGE_BASE_REG;
- vsel = selector + TPS51632_MIN_VSEL;
- if (vsel > TPS51632_MAX_VSEL)
+ if (selector > TPS51632_MAX_VSEL)
return -EINVAL;
- ret = regmap_write(tps->regmap, reg, vsel);
+ ret = regmap_write(tps->regmap, reg, selector);
if (ret < 0)
dev_err(tps->dev, "reg write failed, err %d\n", ret);
return ret;
@@ -254,7 +248,8 @@ static int tps51632_probe(struct i2c_client *client,
tps->desc.ramp_delay = TPS51632_DEFAULT_RAMP_DELAY;
tps->desc.min_uV = TPS51632_MIN_VOLATGE;
tps->desc.uV_step = TPS51632_VOLATGE_STEP_10mV;
- tps->desc.n_voltages = (TPS51632_MAX_VSEL - TPS51632_MIN_VSEL) + 1;
+ tps->desc.linear_min_sel = TPS51632_MIN_VSEL;
+ tps->desc.n_voltages = TPS51632_MAX_VSEL + 1;
tps->desc.ops = &tps51632_dcdc_ops;
tps->desc.type = REGULATOR_VOLTAGE;
tps->desc.owner = THIS_MODULE;
--
1.7.9.5
next prev parent reply other threads:[~2012-11-27 2:28 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-27 2:24 [RFC/RFT][PATCH 1/4] regulator: core: Allow specific minimal selector for starting linear mapping Axel Lin
2012-11-27 2:26 ` [RFC/RFT][PATCH 2/4] regulator: da9055: Use linear_min_sel and regulator_[map|list]_voltage_linear Axel Lin
2012-11-27 2:27 ` [RFC/RFT][PATCH 3/4] regulator: palmas: " Axel Lin
2012-11-27 2:28 ` Axel Lin [this message]
2012-11-27 20:14 ` [RFC/RFT][PATCH 4/4] regulator: tps51632: " Mark Brown
2012-11-27 20:15 ` [RFC/RFT][PATCH 1/4] regulator: core: Allow specific minimal selector for starting linear mapping 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=1353983327.5422.8.camel@phoenix \
--to=axel.lin@ingics.com \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=ldewangan@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lrg@ti.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