diff options
author | Alok Chauhan <alokc@nvidia.com> | 2012-02-17 15:17:38 +0530 |
---|---|---|
committer | Simone Willett <swillett@nvidia.com> | 2012-04-10 11:17:39 -0700 |
commit | 79ef930900b0a656910009c4305c44378fb7a3ae (patch) | |
tree | e5124d779fe8f862a21c89f6c47c0fcb7ab502db /drivers/regulator | |
parent | 679a48b98f3b99592b2a2a3e71c35c729d28a0ce (diff) |
regulator: max8907: Add driver specific data for regulator
Adding the regulator driver specific information and passing
this information through regulator driver data. This struture
is containing delay operation which is require to voltage to
be settle down after enabling rail.
Bug 939242
Change-Id: I7da6ec487fe5f04857d3fd5f06a383b4a8fbcc7b
Signed-off-by: Alok Chauhan <alokc@nvidia.com>
Reviewed-on: http://git-master/r/94500
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Venkat Moganty <vmoganty@nvidia.com>
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
Diffstat (limited to 'drivers/regulator')
-rw-r--r-- | drivers/regulator/max8907c-regulator.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/regulator/max8907c-regulator.c b/drivers/regulator/max8907c-regulator.c index 925f161d9922..bc86f927ead3 100644 --- a/drivers/regulator/max8907c-regulator.c +++ b/drivers/regulator/max8907c-regulator.c @@ -14,6 +14,7 @@ #include <linux/err.h> #include <linux/platform_device.h> #include <linux/regulator/driver.h> +#include <linux/regulator/machine.h> #include <linux/mfd/max8907c.h> #include <linux/regulator/max8907c-regulator.h> @@ -29,6 +30,7 @@ struct max8907c_regulator_info { u32 max_uV; u32 step_uV; u8 reg_base; + u32 enable_time_us; struct regulator_desc desc; struct i2c_client *i2c; }; @@ -129,6 +131,7 @@ static int max8907c_regulator_out5v_enable(struct regulator_dev *dev); static int max8907c_regulator_ldo_disable(struct regulator_dev *dev); static int max8907c_regulator_out5v_disable(struct regulator_dev *dev); static int max8907c_regulator_ldo_is_enabled(struct regulator_dev *dev); +static int max8907c_regulator_ldo_enable_time(struct regulator_dev *dev); static int max8907c_regulator_out5v_is_enabled(struct regulator_dev *dev); static struct regulator_ops max8907c_ldo_ops = { @@ -138,6 +141,7 @@ static struct regulator_ops max8907c_ldo_ops = { .enable = max8907c_regulator_ldo_enable, .disable = max8907c_regulator_ldo_disable, .is_enabled = max8907c_regulator_ldo_is_enabled, + .enable_time = max8907c_regulator_ldo_enable_time, }; static struct regulator_ops max8907c_fixed_ops = { @@ -334,6 +338,13 @@ static int max8907c_regulator_ldo_is_enabled(struct regulator_dev *rdev) return (val & MAX8907C_MASK_LDO_EN) || !(val & MAX8907C_MASK_LDO_SEQ); } +static int max8907c_regulator_ldo_enable_time(struct regulator_dev *rdev) +{ + struct max8907c_regulator_info *info = rdev_get_drvdata(rdev); + + return info->enable_time_us; +} + static int max8907c_regulator_out5v_is_enabled(struct regulator_dev *rdev) { const struct max8907c_regulator_info *info = rdev_get_drvdata(rdev); @@ -357,6 +368,8 @@ static int max8907c_regulator_probe(struct platform_device *pdev) struct max8907c *max8907c = dev_get_drvdata(pdev->dev.parent); struct max8907c_regulator_info *info; struct regulator_dev *rdev; + struct regulator_init_data *p = pdev->dev.platform_data; + struct max8907c_chip_regulator_data *chip_data = p->driver_data;; u8 version; /* Backwards compatibility with max8907b, SD1 uses different voltages */ @@ -370,6 +383,9 @@ static int max8907c_regulator_probe(struct platform_device *pdev) info = &max8907c_regulators[pdev->id]; info->i2c = max8907c->i2c_power; + if (chip_data != NULL) + info->enable_time_us = chip_data->enable_time_us; + rdev = regulator_register(&info->desc, &pdev->dev, pdev->dev.platform_data, info); if (IS_ERR(rdev)) { |