From: Axel Lin <axel.lin@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: Sangbeom Kim <sbkim73@samsung.com>, Liam Girdwood <lrg@ti.com>,
Mark Brown <broonie@opensource.wolfsonmicro.com>
Subject: [PATCH RFC] regulator: Fix the logic of s5m8767_set_voltage_time_sel
Date: Fri, 24 Feb 2012 14:52:45 +0800 [thread overview]
Message-ID: <1330066365.21167.1.camel@phoenix> (raw)
This patch includes below fixes:
1. The mask variable is not used at all here, remove it.
2. We already have the new_sel and old_sel, simply returns the delay by:
DIV_ROUND_UP(desc->step * (new_sel - old_sel), s5m8767->ramp_delay);
Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
Hi Sangbeom,
I don't have this hardware, I'd appreciate if you can review and test this patch.
The fix of the logic is base on the original post of the patch(v2):
https://lkml.org/lkml/2011/12/24/31
I think the implementation got wrong when converting to
s5m8767_set_voltage_time_sel.
Axel
drivers/regulator/s5m8767.c | 30 ++----------------------------
1 files changed, 2 insertions(+), 28 deletions(-)
diff --git a/drivers/regulator/s5m8767.c b/drivers/regulator/s5m8767.c
index 2fb2add..9b97aa3 100644
--- a/drivers/regulator/s5m8767.c
+++ b/drivers/regulator/s5m8767.c
@@ -452,39 +452,13 @@ static int s5m8767_set_voltage_time_sel(struct regulator_dev *rdev,
struct s5m8767_info *s5m8767 = rdev_get_drvdata(rdev);
const struct s5m_voltage_desc *desc;
int reg_id = rdev_get_id(rdev);
- int mask;
- int new_val, old_val;
- switch (reg_id) {
- case S5M8767_LDO1 ... S5M8767_LDO28:
- mask = 0x3f;
- break;
- case S5M8767_BUCK1 ... S5M8767_BUCK6:
- mask = 0xff;
- break;
- case S5M8767_BUCK7 ... S5M8767_BUCK8:
- return -EINVAL;
- case S5M8767_BUCK9:
- mask = 0xff;
- break;
- default:
- return -EINVAL;
- }
desc = reg_voltage_map[reg_id];
- new_val = s5m8767_convert_voltage(desc, new_sel, new_sel);
- if (new_val < 0)
- return new_val;
-
- old_val = s5m8767_convert_voltage(desc, old_sel, old_sel);
- if (old_val < 0)
- return old_val;
-
if (old_sel < new_sel)
- return DIV_ROUND_UP(desc->step * (new_val - old_val),
+ return DIV_ROUND_UP(desc->step * (new_sel - old_sel),
s5m8767->ramp_delay);
- else
- return 0;
+ return 0;
}
static struct regulator_ops s5m8767_ldo_ops = {
--
1.7.5.4
next reply other threads:[~2012-02-24 6:52 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-24 6:52 Axel Lin [this message]
2012-02-29 23:22 ` [PATCH RFC] regulator: Fix the logic of s5m8767_set_voltage_time_sel 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=1330066365.21167.1.camel@phoenix \
--to=axel.lin@gmail.com \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lrg@ti.com \
--cc=sbkim73@samsung.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).