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

Commit 789e0443 authored by Jordan Crouse's avatar Jordan Crouse
Browse files

msm: kgsl: Don't populate the OPP table if it already exists



If we query the OPP table when it doesn't exist we get an error. If
we populate it again with the same operating points we get an error.
So just skip the table create if it already exists and go with
whatever we have.

Change-Id: Ic0dedbad3d5bd24b35867a82873a6ece555d8314
Signed-off-by: default avatarJordan Crouse <jcrouse@codeaurora.org>
parent 2e72d893
Loading
Loading
Loading
Loading
+7 −40
Original line number Diff line number Diff line
@@ -779,52 +779,19 @@ static const struct of_device_id adreno_match_table[] = {
/* Dynamically build the OPP table for the GPU device */
static void adreno_build_opp_table(struct device *dev, struct kgsl_pwrctrl *pwr)
{
	struct dev_pm_opp *opp;
	unsigned long freq = 0;
	struct opp_table *table;
	int i;

	/*
	 * First an annoying step: Some targets have clock drivers that
	 * "helpfully" builds a OPP table for us but usually it is wrong.
	 * Go through and filter out unsupported frequencies
	 */

	for (;;) {
		opp = dev_pm_opp_find_freq_ceil(dev, &freq);

		if (IS_ERR(opp))
			break;

		dev_pm_opp_put(opp);

		for (i = 0; i < pwr->num_pwrlevels; i++) {
			if (freq == pwr->pwrlevels[i].gpu_freq)
				break;
		}

		if (i == pwr->num_pwrlevels)
			dev_pm_opp_remove(dev, freq);

		freq++;
	}

	/* Now add all of our supported frequencies into the tree */
	for (i = 0; i < pwr->num_pwrlevels; i++) {
		/*
		 * When we defer a probe the previous table will still be active
		 * don't add again to avoid duplicate OPP spam
		 */
		opp = dev_pm_opp_find_freq_exact(dev,
			pwr->pwrlevels[i].gpu_freq, true);

		if (!IS_ERR(opp)) {
			dev_pm_opp_put(opp);
			continue;
	table = dev_pm_opp_get_opp_table(dev);
	if (table) {
		dev_pm_opp_put_opp_table(table);
		return;
	}

	/* Add all the supported frequencies into the tree */
	for (i = 0; i < pwr->num_pwrlevels; i++)
		dev_pm_opp_add(dev, pwr->pwrlevels[i].gpu_freq, 0);
}
}

static int adreno_of_parse_pwrlevels(struct adreno_device *adreno_dev,
		struct device_node *node)