From: Mark Brown <broonie@opensource.wolfsonmicro.com>
To: AnilKumar Ch <anilkumar@ti.com>
Cc: sameo@linux.intel.com, lrg@ti.com, linux-kernel@vger.kernel.org,
linux-omap@vger.kernel.org, nsekhar@ti.com
Subject: Re: [PATCH V2 2/2] TPS65217: Add tps65217 regulator driver
Date: Mon, 2 Jan 2012 13:16:48 +0000 [thread overview]
Message-ID: <20120102131648.GJ4300@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <1325508522-23217-1-git-send-email-anilkumar@ti.com>
On Mon, Jan 02, 2012 at 06:18:42PM +0530, AnilKumar Ch wrote:
> This patch adds tps65217 PMIC as a regulator
Use subject lines appropriate for the subsystem you're submitting
against.
> +config REGULATOR_TPS65217
> + tristate "TI TPS65217 Power regulators"
> + depends on (I2C && MFD_TPS65217)
Should only depend on the MFD, there's no direct I2C usage.
> +static unsigned int tps65217_vsel_to_uv_range0(unsigned int vsel)
> +{
> + unsigned int uV = 0;
> +
> + if (vsel <= 24)
> + uV = ((vsel * 25000) + 900000);
> + else if (vsel > 24 && vsel <= 52)
> + uV = (((vsel - 24) * 50000) + 1500000);
> + else if (vsel > 52 && vsel <= 56)
> + uV = (((vsel - 52) * 100000) + 2900000);
No need for the > checks as this is already taken care of by being in
the else clause.
> +static unsigned int tps65217_vsel_to_uv_range2(unsigned int vsel)
> +{
> + unsigned int uV = 0;
> +
> + if (vsel <= 8)
> + uV = ((vsel * 50000) + 1500000);
> + else if (vsel > 9 && vsel <= 13)
> + uV = (((vsel - 8) * 100000) + 1900000);
> + else if (vsel > 13)
> + uV = (((vsel - 13) * 50000) + 2400000);
> +
> + return uV;
In all of these functions there ought to be a check to make sure vsel
isn't out of range and return an error if it is.
> +static int tps65217_pmic_set_bits(struct tps65217 *tps, unsigned int reg,
> + unsigned int mask, unsigned int val, unsigned int level)
> +{
To repeat what I said when reviewing the previous version of the patch
things like this shouldn't be open coded in individual function drivers,
they should be in the MFD driver. There is *nothing* PMIC specific
about register access.
I've stopped reading at this point.
next prev parent reply other threads:[~2012-01-02 13:16 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-02 12:48 [PATCH V2 2/2] TPS65217: Add tps65217 regulator driver AnilKumar Ch
2012-01-02 13:16 ` Mark Brown [this message]
2012-01-03 6:16 ` AnilKumar, Chimata
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=20120102131648.GJ4300@opensource.wolfsonmicro.com \
--to=broonie@opensource.wolfsonmicro.com \
--cc=anilkumar@ti.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=lrg@ti.com \
--cc=nsekhar@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