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

Commit 34bcc8f7 authored by Kyle Piefer's avatar Kyle Piefer Committed by Gerrit - the friendly Code Review server
Browse files

msm: kgsl: Set VLVL values for GMU and GPU



The GPU and GMU need the VLVL values for their respective
operating levels to set up their frequency tables.
Register these values during probe with the OPP kernel
API. Since we are defining them ourselves, we no longer
need to disable unwanted OPPs in the code.

Change-Id: I1982ce7b55e53b0f368c98212032c67bac2439f0
Signed-off-by: default avatarKyle Piefer <kpiefer@codeaurora.org>
parent 4912a404
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -816,6 +816,18 @@ static int adreno_of_parse_pwrlevels(struct adreno_device *adreno_dev,
	struct kgsl_device *device = KGSL_DEVICE(adreno_dev);
	struct kgsl_pwrctrl *pwr = &device->pwrctrl;
	struct device_node *child;
	int ret;

	/* ADD the GPU OPP table if we define it */
	if (of_find_property(device->pdev->dev.of_node,
			"operating-points-v2", NULL)) {
		ret = dev_pm_opp_of_add_table(&device->pdev->dev);
		if (ret) {
			KGSL_CORE_ERR("Unable to set the GPU OPP table: %d\n",
					ret);
			return ret;
		}
	}

	pwr->num_pwrlevels = 0;

+16 −2
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@
#include <linux/pm_opp.h>
#include <linux/io.h>
#include <soc/qcom/cmd-db.h>
#include <dt-bindings/regulator/qcom,rpmh-regulator.h>

#include "kgsl_device.h"
#include "kgsl_gmu.h"
@@ -661,7 +662,8 @@ static int rpmh_arc_votes_init(struct gmu_device *gmu,
		}

		/* Values from OPP framework are offset by 1 */
		vlvl_tbl[i] = dev_pm_opp_get_voltage(opp) - 1;
		vlvl_tbl[i] = dev_pm_opp_get_voltage(opp)
				- RPMH_REGULATOR_LEVEL_OFFSET;
		dev_pm_opp_put(opp);
	}

@@ -857,10 +859,22 @@ static irqreturn_t hfi_irq_handler(int irq, void *data)

static int gmu_pwrlevel_probe(struct gmu_device *gmu, struct device_node *node)
{
	int ret;
	struct device_node *pwrlevel_node, *child;

	pwrlevel_node = of_find_node_by_name(node, "qcom,gmu-pwrlevels");
	/* Add the GMU OPP table if we define it */
	if (of_find_property(gmu->pdev->dev.of_node,
			"operating-points-v2", NULL)) {
		ret = dev_pm_opp_of_add_table(&gmu->pdev->dev);
		if (ret) {
			dev_err(&gmu->pdev->dev,
					"Unable to set the GMU OPP table: %d\n",
					ret);
			return ret;
		}
	}

	pwrlevel_node = of_find_node_by_name(node, "qcom,gmu-pwrlevels");
	if (pwrlevel_node == NULL) {
		dev_err(&gmu->pdev->dev, "Unable to find 'qcom,gmu-pwrlevels'\n");
		return -EINVAL;