All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ashish Jangam <ashish.jangam@kpitcummins.com>
To: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: Liam Girdwood <lrg@ti.com>, Samuel Ortiz <sameo@linux.intel.com>,
	David Dajun Chen <dchen@diasemi.com>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [Patch v2 2/7] Regulator: DA9055 Regulator driver
Date: Tue, 9 Oct 2012 16:30:16 +0530	[thread overview]
Message-ID: <1349780416.5244.39.camel@dhruva> (raw)
In-Reply-To: <C3AE124F08223B42BC95AEB82F0F6CED38A84E78@KCHJEXMB03.kpit.com>

On Tue, 2012-10-09 at 15:37 +0530, Mark Brown wrote:
> On Mon, Oct 08, 2012 at 07:00:39PM +0530, Ashish Jangam wrote:
> 
> Mostly OK, but there's a few issues including yet more reimplementation
> of framework features.
> 
> > +static int da9055_list_voltage(struct regulator_dev *rdev,
> > +				unsigned int selector)
> > +{
> > +	struct da9055_regulator *regulator = rdev_get_drvdata(rdev);
> > +	struct da9055_regulator_info *info = regulator->info;
> > +	int volt_uV;
> > +
> > +	volt_uV = (selector * info->step_uV) + info->min_uV;
> > +
> > +	if (volt_uV > info->max_uV)
> > +		return -EINVAL;
> > +
> > +	return volt_uV;
> > +}
> 
> This is regulator_list_voltage_linear()
Agree.
> 
> > +static int da9055_map_voltage(struct regulator_dev *rdev,
> > +			      int min_uV, int max_uV)
> > +{
> > +	struct da9055_regulator *regulator = rdev_get_drvdata(rdev);
> > +	struct da9055_regulator_info *info = regulator->info;
> > +	int ret, sel;
> > +
> > +	ret = verify_range(info, min_uV, max_uV);
> > +	if (ret < 0)
> > +		return ret;
> > +
> > +	if (min_uV < info->min_uV)
> > +		min_uV = info->min_uV;
> > +
> > +	sel = DIV_ROUND_UP(min_uV - info->min_uV, info->step_uV);
> > +
> > +	ret = da9055_list_voltage(rdev, sel);
> > +	if (ret < 0)
> > +		return ret;
> > +
> > +	return sel;
> > +}
> 
> This is regulator_map_voltage_linear().
Agree.
> 
> > +             int gpio = pdata->gpio_base + pdata->gpio_ren[id];
> 
> > +		sprintf(name, "DA9055 REG %d STATE", id);
> 
> snprintf().
> 
> > +		/* Set the GPIO I/P pin for controlling the regulator state. */
> > +		ret = devm_gpio_request_one(config->dev, gpio, GPIOF_DIR_IN,
> > +					    name);
> > +		if (ret < 0)
> > +			goto err;
> 
> We never actually appear to use this GPIO anywhere...  why are we
> requesting it?
DA9055 regulator changes its state by detecting the rising/failing edge at
GPI DA9055. Therefore we just need to set the DA9055 GPIO direction to input.
>   Also, why is the ability to read the regulator state via
> a GPIO associated with controlling it via a GPIO, it's unusual for these
> things to be tied together.
> 
There is no connection between state just to differentiate between two strings/labels.
If required I can change the string.



       reply	other threads:[~2012-10-09 10:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <C3AE124F08223B42BC95AEB82F0F6CED38A84E78@KCHJEXMB03.kpit.com>
2012-10-09 11:00 ` Ashish Jangam [this message]
2012-10-10  3:56   ` [Patch v2 2/7] Regulator: DA9055 Regulator driver Mark Brown
2012-10-10  9:27     ` Ashish Jangam
2012-10-08 13:30 Ashish Jangam
2012-10-09  7:11 ` 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=1349780416.5244.39.camel@dhruva \
    --to=ashish.jangam@kpitcummins.com \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=dchen@diasemi.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lrg@ti.com \
    --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 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.