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

Commit 43d3505b authored by David Collins's avatar David Collins Committed by Matt Wagantall
Browse files

regulator: rpm-smd-regulator: add support to send default requests



Add support for a boolean device tree property which can be
specified in order to cause default initial parameter values to
be sent to the RPM before any consumers have made their own
requests.  This feature can be used in situations where it is
not desirable to enable a RPM controlled regulator but where some
other SMD parameter must be sent.

Change-Id: Ic9ed813064b0d3e3884fc328af7cb6b8562b9dfe
Signed-off-by: default avatarDavid Collins <collinsd@codeaurora.org>
parent 6e9cc102
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -88,6 +88,12 @@ Optional properties:
				current updates are only sent if the given
				regulator has also been enabled by a Linux
				consumer.
- qcom,send-defaults:          Boolean flag which indicates that the initial
				parameter values should be sent to the RPM
				before consumers make their own requests.  If
				this flag is not specified, then initial
				parameters values will only be sent after some
				consumer makes a request.

The following properties specify initial values for parameters to be sent to the
RPM in regulator requests.
+21 −0
Original line number Diff line number Diff line
@@ -893,6 +893,19 @@ static int rpm_vreg_enable_time(struct regulator_dev *rdev)
	return reg->rpm_vreg->enable_time;
}

static int rpm_vreg_send_defaults(struct rpm_regulator *reg)
{
	int rc;

	rpm_vreg_lock(reg->rpm_vreg);
	rc = rpm_vreg_aggregate_requests(reg);
	if (rc)
		vreg_err(reg, "RPM request failed, rc=%d", rc);
	rpm_vreg_unlock(reg->rpm_vreg);

	return rc;
}

/**
 * rpm_regulator_get() - lookup and obtain a handle to an RPM regulator
 * @dev: device for regulator consumer
@@ -1500,6 +1513,14 @@ static int rpm_vreg_device_probe(struct platform_device *pdev)
	list_add(&reg->list, &rpm_vreg->reg_list);
	rpm_vreg_unlock(rpm_vreg);

	if (of_property_read_bool(node, "qcom,send-defaults")) {
		rc = rpm_vreg_send_defaults(reg);
		if (rc) {
			vreg_err(reg, "could not send defaults, rc=%d\n", rc);
			goto fail_remove_from_list;
		}
	}

	reg_config.dev = dev;
	reg_config.init_data = init_data;
	reg_config.of_node = node;