All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marek Vasut <marek.vasut@gmail.com>
To: Axel Lin <axel.lin@gmail.com>
Cc: linux-kernel@vger.kernel.org, Liam Girdwood <lrg@ti.com>,
	Mark Brown <broonie@opensource.wolfsonmicro.com>
Subject: Re: [PATCH RFT 3/3] regulator: isl6271a: Convert to set_voltage_sel and regulator_map_voltage_linear
Date: Wed, 16 May 2012 04:29:31 +0200	[thread overview]
Message-ID: <201205160429.31382.marek.vasut@gmail.com> (raw)
In-Reply-To: <1337134273.5940.4.camel@phoenix>

Dear Axel Lin,

> Signed-off-by: Axel Lin <axel.lin@gmail.com>
> ---
>  drivers/regulator/isl6271a-regulator.c |   21 ++++++---------------
>  1 files changed, 6 insertions(+), 15 deletions(-)
> 
> diff --git a/drivers/regulator/isl6271a-regulator.c
> b/drivers/regulator/isl6271a-regulator.c index 00cb288..56d273f 100644
> --- a/drivers/regulator/isl6271a-regulator.c
> +++ b/drivers/regulator/isl6271a-regulator.c
> @@ -50,25 +50,15 @@ static int isl6271a_get_voltage_sel(struct
> regulator_dev *dev) return idx;
>  }
> 
> -static int isl6271a_set_voltage(struct regulator_dev *dev,
> -				int minuV, int maxuV,
> -				unsigned *selector)
> +static int isl6271a_set_voltage_sel(struct regulator_dev *dev,
> +				    unsigned selector)
>  {
>  	struct isl_pmic *pmic = rdev_get_drvdata(dev);
> -	int err, data;
> -
> -	if (minuV < ISL6271A_VOLTAGE_MIN || minuV > ISL6271A_VOLTAGE_MAX)
> -		return -EINVAL;
> -	if (maxuV < ISL6271A_VOLTAGE_MIN || maxuV > ISL6271A_VOLTAGE_MAX)
> -		return -EINVAL;
> -
> -	data = DIV_ROUND_UP(minuV - ISL6271A_VOLTAGE_MIN,
> -			    ISL6271A_VOLTAGE_STEP);
> -	*selector = data;
> +	int err;
> 
>  	mutex_lock(&pmic->mtx);
> 
> -	err = i2c_smbus_write_byte(pmic->client, data);
> +	err = i2c_smbus_write_byte(pmic->client, selector);
>  	if (err < 0)
>  		dev_err(&pmic->client->dev, "Error setting voltage\n");
> 
> @@ -78,8 +68,9 @@ static int isl6271a_set_voltage(struct regulator_dev
> *dev,
> 
>  static struct regulator_ops isl_core_ops = {
>  	.get_voltage_sel = isl6271a_get_voltage_sel,
> -	.set_voltage	= isl6271a_set_voltage,
> +	.set_voltage_sel = isl6271a_set_voltage_sel,
>  	.list_voltage	= regulator_list_voltage_linear,
> +	.map_voltage	= regulator_map_voltage_linear,
>  };
> 
>  static int isl6271a_get_fixed_voltage(struct regulator_dev *dev)

Hm well, I hope this won't break the driver. I can't test it any soon.

Best regards,
Marek Vasut

  reply	other threads:[~2012-05-16  2:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-16  2:09 [PATCH RFT 1/3] regulator: isl6271a: Use regulator_list_voltage_linear() Axel Lin
2012-05-16  2:10 ` [PATCH RFT 2/3] regulator: isl6271a: Convert to get_voltage_sel Axel Lin
2012-05-16  2:11 ` [PATCH RFT 3/3] regulator: isl6271a: Convert to set_voltage_sel and regulator_map_voltage_linear Axel Lin
2012-05-16  2:29   ` Marek Vasut [this message]
2012-05-16  8:47 ` [PATCH RFT 1/3] regulator: isl6271a: Use regulator_list_voltage_linear() 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=201205160429.31382.marek.vasut@gmail.com \
    --to=marek.vasut@gmail.com \
    --cc=axel.lin@gmail.com \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=linux-kernel@vger.kernel.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 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.