Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 312545
b: refs/heads/master
c: 34e74f3
h: refs/heads/master
i:
  312543: 1152ba3
v: v3
  • Loading branch information
Axel Lin authored and Mark Brown committed Jun 17, 2012
1 parent 176f951 commit 610bcf7
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 71 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: ee5e6253ac22210da892435711890fa2272daa41
refs/heads/master: 34e74f39fa9a2c1489444266cc9e973dc1b3a419
38 changes: 19 additions & 19 deletions trunk/drivers/regulator/mc13783-regulator.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,78 +93,78 @@


/* Voltage Values */
static const int mc13783_sw3_val[] = {
static const unsigned int mc13783_sw3_val[] = {
5000000, 5000000, 5000000, 5500000,
};

static const int mc13783_vaudio_val[] = {
static const unsigned int mc13783_vaudio_val[] = {
2775000,
};

static const int mc13783_viohi_val[] = {
static const unsigned int mc13783_viohi_val[] = {
2775000,
};

static const int mc13783_violo_val[] = {
static const unsigned int mc13783_violo_val[] = {
1200000, 1300000, 1500000, 1800000,
};

static const int mc13783_vdig_val[] = {
static const unsigned int mc13783_vdig_val[] = {
1200000, 1300000, 1500000, 1800000,
};

static const int mc13783_vgen_val[] = {
static const unsigned int mc13783_vgen_val[] = {
1200000, 1300000, 1500000, 1800000,
1100000, 2000000, 2775000, 2400000,
};

static const int mc13783_vrfdig_val[] = {
static const unsigned int mc13783_vrfdig_val[] = {
1200000, 1500000, 1800000, 1875000,
};

static const int mc13783_vrfref_val[] = {
static const unsigned int mc13783_vrfref_val[] = {
2475000, 2600000, 2700000, 2775000,
};

static const int mc13783_vrfcp_val[] = {
static const unsigned int mc13783_vrfcp_val[] = {
2700000, 2775000,
};

static const int mc13783_vsim_val[] = {
static const unsigned int mc13783_vsim_val[] = {
1800000, 2900000, 3000000,
};

static const int mc13783_vesim_val[] = {
static const unsigned int mc13783_vesim_val[] = {
1800000, 2900000,
};

static const int mc13783_vcam_val[] = {
static const unsigned int mc13783_vcam_val[] = {
1500000, 1800000, 2500000, 2550000,
2600000, 2750000, 2800000, 3000000,
};

static const int mc13783_vrfbg_val[] = {
static const unsigned int mc13783_vrfbg_val[] = {
1250000,
};

static const int mc13783_vvib_val[] = {
static const unsigned int mc13783_vvib_val[] = {
1300000, 1800000, 2000000, 3000000,
};

static const int mc13783_vmmc_val[] = {
static const unsigned int mc13783_vmmc_val[] = {
1600000, 1800000, 2000000, 2600000,
2700000, 2800000, 2900000, 3000000,
};

static const int mc13783_vrf_val[] = {
static const unsigned int mc13783_vrf_val[] = {
1500000, 1875000, 2700000, 2775000,
};

static const int mc13783_gpo_val[] = {
static const unsigned int mc13783_gpo_val[] = {
3100000,
};

static const int mc13783_pwgtdrv_val[] = {
static const unsigned int mc13783_pwgtdrv_val[] = {
5500000,
};

Expand Down Expand Up @@ -328,7 +328,7 @@ static struct regulator_ops mc13783_gpo_regulator_ops = {
.enable = mc13783_gpo_regulator_enable,
.disable = mc13783_gpo_regulator_disable,
.is_enabled = mc13783_gpo_regulator_is_enabled,
.list_voltage = mc13xxx_regulator_list_voltage,
.list_voltage = regulator_list_voltage_table,
.set_voltage = mc13xxx_fixed_regulator_set_voltage,
.get_voltage = mc13xxx_fixed_regulator_get_voltage,
};
Expand Down
42 changes: 21 additions & 21 deletions trunk/drivers/regulator/mc13892-regulator.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,12 @@
#define MC13892_USB1 50
#define MC13892_USB1_VUSBEN (1<<3)

static const int mc13892_vcoincell[] = {
static const unsigned int mc13892_vcoincell[] = {
2500000, 2700000, 2800000, 2900000, 3000000, 3100000,
3200000, 3300000,
};

static const int mc13892_sw1[] = {
static const unsigned int mc13892_sw1[] = {
600000, 625000, 650000, 675000, 700000, 725000,
750000, 775000, 800000, 825000, 850000, 875000,
900000, 925000, 950000, 975000, 1000000, 1025000,
Expand All @@ -164,7 +164,7 @@ static const int mc13892_sw1[] = {
1350000, 1375000
};

static const int mc13892_sw[] = {
static const unsigned int mc13892_sw[] = {
600000, 625000, 650000, 675000, 700000, 725000,
750000, 775000, 800000, 825000, 850000, 875000,
900000, 925000, 950000, 975000, 1000000, 1025000,
Expand All @@ -176,65 +176,65 @@ static const int mc13892_sw[] = {
1800000, 1825000, 1850000, 1875000
};

static const int mc13892_swbst[] = {
static const unsigned int mc13892_swbst[] = {
5000000,
};

static const int mc13892_viohi[] = {
static const unsigned int mc13892_viohi[] = {
2775000,
};

static const int mc13892_vpll[] = {
static const unsigned int mc13892_vpll[] = {
1050000, 1250000, 1650000, 1800000,
};

static const int mc13892_vdig[] = {
static const unsigned int mc13892_vdig[] = {
1050000, 1250000, 1650000, 1800000,
};

static const int mc13892_vsd[] = {
static const unsigned int mc13892_vsd[] = {
1800000, 2000000, 2600000, 2700000,
2800000, 2900000, 3000000, 3150000,
};

static const int mc13892_vusb2[] = {
static const unsigned int mc13892_vusb2[] = {
2400000, 2600000, 2700000, 2775000,
};

static const int mc13892_vvideo[] = {
static const unsigned int mc13892_vvideo[] = {
2700000, 2775000, 2500000, 2600000,
};

static const int mc13892_vaudio[] = {
static const unsigned int mc13892_vaudio[] = {
2300000, 2500000, 2775000, 3000000,
};

static const int mc13892_vcam[] = {
static const unsigned int mc13892_vcam[] = {
2500000, 2600000, 2750000, 3000000,
};

static const int mc13892_vgen1[] = {
static const unsigned int mc13892_vgen1[] = {
1200000, 1500000, 2775000, 3150000,
};

static const int mc13892_vgen2[] = {
static const unsigned int mc13892_vgen2[] = {
1200000, 1500000, 1600000, 1800000,
2700000, 2800000, 3000000, 3150000,
};

static const int mc13892_vgen3[] = {
static const unsigned int mc13892_vgen3[] = {
1800000, 2900000,
};

static const int mc13892_vusb[] = {
static const unsigned int mc13892_vusb[] = {
3300000,
};

static const int mc13892_gpo[] = {
static const unsigned int mc13892_gpo[] = {
2750000,
};

static const int mc13892_pwgtdrv[] = {
static const unsigned int mc13892_pwgtdrv[] = {
5000000,
};

Expand Down Expand Up @@ -394,7 +394,7 @@ static struct regulator_ops mc13892_gpo_regulator_ops = {
.enable = mc13892_gpo_regulator_enable,
.disable = mc13892_gpo_regulator_disable,
.is_enabled = mc13892_gpo_regulator_is_enabled,
.list_voltage = mc13xxx_regulator_list_voltage,
.list_voltage = regulator_list_voltage_table,
.set_voltage = mc13xxx_fixed_regulator_set_voltage,
.get_voltage = mc13xxx_fixed_regulator_get_voltage,
};
Expand Down Expand Up @@ -436,7 +436,7 @@ static int mc13892_sw_regulator_set_voltage_sel(struct regulator_dev *rdev,
u32 valread;
int ret;

value = mc13892_regulators[id].voltages[selector];
value = rdev->desc->volt_table[selector];

mc13xxx_lock(priv->mc13xxx);
ret = mc13xxx_reg_read(priv->mc13xxx,
Expand Down Expand Up @@ -470,7 +470,7 @@ static int mc13892_sw_regulator_set_voltage_sel(struct regulator_dev *rdev,

static struct regulator_ops mc13892_sw_regulator_ops = {
.is_enabled = mc13xxx_sw_regulator_is_enabled,
.list_voltage = mc13xxx_regulator_list_voltage,
.list_voltage = regulator_list_voltage_table,
.set_voltage_sel = mc13892_sw_regulator_set_voltage_sel,
.get_voltage = mc13892_sw_regulator_get_voltage,
};
Expand Down
30 changes: 6 additions & 24 deletions trunk/drivers/regulator/mc13xxx-regulator-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,20 +80,6 @@ static int mc13xxx_regulator_is_enabled(struct regulator_dev *rdev)
return (val & mc13xxx_regulators[id].enable_bit) != 0;
}

int mc13xxx_regulator_list_voltage(struct regulator_dev *rdev,
unsigned selector)
{
int id = rdev_get_id(rdev);
struct mc13xxx_regulator_priv *priv = rdev_get_drvdata(rdev);
struct mc13xxx_regulator *mc13xxx_regulators = priv->mc13xxx_regulators;

if (selector >= mc13xxx_regulators[id].desc.n_voltages)
return -EINVAL;

return mc13xxx_regulators[id].voltages[selector];
}
EXPORT_SYMBOL_GPL(mc13xxx_regulator_list_voltage);

static int mc13xxx_regulator_set_voltage_sel(struct regulator_dev *rdev,
unsigned selector)
{
Expand Down Expand Up @@ -135,14 +121,14 @@ static int mc13xxx_regulator_get_voltage(struct regulator_dev *rdev)

BUG_ON(val >= mc13xxx_regulators[id].desc.n_voltages);

return mc13xxx_regulators[id].voltages[val];
return rdev->desc->volt_table[val];
}

struct regulator_ops mc13xxx_regulator_ops = {
.enable = mc13xxx_regulator_enable,
.disable = mc13xxx_regulator_disable,
.is_enabled = mc13xxx_regulator_is_enabled,
.list_voltage = mc13xxx_regulator_list_voltage,
.list_voltage = regulator_list_voltage_table,
.set_voltage_sel = mc13xxx_regulator_set_voltage_sel,
.get_voltage = mc13xxx_regulator_get_voltage,
};
Expand All @@ -151,15 +137,13 @@ EXPORT_SYMBOL_GPL(mc13xxx_regulator_ops);
int mc13xxx_fixed_regulator_set_voltage(struct regulator_dev *rdev, int min_uV,
int max_uV, unsigned *selector)
{
struct mc13xxx_regulator_priv *priv = rdev_get_drvdata(rdev);
struct mc13xxx_regulator *mc13xxx_regulators = priv->mc13xxx_regulators;
int id = rdev_get_id(rdev);

dev_dbg(rdev_get_dev(rdev), "%s id: %d min_uV: %d max_uV: %d\n",
__func__, id, min_uV, max_uV);

if (min_uV <= mc13xxx_regulators[id].voltages[0] &&
mc13xxx_regulators[id].voltages[0] <= max_uV)
if (min_uV <= rdev->desc->volt_table[0] &&
rdev->desc->volt_table[0] <= max_uV)
return 0;
else
return -EINVAL;
Expand All @@ -168,21 +152,19 @@ EXPORT_SYMBOL_GPL(mc13xxx_fixed_regulator_set_voltage);

int mc13xxx_fixed_regulator_get_voltage(struct regulator_dev *rdev)
{
struct mc13xxx_regulator_priv *priv = rdev_get_drvdata(rdev);
struct mc13xxx_regulator *mc13xxx_regulators = priv->mc13xxx_regulators;
int id = rdev_get_id(rdev);

dev_dbg(rdev_get_dev(rdev), "%s id: %d\n", __func__, id);

return mc13xxx_regulators[id].voltages[0];
return rdev->desc->volt_table[0];
}
EXPORT_SYMBOL_GPL(mc13xxx_fixed_regulator_get_voltage);

struct regulator_ops mc13xxx_fixed_regulator_ops = {
.enable = mc13xxx_regulator_enable,
.disable = mc13xxx_regulator_disable,
.is_enabled = mc13xxx_regulator_is_enabled,
.list_voltage = mc13xxx_regulator_list_voltage,
.list_voltage = regulator_list_voltage_table,
.set_voltage = mc13xxx_fixed_regulator_set_voltage,
.get_voltage = mc13xxx_fixed_regulator_get_voltage,
};
Expand Down
9 changes: 3 additions & 6 deletions trunk/drivers/regulator/mc13xxx.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ struct mc13xxx_regulator {
int vsel_shift;
int vsel_mask;
int hi_bit;
int const *voltages;
};

struct mc13xxx_regulator_priv {
Expand All @@ -35,8 +34,6 @@ struct mc13xxx_regulator_priv {

extern int mc13xxx_sw_regulator(struct regulator_dev *rdev);
extern int mc13xxx_sw_regulator_is_enabled(struct regulator_dev *rdev);
extern int mc13xxx_regulator_list_voltage(struct regulator_dev *rdev,
unsigned selector);
extern int mc13xxx_fixed_regulator_set_voltage(struct regulator_dev *rdev,
int min_uV, int max_uV, unsigned *selector);
extern int mc13xxx_fixed_regulator_get_voltage(struct regulator_dev *rdev);
Expand Down Expand Up @@ -68,6 +65,7 @@ extern struct regulator_ops mc13xxx_fixed_regulator_ops;
.desc = { \
.name = #_name, \
.n_voltages = ARRAY_SIZE(_voltages), \
.volt_table = _voltages, \
.ops = &_ops, \
.type = REGULATOR_VOLTAGE, \
.id = prefix ## _name, \
Expand All @@ -78,37 +76,36 @@ extern struct regulator_ops mc13xxx_fixed_regulator_ops;
.vsel_reg = prefix ## _vsel_reg, \
.vsel_shift = prefix ## _vsel_reg ## _ ## _name ## VSEL,\
.vsel_mask = prefix ## _vsel_reg ## _ ## _name ## VSEL_M,\
.voltages = _voltages, \
}

#define MC13xxx_FIXED_DEFINE(prefix, _name, _reg, _voltages, _ops) \
[prefix ## _name] = { \
.desc = { \
.name = #_name, \
.n_voltages = ARRAY_SIZE(_voltages), \
.volt_table = _voltages, \
.ops = &_ops, \
.type = REGULATOR_VOLTAGE, \
.id = prefix ## _name, \
.owner = THIS_MODULE, \
}, \
.reg = prefix ## _reg, \
.enable_bit = prefix ## _reg ## _ ## _name ## EN, \
.voltages = _voltages, \
}

#define MC13xxx_GPO_DEFINE(prefix, _name, _reg, _voltages, _ops) \
[prefix ## _name] = { \
.desc = { \
.name = #_name, \
.n_voltages = ARRAY_SIZE(_voltages), \
.volt_table = _voltages, \
.ops = &_ops, \
.type = REGULATOR_VOLTAGE, \
.id = prefix ## _name, \
.owner = THIS_MODULE, \
}, \
.reg = prefix ## _reg, \
.enable_bit = prefix ## _reg ## _ ## _name ## EN, \
.voltages = _voltages, \
}

#define MC13xxx_DEFINE_SW(_name, _reg, _vsel_reg, _voltages, ops) \
Expand Down

0 comments on commit 610bcf7

Please sign in to comment.