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

Commit 5b794bc0 authored by Kyle Piefer's avatar Kyle Piefer
Browse files

msm: kgsl: Fix voltage dependency table logic



ARC values might not always be unique and increasing.
If a voltage corner is deactivated, cmddb could reuse
values, causing strings of repeats in the list.
Fix potential incorrect counting of the values from
cmddb by stopping the count on hitting 0 padding
instead of on hitting a duplicate or lower value.

Also, look for a primary rail voltage greater than
or equal to a VLVL value instead of equal to, for
the same reason. Then use this value to find a
secondary rail value.

Change-Id: If5996b5d4a4319248f95be9138cd380db519a8a6
Signed-off-by: default avatarKyle Piefer <kpiefer@codeaurora.org>
parent 6dbbe7f7
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -708,7 +708,7 @@ static int rpmh_arc_cmds(struct gmu_device *gmu,
	 * zero padding.
	 */
	for (arc->num = 1; arc->num < (len >> 1); arc->num++) {
		if (arc->val[arc->num - 1] >= arc->val[arc->num])
		if (arc->val[arc->num - 1] != 0 &&  arc->val[arc->num] == 0)
			break;
	}

@@ -736,7 +736,7 @@ static int setup_volt_dependency_tbl(uint32_t *votes,
	bool found_match;

	/* i tracks current KGSL GPU frequency table entry
	 * j tracks second rail voltage table entry
	 * j tracks secondary rail voltage table entry
	 * k tracks primary rail voltage table entry
	 */
	for (i = 0; i < num_entries; i++) {
@@ -744,8 +744,8 @@ static int setup_volt_dependency_tbl(uint32_t *votes,

		/* Look for a primary rail voltage that matches a VLVL level */
		for (k = 0; k < pri_rail->num; k++) {
			if (pri_rail->val[k] == vlvl[i]) {
				cur_vlvl = vlvl[i];
			if (pri_rail->val[k] >= vlvl[i]) {
				cur_vlvl = pri_rail->val[k];
				found_match = true;
				break;
			}
@@ -769,7 +769,7 @@ static int setup_volt_dependency_tbl(uint32_t *votes,
		if (j == sec_rail->num)
			j = 0;

		votes[i] = ARC_VOTE_SET(k, j, vlvl[i]);
		votes[i] = ARC_VOTE_SET(k, j, cur_vlvl);
	}

	return 0;