* [PATCH v2 1/2] regulator: as3722: Fix equation to calculate max_uV in regulator_lin_range macro
@ 2013-10-02 12:47 Axel Lin
2013-10-02 12:49 ` [PATCH v2 2/2] regulator: as3722: Fix off-by-one n_voltages setting for SDx Axel Lin
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Axel Lin @ 2013-10-02 12:47 UTC (permalink / raw)
To: Mark Brown; +Cc: Laxman Dewangan, Florian Lobmaier, Liam Girdwood, linux-kernel
Fix off-by-one in the equation to calculate max_uV and also adjust the _min_uV
setting accordingly.
For LDOs:
The voltage select bits set the LDO output voltage 0.825V...3.3V, 25mV steps
....00h : LDO off
01h-24h : V_LDO4 = 0.8V + ldo4_vsel * 25mV
= 0.825V + (ldo4_vsel - 1h) * 25mV
25h-3Fh : do not use
40h-7Fh : V_LDO4 = 1.725V + (ldo4_vsel - 40h) * 25mV
For SD2345:
The voltage select bits set the DC/DC output voltage level and power the DC/DC
converter down.
....00h : DC/DC powered down
01h-40h : V_SD2 = 0.6V + sd2_vsel * 12.5mV
= 0.6125V + (sd2_vsel - 1h) * 12.5mV
41h-70h : V_SD2 = 1.4V + (sd2_vsel - 40h) * 25mV
= 1.425V + (sd2_vsel - 41h) * 25mV
71h-7Fh : V_SD2 = 2.6V + (sd2_vsel - 70h) * 50mV
= 2.65V + (sd2_vsel - 71h) * 50mV
Note, the third entry in as3722_sd2345_ranges is wrong in current code.
Fix it based on the datasheet.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
drivers/regulator/as3722-regulator.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/regulator/as3722-regulator.c b/drivers/regulator/as3722-regulator.c
index 16a5d26..01a8b17 100644
--- a/drivers/regulator/as3722-regulator.c
+++ b/drivers/regulator/as3722-regulator.c
@@ -441,11 +441,11 @@ static struct regulator_ops as3722_ldo3_extcntrl_ops = {
.max_sel = _max_sel, \
.uV_step = _step_uV, \
.min_uV = _min_uV, \
- .max_uV = _min_uV + (_max_sel - _min_sel + 1) * _step_uV, \
+ .max_uV = _min_uV + (_max_sel - _min_sel) * _step_uV, \
}
static const struct regulator_linear_range as3722_ldo_ranges[] = {
- regulator_lin_range(0x01, 0x24, 800000, 25000),
+ regulator_lin_range(0x01, 0x24, 825000, 25000),
regulator_lin_range(0x40, 0x7F, 1725000, 25000),
};
@@ -605,9 +605,9 @@ static int as3722_sd016_set_current_limit(struct regulator_dev *rdev,
}
static const struct regulator_linear_range as3722_sd2345_ranges[] = {
- regulator_lin_range(0x01, 0x40, 600000, 12500),
- regulator_lin_range(0x41, 0x70, 1400000, 25000),
- regulator_lin_range(0x71, 0x7F, 1725000, 50000),
+ regulator_lin_range(0x01, 0x40, 612500, 12500),
+ regulator_lin_range(0x41, 0x70, 1425000, 25000),
+ regulator_lin_range(0x71, 0x7F, 2650000, 50000),
};
static struct regulator_ops as3722_sd016_ops = {
--
1.8.1.2
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH v2 2/2] regulator: as3722: Fix off-by-one n_voltages setting for SDx 2013-10-02 12:47 [PATCH v2 1/2] regulator: as3722: Fix equation to calculate max_uV in regulator_lin_range macro Axel Lin @ 2013-10-02 12:49 ` Axel Lin 2013-10-03 12:31 ` [PATCH v2 1/2] regulator: as3722: Fix equation to calculate max_uV in regulator_lin_range macro Laxman Dewangan 2013-10-03 15:50 ` Mark Brown 2 siblings, 0 replies; 4+ messages in thread From: Axel Lin @ 2013-10-02 12:49 UTC (permalink / raw) To: Mark Brown; +Cc: Laxman Dewangan, Florian Lobmaier, Liam Girdwood, linux-kernel AS3722_SDx_VSEL_MAX means the maximum selecter, the n_voltages should be AS3722_SDx_VSEL_MAX + 1. Signed-off-by: Axel Lin <axel.lin@ingics.com> Acked-by: Laxman Dewangan <ldewangan@nvidia.com> --- v2: no code change, add Laxman's Ack. drivers/regulator/as3722-regulator.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/regulator/as3722-regulator.c b/drivers/regulator/as3722-regulator.c index 01a8b17..d7b71a9 100644 --- a/drivers/regulator/as3722-regulator.c +++ b/drivers/regulator/as3722-regulator.c @@ -99,7 +99,7 @@ static const struct as3722_register_mapping as3722_reg_lookup[] = { .sleep_ctrl_mask = AS3722_SD0_EXT_ENABLE_MASK, .control_reg = AS3722_SD0_CONTROL_REG, .mode_mask = AS3722_SD0_MODE_FAST, - .n_voltages = AS3722_SD0_VSEL_MAX, + .n_voltages = AS3722_SD0_VSEL_MAX + 1, }, { .regulator_id = AS3722_REGULATOR_ID_SD1, @@ -112,7 +112,7 @@ static const struct as3722_register_mapping as3722_reg_lookup[] = { .sleep_ctrl_mask = AS3722_SD1_EXT_ENABLE_MASK, .control_reg = AS3722_SD1_CONTROL_REG, .mode_mask = AS3722_SD1_MODE_FAST, - .n_voltages = AS3722_SD0_VSEL_MAX, + .n_voltages = AS3722_SD0_VSEL_MAX + 1, }, { .regulator_id = AS3722_REGULATOR_ID_SD2, @@ -126,7 +126,7 @@ static const struct as3722_register_mapping as3722_reg_lookup[] = { .sleep_ctrl_mask = AS3722_SD2_EXT_ENABLE_MASK, .control_reg = AS3722_SD23_CONTROL_REG, .mode_mask = AS3722_SD2_MODE_FAST, - .n_voltages = AS3722_SD2_VSEL_MAX, + .n_voltages = AS3722_SD2_VSEL_MAX + 1, }, { .regulator_id = AS3722_REGULATOR_ID_SD3, @@ -140,7 +140,7 @@ static const struct as3722_register_mapping as3722_reg_lookup[] = { .sleep_ctrl_mask = AS3722_SD3_EXT_ENABLE_MASK, .control_reg = AS3722_SD23_CONTROL_REG, .mode_mask = AS3722_SD3_MODE_FAST, - .n_voltages = AS3722_SD2_VSEL_MAX, + .n_voltages = AS3722_SD2_VSEL_MAX + 1, }, { .regulator_id = AS3722_REGULATOR_ID_SD4, @@ -154,7 +154,7 @@ static const struct as3722_register_mapping as3722_reg_lookup[] = { .sleep_ctrl_mask = AS3722_SD4_EXT_ENABLE_MASK, .control_reg = AS3722_SD4_CONTROL_REG, .mode_mask = AS3722_SD4_MODE_FAST, - .n_voltages = AS3722_SD2_VSEL_MAX, + .n_voltages = AS3722_SD2_VSEL_MAX + 1, }, { .regulator_id = AS3722_REGULATOR_ID_SD5, @@ -168,7 +168,7 @@ static const struct as3722_register_mapping as3722_reg_lookup[] = { .sleep_ctrl_mask = AS3722_SD5_EXT_ENABLE_MASK, .control_reg = AS3722_SD5_CONTROL_REG, .mode_mask = AS3722_SD5_MODE_FAST, - .n_voltages = AS3722_SD2_VSEL_MAX, + .n_voltages = AS3722_SD2_VSEL_MAX + 1, }, { .regulator_id = AS3722_REGULATOR_ID_SD6, @@ -181,7 +181,7 @@ static const struct as3722_register_mapping as3722_reg_lookup[] = { .sleep_ctrl_mask = AS3722_SD6_EXT_ENABLE_MASK, .control_reg = AS3722_SD6_CONTROL_REG, .mode_mask = AS3722_SD6_MODE_FAST, - .n_voltages = AS3722_SD0_VSEL_MAX, + .n_voltages = AS3722_SD0_VSEL_MAX + 1, }, { .regulator_id = AS3722_REGULATOR_ID_LDO0, -- 1.8.1.2 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2 1/2] regulator: as3722: Fix equation to calculate max_uV in regulator_lin_range macro 2013-10-02 12:47 [PATCH v2 1/2] regulator: as3722: Fix equation to calculate max_uV in regulator_lin_range macro Axel Lin 2013-10-02 12:49 ` [PATCH v2 2/2] regulator: as3722: Fix off-by-one n_voltages setting for SDx Axel Lin @ 2013-10-03 12:31 ` Laxman Dewangan 2013-10-03 15:50 ` Mark Brown 2 siblings, 0 replies; 4+ messages in thread From: Laxman Dewangan @ 2013-10-03 12:31 UTC (permalink / raw) To: Axel Lin Cc: Mark Brown, Florian Lobmaier, Liam Girdwood, linux-kernel@vger.kernel.org On Wednesday 02 October 2013 06:17 PM, Axel Lin wrote: > Fix off-by-one in the equation to calculate max_uV and also adjust the _min_uV > setting accordingly. > > For LDOs: > The voltage select bits set the LDO output voltage 0.825V...3.3V, 25mV steps > ....00h : LDO off > 01h-24h : V_LDO4 = 0.8V + ldo4_vsel * 25mV > = 0.825V + (ldo4_vsel - 1h) * 25mV > 25h-3Fh : do not use > 40h-7Fh : V_LDO4 = 1.725V + (ldo4_vsel - 40h) * 25mV > > For SD2345: > The voltage select bits set the DC/DC output voltage level and power the DC/DC > converter down. > ....00h : DC/DC powered down > 01h-40h : V_SD2 = 0.6V + sd2_vsel * 12.5mV > = 0.6125V + (sd2_vsel - 1h) * 12.5mV > 41h-70h : V_SD2 = 1.4V + (sd2_vsel - 40h) * 25mV > = 1.425V + (sd2_vsel - 41h) * 25mV > 71h-7Fh : V_SD2 = 2.6V + (sd2_vsel - 70h) * 50mV > = 2.65V + (sd2_vsel - 71h) * 50mV > > Note, the third entry in as3722_sd2345_ranges is wrong in current code. > Fix it based on the datasheet. > > Signed-off-by: Axel Lin <axel.lin@ingics.com> Acked-by: Laxman Dewangan <ldewangan@nvidia.com> ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2 1/2] regulator: as3722: Fix equation to calculate max_uV in regulator_lin_range macro 2013-10-02 12:47 [PATCH v2 1/2] regulator: as3722: Fix equation to calculate max_uV in regulator_lin_range macro Axel Lin 2013-10-02 12:49 ` [PATCH v2 2/2] regulator: as3722: Fix off-by-one n_voltages setting for SDx Axel Lin 2013-10-03 12:31 ` [PATCH v2 1/2] regulator: as3722: Fix equation to calculate max_uV in regulator_lin_range macro Laxman Dewangan @ 2013-10-03 15:50 ` Mark Brown 2 siblings, 0 replies; 4+ messages in thread From: Mark Brown @ 2013-10-03 15:50 UTC (permalink / raw) To: Axel Lin; +Cc: Laxman Dewangan, Florian Lobmaier, Liam Girdwood, linux-kernel [-- Attachment #1: Type: text/plain, Size: 185 bytes --] On Wed, Oct 02, 2013 at 08:47:56PM +0800, Axel Lin wrote: > Fix off-by-one in the equation to calculate max_uV and also adjust the _min_uV > setting accordingly. Applied both, thanks. [-- Attachment #2: Digital signature --] [-- Type: application/pgp-signature, Size: 836 bytes --] ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-10-03 15:50 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2013-10-02 12:47 [PATCH v2 1/2] regulator: as3722: Fix equation to calculate max_uV in regulator_lin_range macro Axel Lin 2013-10-02 12:49 ` [PATCH v2 2/2] regulator: as3722: Fix off-by-one n_voltages setting for SDx Axel Lin 2013-10-03 12:31 ` [PATCH v2 1/2] regulator: as3722: Fix equation to calculate max_uV in regulator_lin_range macro Laxman Dewangan 2013-10-03 15:50 ` Mark Brown
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox