Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 302279
b: refs/heads/master
c: 41097af
h: refs/heads/master
i:
  302277: a1c08b7
  302275: 02934bb
  302271: c074861
v: v3
  • Loading branch information
Axel Lin authored and Mark Brown committed May 14, 2012
1 parent c4d2c03 commit 73f5afe
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 18 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: 7f225ba5850886b9834f3473c6e584a94c5fc53b
refs/heads/master: 41097afd64108348a935c658c78662bce1ea6355
24 changes: 7 additions & 17 deletions trunk/drivers/regulator/tps62360-regulator.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,43 +137,32 @@ static int tps62360_dcdc_get_voltage_sel(struct regulator_dev *dev)
return vsel;
}

static int tps62360_dcdc_set_voltage(struct regulator_dev *dev,
int min_uV, int max_uV, unsigned *selector)
static int tps62360_dcdc_set_voltage_sel(struct regulator_dev *dev,
unsigned selector)
{
struct tps62360_chip *tps = rdev_get_drvdata(dev);
int vsel;
int ret;
bool found = false;
int new_vset_id = tps->curr_vset_id;

if ((max_uV < min_uV) || (max_uV < tps->voltage_base))
return -EINVAL;

if (min_uV > (tps->voltage_base + (tps->desc.n_voltages - 1) * 10000))
return -EINVAL;

vsel = DIV_ROUND_UP(min_uV - tps->voltage_base, 10000);
if (selector)
*selector = (vsel & tps->voltage_reg_mask);

/*
* If gpios are available to select the VSET register then least
* recently used register for new configuration.
*/
if (tps->valid_gpios)
found = find_voltage_set_register(tps, vsel, &new_vset_id);
found = find_voltage_set_register(tps, selector, &new_vset_id);

if (!found) {
ret = regmap_update_bits(tps->regmap, REG_VSET0 + new_vset_id,
tps->voltage_reg_mask, vsel);
tps->voltage_reg_mask, selector);
if (ret < 0) {
dev_err(tps->dev,
"%s(): register %d update failed with err %d\n",
__func__, REG_VSET0 + new_vset_id, ret);
return ret;
}
tps->curr_vset_id = new_vset_id;
tps->curr_vset_vsel[new_vset_id] = vsel;
tps->curr_vset_vsel[new_vset_id] = selector;
}

/* Select proper VSET register vio gpios */
Expand Down Expand Up @@ -204,8 +193,9 @@ static int tps62360_set_voltage_time_sel(struct regulator_dev *rdev,

static struct regulator_ops tps62360_dcdc_ops = {
.get_voltage_sel = tps62360_dcdc_get_voltage_sel,
.set_voltage = tps62360_dcdc_set_voltage,
.set_voltage_sel = tps62360_dcdc_set_voltage_sel,
.list_voltage = regulator_list_voltage_linear,
.map_voltage = regulator_map_voltage_linear,
.set_voltage_time_sel = tps62360_set_voltage_time_sel,
};

Expand Down

0 comments on commit 73f5afe

Please sign in to comment.