regulator: tps6586x: add SMx slew rate setting
PATCH 1/1 regulator: tps6586x: add SMx slew rate setting
From: Xin Xie <[email protected]>
Add output vlotage slew rate setting for SM0/SM1
Signed-off-by Xin Xie <[email protected]>
Signed-off-by Danny Huang <[email protected]>
--- drivers/regulator/tps6586x-regulator.c | 32 +++++++++++++++++++++++++++++++- include/linux/mfd/tps6586x.h | 16 ++++++++++++++++ 2 files changed, 47 insertions(+), 1 deletions(-)
drivers/regulator/tps6586x-regulator.c +31 -1
@@ -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)
include/linux/mfd/tps6586x.h +16 -0
@@ -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;
Signature · 1 line
1.7.6
Quoted 3 lines · On Tue, Aug 09, 2011 at 06:47:50PM +0800, [email protected] wrote:
From: Xin Xie <[email protected]>
Add output vlotage slew rate setting for SM0/SM1
Acked-by Mark Brown <[email protected]>
Hi Xin,
Quoted 6 lines · On Tue, Aug 09, 2011 at 06:47:50PM +0800, [email protected] wrote:
From: Xin Xie <[email protected]>
Add output vlotage slew rate setting for SM0/SM1
Signed-off-by Xin Xie <[email protected]>Signed-off-by Danny Huang <[email protected]>
Acked-by Samuel Ortiz <[email protected]>
Liam, are you taking this one ?
Cheers,
Samuel.
Signature · 2 lines
Intel Open Source Technology Centre http://oss.intel.com/
Quoted 5 lines · Samuel Ortiz
Hi Xin,
Quoted 2 lines · On Tue, Aug 09, 2011 at 06:47:50PM +0800, [email protected] wrote:
From: Xin Xie <[email protected]>
Quoted 8 lines
Quoted 4 lines
Add output vlotage slew rate setting for SM0/SM1
Signed-off-by Xin Xie <[email protected]>Signed-off-by Danny Huang <[email protected]>Acked-by Samuel Ortiz <[email protected]>Liam, are you taking this one ?
I will do in the next few days. I've had an ADSL fault for the last two weeks that is keeping me off line atm.
Liam
Liam Girdwood
AppliedQuoted 85 lines · On Tue, 2011-08-09 at 18:47 +0800, [email protected] wrote:
From: Xin Xie <[email protected]>
Add output vlotage slew rate setting for SM0/SM1
Signed-off-by Xin Xie <[email protected]>Signed-off-by Danny Huang <[email protected]>--- drivers/regulator/tps6586x-regulator.c | 32 +++++++++++++++++++++++++++++++- include/linux/mfd/tps6586x.h | 16 ++++++++++++++++ 2 files changed, 47 insertions(+), 1 deletions(-)drivers/regulator/tps6586x-regulator.c +31
-1@@ -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)include/linux/mfd/tps6586x.h +12
-0@@ -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,
include/linux/mfd/tps6586x.h enum { · line 69
Quoted 10 lines
include/linux/mfd/tps6586x.h +4
-0@@ -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