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

Commit ea781109 authored by Fenglin Wu's avatar Fenglin Wu
Browse files

regulator: tps65132: add low power mode control for enable pins



Add ti,en-gpio-lpm property to set the enable pins to input/pull
down state when the boost regulator being disabled. This can reduce the
rock bottom power numbers when system entering into sleep state with the
regulators disabled.

Take this chance to correct a typo of drive-strength property specified
in tps65132-en-pin pin group node for msm8916 QRD SKUH board.

Change-Id: I2c2df1f4893c31deeba02c3b2988d1157bdb7b61
Signed-off-by: default avatarFenglin Wu <fenglinw@codeaurora.org>
parent 70b9d27d
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -19,6 +19,8 @@ Optional properties:
			pinctrl for EN-pins.
			For details of pinctrl properties, please refer to:
			"Documentation/devicetree/bindings/pinctrl/pinctrl-bindings.txt"
  - ti,en-gpio-lpm:	A boolean flag to indicate if the enable pin is configured
			to low power mode (LPM) when the output is disabled.

Regulator child node required properties:
  - regulator-name:	A string used as a descriptive name for the regulator
+3 −2
Original line number Diff line number Diff line
@@ -51,8 +51,8 @@
		qcom,pin-func = <0>;

		tps65132_en_default: en-default {
			driver-strength = <2>;
			bias-disable;
			drive-strength = <2>;
			bias-pull-down;
		};
	};
};
@@ -116,6 +116,7 @@
		compatible = "ti,tps65132";
		reg = <0x3e>;
		i2c-pwr-supply = <&pm8916_l6>;
		ti,en-gpio-lpm;
		pinctrl-names = "default";
		pinctrl-0 = <&tps65132_en_default>;

+14 −2
Original line number Diff line number Diff line
@@ -59,6 +59,7 @@ struct tps65132_chip {
	u8				apps_cfg_bit_pos;
	u8				apps_dischg_val;
	bool				apps_dischg_cfg_postpone;
	bool				en_gpio_lpm;
};

#define TPS65132_REG_VPOS		0x00
@@ -99,9 +100,14 @@ static struct of_regulator_match tps65132_reg_matches[] = {
static int tps65132_regulator_disable(struct regulator_dev *rdev)
{
	struct tps65132_regulator *vreg = rdev_get_drvdata(rdev);
	struct tps65132_chip *chip = vreg->chip;

	if (chip->en_gpio_lpm)
		gpio_direction_input(vreg->en_gpio);
	else
		gpio_set_value_cansleep(vreg->en_gpio,
			vreg->gpio_flags & OF_GPIO_ACTIVE_LOW ? 1 : 0);

	vreg->is_enabled = false;

	return 0;
@@ -113,6 +119,10 @@ static int tps65132_regulator_enable(struct regulator_dev *rdev)
	struct tps65132_chip *chip = vreg->chip;
	int rc;

	if (chip->en_gpio_lpm)
		gpio_direction_output(vreg->en_gpio,
			vreg->gpio_flags & OF_GPIO_ACTIVE_LOW ? 0 : 1);
	else
		gpio_set_value_cansleep(vreg->en_gpio,
			vreg->gpio_flags & OF_GPIO_ACTIVE_LOW ? 0 : 1);
	vreg->is_enabled = true;
@@ -386,6 +396,8 @@ static int tps65132_parse_dt(struct tps65132_chip *chip,
			return rc;
		}
	}
	chip->en_gpio_lpm = of_property_read_bool(client->dev.of_node,
						"ti,en-gpio-lpm");

	for (i = 0; i < chip->num_regulators; i++) {
		match = &tps65132_reg_matches[i];