* [PATCH v2 0/2] regulator: tps62360: add cache support and settling time
@ 2012-05-07 12:38 Laxman Dewangan
2012-05-07 12:38 ` [PATCH v2 1/2] regulator: tps62360: enable register cache Laxman Dewangan
2012-05-07 12:38 ` [PATCH v2 2/2] regulator: tps62360: Provide settling time for voltage change Laxman Dewangan
0 siblings, 2 replies; 5+ messages in thread
From: Laxman Dewangan @ 2012-05-07 12:38 UTC (permalink / raw)
To: broonie, lrg; +Cc: linux-kernel, Laxman Dewangan
This patch series is for improving the register update time by enabling
caching and provide settling time for voltage output change.
Creating this patch series by removing the stylistic fix as it
is under discussion and these changes can go independently.
Laxman Dewangan (2):
regulator: tps62360: enable register cache
Enable the caching of register to have faster update_bits as it
will avoid one more i2c read every time.
regulator: tps62360: Provide settling time for voltage change
This will provide settlling delay when voltage output changes.
drivers/regulator/tps62360-regulator.c | 52 +++++++++++++++++++++++++++-----
1 files changed, 44 insertions(+), 8 deletions(-)
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2 1/2] regulator: tps62360: enable register cache
2012-05-07 12:38 [PATCH v2 0/2] regulator: tps62360: add cache support and settling time Laxman Dewangan
@ 2012-05-07 12:38 ` Laxman Dewangan
2012-05-07 14:24 ` Mark Brown
2012-05-07 12:38 ` [PATCH v2 2/2] regulator: tps62360: Provide settling time for voltage change Laxman Dewangan
1 sibling, 1 reply; 5+ messages in thread
From: Laxman Dewangan @ 2012-05-07 12:38 UTC (permalink / raw)
To: broonie, lrg; +Cc: linux-kernel, Laxman Dewangan
Enable cache of device register using regmap cache RBTREE.
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
---
Just resending as part of this series.
drivers/regulator/tps62360-regulator.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/regulator/tps62360-regulator.c b/drivers/regulator/tps62360-regulator.c
index 20fef1d..e893080 100644
--- a/drivers/regulator/tps62360-regulator.c
+++ b/drivers/regulator/tps62360-regulator.c
@@ -262,8 +262,10 @@ static int tps62360_init_dcdc(struct tps62360_chip *tps,
}
static const struct regmap_config tps62360_regmap_config = {
- .reg_bits = 8,
- .val_bits = 8,
+ .reg_bits = 8,
+ .val_bits = 8,
+ .max_register = REG_CHIPID,
+ .cache_type = REGCACHE_RBTREE,
};
static int __devinit tps62360_probe(struct i2c_client *client,
--
1.7.1.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v2 2/2] regulator: tps62360: Provide settling time for voltage change
2012-05-07 12:38 [PATCH v2 0/2] regulator: tps62360: add cache support and settling time Laxman Dewangan
2012-05-07 12:38 ` [PATCH v2 1/2] regulator: tps62360: enable register cache Laxman Dewangan
@ 2012-05-07 12:38 ` Laxman Dewangan
1 sibling, 0 replies; 5+ messages in thread
From: Laxman Dewangan @ 2012-05-07 12:38 UTC (permalink / raw)
To: broonie, lrg; +Cc: linux-kernel, Laxman Dewangan
Settling time is require when there is voltage output change.
Implement set_voltage_time_sel() callback which returns delay time
for voltage change to settle down to new value.
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
---
Removing stylistic fix as it is under discussion and
creating new patch series.
drivers/regulator/tps62360-regulator.c | 46 +++++++++++++++++++++++++++----
1 files changed, 40 insertions(+), 6 deletions(-)
diff --git a/drivers/regulator/tps62360-regulator.c b/drivers/regulator/tps62360-regulator.c
index e893080..d2f657e 100644
--- a/drivers/regulator/tps62360-regulator.c
+++ b/drivers/regulator/tps62360-regulator.c
@@ -71,6 +71,7 @@ struct tps62360_chip {
int lru_index[4];
int curr_vset_vsel[4];
int curr_vset_id;
+ int change_uv_per_us;
};
/*
@@ -114,7 +115,7 @@ update_lru_index:
return found;
}
-static int tps62360_dcdc_get_voltage(struct regulator_dev *dev)
+static int tps62360_dcdc_get_voltage_sel(struct regulator_dev *dev)
{
struct tps62360_chip *tps = rdev_get_drvdata(dev);
int vsel;
@@ -128,7 +129,7 @@ static int tps62360_dcdc_get_voltage(struct regulator_dev *dev)
return ret;
}
vsel = (int)data & tps->voltage_reg_mask;
- return (tps->voltage_base + vsel * 10) * 1000;
+ return vsel;
}
static int tps62360_dcdc_set_voltage(struct regulator_dev *dev,
@@ -193,10 +194,28 @@ static int tps62360_dcdc_list_voltage(struct regulator_dev *dev,
return (tps->voltage_base + selector * 10) * 1000;
}
+static int tps62360_set_voltage_time_sel(struct regulator_dev *rdev,
+ unsigned int old_selector, unsigned int new_selector)
+{
+ struct tps62360_chip *tps = rdev_get_drvdata(rdev);
+ int old_uV, new_uV;
+
+ old_uV = tps62360_dcdc_list_voltage(rdev, old_selector);
+ if (old_uV < 0)
+ return old_uV;
+
+ new_uV = tps62360_dcdc_list_voltage(rdev, new_selector);
+ if (new_uV < 0)
+ return new_uV;
+
+ return DIV_ROUND_UP(abs(old_uV - new_uV), tps->change_uv_per_us);
+}
+
static struct regulator_ops tps62360_dcdc_ops = {
- .get_voltage = tps62360_dcdc_get_voltage,
- .set_voltage = tps62360_dcdc_set_voltage,
- .list_voltage = tps62360_dcdc_list_voltage,
+ .get_voltage_sel = tps62360_dcdc_get_voltage_sel,
+ .set_voltage = tps62360_dcdc_set_voltage,
+ .list_voltage = tps62360_dcdc_list_voltage,
+ .set_voltage_time_sel = tps62360_set_voltage_time_sel,
};
static int tps62360_init_force_pwm(struct tps62360_chip *tps,
@@ -228,6 +247,7 @@ static int tps62360_init_dcdc(struct tps62360_chip *tps,
{
int ret;
int i;
+ unsigned int ramp_ctrl;
/* Initailize internal pull up/down control */
if (tps->en_internal_pulldn)
@@ -255,9 +275,23 @@ static int tps62360_init_dcdc(struct tps62360_chip *tps,
/* Reset output discharge path to reduce power consumption */
ret = regmap_update_bits(tps->regmap, REG_RAMPCTRL, BIT(2), 0);
- if (ret < 0)
+ if (ret < 0) {
dev_err(tps->dev, "%s() fails in updating reg %d\n",
__func__, REG_RAMPCTRL);
+ return ret;
+ }
+
+ /* Get ramp value from ramp control register */
+ ret = regmap_read(tps->regmap, REG_RAMPCTRL, &ramp_ctrl);
+ if (ret < 0) {
+ dev_err(tps->dev, "%s() fails in reading reg %d\n",
+ __func__, REG_RAMPCTRL);
+ return ret;
+ }
+ ramp_ctrl = (ramp_ctrl >> 4) & 0x7;
+
+ /* ramp mV/us = 32/(2^ramp_ctrl) */
+ tps->change_uv_per_us = DIV_ROUND_UP(32000, BIT(ramp_ctrl));
return ret;
}
--
1.7.1.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2 1/2] regulator: tps62360: enable register cache
2012-05-07 12:38 ` [PATCH v2 1/2] regulator: tps62360: enable register cache Laxman Dewangan
@ 2012-05-07 14:24 ` Mark Brown
2012-05-07 14:37 ` Laxman Dewangan
0 siblings, 1 reply; 5+ messages in thread
From: Mark Brown @ 2012-05-07 14:24 UTC (permalink / raw)
To: Laxman Dewangan; +Cc: lrg, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 233 bytes --]
On Mon, May 07, 2012 at 06:08:25PM +0530, Laxman Dewangan wrote:
> Enable cache of device register using regmap cache RBTREE.
Applied both, thanks.
> Just resending as part of this series.
You did fix the thing with the defaults.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2 1/2] regulator: tps62360: enable register cache
2012-05-07 14:24 ` Mark Brown
@ 2012-05-07 14:37 ` Laxman Dewangan
0 siblings, 0 replies; 5+ messages in thread
From: Laxman Dewangan @ 2012-05-07 14:37 UTC (permalink / raw)
To: Mark Brown; +Cc: lrg@ti.com, linux-kernel@vger.kernel.org
On Monday 07 May 2012 07:54 PM, Mark Brown wrote:
> * PGP Signed by an unknown key
>
> On Mon, May 07, 2012 at 06:08:25PM +0530, Laxman Dewangan wrote:
>> Enable cache of device register using regmap cache RBTREE.
> Applied both, thanks.
>
Thanks for taking care.
>> Just resending as part of this series.
> You did fix the thing with the defaults.
Oops, I really forgot this change after doing test as more concentration
on removing dependency.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-05-07 14:40 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-07 12:38 [PATCH v2 0/2] regulator: tps62360: add cache support and settling time Laxman Dewangan
2012-05-07 12:38 ` [PATCH v2 1/2] regulator: tps62360: enable register cache Laxman Dewangan
2012-05-07 14:24 ` Mark Brown
2012-05-07 14:37 ` Laxman Dewangan
2012-05-07 12:38 ` [PATCH v2 2/2] regulator: tps62360: Provide settling time for voltage change Laxman Dewangan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox