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

Commit 8e42fe31 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: rpm-regulator-smd: fix request suppression policy"

parents 61c9e085 706635fc
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -32,6 +32,10 @@ Optional properties:
- qcom,enable-time:    Time in us to delay after enabling the regulator
- qcom,hpm-min-load:   Load current in uA which corresponds to the minimum load
			which requires the regulator to be in high power mode.
- qcom,apps-only:      Flag which indicates that the regulator only has
			consumers on the application processor. If this flag
			is specified, then voltage and current updates are
			only sent to the RPM if the regulator is enabled.

[Second Level Nodes]

@@ -84,6 +88,7 @@ Optional properties:
				current updates are only sent if the given
				regulator has also been enabled by a Linux
				consumer.

The following properties specify initial values for parameters to be sent to the
RPM in regulator requests.
- qcom,init-enable:            0 = regulator disabled
+20 −4
Original line number Diff line number Diff line
@@ -163,6 +163,7 @@ struct rpm_vreg {
	struct mutex		mlock;
	unsigned long		flags;
	bool			sleep_request_sent;
	bool			apps_only;
	struct msm_rpm_request	*handle_active;
	struct msm_rpm_request	*handle_sleep;
};
@@ -241,6 +242,16 @@ static inline bool rpm_vreg_active_or_sleep_enabled(struct rpm_vreg *rpm_vreg)
					& BIT(RPM_REGULATOR_PARAM_ENABLE)));
}

static inline bool rpm_vreg_shared_active_or_sleep_enabled_valid
						(struct rpm_vreg *rpm_vreg)
{
	return !rpm_vreg->apps_only &&
		((rpm_vreg->aggr_req_active.valid
					& BIT(RPM_REGULATOR_PARAM_ENABLE))
		 || (rpm_vreg->aggr_req_sleep.valid
					& BIT(RPM_REGULATOR_PARAM_ENABLE)));
}

/*
 * This is used when voting for LPM or HPM by subtracting or adding to the
 * hpm_min_load of a regulator.  It has units of uA.
@@ -660,7 +671,8 @@ static int rpm_vreg_set_voltage(struct regulator_dev *rdev, int min_uV,
	 * if the regulator has been configured to always send voltage updates.
	 */
	if (reg->always_send_voltage
	    || rpm_vreg_active_or_sleep_enabled(reg->rpm_vreg))
	    || rpm_vreg_active_or_sleep_enabled(reg->rpm_vreg)
	    || rpm_vreg_shared_active_or_sleep_enabled_valid(reg->rpm_vreg))
		rc = rpm_vreg_aggregate_requests(reg);

	if (rc) {
@@ -719,7 +731,8 @@ static int rpm_vreg_set_voltage_corner(struct regulator_dev *rdev, int min_uV,
	 * updates.
	 */
	if (reg->always_send_voltage
	    || rpm_vreg_active_or_sleep_enabled(reg->rpm_vreg))
	    || rpm_vreg_active_or_sleep_enabled(reg->rpm_vreg)
	    || rpm_vreg_shared_active_or_sleep_enabled_valid(reg->rpm_vreg))
		rc = rpm_vreg_aggregate_requests(reg);

	if (rc) {
@@ -774,7 +787,8 @@ static int rpm_vreg_set_voltage_floor_corner(struct regulator_dev *rdev,
	 * voltage updates.
	 */
	if (reg->always_send_voltage
	    || rpm_vreg_active_or_sleep_enabled(reg->rpm_vreg))
	    || rpm_vreg_active_or_sleep_enabled(reg->rpm_vreg)
	    || rpm_vreg_shared_active_or_sleep_enabled_valid(reg->rpm_vreg))
		rc = rpm_vreg_aggregate_requests(reg);

	if (rc) {
@@ -829,7 +843,8 @@ static int rpm_vreg_set_mode(struct regulator_dev *rdev, unsigned int mode)
	 * current updates.
	 */
	if (reg->always_send_current
	    || rpm_vreg_active_or_sleep_enabled(reg->rpm_vreg))
	    || rpm_vreg_active_or_sleep_enabled(reg->rpm_vreg)
	    || rpm_vreg_shared_active_or_sleep_enabled_valid(reg->rpm_vreg))
		rc = rpm_vreg_aggregate_requests(reg);

	if (rc) {
@@ -1584,6 +1599,7 @@ static int rpm_vreg_resource_probe(struct platform_device *pdev)
	of_property_read_u32(node, "qcom,enable-time", &rpm_vreg->enable_time);
	of_property_read_u32(node, "qcom,hpm-min-load",
		&rpm_vreg->hpm_min_load);
	rpm_vreg->apps_only = of_property_read_bool(node, "qcom,apps-only");

	rpm_vreg->handle_active = msm_rpm_create_request(RPM_SET_ACTIVE,
		resource_type, rpm_vreg->resource_id, RPM_REGULATOR_PARAM_MAX);