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

Commit dc27af08 authored by Prakash Gupta's avatar Prakash Gupta Committed by Sunil Khatri
Browse files

iommu/arm-smmu: Add support for regulator deferred disable



In case of unmap call, regulator is enabled/disabled. This may introduce
additional delay. For clients who do not detach, it's not possible to keep
regulator vote while smmu is attached.
Add support for regulator deferred disable. The time delay for deferred
disable can be set using dt property qcom,deferred-regulator-disable-delay
in ms.

Change-Id: I462e1999bd81f6332169b24749632d7b247c75c5
Signed-off-by: default avatarPrakash Gupta <guptap@codeaurora.org>
parent 44f3113d
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -115,6 +115,12 @@ conditions.
		  supported as we are directly comparing client SID with ID bits
		  of SMR registers.

- qcom,deferred-regulator-disable-delay : The time delay for deferred regulator
                  disable in ms. In case of unmap call, regulator is
                  enabled/disabled. This may introduce additional delay. For
                  clients who do not detach, it's not possible to keep regulator
                  vote while smmu is attached. Type is <u32>.

- clocks        : List of clocks to be used during SMMU register access. See
                  Documentation/devicetree/bindings/clock/clock-bindings.txt
                  for information about the format. For each clock specified
+18 −3
Original line number Diff line number Diff line
@@ -407,6 +407,7 @@ struct arm_smmu_device {
	char				*bus_client_name;

	enum tz_smmu_device_id		sec_id;
	int				regulator_defer;
};

struct arm_smmu_cfg {
@@ -801,11 +802,19 @@ static int arm_smmu_unrequest_bus(struct arm_smmu_device *smmu)

static int arm_smmu_disable_regulators(struct arm_smmu_device *smmu)
{
	int ret = 0;

	arm_smmu_unprepare_clocks(smmu);
	arm_smmu_unrequest_bus(smmu);
	if (!smmu->gdsc)
		return 0;
	return regulator_disable(smmu->gdsc);

	if (smmu->gdsc) {
		ret = regulator_disable_deferred(smmu->gdsc,
						 smmu->regulator_defer);
		WARN(ret, "%s: Regulator disable failed\n",
			dev_name(smmu->dev));
	}

	return ret;
}

static int arm_smmu_enable_regulators(struct arm_smmu_device *smmu)
@@ -3320,6 +3329,12 @@ static int arm_smmu_init_regulators(struct arm_smmu_device *smmu)
	if (!of_get_property(dev->of_node, "vdd-supply", NULL))
		return 0;

	if (!of_property_read_u32(dev->of_node,
				  "qcom,deferred-regulator-disable-delay",
				  &(smmu->regulator_defer)))
		dev_info(dev, "regulator defer delay %d\n",
			smmu->regulator_defer);

	smmu->gdsc = devm_regulator_get(dev, "vdd");
	if (IS_ERR(smmu->gdsc))
		return PTR_ERR(smmu->gdsc);