Skip to content

Commit

Permalink
Merge remote-tracking branches 'regulator/topic/s2mps11', 'regulator/…
Browse files Browse the repository at this point in the history
…topic/s5m8767', 'regulator/topic/stw481x-vmmc', 'regulator/topic/tps51632', 'regulator/topic/tps62360', 'regulator/topic/tps65910', 'regulator/topic/twl' and 'regulator/topic/wm831x' into regulator-linus
  • Loading branch information
Mark Brown committed Jan 23, 2014
9 parents a2a2be6 + 699b369 + ee5182b + 991a645 + 9d9339d + 541f597 + b8903eb + 3db3988 + 477b2ba commit 07b1980
Show file tree
Hide file tree
Showing 13 changed files with 140 additions and 122 deletions.
4 changes: 2 additions & 2 deletions Documentation/devicetree/bindings/mfd/tps65910.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Required properties:

The valid regulator-compatible values are:
tps65910: vrtc, vio, vdd1, vdd2, vdd3, vdig1, vdig2, vpll, vdac, vaux1,
vaux2, vaux33, vmmc
vaux2, vaux33, vmmc, vbb
tps65911: vrtc, vio, vdd1, vdd3, vddctrl, ldo1, ldo2, ldo3, ldo4, ldo5,
ldo6, ldo7, ldo8

Expand All @@ -38,7 +38,7 @@ Required properties:
vcc4-supply: VAUX1 and VAUX2 input.
vcc5-supply: VPLL and VDAC input.
vcc6-supply: VDIG1 and VDIG2 input.
vcc7-supply: VRTC input.
vcc7-supply: VRTC and VBB input.
vccio-supply: VIO input.
tps65911:
vcc1-supply: VDD1 input.
Expand Down
30 changes: 0 additions & 30 deletions drivers/mfd/sec-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,36 +79,6 @@ static struct of_device_id sec_dt_match[] = {
};
#endif

int sec_reg_read(struct sec_pmic_dev *sec_pmic, u8 reg, void *dest)
{
return regmap_read(sec_pmic->regmap_pmic, reg, dest);
}
EXPORT_SYMBOL_GPL(sec_reg_read);

int sec_bulk_read(struct sec_pmic_dev *sec_pmic, u8 reg, int count, u8 *buf)
{
return regmap_bulk_read(sec_pmic->regmap_pmic, reg, buf, count);
}
EXPORT_SYMBOL_GPL(sec_bulk_read);

int sec_reg_write(struct sec_pmic_dev *sec_pmic, u8 reg, u8 value)
{
return regmap_write(sec_pmic->regmap_pmic, reg, value);
}
EXPORT_SYMBOL_GPL(sec_reg_write);

int sec_bulk_write(struct sec_pmic_dev *sec_pmic, u8 reg, int count, u8 *buf)
{
return regmap_raw_write(sec_pmic->regmap_pmic, reg, buf, count);
}
EXPORT_SYMBOL_GPL(sec_bulk_write);

int sec_reg_update(struct sec_pmic_dev *sec_pmic, u8 reg, u8 val, u8 mask)
{
return regmap_update_bits(sec_pmic->regmap_pmic, reg, mask, val);
}
EXPORT_SYMBOL_GPL(sec_reg_update);

static bool s2mps11_volatile(struct device *dev, unsigned int reg)
{
switch (reg) {
Expand Down
2 changes: 0 additions & 2 deletions drivers/regulator/s2mps11.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,6 @@ static int s2mps11_regulator_set_voltage_time_sel(struct regulator_dev *rdev,
ramp_delay = s2mps11->ramp_delay2;
break;
case S2MPS11_BUCK3:
ramp_delay = s2mps11->ramp_delay34;
break;
case S2MPS11_BUCK4:
ramp_delay = s2mps11->ramp_delay34;
break;
Expand Down
99 changes: 56 additions & 43 deletions drivers/regulator/s5m8767.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <linux/mfd/samsung/core.h>
#include <linux/mfd/samsung/s5m8767.h>
#include <linux/regulator/of_regulator.h>
#include <linux/regmap.h>

#define S5M8767_OPMODE_NORMAL_MODE 0x1

Expand Down Expand Up @@ -120,8 +121,8 @@ static const struct sec_voltage_desc *reg_voltage_map[] = {
[S5M8767_BUCK4] = &buck_voltage_val2,
[S5M8767_BUCK5] = &buck_voltage_val1,
[S5M8767_BUCK6] = &buck_voltage_val1,
[S5M8767_BUCK7] = NULL,
[S5M8767_BUCK8] = NULL,
[S5M8767_BUCK7] = &buck_voltage_val3,
[S5M8767_BUCK8] = &buck_voltage_val3,
[S5M8767_BUCK9] = &buck_voltage_val3,
};

Expand Down Expand Up @@ -217,7 +218,7 @@ static int s5m8767_reg_is_enabled(struct regulator_dev *rdev)
{
struct s5m8767_info *s5m8767 = rdev_get_drvdata(rdev);
int ret, reg;
int mask = 0xc0, enable_ctrl;
int enable_ctrl;
unsigned int val;

ret = s5m8767_get_register(rdev, &reg, &enable_ctrl);
Expand All @@ -226,37 +227,38 @@ static int s5m8767_reg_is_enabled(struct regulator_dev *rdev)
else if (ret)
return ret;

ret = sec_reg_read(s5m8767->iodev, reg, &val);
ret = regmap_read(s5m8767->iodev->regmap_pmic, reg, &val);
if (ret)
return ret;

return (val & mask) == enable_ctrl;
return (val & S5M8767_ENCTRL_MASK) == enable_ctrl;
}

static int s5m8767_reg_enable(struct regulator_dev *rdev)
{
struct s5m8767_info *s5m8767 = rdev_get_drvdata(rdev);
int ret, reg;
int mask = 0xc0, enable_ctrl;
int enable_ctrl;

ret = s5m8767_get_register(rdev, &reg, &enable_ctrl);
if (ret)
return ret;

return sec_reg_update(s5m8767->iodev, reg, enable_ctrl, mask);
return regmap_update_bits(s5m8767->iodev->regmap_pmic, reg,
S5M8767_ENCTRL_MASK, enable_ctrl);
}

static int s5m8767_reg_disable(struct regulator_dev *rdev)
{
struct s5m8767_info *s5m8767 = rdev_get_drvdata(rdev);
int ret, reg;
int mask = 0xc0, enable_ctrl;
int ret, reg, enable_ctrl;

ret = s5m8767_get_register(rdev, &reg, &enable_ctrl);
if (ret)
return ret;

return sec_reg_update(s5m8767->iodev, reg, ~mask, mask);
return regmap_update_bits(s5m8767->iodev->regmap_pmic, reg,
S5M8767_ENCTRL_MASK, ~S5M8767_ENCTRL_MASK);
}

static int s5m8767_get_vsel_reg(int reg_id, struct s5m8767_info *s5m8767)
Expand Down Expand Up @@ -417,9 +419,12 @@ static struct regulator_ops s5m8767_ops = {
};

static struct regulator_ops s5m8767_buck78_ops = {
.list_voltage = regulator_list_voltage_linear,
.is_enabled = s5m8767_reg_is_enabled,
.enable = s5m8767_reg_enable,
.disable = s5m8767_reg_disable,
.get_voltage_sel = regulator_get_voltage_sel_regmap,
.set_voltage_sel = regulator_set_voltage_sel_regmap,
};

#define s5m8767_regulator_desc(_name) { \
Expand Down Expand Up @@ -745,17 +750,20 @@ static int s5m8767_pmic_probe(struct platform_device *pdev)
buck_init = s5m8767_convert_voltage_to_sel(&buck_voltage_val2,
pdata->buck2_init);

sec_reg_write(s5m8767->iodev, S5M8767_REG_BUCK2DVS2, buck_init);
regmap_write(s5m8767->iodev->regmap_pmic, S5M8767_REG_BUCK2DVS2,
buck_init);

buck_init = s5m8767_convert_voltage_to_sel(&buck_voltage_val2,
pdata->buck3_init);

sec_reg_write(s5m8767->iodev, S5M8767_REG_BUCK3DVS2, buck_init);
regmap_write(s5m8767->iodev->regmap_pmic, S5M8767_REG_BUCK3DVS2,
buck_init);

buck_init = s5m8767_convert_voltage_to_sel(&buck_voltage_val2,
pdata->buck4_init);

sec_reg_write(s5m8767->iodev, S5M8767_REG_BUCK4DVS2, buck_init);
regmap_write(s5m8767->iodev->regmap_pmic, S5M8767_REG_BUCK4DVS2,
buck_init);

for (i = 0; i < 8; i++) {
if (s5m8767->buck2_gpiodvs) {
Expand Down Expand Up @@ -837,71 +845,76 @@ static int s5m8767_pmic_probe(struct platform_device *pdev)

if (pdata->buck2_gpiodvs || pdata->buck3_gpiodvs ||
pdata->buck4_gpiodvs) {
sec_reg_update(s5m8767->iodev, S5M8767_REG_BUCK2CTRL,
(pdata->buck2_gpiodvs) ? (1 << 1) : (0 << 1),
1 << 1);
sec_reg_update(s5m8767->iodev, S5M8767_REG_BUCK3CTRL,
(pdata->buck3_gpiodvs) ? (1 << 1) : (0 << 1),
1 << 1);
sec_reg_update(s5m8767->iodev, S5M8767_REG_BUCK4CTRL,
(pdata->buck4_gpiodvs) ? (1 << 1) : (0 << 1),
1 << 1);
regmap_update_bits(s5m8767->iodev->regmap_pmic,
S5M8767_REG_BUCK2CTRL, 1 << 1,
(pdata->buck2_gpiodvs) ? (1 << 1) : (0 << 1));
regmap_update_bits(s5m8767->iodev->regmap_pmic,
S5M8767_REG_BUCK3CTRL, 1 << 1,
(pdata->buck3_gpiodvs) ? (1 << 1) : (0 << 1));
regmap_update_bits(s5m8767->iodev->regmap_pmic,
S5M8767_REG_BUCK4CTRL, 1 << 1,
(pdata->buck4_gpiodvs) ? (1 << 1) : (0 << 1));
}

/* Initialize GPIO DVS registers */
for (i = 0; i < 8; i++) {
if (s5m8767->buck2_gpiodvs) {
sec_reg_write(s5m8767->iodev, S5M8767_REG_BUCK2DVS1 + i,
s5m8767->buck2_vol[i]);
regmap_write(s5m8767->iodev->regmap_pmic,
S5M8767_REG_BUCK2DVS1 + i,
s5m8767->buck2_vol[i]);
}

if (s5m8767->buck3_gpiodvs) {
sec_reg_write(s5m8767->iodev, S5M8767_REG_BUCK3DVS1 + i,
s5m8767->buck3_vol[i]);
regmap_write(s5m8767->iodev->regmap_pmic,
S5M8767_REG_BUCK3DVS1 + i,
s5m8767->buck3_vol[i]);
}

if (s5m8767->buck4_gpiodvs) {
sec_reg_write(s5m8767->iodev, S5M8767_REG_BUCK4DVS1 + i,
s5m8767->buck4_vol[i]);
regmap_write(s5m8767->iodev->regmap_pmic,
S5M8767_REG_BUCK4DVS1 + i,
s5m8767->buck4_vol[i]);
}
}

if (s5m8767->buck2_ramp)
sec_reg_update(s5m8767->iodev, S5M8767_REG_DVSRAMP, 0x08, 0x08);
regmap_update_bits(s5m8767->iodev->regmap_pmic,
S5M8767_REG_DVSRAMP, 0x08, 0x08);

if (s5m8767->buck3_ramp)
sec_reg_update(s5m8767->iodev, S5M8767_REG_DVSRAMP, 0x04, 0x04);
regmap_update_bits(s5m8767->iodev->regmap_pmic,
S5M8767_REG_DVSRAMP, 0x04, 0x04);

if (s5m8767->buck4_ramp)
sec_reg_update(s5m8767->iodev, S5M8767_REG_DVSRAMP, 0x02, 0x02);
regmap_update_bits(s5m8767->iodev->regmap_pmic,
S5M8767_REG_DVSRAMP, 0x02, 0x02);

if (s5m8767->buck2_ramp || s5m8767->buck3_ramp
|| s5m8767->buck4_ramp) {
unsigned int val;
switch (s5m8767->ramp_delay) {
case 5:
sec_reg_update(s5m8767->iodev, S5M8767_REG_DVSRAMP,
0x40, 0xf0);
val = S5M8767_DVS_BUCK_RAMP_5;
break;
case 10:
sec_reg_update(s5m8767->iodev, S5M8767_REG_DVSRAMP,
0x90, 0xf0);
val = S5M8767_DVS_BUCK_RAMP_10;
break;
case 25:
sec_reg_update(s5m8767->iodev, S5M8767_REG_DVSRAMP,
0xd0, 0xf0);
val = S5M8767_DVS_BUCK_RAMP_25;
break;
case 50:
sec_reg_update(s5m8767->iodev, S5M8767_REG_DVSRAMP,
0xe0, 0xf0);
val = S5M8767_DVS_BUCK_RAMP_50;
break;
case 100:
sec_reg_update(s5m8767->iodev, S5M8767_REG_DVSRAMP,
0xf0, 0xf0);
val = S5M8767_DVS_BUCK_RAMP_100;
break;
default:
sec_reg_update(s5m8767->iodev, S5M8767_REG_DVSRAMP,
0x90, 0xf0);
val = S5M8767_DVS_BUCK_RAMP_10;
}
regmap_update_bits(s5m8767->iodev->regmap_pmic,
S5M8767_REG_DVSRAMP,
S5M8767_DVS_BUCK_RAMP_MASK,
val << S5M8767_DVS_BUCK_RAMP_SHIFT);
}

for (i = 0; i < pdata->num_regulators; i++) {
Expand Down
12 changes: 2 additions & 10 deletions drivers/regulator/stw481x-vmmc.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ static int stw481x_vmmc_regulator_probe(struct platform_device *pdev)
config.init_data = of_get_regulator_init_data(&pdev->dev,
pdev->dev.of_node);

stw481x->vmmc_regulator = regulator_register(&vmmc_regulator, &config);
stw481x->vmmc_regulator = devm_regulator_register(&pdev->dev,
&vmmc_regulator, &config);
if (IS_ERR(stw481x->vmmc_regulator)) {
dev_err(&pdev->dev,
"error initializing STw481x VMMC regulator\n");
Expand All @@ -85,14 +86,6 @@ static int stw481x_vmmc_regulator_probe(struct platform_device *pdev)
return 0;
}

static int stw481x_vmmc_regulator_remove(struct platform_device *pdev)
{
struct stw481x *stw481x = dev_get_platdata(&pdev->dev);

regulator_unregister(stw481x->vmmc_regulator);
return 0;
}

static const struct of_device_id stw481x_vmmc_match[] = {
{ .compatible = "st,stw481x-vmmc", },
{},
Expand All @@ -105,7 +98,6 @@ static struct platform_driver stw481x_vmmc_regulator_driver = {
.of_match_table = stw481x_vmmc_match,
},
.probe = stw481x_vmmc_regulator_probe,
.remove = stw481x_vmmc_regulator_remove,
};

module_platform_driver(stw481x_vmmc_regulator_driver);
30 changes: 15 additions & 15 deletions drivers/regulator/tps51632-regulator.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,16 @@
#define TPS51632_POWER_STATE_SINGLE_PHASE_CCM 0x1
#define TPS51632_POWER_STATE_SINGLE_PHASE_DCM 0x2

#define TPS51632_MIN_VOLATGE 500000
#define TPS51632_MAX_VOLATGE 1520000
#define TPS51632_VOLATGE_STEP_10mV 10000
#define TPS51632_VOLATGE_STEP_20mV 20000
#define TPS51632_MIN_VOLTAGE 500000
#define TPS51632_MAX_VOLTAGE 1520000
#define TPS51632_VOLTAGE_STEP_10mV 10000
#define TPS51632_VOLTAGE_STEP_20mV 20000
#define TPS51632_MAX_VSEL 0x7F
#define TPS51632_MIN_VSEL 0x19
#define TPS51632_DEFAULT_RAMP_DELAY 6000
#define TPS51632_VOLT_VSEL(uV) \
(DIV_ROUND_UP(uV - TPS51632_MIN_VOLATGE, \
TPS51632_VOLATGE_STEP_10mV) + \
(DIV_ROUND_UP(uV - TPS51632_MIN_VOLTAGE, \
TPS51632_VOLTAGE_STEP_10mV) + \
TPS51632_MIN_VSEL)

/* TPS51632 chip information */
Expand Down Expand Up @@ -243,9 +243,9 @@ static struct tps51632_regulator_platform_data *
pdata->dvfs_step_20mV = of_property_read_bool(np, "ti,dvfs-step-20mV");

pdata->base_voltage_uV = pdata->reg_init_data->constraints.min_uV ? :
TPS51632_MIN_VOLATGE;
TPS51632_MIN_VOLTAGE;
pdata->max_voltage_uV = pdata->reg_init_data->constraints.max_uV ? :
TPS51632_MAX_VOLATGE;
TPS51632_MAX_VOLTAGE;
return pdata;
}
#else
Expand Down Expand Up @@ -284,15 +284,15 @@ static int tps51632_probe(struct i2c_client *client,
}

if (pdata->enable_pwm_dvfs) {
if ((pdata->base_voltage_uV < TPS51632_MIN_VOLATGE) ||
(pdata->base_voltage_uV > TPS51632_MAX_VOLATGE)) {
if ((pdata->base_voltage_uV < TPS51632_MIN_VOLTAGE) ||
(pdata->base_voltage_uV > TPS51632_MAX_VOLTAGE)) {
dev_err(&client->dev, "Invalid base_voltage_uV setting\n");
return -EINVAL;
}

if ((pdata->max_voltage_uV) &&
((pdata->max_voltage_uV < TPS51632_MIN_VOLATGE) ||
(pdata->max_voltage_uV > TPS51632_MAX_VOLATGE))) {
((pdata->max_voltage_uV < TPS51632_MIN_VOLTAGE) ||
(pdata->max_voltage_uV > TPS51632_MAX_VOLTAGE))) {
dev_err(&client->dev, "Invalid max_voltage_uV setting\n");
return -EINVAL;
}
Expand All @@ -305,11 +305,11 @@ static int tps51632_probe(struct i2c_client *client,
}

tps->dev = &client->dev;
tps->desc.name = id->name;
tps->desc.name = client->name;
tps->desc.id = 0;
tps->desc.ramp_delay = TPS51632_DEFAULT_RAMP_DELAY;
tps->desc.min_uV = TPS51632_MIN_VOLATGE;
tps->desc.uV_step = TPS51632_VOLATGE_STEP_10mV;
tps->desc.min_uV = TPS51632_MIN_VOLTAGE;
tps->desc.uV_step = TPS51632_VOLTAGE_STEP_10mV;
tps->desc.linear_min_sel = TPS51632_MIN_VSEL;
tps->desc.n_voltages = TPS51632_MAX_VSEL + 1;
tps->desc.ops = &tps51632_dcdc_ops;
Expand Down
2 changes: 1 addition & 1 deletion drivers/regulator/tps62360-regulator.c
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ static int tps62360_probe(struct i2c_client *client,
dev_err(&client->dev, "Error: No device match found\n");
return -ENODEV;
}
chip_id = (int)match->data;
chip_id = (int)(long)match->data;
if (!pdata)
pdata = of_get_tps62360_platform_data(&client->dev);
} else if (id) {
Expand Down
Loading

0 comments on commit 07b1980

Please sign in to comment.