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

Commit b3590040 authored by Subbaraman Narayanamurthy's avatar Subbaraman Narayanamurthy Committed by David Collins
Browse files

regulator: fan53555: add support to disable suspend voltage configuration



Currently, fan53555 regulator driver always registers for
set_suspend_voltage. This force configures the regulator to
set suspend voltage switching to a different voltage selector.
However, this might not be preferred for certain applications.

Add a device tree parameter "fcs,disable-suspend" for the
regulator which when specified will disable suspend voltage
configuration.

CRs-Fixed: 968575
Change-Id: Ib9f450126482e606f3e057857b7a58800583519a
Signed-off-by: default avatarSubbaraman Narayanamurthy <subbaram@codeaurora.org>
parent 5da0024b
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -11,6 +11,10 @@ Optional properties:
		voltage. The other one is used for the runtime voltage setting
		Possible values are either <0> or <1>
  - vin-supply: regulator supplying the vin pin
  - fcs,disable-suspend: Boolean flag which specifies if suspend voltage
		configuration should be avoided. If this property is present,
		then the voltage selector register defined by
		fcs,suspend-voltage-selector should not be modified at runtime.

Example:

@@ -29,4 +33,5 @@ Example:
		regulator-min-microvolt = <600000>;
		regulator-max-microvolt = <1230000>;
		fcs,suspend-voltage-selector = <1>;
		fcs,disable-suspend;
	};
+6 −0
Original line number Diff line number Diff line
@@ -99,6 +99,8 @@ struct fan53555_device_info {
	unsigned int slew_rate;
	/* Sleep voltage cache */
	unsigned int sleep_vol_cache;
	/* Disable suspend */
	bool disable_suspend;
};

static int fan53555_set_suspend_voltage(struct regulator_dev *rdev, int uV)
@@ -106,6 +108,8 @@ static int fan53555_set_suspend_voltage(struct regulator_dev *rdev, int uV)
	struct fan53555_device_info *di = rdev_get_drvdata(rdev);
	int ret;

	if (di->disable_suspend)
		return 0;
	if (di->sleep_vol_cache == uV)
		return 0;
	ret = regulator_map_voltage_linear(rdev, uV, uV);
@@ -368,6 +372,8 @@ static int fan53555_parse_dt(struct fan53555_device_info *di,
	if (!ret)
		pdata->sleep_vsel_id = tmp;

	di->disable_suspend = of_property_read_bool(np, "fcs,disable-suspend");

	return ret;
}