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

Commit f38a3fad authored by Fenglin Wu's avatar Fenglin Wu Committed by Anirudh Ghayal
Browse files

regulator: cpr-regulator: Add wildcard for matching some fuse bits values



Add wildcard 0xffffffff for matching arbitrary speed bin and PVS version
values in qcom,cpr-speed-bin-max-corners,
qcom,cpr-voltage-ceiling-override and qcom,cpr-voltage-floor-override
properties.

Change-Id: I69505c9e1b397d1fa01ee4cf47cc178a77ddf02b
Signed-off-by: default avatarFenglin Wu <fenglinw@codeaurora.org>
parent dcf4a3a9
Loading
Loading
Loading
Loading
+12 −12
Original line number Diff line number Diff line
@@ -318,10 +318,10 @@ Optional properties:
				the maximum virtual voltage corner corresponding to each fuse corner.  The value N
				corresponds to the number of fuse corners specified by qcom,cpr-fuse-corners.
				The elements in one tuple are:
				[0]: =>		the speed bin of the CPU. If the device doesn't have a speed bin,
						fuse, then set the value to 0xFFFFFFFF.
				[1]: =>		the PVS version of the CPU. If the device doesn't have a PVS version
						fuse, then set the value to 0.
				[0]: =>		the speed bin of the CPU. It may use the value 0xffffffff as a
						wildcard to match any speed bin values.
				[1]: =>		the PVS version of the CPU. It may use the value 0xffffffff as
						a wildcard to match any PVS version values.
				[2 - N+1]: =>	the max virtual voltage corner value corresponding to each fuse corner
						for this speed bin, ordered from lowest voltage corner to highest
						voltage corner.
@@ -352,10 +352,10 @@ Optional properties:
				corresponds to the number of virtual corners as specified by the number of elements
				in the qcom,cpr-corner-map property.
				The elements in one tuple are:
				[0]: =>		the speed bin of the CPU. If the device doesn't have a speed bin
						fuse, then set the value to 0xFFFFFFFF.
				[1]: =>		the PVS version of the CPU. If the device doesn't have a PVS version
						fuse, then set the value to 0.
				[0]: =>		the speed bin of the CPU. It may use the value 0xffffffff as a
						wildcard to match any speed bin values.
				[1]: =>		the PVS version of the CPU. It may use the value 0xffffffff as a
						wildcard to match any PVS version values.
				[2 - N+1]: =>	the ceiling voltage value in microvolts corresponding to each virtual
						corner for this speed bin, ordered from lowest voltage corner to
						highest voltage corner.
@@ -370,10 +370,10 @@ Optional properties:
				corresponds to the number of virtual corners as specified by the number of elements
				in the qcom,cpr-corner-map property.
				The elements in one tuple are:
				[0]: =>		the speed bin of the CPU. If the device doesn't have a speed bin
						fuse, then set the value to 0xFFFFFFFF.
				[1]: =>		the PVS version of the CPU. If the device doesn't have a PVS version
						fuse, then set the value to 0.
				[0]: =>		the speed bin of the CPU. It may use the value 0xffffffff as a
						wildcard to match any speed bin values.
				[1]: =>		the PVS version of the CPU. It may use the value 0xffffffff as a
						wildcard to match any PVS version values.
				[2 - N+1]: =>	the floor voltage value in microvolts corresponding to each virtual
						corner for this speed bin, ordered from lowest voltage corner to
						highest voltage corner.
+21 −18
Original line number Diff line number Diff line
@@ -2173,16 +2173,18 @@ static int cpr_get_corner_quot_adjustment(struct cpr_regulator *cpr_vreg,
	 */
	match_found = false;
	for (i = 0; i < size; i += cpr_vreg->num_fuse_corners + 2) {
		if (tmp[i] == cpr_vreg->speed_bin &&
		    tmp[i + 1] == cpr_vreg->pvs_version) {
		if (tmp[i] != cpr_vreg->speed_bin &&
		    tmp[i] != FUSE_PARAM_MATCH_ANY)
			continue;
		if (tmp[i + 1] != cpr_vreg->pvs_version &&
		    tmp[i + 1] != FUSE_PARAM_MATCH_ANY)
			continue;
		for (j = CPR_FUSE_CORNER_MIN;
		     j <= cpr_vreg->num_fuse_corners; j++)
				corner_max[j]
					= tmp[i + 2 + j - CPR_FUSE_CORNER_MIN];
			corner_max[j] = tmp[i + 2 + j - CPR_FUSE_CORNER_MIN];
		match_found = true;
		break;
	}
	}
	kfree(tmp);

	if (!match_found) {
@@ -2970,16 +2972,17 @@ static int cpr_fill_override_voltage(struct cpr_regulator *cpr_vreg,
	 * and pvs_version values.
	 */
	for (i = 0; i < size; i += cpr_vreg->num_corners + 2) {
		if (tmp[i] == cpr_vreg->speed_bin &&
		    tmp[i + 1] == cpr_vreg->pvs_version) {
			for (j = CPR_CORNER_MIN;
			     j <= cpr_vreg->num_corners; j++)
				virtual_limit[j]
					= tmp[i + 2 + j - CPR_FUSE_CORNER_MIN];
		if (tmp[i] != cpr_vreg->speed_bin &&
		    tmp[i] != FUSE_PARAM_MATCH_ANY)
			continue;
		if (tmp[i + 1] != cpr_vreg->pvs_version &&
		    tmp[i + 1] != FUSE_PARAM_MATCH_ANY)
			continue;
		for (j = CPR_CORNER_MIN; j <= cpr_vreg->num_corners; j++)
			virtual_limit[j] = tmp[i + 2 + j - CPR_FUSE_CORNER_MIN];
		match_found = true;
		break;
	}
	}
	kfree(tmp);

	if (!match_found)