From: Mark Brown <broonie-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
To: MyungJoo Ham <myungjoo.ham-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Liam Girdwood <lrg-kDsPt+C1G03kYMGBc/C6ZA@public.gmane.org>,
Samuel Ortiz <sameo-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>,
kyungmin.park-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org,
myungjoo.ham-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Subject: Re: [PATCH 2/2] MAX8997/8966 PMIC Regulator Driver Initial Release
Date: Fri, 21 Jan 2011 19:16:04 +0000 [thread overview]
Message-ID: <20110121191604.GK22414@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <1294988018-25100-3-git-send-email-myungjoo.ham-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
On Fri, Jan 14, 2011 at 03:53:38PM +0900, MyungJoo Ham wrote:
> This patch supports PMIC/Regulator part of MAX8997/MAX8966 MFD.
> In this initial release, selecting voltages or current-limit
> and switching on/off the regulators are supported.
Mostly good, a few stylistic things and this is out of date for the
current regulator API.
> +static int max8997_get_voltage(struct regulator_dev *rdev)
> +{
> + ret = max8997_list_voltage(rdev, val);
> + if (ret == -EINVAL) {
> + int ldo = max8997_get_ldo(rdev);
It'd probably be easier to just define separate get_voltage() and
list_voltage() functions for these regulators.
> +static int max8997_set_voltage_ldo(struct regulator_dev *rdev,
> + int min_uV, int max_uV)
This needs updating for the current API in -next (and 2.6.38).
> + if ((ldo > MAX8997_BUCK7 || ldo < MAX8997_LDO1) &&
> + ldo != MAX8997_CHARGER_CV &&
> + ldo != MAX8997_CHARGER &&
> + ldo != MAX8997_CHARGER_TOPOFF)
> + return -EINVAL;
> + if (ldo == MAX8997_BUCK6)
> + return -EINVAL;
A switch statement for the valid regulators might be clearer.
> +static int max8997_set_voltage_buck(struct regulator_dev *rdev,
> + int min_uV, int max_uV)
API update needed here too.
> +static int max8997_set_voltage_safeout(struct regulator_dev *rdev,
> + int min_uV, int max_uV)
> +{
Here also. Given that you've got a separate set_voltage() the comment
about a separate get_voltage() above seems even stronger.
> +static inline unsigned int max8997_buck_voltage(int uV)
> +{
> + int step;
> +
> + if (uV <= 650000)
> + return 0x0;
> + if (uV >= 2225000)
> + return 0x3f;
> +
> + step = uV - 650000;
> + step /= 25000;
> +
> + return step + 1;
> +}
Shouldn't this code be shared with set_voltage()? Or...
> + max8997_update_reg(i2c, MAX8997_REG_BUCK1DVS(i),
> + max8997_buck_voltage(pdata->buck1_voltage[i]),
> + 0x3f);
> + max8997_update_reg(i2c, MAX8997_REG_BUCK2DVS(i),
> + max8997_buck_voltage(pdata->buck2_voltage[i]),
> + 0x3f);
> + max8997_update_reg(i2c, MAX8997_REG_BUCK5DVS(i),
> + max8997_buck_voltage(pdata->buck5_voltage[i]),
> + 0x3f);
...just call your set_voltage() operation directly for these?
> + if (gpio_is_valid(pdata->buck125_gpios[0]) &&
> + gpio_is_valid(pdata->buck125_gpios[1]) &&
> + gpio_is_valid(pdata->buck125_gpios[2])) {
Strange indentation here.
WARNING: multiple messages have this Message-ID (diff)
From: Mark Brown <broonie@opensource.wolfsonmicro.com>
To: MyungJoo Ham <myungjoo.ham@samsung.com>
Cc: linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org,
Liam Girdwood <lrg@slimlogic.co.uk>,
Samuel Ortiz <sameo@linux.intel.com>,
kyungmin.park@samsung.com, myungjoo.ham@gmail.com
Subject: Re: [PATCH 2/2] MAX8997/8966 PMIC Regulator Driver Initial Release
Date: Fri, 21 Jan 2011 19:16:04 +0000 [thread overview]
Message-ID: <20110121191604.GK22414@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <1294988018-25100-3-git-send-email-myungjoo.ham@samsung.com>
On Fri, Jan 14, 2011 at 03:53:38PM +0900, MyungJoo Ham wrote:
> This patch supports PMIC/Regulator part of MAX8997/MAX8966 MFD.
> In this initial release, selecting voltages or current-limit
> and switching on/off the regulators are supported.
Mostly good, a few stylistic things and this is out of date for the
current regulator API.
> +static int max8997_get_voltage(struct regulator_dev *rdev)
> +{
> + ret = max8997_list_voltage(rdev, val);
> + if (ret == -EINVAL) {
> + int ldo = max8997_get_ldo(rdev);
It'd probably be easier to just define separate get_voltage() and
list_voltage() functions for these regulators.
> +static int max8997_set_voltage_ldo(struct regulator_dev *rdev,
> + int min_uV, int max_uV)
This needs updating for the current API in -next (and 2.6.38).
> + if ((ldo > MAX8997_BUCK7 || ldo < MAX8997_LDO1) &&
> + ldo != MAX8997_CHARGER_CV &&
> + ldo != MAX8997_CHARGER &&
> + ldo != MAX8997_CHARGER_TOPOFF)
> + return -EINVAL;
> + if (ldo == MAX8997_BUCK6)
> + return -EINVAL;
A switch statement for the valid regulators might be clearer.
> +static int max8997_set_voltage_buck(struct regulator_dev *rdev,
> + int min_uV, int max_uV)
API update needed here too.
> +static int max8997_set_voltage_safeout(struct regulator_dev *rdev,
> + int min_uV, int max_uV)
> +{
Here also. Given that you've got a separate set_voltage() the comment
about a separate get_voltage() above seems even stronger.
> +static inline unsigned int max8997_buck_voltage(int uV)
> +{
> + int step;
> +
> + if (uV <= 650000)
> + return 0x0;
> + if (uV >= 2225000)
> + return 0x3f;
> +
> + step = uV - 650000;
> + step /= 25000;
> +
> + return step + 1;
> +}
Shouldn't this code be shared with set_voltage()? Or...
> + max8997_update_reg(i2c, MAX8997_REG_BUCK1DVS(i),
> + max8997_buck_voltage(pdata->buck1_voltage[i]),
> + 0x3f);
> + max8997_update_reg(i2c, MAX8997_REG_BUCK2DVS(i),
> + max8997_buck_voltage(pdata->buck2_voltage[i]),
> + 0x3f);
> + max8997_update_reg(i2c, MAX8997_REG_BUCK5DVS(i),
> + max8997_buck_voltage(pdata->buck5_voltage[i]),
> + 0x3f);
...just call your set_voltage() operation directly for these?
> + if (gpio_is_valid(pdata->buck125_gpios[0]) &&
> + gpio_is_valid(pdata->buck125_gpios[1]) &&
> + gpio_is_valid(pdata->buck125_gpios[2])) {
Strange indentation here.
next prev parent reply other threads:[~2011-01-21 19:16 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-14 6:53 [PATCH 0/2] MAX8997/8966 MFD (PMIC+RTC+...) Initial Release MyungJoo Ham
2011-01-14 6:53 ` MyungJoo Ham
[not found] ` <1294988018-25100-1-git-send-email-myungjoo.ham-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2011-01-14 6:53 ` [PATCH 1/2] MAX8997/8966 MFD Driver Initial Release (PMIC+RTC+MUIC+Haptic+...) MyungJoo Ham
2011-01-14 6:53 ` MyungJoo Ham
[not found] ` <1294988018-25100-2-git-send-email-myungjoo.ham-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2011-01-30 23:19 ` Samuel Ortiz
2011-01-30 23:19 ` Samuel Ortiz
2011-01-14 6:53 ` [PATCH 2/2] MAX8997/8966 PMIC Regulator Driver Initial Release MyungJoo Ham
2011-01-14 6:53 ` MyungJoo Ham
[not found] ` <1294988018-25100-3-git-send-email-myungjoo.ham-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2011-01-21 19:16 ` Mark Brown [this message]
2011-01-21 19:16 ` 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=20110121191604.GK22414@opensource.wolfsonmicro.com \
--to=broonie-yzvpicuk2aatku/dhu1wvuem+bqzidxxqq4iyu8u01e@public.gmane.org \
--cc=kyungmin.park-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
--cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=lrg-kDsPt+C1G03kYMGBc/C6ZA@public.gmane.org \
--cc=myungjoo.ham-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=myungjoo.ham-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
--cc=sameo-VuQAYsv1563Yd54FQh9/CA@public.gmane.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.