Commit fd4d3328 authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'regulator-3.6' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator

Pull regulator fixes from Mark Brown:
 "A bunch of fixes which are a combination of minor fixes that have been
  shaken down due to greater testing exposure, the biggest block of
  which are for the Palmas driver which hadn't had all the changes
  required for mainline properly tested when it was merged."

* tag 'regulator-3.6' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator:
  regulator: twl-regulator: fix up VINTANA1/VINTANA2
  regulator: core: request only valid gpio pins for regulator enable
  regulator: twl: Remove references to the twl4030 regulator
  regulator: gpio-regulator: Split setting of voltages and currents
  regulator: ab3100: add missing voltage table
  regulator: anatop: Fix wrong mask used in anatop_get_voltage_sel
  regulator: tps6586x: correct vin pin for sm0/sm1/sm2
  regulator: palmas: Fix palmas_probe error handling
  regulator: palmas: Call palmas_ldo_[read|write] in palmas_ldo_init
  regulator: palmas: Fix regmap offsets for PALMAS_REG_SMPS10 vsel_reg
  regulator: palmas: Fix calculating selector in palmas_map_voltage_ldo
parents d408ea2a 908d6d52
...@@ -9,9 +9,9 @@ Required properties: ...@@ -9,9 +9,9 @@ Required properties:
- regulators: list of regulators provided by this controller, must have - regulators: list of regulators provided by this controller, must have
property "regulator-compatible" to match their hardware counterparts: property "regulator-compatible" to match their hardware counterparts:
sm[0-2], ldo[0-9] and ldo_rtc sm[0-2], ldo[0-9] and ldo_rtc
- sm0-supply: The input supply for the SM0. - vin-sm0-supply: The input supply for the SM0.
- sm1-supply: The input supply for the SM1. - vin-sm1-supply: The input supply for the SM1.
- sm2-supply: The input supply for the SM2. - vin-sm2-supply: The input supply for the SM2.
- vinldo01-supply: The input supply for the LDO1 and LDO2 - vinldo01-supply: The input supply for the LDO1 and LDO2
- vinldo23-supply: The input supply for the LDO2 and LDO3 - vinldo23-supply: The input supply for the LDO2 and LDO3
- vinldo4-supply: The input supply for the LDO4 - vinldo4-supply: The input supply for the LDO4
...@@ -30,9 +30,9 @@ Example: ...@@ -30,9 +30,9 @@ Example:
#gpio-cells = <2>; #gpio-cells = <2>;
gpio-controller; gpio-controller;
sm0-supply = <&some_reg>; vin-sm0-supply = <&some_reg>;
sm1-supply = <&some_reg>; vin-sm1-supply = <&some_reg>;
sm2-supply = <&some_reg>; vin-sm2-supply = <&some_reg>;
vinldo01-supply = <...>; vinldo01-supply = <...>;
vinldo23-supply = <...>; vinldo23-supply = <...>;
vinldo4-supply = <...>; vinldo4-supply = <...>;
......
...@@ -486,6 +486,7 @@ ab3100_regulator_desc[AB3100_NUM_REGULATORS] = { ...@@ -486,6 +486,7 @@ ab3100_regulator_desc[AB3100_NUM_REGULATORS] = {
.id = AB3100_BUCK, .id = AB3100_BUCK,
.ops = &regulator_ops_variable_sleepable, .ops = &regulator_ops_variable_sleepable,
.n_voltages = ARRAY_SIZE(ldo_e_buck_typ_voltages), .n_voltages = ARRAY_SIZE(ldo_e_buck_typ_voltages),
.volt_table = ldo_e_buck_typ_voltages,
.type = REGULATOR_VOLTAGE, .type = REGULATOR_VOLTAGE,
.owner = THIS_MODULE, .owner = THIS_MODULE,
.enable_time = 1000, .enable_time = 1000,
......
...@@ -64,14 +64,15 @@ static int anatop_set_voltage_sel(struct regulator_dev *reg, unsigned selector) ...@@ -64,14 +64,15 @@ static int anatop_set_voltage_sel(struct regulator_dev *reg, unsigned selector)
static int anatop_get_voltage_sel(struct regulator_dev *reg) static int anatop_get_voltage_sel(struct regulator_dev *reg)
{ {
struct anatop_regulator *anatop_reg = rdev_get_drvdata(reg); struct anatop_regulator *anatop_reg = rdev_get_drvdata(reg);
u32 val; u32 val, mask;
if (!anatop_reg->control_reg) if (!anatop_reg->control_reg)
return -ENOTSUPP; return -ENOTSUPP;
val = anatop_read_reg(anatop_reg->mfd, anatop_reg->control_reg); val = anatop_read_reg(anatop_reg->mfd, anatop_reg->control_reg);
val = (val & ((1 << anatop_reg->vol_bit_width) - 1)) >> mask = ((1 << anatop_reg->vol_bit_width) - 1) <<
anatop_reg->vol_bit_shift; anatop_reg->vol_bit_shift;
val = (val & mask) >> anatop_reg->vol_bit_shift;
return val - anatop_reg->min_bit_val; return val - anatop_reg->min_bit_val;
} }
......
...@@ -3217,7 +3217,7 @@ regulator_register(const struct regulator_desc *regulator_desc, ...@@ -3217,7 +3217,7 @@ regulator_register(const struct regulator_desc *regulator_desc,
dev_set_drvdata(&rdev->dev, rdev); dev_set_drvdata(&rdev->dev, rdev);
if (config->ena_gpio) { if (config->ena_gpio && gpio_is_valid(config->ena_gpio)) {
ret = gpio_request_one(config->ena_gpio, ret = gpio_request_one(config->ena_gpio,
GPIOF_DIR_OUT | config->ena_gpio_flags, GPIOF_DIR_OUT | config->ena_gpio_flags,
rdev_get_name(rdev)); rdev_get_name(rdev));
......
...@@ -57,16 +57,17 @@ static int gpio_regulator_get_value(struct regulator_dev *dev) ...@@ -57,16 +57,17 @@ static int gpio_regulator_get_value(struct regulator_dev *dev)
return -EINVAL; return -EINVAL;
} }
static int gpio_regulator_set_value(struct regulator_dev *dev, static int gpio_regulator_set_voltage(struct regulator_dev *dev,
int min, int max, unsigned *selector) int min_uV, int max_uV,
unsigned *selector)
{ {
struct gpio_regulator_data *data = rdev_get_drvdata(dev); struct gpio_regulator_data *data = rdev_get_drvdata(dev);
int ptr, target = 0, state, best_val = INT_MAX; int ptr, target = 0, state, best_val = INT_MAX;
for (ptr = 0; ptr < data->nr_states; ptr++) for (ptr = 0; ptr < data->nr_states; ptr++)
if (data->states[ptr].value < best_val && if (data->states[ptr].value < best_val &&
data->states[ptr].value >= min && data->states[ptr].value >= min_uV &&
data->states[ptr].value <= max) { data->states[ptr].value <= max_uV) {
target = data->states[ptr].gpios; target = data->states[ptr].gpios;
best_val = data->states[ptr].value; best_val = data->states[ptr].value;
if (selector) if (selector)
...@@ -85,13 +86,6 @@ static int gpio_regulator_set_value(struct regulator_dev *dev, ...@@ -85,13 +86,6 @@ static int gpio_regulator_set_value(struct regulator_dev *dev,
return 0; return 0;
} }
static int gpio_regulator_set_voltage(struct regulator_dev *dev,
int min_uV, int max_uV,
unsigned *selector)
{
return gpio_regulator_set_value(dev, min_uV, max_uV, selector);
}
static int gpio_regulator_list_voltage(struct regulator_dev *dev, static int gpio_regulator_list_voltage(struct regulator_dev *dev,
unsigned selector) unsigned selector)
{ {
...@@ -106,7 +100,27 @@ static int gpio_regulator_list_voltage(struct regulator_dev *dev, ...@@ -106,7 +100,27 @@ static int gpio_regulator_list_voltage(struct regulator_dev *dev,
static int gpio_regulator_set_current_limit(struct regulator_dev *dev, static int gpio_regulator_set_current_limit(struct regulator_dev *dev,
int min_uA, int max_uA) int min_uA, int max_uA)
{ {
return gpio_regulator_set_value(dev, min_uA, max_uA, NULL); struct gpio_regulator_data *data = rdev_get_drvdata(dev);
int ptr, target = 0, state, best_val = 0;
for (ptr = 0; ptr < data->nr_states; ptr++)
if (data->states[ptr].value > best_val &&
data->states[ptr].value >= min_uA &&
data->states[ptr].value <= max_uA) {
target = data->states[ptr].gpios;
best_val = data->states[ptr].value;
}
if (best_val == 0)
return -EINVAL;
for (ptr = 0; ptr < data->nr_gpios; ptr++) {
state = (target & (1 << ptr)) >> ptr;
gpio_set_value(data->gpios[ptr].gpio, state);
}
data->state = target;
return 0;
} }
static struct regulator_ops gpio_regulator_voltage_ops = { static struct regulator_ops gpio_regulator_voltage_ops = {
......
...@@ -486,9 +486,12 @@ static int palmas_map_voltage_ldo(struct regulator_dev *rdev, ...@@ -486,9 +486,12 @@ static int palmas_map_voltage_ldo(struct regulator_dev *rdev,
{ {
int ret, voltage; int ret, voltage;
ret = ((min_uV - 900000) / 50000) + 1; if (min_uV == 0)
if (ret < 0) return 0;
return ret;
if (min_uV < 900000)
min_uV = 900000;
ret = DIV_ROUND_UP(min_uV - 900000, 50000) + 1;
/* Map back into a voltage to verify we're still in bounds */ /* Map back into a voltage to verify we're still in bounds */
voltage = palmas_list_voltage_ldo(rdev, ret); voltage = palmas_list_voltage_ldo(rdev, ret);
...@@ -586,7 +589,7 @@ static int palmas_ldo_init(struct palmas *palmas, int id, ...@@ -586,7 +589,7 @@ static int palmas_ldo_init(struct palmas *palmas, int id,
addr = palmas_regs_info[id].ctrl_addr; addr = palmas_regs_info[id].ctrl_addr;
ret = palmas_smps_read(palmas, addr, &reg); ret = palmas_ldo_read(palmas, addr, &reg);
if (ret) if (ret)
return ret; return ret;
...@@ -596,7 +599,7 @@ static int palmas_ldo_init(struct palmas *palmas, int id, ...@@ -596,7 +599,7 @@ static int palmas_ldo_init(struct palmas *palmas, int id,
if (reg_init->mode_sleep) if (reg_init->mode_sleep)
reg |= PALMAS_LDO1_CTRL_MODE_SLEEP; reg |= PALMAS_LDO1_CTRL_MODE_SLEEP;
ret = palmas_smps_write(palmas, addr, reg); ret = palmas_ldo_write(palmas, addr, reg);
if (ret) if (ret)
return ret; return ret;
...@@ -630,7 +633,7 @@ static __devinit int palmas_probe(struct platform_device *pdev) ...@@ -630,7 +633,7 @@ static __devinit int palmas_probe(struct platform_device *pdev)
ret = palmas_smps_read(palmas, PALMAS_SMPS_CTRL, &reg); ret = palmas_smps_read(palmas, PALMAS_SMPS_CTRL, &reg);
if (ret) if (ret)
goto err_unregister_regulator; return ret;
if (reg & PALMAS_SMPS_CTRL_SMPS12_SMPS123_EN) if (reg & PALMAS_SMPS_CTRL_SMPS12_SMPS123_EN)
pmic->smps123 = 1; pmic->smps123 = 1;
...@@ -676,7 +679,9 @@ static __devinit int palmas_probe(struct platform_device *pdev) ...@@ -676,7 +679,9 @@ static __devinit int palmas_probe(struct platform_device *pdev)
case PALMAS_REG_SMPS10: case PALMAS_REG_SMPS10:
pmic->desc[id].n_voltages = PALMAS_SMPS10_NUM_VOLTAGES; pmic->desc[id].n_voltages = PALMAS_SMPS10_NUM_VOLTAGES;
pmic->desc[id].ops = &palmas_ops_smps10; pmic->desc[id].ops = &palmas_ops_smps10;
pmic->desc[id].vsel_reg = PALMAS_SMPS10_CTRL; pmic->desc[id].vsel_reg =
PALMAS_BASE_TO_REG(PALMAS_SMPS_BASE,
PALMAS_SMPS10_CTRL);
pmic->desc[id].vsel_mask = SMPS10_VSEL; pmic->desc[id].vsel_mask = SMPS10_VSEL;
pmic->desc[id].enable_reg = pmic->desc[id].enable_reg =
PALMAS_BASE_TO_REG(PALMAS_SMPS_BASE, PALMAS_BASE_TO_REG(PALMAS_SMPS_BASE,
...@@ -778,8 +783,10 @@ static __devinit int palmas_probe(struct platform_device *pdev) ...@@ -778,8 +783,10 @@ static __devinit int palmas_probe(struct platform_device *pdev)
reg_init = pdata->reg_init[id]; reg_init = pdata->reg_init[id];
if (reg_init) { if (reg_init) {
ret = palmas_ldo_init(palmas, id, reg_init); ret = palmas_ldo_init(palmas, id, reg_init);
if (ret) if (ret) {
regulator_unregister(pmic->rdev[id]);
goto err_unregister_regulator; goto err_unregister_regulator;
}
} }
} }
} }
......
...@@ -240,14 +240,16 @@ static struct tps6586x_regulator tps6586x_regulator[] = { ...@@ -240,14 +240,16 @@ static struct tps6586x_regulator tps6586x_regulator[] = {
TPS6586X_LDO(LDO_9, "vinldo9", ldo, SUPPLYV6, 3, 3, ENE, 7, ENE, 7), TPS6586X_LDO(LDO_9, "vinldo9", ldo, SUPPLYV6, 3, 3, ENE, 7, ENE, 7),
TPS6586X_LDO(LDO_RTC, NULL, ldo, SUPPLYV4, 3, 3, V4, 7, V4, 7), TPS6586X_LDO(LDO_RTC, NULL, ldo, SUPPLYV4, 3, 3, V4, 7, V4, 7),
TPS6586X_LDO(LDO_1, "vinldo01", dvm, SUPPLYV1, 0, 5, ENC, 1, END, 1), TPS6586X_LDO(LDO_1, "vinldo01", dvm, SUPPLYV1, 0, 5, ENC, 1, END, 1),
TPS6586X_LDO(SM_2, "sm2", sm2, SUPPLYV2, 0, 5, ENC, 7, END, 7), TPS6586X_LDO(SM_2, "vin-sm2", sm2, SUPPLYV2, 0, 5, ENC, 7, END, 7),
TPS6586X_DVM(LDO_2, "vinldo23", dvm, LDO2BV1, 0, 5, ENA, 3, TPS6586X_DVM(LDO_2, "vinldo23", dvm, LDO2BV1, 0, 5, ENA, 3,
ENB, 3, VCC2, 6), ENB, 3, VCC2, 6),
TPS6586X_DVM(LDO_4, "vinldo4", ldo4, LDO4V1, 0, 5, ENC, 3, TPS6586X_DVM(LDO_4, "vinldo4", ldo4, LDO4V1, 0, 5, ENC, 3,
END, 3, VCC1, 6), END, 3, VCC1, 6),
TPS6586X_DVM(SM_0, "sm0", dvm, SM0V1, 0, 5, ENA, 1, ENB, 1, VCC1, 2), TPS6586X_DVM(SM_0, "vin-sm0", dvm, SM0V1, 0, 5, ENA, 1,
TPS6586X_DVM(SM_1, "sm1", dvm, SM1V1, 0, 5, ENA, 0, ENB, 0, VCC1, 0), ENB, 1, VCC1, 2),
TPS6586X_DVM(SM_1, "vin-sm1", dvm, SM1V1, 0, 5, ENA, 0,
ENB, 0, VCC1, 0),
}; };
/* /*
......
...@@ -1037,7 +1037,7 @@ TWL6025_ADJUSTABLE_LDO(LDO7, 0x74, 1000, 3300); ...@@ -1037,7 +1037,7 @@ TWL6025_ADJUSTABLE_LDO(LDO7, 0x74, 1000, 3300);
TWL6025_ADJUSTABLE_LDO(LDO6, 0x60, 1000, 3300); TWL6025_ADJUSTABLE_LDO(LDO6, 0x60, 1000, 3300);
TWL6025_ADJUSTABLE_LDO(LDOLN, 0x64, 1000, 3300); TWL6025_ADJUSTABLE_LDO(LDOLN, 0x64, 1000, 3300);
TWL6025_ADJUSTABLE_LDO(LDOUSB, 0x70, 1000, 3300); TWL6025_ADJUSTABLE_LDO(LDOUSB, 0x70, 1000, 3300);
TWL4030_FIXED_LDO(VINTANA2, 0x3f, 1500, 11, 100, 0x08); TWL4030_FIXED_LDO(VINTANA1, 0x3f, 1500, 11, 100, 0x08);
TWL4030_FIXED_LDO(VINTDIG, 0x47, 1500, 13, 100, 0x08); TWL4030_FIXED_LDO(VINTDIG, 0x47, 1500, 13, 100, 0x08);
TWL4030_FIXED_LDO(VUSB1V5, 0x71, 1500, 17, 100, 0x08); TWL4030_FIXED_LDO(VUSB1V5, 0x71, 1500, 17, 100, 0x08);
TWL4030_FIXED_LDO(VUSB1V8, 0x74, 1800, 18, 100, 0x08); TWL4030_FIXED_LDO(VUSB1V8, 0x74, 1800, 18, 100, 0x08);
...@@ -1048,7 +1048,6 @@ TWL6030_FIXED_LDO(VDAC, 0x64, 1800, 0); ...@@ -1048,7 +1048,6 @@ TWL6030_FIXED_LDO(VDAC, 0x64, 1800, 0);
TWL6030_FIXED_LDO(VUSB, 0x70, 3300, 0); TWL6030_FIXED_LDO(VUSB, 0x70, 3300, 0);
TWL6030_FIXED_LDO(V1V8, 0x16, 1800, 0); TWL6030_FIXED_LDO(V1V8, 0x16, 1800, 0);
TWL6030_FIXED_LDO(V2V1, 0x1c, 2100, 0); TWL6030_FIXED_LDO(V2V1, 0x1c, 2100, 0);
TWL6030_FIXED_RESOURCE(CLK32KG, 0x8C, 0);
TWL6025_ADJUSTABLE_SMPS(SMPS3, 0x34); TWL6025_ADJUSTABLE_SMPS(SMPS3, 0x34);
TWL6025_ADJUSTABLE_SMPS(SMPS4, 0x10); TWL6025_ADJUSTABLE_SMPS(SMPS4, 0x10);
TWL6025_ADJUSTABLE_SMPS(VIO, 0x16); TWL6025_ADJUSTABLE_SMPS(VIO, 0x16);
...@@ -1117,7 +1116,7 @@ static const struct of_device_id twl_of_match[] __devinitconst = { ...@@ -1117,7 +1116,7 @@ static const struct of_device_id twl_of_match[] __devinitconst = {
TWL6025_OF_MATCH("ti,twl6025-ldo6", LDO6), TWL6025_OF_MATCH("ti,twl6025-ldo6", LDO6),
TWL6025_OF_MATCH("ti,twl6025-ldoln", LDOLN), TWL6025_OF_MATCH("ti,twl6025-ldoln", LDOLN),
TWL6025_OF_MATCH("ti,twl6025-ldousb", LDOUSB), TWL6025_OF_MATCH("ti,twl6025-ldousb", LDOUSB),
TWLFIXED_OF_MATCH("ti,twl4030-vintana2", VINTANA2), TWLFIXED_OF_MATCH("ti,twl4030-vintana1", VINTANA1),
TWLFIXED_OF_MATCH("ti,twl4030-vintdig", VINTDIG), TWLFIXED_OF_MATCH("ti,twl4030-vintdig", VINTDIG),
TWLFIXED_OF_MATCH("ti,twl4030-vusb1v5", VUSB1V5), TWLFIXED_OF_MATCH("ti,twl4030-vusb1v5", VUSB1V5),
TWLFIXED_OF_MATCH("ti,twl4030-vusb1v8", VUSB1V8), TWLFIXED_OF_MATCH("ti,twl4030-vusb1v8", VUSB1V8),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment