From: Mark Brown <broonie@kernel.org>
To: Keerthy <j-keerthy@ti.com>
Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
sameo@linux.intel.com, lee.jones@linaro.org,
grant.likely@linaro.org, robh+dt@kernel.org, lgirdwood@gmail.com
Subject: Re: [PATCH 2/2] Regulators: TPS65917: Add Regulator driver for TPS65917 PMIC
Date: Mon, 28 Apr 2014 10:03:45 +0100 [thread overview]
Message-ID: <20140428090345.GD15125@sirena.org.uk> (raw)
In-Reply-To: <1398662906-4398-3-git-send-email-j-keerthy@ti.com>
[-- Attachment #1: Type: text/plain, Size: 1876 bytes --]
On Mon, Apr 28, 2014 at 10:58:26AM +0530, Keerthy wrote:
> index 6a79328..5ddb220 100644
> --- a/drivers/regulator/Kconfig
> +++ b/drivers/regulator/Kconfig
> @@ -384,6 +384,18 @@ config REGULATOR_PALMAS
> on the muxing. This is handled automatically in the driver by
> reading the mux info from OTP.
>
> +config REGULATOR_TPS65917
> + tristate "TI TPS65917 PMIC Regulators"
> + depends on MFD_TPS65917
Please keep the Kconfig and Makefile sorted.
> +static const struct regs_info tps65917_regs_info[] = {
> + {
> + .name = "SMPS1",
> + .sname = "smps1-in",
> + .vsel_addr = TPS65917_SMPS1_VOLTAGE,
> + .ctrl_addr = TPS65917_SMPS1_CTRL,
> + .sleep_id = TPS65917_EXTERNAL_REQSTR_ID_SMPS1,
> + },
> +static int tps65917_is_enabled_smps(struct regulator_dev *dev)
> +{
> + struct tps65917_pmic *pmic = rdev_get_drvdata(dev);
> + int id = rdev_get_id(dev);
> + unsigned int reg;
> +
> + tps65917_smps_read(pmic->tps65917,
> + tps65917_regs_info[id].ctrl_addr, ®);
> +
> + reg &= TPS65917_SMPS1_CTRL_STATUS_MASK;
> + reg >>= TPS65917_SMPS1_CTRL_STATUS_SHIFT;
> +
> + return !!(reg);
> +}
A lot of these functions look like they could be implemented using the
standard helpers rather than open coded - the helpers now support
multi-bit enable fields.
> + if (selector == 0)
> + return 0;
> + else if (selector < 6)
> + return 500000 * mult;
> + else
> + /* Voltage is linear mapping starting from selector 6,
> + * volt = (0.49V + ((selector - 5) * 0.01V)) * RANGE
> + * RANGE is either x1 or x2
> + */
> + return (490000 + ((selector - 5) * 10000)) * mult;
> +}
This looks like the driver could just use linear ranges.
> +static struct of_device_id of_tps65917_match_tbl[] = {
> + { .compatible = "ti,tps65917-pmic", },
> +};
Missing null entry at the end of the table here.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
prev parent reply other threads:[~2014-04-28 9:04 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-28 5:28 [PATCH 0/2] TPS65917: Drivers " Keerthy
2014-04-28 5:28 ` [PATCH 1/2] MFD: TPS65917: Add driver for the " Keerthy
2014-04-28 5:28 ` [PATCH 2/2] Regulators: TPS65917: Add Regulator driver for " Keerthy
2014-04-28 9:03 ` Mark Brown [this message]
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=20140428090345.GD15125@sirena.org.uk \
--to=broonie@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=grant.likely@linaro.org \
--cc=j-keerthy@ti.com \
--cc=lee.jones@linaro.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=robh+dt@kernel.org \
--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
Powered by JetHome