From: Mark Brown <broonie@opensource.wolfsonmicro.com>
To: Sundar Iyer <sundar.iyer@stericsson.com>
Cc: lrg@slimlogic.co.uk, sameo@linux.intel.com,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
STEricsson_nomadik_linux@list.st.com,
Linus Walleij <linus.walleij@stericsson.com>,
"Acked-By: Bengt JONSSON" <bengt.g.jonsson@stericsson.com>
Subject: Re: [PATCH 2/3] regulator: add support for regulators on the ab8500 MFD
Date: Tue, 13 Jul 2010 10:55:56 +0100 [thread overview]
Message-ID: <20100713095556.GB12686@rakim.wolfsonmicro.main> (raw)
In-Reply-To: <1279002090-11234-3-git-send-email-sundar.iyer@stericsson.com>
On Tue, Jul 13, 2010 at 11:51:29AM +0530, Sundar Iyer wrote:
> + * @mask: mask to enable/disable regulator
> + * @enable: enable bits to enable the regulator
Presumably these two will always be identical?
> + * @typical_voltages: typical supported voltage table
Why typical - might the set of supported values change, and if they do
how will that be detected and handled?
> + ret = ab8500_read(info->ab8500, info->update_reg);
> + if (ret < 0)
> + dev_dbg(rdev_get_dev(rdev),
> + "couldnt read 0x%x register\n", info->update_reg);
> +
> + if (ret & info->mask)
> + return true;
> + else
> + return false;
This should return the error code if the read failed.
> +static int ab8500_get_best_voltage_index(struct regulator_dev *rdev,
> + int min_uV, int max_uV)
> +{
> + struct ab8500_regulator_info *info = rdev_get_drvdata(rdev);
> + int i;
> +
> + /* check the supported voltage */
> + for (i = 0; i < info->voltages_len; i++) {
> + if ((info->typical_voltages[i] >= min_uV) &&
> + (info->typical_voltages[i] <= max_uV))
> + return i;
The indentation here is confusing - the second line of the if () is
aligned with the return statement not the first line.
> + /* get the appropriate voltages within the range */
> + ret = ab8500_get_best_voltage_index(rdev, min_uV, max_uV);
> + if (ret < 0) {
> + dev_dbg(rdev_get_dev(rdev),
> + "coudlnt get best voltage for regulator\n");
> + }
Should return an error here.
> + /* set the registers for the request */
> + ret = ab8500_set_bits(info->ab8500, info->voltage_reg,
> + info->voltage_mask, ret);
> + if (ret < 0) {
> + dev_dbg(rdev_get_dev(rdev),
> + "couldnt set voltage reg for regulator\n");
> + return -EINVAL;
Should return the error you got back from set_bits() to provide maximum
information to the caller (besides, this isn't an invalid value - it's
an I/O issue).
> +static int ab8500_fixed_get_voltage(struct regulator_dev *rdev)
> +{
> + int regulator_id;
> + struct ab8500_regulator_info *info = rdev_get_drvdata(rdev);
> +
> + regulator_id = rdev_get_id(rdev);
> + if (regulator_id >= AB8500_NUM_REGULATORS)
> + return -EINVAL;
> +
> + return info->fixed_uV;
> +}
> +
> +static struct regulator_ops ab8500_ldo_fixed_ops = {
> + .enable = ab8500_regulator_enable,
> + .disable = ab8500_regulator_disable,
> + .is_enabled = ab8500_regulator_is_enabled,
> + .get_voltage = ab8500_fixed_get_voltage,
> +};
Should have list_voltage() support also ideally.
next prev parent reply other threads:[~2010-07-13 9:55 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-13 6:21 [PATCH 0/3] ab8500-mfd: add regulator support Sundar Iyer
2010-07-13 6:21 ` [PATCH 1/3] ab8500-mfd: add regulator support to ab8500 mfd device Sundar Iyer
2010-07-13 9:49 ` Mark Brown
2010-07-14 10:13 ` Samuel Ortiz
2010-07-15 10:29 ` Liam Girdwood
2010-07-13 6:21 ` [PATCH 2/3] regulator: add support for regulators on the ab8500 MFD Sundar Iyer
2010-07-13 9:55 ` Mark Brown [this message]
2010-07-13 6:21 ` [PATCH 3/3] ux500: add ab8500-regulators machine specific data Sundar Iyer
2010-07-13 10:00 ` 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=20100713095556.GB12686@rakim.wolfsonmicro.main \
--to=broonie@opensource.wolfsonmicro.com \
--cc=STEricsson_nomadik_linux@list.st.com \
--cc=bengt.g.jonsson@stericsson.com \
--cc=linus.walleij@stericsson.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lrg@slimlogic.co.uk \
--cc=sameo@linux.intel.com \
--cc=sundar.iyer@stericsson.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
all inboxes | Powered by JetHome®