All of lore.kernel.org
 help / color / mirror / Atom feed
From: Liam Girdwood <lrg@kernel.org>
To: dahuang@nvidia.com
Cc: broonie@opensource.wolfsonmicro.com, lrg@ti.com,
	mike@compulab.co.il, sameo@linux.intel.com, xxie@nvidia.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] regulator: tps6586x: add SMx slew rate setting
Date: Sun, 28 Aug 2011 17:49:41 +0100	[thread overview]
Message-ID: <1314550181.3666.7.camel@odin> (raw)
In-Reply-To: <1312886870-17451-1-git-send-email-dahuang@nvidia.com>

On Tue, 2011-08-09 at 18:47 +0800, dahuang@nvidia.com wrote:
> From: Xin Xie <xxie@nvidia.com>
> 
> Add output vlotage slew rate setting for SM0/SM1
> 
> Signed-off-by: Xin Xie <xxie@nvidia.com>
> Signed-off-by: Danny Huang <dahuang@nvidia.com>
> ---
>  drivers/regulator/tps6586x-regulator.c |   32 +++++++++++++++++++++++++++++++-
>  include/linux/mfd/tps6586x.h           |   16 ++++++++++++++++
>  2 files changed, 47 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/regulator/tps6586x-regulator.c b/drivers/regulator/tps6586x-regulator.c
> index bb04a75..dbcf09d 100644
> --- a/drivers/regulator/tps6586x-regulator.c
> +++ b/drivers/regulator/tps6586x-regulator.c
> @@ -332,6 +332,36 @@ static inline int tps6586x_regulator_preinit(struct device *parent,
>  				 1 << ri->enable_bit[1]);
>  }
>  
> +static int tps6586x_regulator_set_slew_rate(struct platform_device *pdev)
> +{
> +	struct device *parent = pdev->dev.parent;
> +	struct regulator_init_data *p = pdev->dev.platform_data;
> +	struct tps6586x_settings *setting = p->driver_data;
> +	uint8_t reg;
> +
> +	if (setting == NULL)
> +		return 0;
> +
> +	if (!(setting->slew_rate & TPS6586X_SLEW_RATE_SET))
> +		return 0;
> +
> +	/* only SM0 and SM1 can have the slew rate settings */
> +	switch (pdev->id) {
> +	case TPS6586X_ID_SM_0:
> +		reg = TPS6586X_SM0SL;
> +		break;
> +	case TPS6586X_ID_SM_1:
> +		reg = TPS6586X_SM1SL;
> +		break;
> +	default:
> +		dev_warn(&pdev->dev, "Only SM0/SM1 can set slew rate\n");
> +		return -EINVAL;
> +	}
> +
> +	return tps6586x_write(parent, reg,
> +			setting->slew_rate & TPS6586X_SLEW_RATE_MASK);
> +}
> +
>  static inline struct tps6586x_regulator *find_regulator_info(int id)
>  {
>  	struct tps6586x_regulator *ri;
> @@ -374,7 +404,7 @@ static int __devinit tps6586x_regulator_probe(struct platform_device *pdev)
>  
>  	platform_set_drvdata(pdev, rdev);
>  
> -	return 0;
> +	return tps6586x_regulator_set_slew_rate(pdev);
>  }
>  
>  static int __devexit tps6586x_regulator_remove(struct platform_device *pdev)
> diff --git a/include/linux/mfd/tps6586x.h b/include/linux/mfd/tps6586x.h
> index b6bab1b..b19176e 100644
> --- a/include/linux/mfd/tps6586x.h
> +++ b/include/linux/mfd/tps6586x.h
> @@ -1,6 +1,18 @@
>  #ifndef __LINUX_MFD_TPS6586X_H
>  #define __LINUX_MFD_TPS6586X_H
>  
> +#define TPS6586X_SLEW_RATE_INSTANTLY	0x00
> +#define TPS6586X_SLEW_RATE_110UV	0x01
> +#define TPS6586X_SLEW_RATE_220UV	0x02
> +#define TPS6586X_SLEW_RATE_440UV	0x03
> +#define TPS6586X_SLEW_RATE_880UV	0x04
> +#define TPS6586X_SLEW_RATE_1760UV	0x05
> +#define TPS6586X_SLEW_RATE_3520UV	0x06
> +#define TPS6586X_SLEW_RATE_7040UV	0x07
> +
> +#define TPS6586X_SLEW_RATE_SET		0x08
> +#define TPS6586X_SLEW_RATE_MASK         0x07
> +
>  enum {
>  	TPS6586X_ID_SM_0,
>  	TPS6586X_ID_SM_1,
> @@ -48,6 +60,10 @@ enum {
>  	TPS6586X_INT_RTC_ALM2,
>  };
>  
> +struct tps6586x_settings {
> +	int slew_rate;
> +};
> +
>  struct tps6586x_subdev_info {
>  	int		id;
>  	const char	*name;

Applied.

Thanks

Liam



  parent reply	other threads:[~2011-08-28 16:49 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-09 10:47 [PATCH] regulator: tps6586x: add SMx slew rate setting dahuang
2011-08-09 16:06 ` Mark Brown
2011-08-22  9:35 ` Samuel Ortiz
2011-08-22  9:41   ` Liam Girdwood
2011-08-28 16:49 ` Liam Girdwood [this message]
  -- strict thread matches above, loose matches on Subject: below --
2011-08-04 11:34 dahuang
2011-08-04 12:12 ` Mark Brown
2011-08-05 11:51   ` Danny Huang
2011-08-08  9:37     ` Mark Brown
2011-08-08 12:28       ` Danny Huang
2011-08-08 13:32         ` Mark Brown
2011-08-04 12:42 ` Mark Brown
2011-08-05 11:53   ` Danny Huang

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=1314550181.3666.7.camel@odin \
    --to=lrg@kernel.org \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=dahuang@nvidia.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lrg@ti.com \
    --cc=mike@compulab.co.il \
    --cc=sameo@linux.intel.com \
    --cc=xxie@nvidia.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.