Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 312587
b: refs/heads/master
c: d172f31
h: refs/heads/master
i:
  312585: 339b977
  312583: 6c00014
v: v3
  • Loading branch information
Axel Lin authored and Mark Brown committed Jul 1, 2012
1 parent d0f5ba0 commit 5027e82
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 30 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: e2eb169b1bc207dd1a79109d85b098b241be2e9b
refs/heads/master: d172f319c1094ef22d2a00f43e8a7da4dd02c8f3
47 changes: 22 additions & 25 deletions trunk/drivers/regulator/tps65217-regulator.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include <linux/regulator/machine.h>
#include <linux/mfd/tps65217.h>

#define TPS65217_REGULATOR(_name, _id, _ops, _n, _vr, _vm, _em) \
#define TPS65217_REGULATOR(_name, _id, _ops, _n, _vr, _vm, _em, _t) \
{ \
.name = _name, \
.id = _id, \
Expand All @@ -38,20 +38,19 @@
.vsel_mask = _vm, \
.enable_reg = TPS65217_REG_ENABLE, \
.enable_mask = _em, \
.volt_table = _t, \
} \

#define TPS65217_INFO(_nm, _min, _max, _f1, _f2, _t, _n)\
#define TPS65217_INFO(_nm, _min, _max, _f1, _f2) \
{ \
.name = _nm, \
.min_uV = _min, \
.max_uV = _max, \
.vsel_to_uv = _f1, \
.uv_to_vsel = _f2, \
.table = _t, \
.table_len = _n, \
}

static const int LDO1_VSEL_table[] = {
static const unsigned int LDO1_VSEL_table[] = {
1000000, 1100000, 1200000, 1250000,
1300000, 1350000, 1400000, 1500000,
1600000, 1800000, 2500000, 2750000,
Expand Down Expand Up @@ -128,19 +127,18 @@ static int tps65217_uv_to_vsel2(int uV, unsigned int *vsel)

static struct tps_info tps65217_pmic_regs[] = {
TPS65217_INFO("DCDC1", 900000, 1800000, tps65217_vsel_to_uv1,
tps65217_uv_to_vsel1, NULL, 64),
tps65217_uv_to_vsel1),
TPS65217_INFO("DCDC2", 900000, 3300000, tps65217_vsel_to_uv1,
tps65217_uv_to_vsel1, NULL, 64),
tps65217_uv_to_vsel1),
TPS65217_INFO("DCDC3", 900000, 1500000, tps65217_vsel_to_uv1,
tps65217_uv_to_vsel1, NULL, 64),
TPS65217_INFO("LDO1", 1000000, 3300000, NULL, NULL, LDO1_VSEL_table,
16),
tps65217_uv_to_vsel1),
TPS65217_INFO("LDO1", 1000000, 3300000, NULL, NULL),
TPS65217_INFO("LDO2", 900000, 3300000, tps65217_vsel_to_uv1,
tps65217_uv_to_vsel1, NULL, 64),
tps65217_uv_to_vsel1),
TPS65217_INFO("LDO3", 1800000, 3300000, tps65217_vsel_to_uv2,
tps65217_uv_to_vsel2, NULL, 32),
tps65217_uv_to_vsel2),
TPS65217_INFO("LDO4", 1800000, 3300000, tps65217_vsel_to_uv2,
tps65217_uv_to_vsel2, NULL, 32),
tps65217_uv_to_vsel2),
};

static int tps65217_pmic_enable(struct regulator_dev *dev)
Expand Down Expand Up @@ -230,12 +228,9 @@ static int tps65217_pmic_list_voltage(struct regulator_dev *dev,
if (rid < TPS65217_DCDC_1 || rid > TPS65217_LDO_4)
return -EINVAL;

if (selector >= tps->info[rid]->table_len)
if (selector >= dev->desc->n_voltages)
return -EINVAL;

if (tps->info[rid]->table)
return tps->info[rid]->table[selector];

return tps->info[rid]->vsel_to_uv(selector);
}

Expand All @@ -257,31 +252,33 @@ static struct regulator_ops tps65217_pmic_ldo1_ops = {
.disable = tps65217_pmic_disable,
.get_voltage_sel = regulator_get_voltage_sel_regmap,
.set_voltage_sel = tps65217_pmic_set_voltage_sel,
.list_voltage = tps65217_pmic_list_voltage,
.list_voltage = regulator_list_voltage_table,
};

static const struct regulator_desc regulators[] = {
TPS65217_REGULATOR("DCDC1", TPS65217_DCDC_1, tps65217_pmic_ops, 64,
TPS65217_REG_DEFDCDC1, TPS65217_DEFDCDCX_DCDC_MASK,
TPS65217_ENABLE_DC1_EN),
TPS65217_ENABLE_DC1_EN, NULL),
TPS65217_REGULATOR("DCDC2", TPS65217_DCDC_2, tps65217_pmic_ops, 64,
TPS65217_REG_DEFDCDC2, TPS65217_DEFDCDCX_DCDC_MASK,
TPS65217_ENABLE_DC2_EN),
TPS65217_ENABLE_DC2_EN, NULL),
TPS65217_REGULATOR("DCDC3", TPS65217_DCDC_3, tps65217_pmic_ops, 64,
TPS65217_REG_DEFDCDC3, TPS65217_DEFDCDCX_DCDC_MASK,
TPS65217_ENABLE_DC3_EN),
TPS65217_ENABLE_DC3_EN, NULL),
TPS65217_REGULATOR("LDO1", TPS65217_LDO_1, tps65217_pmic_ldo1_ops, 16,
TPS65217_REG_DEFLDO1, TPS65217_DEFLDO1_LDO1_MASK,
TPS65217_ENABLE_LDO1_EN),
TPS65217_ENABLE_LDO1_EN, LDO1_VSEL_table),
TPS65217_REGULATOR("LDO2", TPS65217_LDO_2, tps65217_pmic_ops, 64,
TPS65217_REG_DEFLDO2, TPS65217_DEFLDO2_LDO2_MASK,
TPS65217_ENABLE_LDO2_EN),
TPS65217_ENABLE_LDO2_EN, NULL),
TPS65217_REGULATOR("LDO3", TPS65217_LDO_3, tps65217_pmic_ops, 32,
TPS65217_REG_DEFLS1, TPS65217_DEFLDO3_LDO3_MASK,
TPS65217_ENABLE_LS1_EN | TPS65217_DEFLDO3_LDO3_EN),
TPS65217_ENABLE_LS1_EN | TPS65217_DEFLDO3_LDO3_EN,
NULL),
TPS65217_REGULATOR("LDO4", TPS65217_LDO_4, tps65217_pmic_ops, 32,
TPS65217_REG_DEFLS2, TPS65217_DEFLDO4_LDO4_MASK,
TPS65217_ENABLE_LS2_EN | TPS65217_DEFLDO4_LDO4_EN),
TPS65217_ENABLE_LS2_EN | TPS65217_DEFLDO4_LDO4_EN,
NULL),
};

static int __devinit tps65217_regulator_probe(struct platform_device *pdev)
Expand Down
4 changes: 0 additions & 4 deletions trunk/include/linux/mfd/tps65217.h
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,6 @@ struct tps65217_board {
* @max_uV: minimum micro volts
* @vsel_to_uv: Function pointer to get voltage from selector
* @uv_to_vsel: Function pointer to get selector from voltage
* @table: Table for non-uniform voltage step-size
* @table_len: Length of the voltage table
*
* This data is used to check the regualtor voltage limits while setting.
*/
Expand All @@ -238,8 +236,6 @@ struct tps_info {
int max_uV;
int (*vsel_to_uv)(unsigned int vsel);
int (*uv_to_vsel)(int uV, unsigned int *vsel);
const int *table;
unsigned int table_len;
};

/**
Expand Down

0 comments on commit 5027e82

Please sign in to comment.