From: "T Krishnamoorthy, Balaji" <balajitk@ti.com>
To: Graeme Gregory <gg@slimlogic.co.uk>
Cc: linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org,
sameo@linux.intel.com, balbi@ti.com, lrg@slimlogic.co.uk,
broonie@opensource.wolfsonmicro.com, linux@slimlogic.co.uk,
lrg@ti.com
Subject: Re: [PATCH v3 1/2] REGULATOR: TWL6025: add support to twl-regulator
Date: Fri, 20 May 2011 20:19:21 +0530 [thread overview]
Message-ID: <BANLkTi=jccSDyG9R2pESN9XCwnViLh5tpg@mail.gmail.com> (raw)
In-Reply-To: <1305743570-12074-2-git-send-email-gg@slimlogic.co.uk>
On Thu, May 19, 2011 at 12:02 AM, Graeme Gregory <gg@slimlogic.co.uk> wrote:
> Adding support for the twl6025. Major difference in the twl6025 is the
> group functionality has been removed from the chip so this affects how
> regulators are enabled and disabled.
>
> The names of the regulators also changed.
>
> The DCDCs of the 6025 are software controllable as well.
>
> Since V1
>
> Use the features variable passed via platform data instead of calling
> global function.
>
> Change the very switch like if statements to be a more readable
> switch statement.
>
> Since V2
>
> twl6025 doesn't use remap so remove it from the macros.
>
> Signed-off-by: Graeme Gregory <gg@slimlogic.co.uk>
> ---
> drivers/regulator/twl-regulator.c | 410 +++++++++++++++++++++++++++++++++---
> 1 files changed, 375 insertions(+), 35 deletions(-)
>
<snip>
> +
> +static int twl6030dcdc_list_voltage(struct regulator_dev *rdev, unsigned index)
> +{
> + struct twlreg_info *info = rdev_get_drvdata(rdev);
> +
> + int voltage = 0;
> +
> + switch (info->flags) {
> + case 0:
> + switch (index) {
> + case 0:
> + voltage = 0;
> + break;
> + case 58:
Not sure if hex 0x3A is better here, TRM gives in binary though.
> + voltage = 1350 * 1000;
> + break;
> + case 59:
> + voltage = 1500 * 1000;
> + break;
> + case 60:
> + voltage = 1800 * 1000;
> + break;
> + case 61:
> + voltage = 1900 * 1000;
> + break;
> + case 62:
> + voltage = 2100 * 1000;
> + break;
> + default:
> + voltage = (600000 + (12500 * (index - 1)));
> + }
> + break;
> + case DCDC_OFFSET_EN:
> + switch (index) {
> + case 0:
> + voltage = 0;
> + break;
> + case 58:
> + voltage = 1350 * 1000;
> + break;
> + case 59:
> + voltage = 1500 * 1000;
> + break;
> + case 60:
> + voltage = 1800 * 1000;
> + break;
> + case 61:
> + voltage = 1900 * 1000;
> + break;
> + case 62:
> + voltage = 2100 * 1000;
> + break;
> + default:
> + voltage = (700000 + (12500 * (index - 1)));
Between DCDC_OFFSET_EN and case 0
700000 and 600000 is the only difference,
can it be handled via additional 100000 in case DCDC_OFFSET_EN?
like
+ case DCDC_OFFSET_EN:
voltage = 100000;
/* fall through */
+ case 0:
voltage += (600000 + (12500 * (index - 1)));
> + }
> + break;
> + case DCDC_EXTENDED_EN:
> + switch (index) {
> + case 0:
> + voltage = 0;
> + break;
> + case 58:
> + voltage = 2084 * 1000;
> + break;
> + case 59:
> + voltage = 2315 * 1000;
> + break;
> + case 60:
> + voltage = 2778 * 1000;
> + break;
> + case 61:
> + voltage = 2932 * 1000;
> + break;
> + case 62:
> + voltage = 3241 * 1000;
> + break;
> + default:
> + voltage = (1852000 + (38600 * (index - 1)));
> + }
> + break;
> + case DCDC_OFFSET_EN|DCDC_EXTENDED_EN:
space between |
> + switch (index) {
> +
> +static int
> +twl6030dcdc_set_voltage(struct regulator_dev *rdev, int min_uV, int max_uV,
> + unsigned int *selector)
> +{
> + struct twlreg_info *info = rdev_get_drvdata(rdev);
> + int vsel = 0;
> +
> + switch (info->flags) {
> + case 0:
> + if (min_uV == 0)
> + vsel = 0;
> + else if ((min_uV >= 600000) && (max_uV <= 1300000)) {
> + vsel = (min_uV - 600000) / 125;
> + if (vsel % 100)
> + vsel += 100;
> + vsel /= 100;
> + vsel++;
> + }
> + /* Values 1..57 for vsel are linear and can be calculated
> + * values 58..62 are non linear.
> + */
> + else if ((min_uV > 1900000) && (max_uV >= 2100000))
> + vsel = 62;
> + else if ((min_uV > 1800000) && (max_uV >= 1900000))
> + vsel = 61;
> + else if ((min_uV > 1500000) && (max_uV >= 1800000))
> + vsel = 60;
> + else if ((min_uV > 1350000) && (max_uV >= 1500000))
> + vsel = 59;
> + else if ((min_uV > 1300000) && (max_uV >= 1350000))
> + vsel = 58;
> + else
> + return -EINVAL;
> + break;
> + case DCDC_OFFSET_EN:
> + if (min_uV == 0)
> + vsel = 0;
> + else if ((min_uV >= 700000) && (max_uV <= 1420000)) {
> + vsel = (min_uV - 600000) / 125;
s/600000/700000 ?
> + if (vsel % 100)
> + vsel += 100;
> + vsel /= 100;
> + vsel++;
> + }
> +static struct regulator_ops twldcdc_ops = {
> + .list_voltage = twl6030dcdc_list_voltage,
> +
> + .set_voltage = twl6030dcdc_set_voltage,
> + .get_voltage_sel = twl6030dcdc_get_voltage_sel,
In 6030 TRM, dcdc is mentioned as SMPS
Is it different it in 6025 TRM?
next prev parent reply other threads:[~2011-05-20 14:49 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-18 18:32 [PATCH v3 0/2] Add support for twl6025 PMIC Graeme Gregory
2011-05-18 18:32 ` [PATCH v3 1/2] REGULATOR: TWL6025: add support to twl-regulator Graeme Gregory
2011-05-20 14:49 ` T Krishnamoorthy, Balaji [this message]
2011-05-22 7:05 ` Mark Brown
2011-05-18 18:32 ` [PATCH v3 2/2] USB: TWL6025 allow different regulator name Graeme Gregory
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='BANLkTi=jccSDyG9R2pESN9XCwnViLh5tpg@mail.gmail.com' \
--to=balajitk@ti.com \
--cc=balbi@ti.com \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=gg@slimlogic.co.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=linux@slimlogic.co.uk \
--cc=lrg@slimlogic.co.uk \
--cc=lrg@ti.com \
--cc=sameo@linux.intel.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).