From: Mark Brown <broonie@kernel.org>
To: Laxman Dewangan <ldewangan@nvidia.com>
Cc: lee.jones@linaro.org, sameo@linux.intel.com,
linus.walleij@linaro.org, akpm@linux-foundation.org,
devicetree@vger.kernel.org, linux-doc@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org,
rtc-linux@googlegroups.com, rob.herring@calxeda.com,
mark.rutland@arm.com, pawel.moll@arm.com, swarren@wwwdotorg.org,
rob@landley.net, ijc+devicetree@hellion.org.uk,
grant.likely@linaro.org, florian.lobmaier@ams.com
Subject: Re: [PATCH 3/4] regulator: as3722: add regulator driver for AMS AS3722
Date: Tue, 17 Sep 2013 12:41:33 +0100 [thread overview]
Message-ID: <20130917114133.GV21013@sirena.org.uk> (raw)
In-Reply-To: <1379400338-20704-4-git-send-email-ldewangan@nvidia.com>
[-- Attachment #1: Type: text/plain, Size: 2860 bytes --]
On Tue, Sep 17, 2013 at 12:15:37PM +0530, Laxman Dewangan wrote:
> + ams,enable-oc-config: Enable overcurrent configuration of the
> + ams,oc-trip-threshold-perphase: Overcurrent trip threshold
> + ams,oc-alarm-threshold-perphase: Overcurrent alarm threshold
These look like you should be implementing the current setting
operations in the framework, probably mapping to the alarm limit if
nothing else.
> +static int as3722_ldo_get_voltage_sel(struct regulator_dev *rdev)
> +{
> + int ret;
> +
> + ret = regulator_get_voltage_sel_regmap(rdev);
> + if (ret >= 0x40)
> + ret -= 0x1B;
> + return ret;
> +}
This looks very strange. What's going on here? A gap in the selectors?
If that's the case you probably want to be using linear ranges.
> +static struct regulator_ops as3722_ldo_extcntrl_ops = {
> + .get_voltage_sel = as3722_ldo_get_voltage_sel,
> + .set_voltage_sel = as3722_ldo_set_voltage_sel,
> + .list_voltage = regulator_list_voltage_linear,
> +};
You ought to be providing map_voltage() too, same for some if not all of
the other regulators.
> +static unsigned int as3722_sd_get_mode(struct regulator_dev *dev)
> +{
> + struct as3722_regulators *as3722_regs = rdev_get_drvdata(dev);
> + struct as3722 *as3722 = as3722_regs->as3722;
> + int id = rdev_get_id(dev);
> + u32 val;
> + int ret;
> +
> + if (!as3722_reg_lookup[id].control_reg)
> + return -ERANGE;
That seems a bit of a random error code. -ENOTSUPP?
> +static int as3722_sd_list_voltage(struct regulator_dev *rdev, unsigned selector)
> +{
> + if (selector >= AS3722_SD2_VSEL_MAX)
> + return -EINVAL;
> +
> + selector++;
> + if (selector <= 0x40)
> + return 600000 + selector * 12500;
> + if (selector <= 0x70)
> + return 1400000 + (selector - 0x40) * 25000;
> + if (selector <= 0x7F)
> + return 2600000 + (selector - 0x70) * 50000;
> + return -EINVAL;
> +}
Use linear ranges.
> +static struct of_regulator_match as3722_regulator_matches[] = {
> + {.name = "sd0", },
{ .name = "sd0", },
> + config.of_node = as3722_regulator_matches[id].of_node;
> + rdev = regulator_register(&as3722_regs->desc[id], &config);
> + if (IS_ERR(rdev)) {
devm_regualtor_register().
> + if (reg_config->ext_control) {
> + ret = regulator_enable_regmap(rdev);
> + if (ret < 0) {
> + dev_err(&pdev->dev,
> + "Regulator %d enable failed: %d\n",
> + id, ret);
> + goto scrub;
> + }
This looks wrong... why is the regualtor being enabled by something
other than the core?
> +static int __init as3722_regulator_init(void)
> +{
> + return platform_driver_register(&as3722_regulator_driver);
> +}
> +subsys_initcall(as3722_regulator_init);
> +
> +static void __exit as3722_regulator_exit(void)
> +{
> + platform_driver_unregister(&as3722_regulator_driver);
> +}
> +module_exit(as3722_regulator_exit);
module_platform_driver().
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
next prev parent reply other threads:[~2013-09-17 11:41 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-17 6:45 [PATCH 0/4] Add AMS AS3722 mfd, GPIO, regulator and RTC driver Laxman Dewangan
2013-09-17 6:45 ` [PATCH 1/4] mfd: add support for AMS AS3722 PMIC Laxman Dewangan
2013-09-17 8:02 ` Lee Jones
2013-09-17 11:24 ` Mark Brown
2013-09-17 12:03 ` Laxman Dewangan
2013-09-17 12:22 ` Laxman Dewangan
2013-09-23 16:45 ` Stephen Warren
2013-09-17 6:45 ` [PATCH 2/4] gpio: add support for AMS AS3722 gpio driver Laxman Dewangan
2013-09-23 16:53 ` Stephen Warren
2013-09-17 6:45 ` [PATCH 3/4] regulator: as3722: add regulator driver for AMS AS3722 Laxman Dewangan
2013-09-17 11:41 ` Mark Brown [this message]
2013-09-17 12:15 ` Laxman Dewangan
2013-09-23 16:58 ` Stephen Warren
2013-09-17 6:45 ` [PATCH 4/4] drivers/rtc/rtc-as3722: add RTC driver Laxman Dewangan
2013-09-17 11:43 ` 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=20130917114133.GV21013@sirena.org.uk \
--to=broonie@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=devicetree@vger.kernel.org \
--cc=florian.lobmaier@ams.com \
--cc=grant.likely@linaro.org \
--cc=ijc+devicetree@hellion.org.uk \
--cc=ldewangan@nvidia.com \
--cc=lee.jones@linaro.org \
--cc=linus.walleij@linaro.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=pawel.moll@arm.com \
--cc=rob.herring@calxeda.com \
--cc=rob@landley.net \
--cc=rtc-linux@googlegroups.com \
--cc=sameo@linux.intel.com \
--cc=swarren@wwwdotorg.org \
/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
all inboxes | Powered by JetHome®