Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 312562
b: refs/heads/master
c: 852abad
h: refs/heads/master
v: v3
  • Loading branch information
Yadwinder Singh Brar authored and Mark Brown committed Jun 19, 2012
1 parent adb0c4a commit b5e1c65
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 34 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a133829e66d25e1ce293a30bcc3fb8eb653a1519
refs/heads/master: 852abad238da723efac29f3e78dd768c18d6a062
42 changes: 9 additions & 33 deletions trunk/drivers/regulator/max77686.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
#define MAX77686_LDO_LOW_UVSTEP 25000
#define MAX77686_BUCK_MINUV 750000
#define MAX77686_BUCK_UVSTEP 50000
#define MAX77686_RAMP_DELAY 100000 /* uV/us */
#define MAX77686_DVS_RAMP_DELAY 27500 /* uV/us */
#define MAX77686_DVS_MINUV 600000
#define MAX77686_DVS_UVSTEP 12500

Expand All @@ -66,28 +68,8 @@ struct max77686_data {
struct device *dev;
struct max77686_dev *iodev;
struct regulator_dev **rdev;
int ramp_delay; /* in mV/us */
};

static int max77686_set_dvs_voltage_time_sel(struct regulator_dev *rdev,
unsigned int old_selector, unsigned int new_selector)
{
struct max77686_data *max77686 = rdev_get_drvdata(rdev);
int ramp_rate[] = {13, 27, 55, 100};

return DIV_ROUND_UP(rdev->desc->uV_step *
abs(new_selector - old_selector),
ramp_rate[max77686->ramp_delay] * 1000);
}

static int max77686_set_voltage_time_sel(struct regulator_dev *rdev,
unsigned int old_selector, unsigned int new_selector)
{
/* Unconditionally 100 mV/us */
return DIV_ROUND_UP(rdev->desc->uV_step *
abs(new_selector - old_selector), 100 * 1000);
}

static struct regulator_ops max77686_ops = {
.list_voltage = regulator_list_voltage_linear,
.map_voltage = regulator_map_voltage_linear,
Expand All @@ -96,7 +78,7 @@ static struct regulator_ops max77686_ops = {
.disable = regulator_disable_regmap,
.get_voltage_sel = regulator_get_voltage_sel_regmap,
.set_voltage_sel = regulator_set_voltage_sel_regmap,
.set_voltage_time_sel = max77686_set_voltage_time_sel,
.set_voltage_time_sel = regulator_set_voltage_time_sel,
};

static struct regulator_ops max77686_buck_dvs_ops = {
Expand All @@ -107,7 +89,7 @@ static struct regulator_ops max77686_buck_dvs_ops = {
.disable = regulator_disable_regmap,
.get_voltage_sel = regulator_get_voltage_sel_regmap,
.set_voltage_sel = regulator_set_voltage_sel_regmap,
.set_voltage_time_sel = max77686_set_dvs_voltage_time_sel,
.set_voltage_time_sel = regulator_set_voltage_time_sel,
};

#define regulator_desc_ldo(num) { \
Expand All @@ -118,6 +100,7 @@ static struct regulator_ops max77686_buck_dvs_ops = {
.owner = THIS_MODULE, \
.min_uV = MAX77686_LDO_MINUV, \
.uV_step = MAX77686_LDO_UVSTEP, \
.ramp_delay = MAX77686_RAMP_DELAY, \
.n_voltages = MAX77686_VSEL_MASK + 1, \
.vsel_reg = MAX77686_REG_LDO1CTRL1 + num - 1, \
.vsel_mask = MAX77686_VSEL_MASK, \
Expand All @@ -133,6 +116,7 @@ static struct regulator_ops max77686_buck_dvs_ops = {
.owner = THIS_MODULE, \
.min_uV = MAX77686_LDO_LOW_MINUV, \
.uV_step = MAX77686_LDO_LOW_UVSTEP, \
.ramp_delay = MAX77686_RAMP_DELAY, \
.n_voltages = MAX77686_VSEL_MASK + 1, \
.vsel_reg = MAX77686_REG_LDO1CTRL1 + num - 1, \
.vsel_mask = MAX77686_VSEL_MASK, \
Expand All @@ -148,6 +132,7 @@ static struct regulator_ops max77686_buck_dvs_ops = {
.owner = THIS_MODULE, \
.min_uV = MAX77686_BUCK_MINUV, \
.uV_step = MAX77686_BUCK_UVSTEP, \
.ramp_delay = MAX77686_RAMP_DELAY, \
.n_voltages = MAX77686_VSEL_MASK + 1, \
.vsel_reg = MAX77686_REG_BUCK5OUT + (num - 5) * 2, \
.vsel_mask = MAX77686_VSEL_MASK, \
Expand All @@ -162,6 +147,7 @@ static struct regulator_ops max77686_buck_dvs_ops = {
.owner = THIS_MODULE, \
.min_uV = MAX77686_BUCK_MINUV, \
.uV_step = MAX77686_BUCK_UVSTEP, \
.ramp_delay = MAX77686_RAMP_DELAY, \
.n_voltages = MAX77686_VSEL_MASK + 1, \
.vsel_reg = MAX77686_REG_BUCK1OUT, \
.vsel_mask = MAX77686_VSEL_MASK, \
Expand All @@ -176,6 +162,7 @@ static struct regulator_ops max77686_buck_dvs_ops = {
.owner = THIS_MODULE, \
.min_uV = MAX77686_DVS_MINUV, \
.uV_step = MAX77686_DVS_UVSTEP, \
.ramp_delay = MAX77686_DVS_RAMP_DELAY, \
.n_voltages = MAX77686_DVS_VSEL_MASK + 1, \
.vsel_reg = MAX77686_REG_BUCK2DVS1 + (num - 2) * 10, \
.vsel_mask = MAX77686_DVS_VSEL_MASK, \
Expand Down Expand Up @@ -255,17 +242,6 @@ static __devinit int max77686_pmic_probe(struct platform_device *pdev)
max77686->iodev = iodev;
platform_set_drvdata(pdev, max77686);

max77686->ramp_delay = RAMP_RATE_NO_CTRL; /* Set 0x3 for RAMP */
regmap_update_bits(max77686->iodev->regmap,
MAX77686_REG_BUCK2CTRL1, MAX77686_RAMP_RATE_MASK,
max77686->ramp_delay << 6);
regmap_update_bits(max77686->iodev->regmap,
MAX77686_REG_BUCK3CTRL1, MAX77686_RAMP_RATE_MASK,
max77686->ramp_delay << 6);
regmap_update_bits(max77686->iodev->regmap,
MAX77686_REG_BUCK4CTRL1, MAX77686_RAMP_RATE_MASK,
max77686->ramp_delay << 6);

for (i = 0; i < MAX77686_REGULATORS; i++) {
config.dev = max77686->dev;
config.regmap = iodev->regmap;
Expand Down

0 comments on commit b5e1c65

Please sign in to comment.