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

Commit 1f6bfc5a authored by Harshdeep Dhatt's avatar Harshdeep Dhatt
Browse files

devfreq: Restrict gpu governors to gpu devfreq devices



These governors should fail if being set for any device
other than the gpu device. Do this by checking that the
devfreq device for which this governor is being set for
has the gpu device as it's parent device.

The vbif_bw governor immutable attribute is used
to restrict it being set for only gpu devfreq devices.
Because we don't intend to change the governor for
the devfreq devices which have this governor set as
default.

Change-Id: I391557c0d52a1f4ffba70e010401a0769587dea0
Signed-off-by: default avatarHarshdeep Dhatt <hdhatt@codeaurora.org>
parent 07c19948
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -115,6 +115,8 @@ static int devfreq_vbif_ev_handler(struct devfreq *devfreq,

static struct devfreq_governor devfreq_vbif = {
	.name = "bw_vbif",
	/* Restrict this governor to only gpu devfreq devices */
	.immutable = 1,
	.get_target_freq = devfreq_vbif_get_freq,
	.event_handler = devfreq_vbif_ev_handler,
};
+9 −0
Original line number Diff line number Diff line
@@ -6,6 +6,7 @@
#include <linux/devfreq.h>
#include <linux/module.h>
#include <linux/msm_adreno_devfreq.h>
#include <linux/of_platform.h>
#include <linux/slab.h>

#include "devfreq_trace.h"
@@ -208,6 +209,14 @@ static int devfreq_gpubw_event_handler(struct devfreq *devfreq,
{
	int result = 0;
	unsigned long freq;
	struct device_node *node = devfreq->dev.parent->of_node;

	/*
	 * We want to restrict this governor be set only for
	 * gpu devfreq devices.
	 */
	if (!of_device_is_compatible(node, "qcom,kgsl-busmon"))
		return -EINVAL;

	mutex_lock(&devfreq->lock);
	freq = devfreq->previous_freq;
+12 −4
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@
#include <asm/cacheflush.h>
#include <soc/qcom/scm.h>
#include <soc/qcom/qtee_shmbridge.h>
#include <linux/of_platform.h>
#include "governor.h"

static DEFINE_SPINLOCK(tz_lock);
@@ -552,11 +553,18 @@ static int tz_suspend(struct devfreq *devfreq)
static int tz_handler(struct devfreq *devfreq, unsigned int event, void *data)
{
	int result;
	struct msm_adreno_extended_profile *gpu_profile;
	struct device_node *node = devfreq->dev.parent->of_node;

	struct msm_adreno_extended_profile *gpu_profile = container_of(
					(devfreq->profile),
					struct msm_adreno_extended_profile,
					profile);
	/*
	 * We want to restrict this governor be set only for
	 * gpu devfreq devices.
	 */
	if (!of_device_is_compatible(node, "qcom,kgsl-3d0"))
		return -EINVAL;

	gpu_profile = container_of((devfreq->profile),
		struct msm_adreno_extended_profile, profile);

	switch (event) {
	case DEVFREQ_GOV_START: