Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit fd4d3328 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
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
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -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 = <...>;
+1 −0
Original line number Diff line number Diff line
@@ -486,6 +486,7 @@ ab3100_regulator_desc[AB3100_NUM_REGULATORS] = {
		.id   = AB3100_BUCK,
		.ops  = &regulator_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,
+3 −2
Original line number Diff line number Diff line
@@ -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;
}
+1 −1
Original line number Diff line number Diff line
@@ -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));
+26 −12
Original line number Diff line number Diff line
@@ -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 = {
Loading