regulator: Updates for 3.6
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. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iQIcBAABAgAGBQJQLsN2AAoJEFJkBDiqVpZ4po4QAKdrLVeV3LgNQJEIbig+sDkx 7buj8nFez4RzjM0JOj7k1bJc4kDW8XaBSOsMEO2T4yFk7uEsAHfbusqeBwl3imQe I6bdoo5AClDzvkWIoPQ0ssuRv9DWj2s0B9S5QtMFL7WdnlQyaOCweResOcRyV0OJ 8CwoX9/oQszAEkpgjEF+CW40DLeaevogz0SQg4vMzYT5yzMUtYIVO2K+NDNMoTMg Kwc8mKj9feEP8ilkyM86iz2/YASMf3YP0Vj+VmZQ52BxFhDBytIZJk3xKqkuVNJg qd8TLMsF4gz2Jc+KtEWKOA0DW7N0DrE4SaweDOgNrL8A0odegOL5Hk7SQRv1c8BX qyJEBSS19L7OYW44gGrZG6pWdSI9PuThjaibzBd5J/PfbpTBMWCz8i7S9n2yMlil KyNWxrWiHY7y6xBii6qWtnU5sdVVqLfeQxLv++vPexy+DMROrUdN43oJef5eomY5 0SYo1ElPmb8EsTEX1DQqHEKEH3yTbrGzjgpyCtvhn/3+cmJwlBUJzxSSjsg13y1Z P72aQhuNBYjjeuTss0ZlX6luHUhlLB0x4DYnMs7E89CuqnJ2iBhVgnwRTpU6SS/E 2pZWYsfeHrraGYmiRdiOEUEvaVxtgXNrgobfSqyiz8jnzkM0GtwBPNXy0lLyMEzI 69vhwu3OjSKKSE0rYJ1B =gocn -----END PGP SIGNATURE----- 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
This commit is contained in:
commit
fd4d3328b2
|
@ -9,9 +9,9 @@ Required properties:
|
|||
- regulators: list of regulators provided by this controller, must have
|
||||
property "regulator-compatible" to match their hardware counterparts:
|
||||
sm[0-2], ldo[0-9] and ldo_rtc
|
||||
- sm0-supply: The input supply for the SM0.
|
||||
- sm1-supply: The input supply for the SM1.
|
||||
- sm2-supply: The input supply for the SM2.
|
||||
- vin-sm0-supply: The input supply for the SM0.
|
||||
- vin-sm1-supply: The input supply for the SM1.
|
||||
- vin-sm2-supply: The input supply for the SM2.
|
||||
- vinldo01-supply: The input supply for the LDO1 and LDO2
|
||||
- vinldo23-supply: The input supply for the LDO2 and LDO3
|
||||
- vinldo4-supply: The input supply for the LDO4
|
||||
|
@ -30,9 +30,9 @@ Example:
|
|||
#gpio-cells = <2>;
|
||||
gpio-controller;
|
||||
|
||||
sm0-supply = <&some_reg>;
|
||||
sm1-supply = <&some_reg>;
|
||||
sm2-supply = <&some_reg>;
|
||||
vin-sm0-supply = <&some_reg>;
|
||||
vin-sm1-supply = <&some_reg>;
|
||||
vin-sm2-supply = <&some_reg>;
|
||||
vinldo01-supply = <...>;
|
||||
vinldo23-supply = <...>;
|
||||
vinldo4-supply = <...>;
|
||||
|
|
|
@ -486,6 +486,7 @@ ab3100_regulator_desc[AB3100_NUM_REGULATORS] = {
|
|||
.id = AB3100_BUCK,
|
||||
.ops = ®ulator_ops_variable_sleepable,
|
||||
.n_voltages = ARRAY_SIZE(ldo_e_buck_typ_voltages),
|
||||
.volt_table = ldo_e_buck_typ_voltages,
|
||||
.type = REGULATOR_VOLTAGE,
|
||||
.owner = THIS_MODULE,
|
||||
.enable_time = 1000,
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
struct anatop_regulator *anatop_reg = rdev_get_drvdata(reg);
|
||||
u32 val;
|
||||
u32 val, mask;
|
||||
|
||||
if (!anatop_reg->control_reg)
|
||||
return -ENOTSUPP;
|
||||
|
||||
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;
|
||||
val = (val & mask) >> anatop_reg->vol_bit_shift;
|
||||
|
||||
return val - anatop_reg->min_bit_val;
|
||||
}
|
||||
|
|
|
@ -3217,7 +3217,7 @@ regulator_register(const struct regulator_desc *regulator_desc,
|
|||
|
||||
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,
|
||||
GPIOF_DIR_OUT | config->ena_gpio_flags,
|
||||
rdev_get_name(rdev));
|
||||
|
|
|
@ -57,16 +57,17 @@ static int gpio_regulator_get_value(struct regulator_dev *dev)
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
static int gpio_regulator_set_value(struct regulator_dev *dev,
|
||||
int min, int max, unsigned *selector)
|
||||
static int gpio_regulator_set_voltage(struct regulator_dev *dev,
|
||||
int min_uV, int max_uV,
|
||||
unsigned *selector)
|
||||
{
|
||||
struct gpio_regulator_data *data = rdev_get_drvdata(dev);
|
||||
int ptr, target = 0, state, best_val = INT_MAX;
|
||||
|
||||
for (ptr = 0; ptr < data->nr_states; ptr++)
|
||||
if (data->states[ptr].value < best_val &&
|
||||
data->states[ptr].value >= min &&
|
||||
data->states[ptr].value <= max) {
|
||||
data->states[ptr].value >= min_uV &&
|
||||
data->states[ptr].value <= max_uV) {
|
||||
target = data->states[ptr].gpios;
|
||||
best_val = data->states[ptr].value;
|
||||
if (selector)
|
||||
|
@ -85,13 +86,6 @@ static int gpio_regulator_set_value(struct regulator_dev *dev,
|
|||
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,
|
||||
unsigned selector)
|
||||
{
|
||||
|
@ -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,
|
||||
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 = {
|
||||
|
|
|
@ -486,9 +486,12 @@ static int palmas_map_voltage_ldo(struct regulator_dev *rdev,
|
|||
{
|
||||
int ret, voltage;
|
||||
|
||||
ret = ((min_uV - 900000) / 50000) + 1;
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
if (min_uV == 0)
|
||||
return 0;
|
||||
|
||||
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 */
|
||||
voltage = palmas_list_voltage_ldo(rdev, ret);
|
||||
|
@ -586,7 +589,7 @@ static int palmas_ldo_init(struct palmas *palmas, int id,
|
|||
|
||||
addr = palmas_regs_info[id].ctrl_addr;
|
||||
|
||||
ret = palmas_smps_read(palmas, addr, ®);
|
||||
ret = palmas_ldo_read(palmas, addr, ®);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
@ -596,7 +599,7 @@ static int palmas_ldo_init(struct palmas *palmas, int id,
|
|||
if (reg_init->mode_sleep)
|
||||
reg |= PALMAS_LDO1_CTRL_MODE_SLEEP;
|
||||
|
||||
ret = palmas_smps_write(palmas, addr, reg);
|
||||
ret = palmas_ldo_write(palmas, addr, reg);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
@ -630,7 +633,7 @@ static __devinit int palmas_probe(struct platform_device *pdev)
|
|||
|
||||
ret = palmas_smps_read(palmas, PALMAS_SMPS_CTRL, ®);
|
||||
if (ret)
|
||||
goto err_unregister_regulator;
|
||||
return ret;
|
||||
|
||||
if (reg & PALMAS_SMPS_CTRL_SMPS12_SMPS123_EN)
|
||||
pmic->smps123 = 1;
|
||||
|
@ -676,7 +679,9 @@ static __devinit int palmas_probe(struct platform_device *pdev)
|
|||
case PALMAS_REG_SMPS10:
|
||||
pmic->desc[id].n_voltages = PALMAS_SMPS10_NUM_VOLTAGES;
|
||||
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].enable_reg =
|
||||
PALMAS_BASE_TO_REG(PALMAS_SMPS_BASE,
|
||||
|
@ -778,8 +783,10 @@ static __devinit int palmas_probe(struct platform_device *pdev)
|
|||
reg_init = pdata->reg_init[id];
|
||||
if (reg_init) {
|
||||
ret = palmas_ldo_init(palmas, id, reg_init);
|
||||
if (ret)
|
||||
if (ret) {
|
||||
regulator_unregister(pmic->rdev[id]);
|
||||
goto err_unregister_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_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(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,
|
||||
ENB, 3, VCC2, 6),
|
||||
TPS6586X_DVM(LDO_4, "vinldo4", ldo4, LDO4V1, 0, 5, ENC, 3,
|
||||
END, 3, VCC1, 6),
|
||||
TPS6586X_DVM(SM_0, "sm0", dvm, SM0V1, 0, 5, ENA, 1, ENB, 1, VCC1, 2),
|
||||
TPS6586X_DVM(SM_1, "sm1", dvm, SM1V1, 0, 5, ENA, 0, ENB, 0, VCC1, 0),
|
||||
TPS6586X_DVM(SM_0, "vin-sm0", dvm, SM0V1, 0, 5, ENA, 1,
|
||||
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);
|
|||
TWL6025_ADJUSTABLE_LDO(LDO6, 0x60, 1000, 3300);
|
||||
TWL6025_ADJUSTABLE_LDO(LDOLN, 0x64, 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(VUSB1V5, 0x71, 1500, 17, 100, 0x08);
|
||||
TWL4030_FIXED_LDO(VUSB1V8, 0x74, 1800, 18, 100, 0x08);
|
||||
|
@ -1048,7 +1048,6 @@ TWL6030_FIXED_LDO(VDAC, 0x64, 1800, 0);
|
|||
TWL6030_FIXED_LDO(VUSB, 0x70, 3300, 0);
|
||||
TWL6030_FIXED_LDO(V1V8, 0x16, 1800, 0);
|
||||
TWL6030_FIXED_LDO(V2V1, 0x1c, 2100, 0);
|
||||
TWL6030_FIXED_RESOURCE(CLK32KG, 0x8C, 0);
|
||||
TWL6025_ADJUSTABLE_SMPS(SMPS3, 0x34);
|
||||
TWL6025_ADJUSTABLE_SMPS(SMPS4, 0x10);
|
||||
TWL6025_ADJUSTABLE_SMPS(VIO, 0x16);
|
||||
|
@ -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-ldoln", LDOLN),
|
||||
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-vusb1v5", VUSB1V5),
|
||||
TWLFIXED_OF_MATCH("ti,twl4030-vusb1v8", VUSB1V8),
|
||||
|
|
Loading…
Reference in a new issue