From: Mark Brown <broonie@opensource.wolfsonmicro.com>
To: "Heiko Stübner" <heiko@sntech.de>
Cc: linux-pm@lists.linux-foundation.org, Liam Girdwood <lrg@ti.com>
Subject: Re: [PATCH] Add regulator driver for the bq2407x family of charger ICs
Date: Tue, 23 Aug 2011 12:50:24 +0100 [thread overview]
Message-ID: <20110823115024.GL9232@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <201108202224.52250.heiko@sntech.de>
On Sat, Aug 20, 2011 at 10:24:51PM +0200, Heiko Stübner wrote:
Mostly looks good, just a few fairly small comments below.
> + if (pdata->max_uA && pdata->max_uA > 500000
> + && max_uA >= pdata->max_uA) {
> + dev_dbg(rdev_get_dev(rdev),
> + "setting current limit to %d mA\n",
> + pdata->max_uA / 1000);
> + gpio_set_value(pdata->gpio_en2, 1);
> + gpio_set_value(pdata->gpio_en1, 0);
> + } else if (max_uA >= 500000) {
> + dev_dbg(rdev_get_dev(rdev),
> + "setting current limit to 500 mA\n");
> + gpio_set_value(pdata->gpio_en2, 0);
> + gpio_set_value(pdata->gpio_en1, 1);
> + } else if (max_uA >= 100000) {
> + dev_dbg(rdev_get_dev(rdev),
> + "setting current limit to 100 mA\n");
> + gpio_set_value(pdata->gpio_en2, 0);
> + gpio_set_value(pdata->gpio_en1, 0);
> + } else {
> + dev_dbg(rdev_get_dev(rdev),
> + "setting current limit to 0 mA\n");
> + gpio_set_value(pdata->gpio_en2, 1);
> + gpio_set_value(pdata->gpio_en1, 1);
> + }
I'd rather expect this to return an error sometimes.
> +static int bq2407x_get_current_limit(struct regulator_dev *rdev)
> +{
> + struct bq2407x_mach_info *pdata = rdev_get_drvdata(rdev);
> +
> + int en2 = gpio_get_value(pdata->gpio_en2);
> + int en1 = gpio_get_value(pdata->gpio_en1);
Calling gpio_get_value() on an output GPIO is undefined, you need to
remember what values you set.
> +static int bq2407x_enable(struct regulator_dev *rdev)
> +{
> + struct bq2407x_mach_info *pdata = rdev_get_drvdata(rdev);
> +
> + dev_dbg(rdev_get_dev(rdev), "enabling charger\n");
> +
> + gpio_set_value(pdata->gpio_nce, 0);
> + return 0;
Blank line here.
next prev parent reply other threads:[~2011-08-23 11:50 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-20 20:24 [PATCH] Add regulator driver for the bq2407x family of charger ICs Heiko Stübner
2011-08-23 11:50 ` Mark Brown [this message]
2011-08-23 20:15 ` Heiko Stübner
2011-08-24 9:07 ` Mark Brown
2011-08-24 18:48 ` [PATCH v2] " Heiko Stübner
2011-08-25 6:55 ` MyungJoo Ham
2011-08-25 8:51 ` Heiko Stübner
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=20110823115024.GL9232@opensource.wolfsonmicro.com \
--to=broonie@opensource.wolfsonmicro.com \
--cc=heiko@sntech.de \
--cc=linux-pm@lists.linux-foundation.org \
--cc=lrg@ti.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).