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

Commit 7e1fc2b2 authored by Jordan Crouse's avatar Jordan Crouse Committed by Harshdeep Dhatt
Browse files

devfreq: Update the callback function for governor_bw_vbif



Update the callback function used by governor_bw_vbif to get the current
bandwidth settings from the GPU to include the IB, AB and an opaque
data pointer.

Change-Id: Ic0dedbad4ea9f0d85d99841d7f15c7be5eb63b8f
Signed-off-by: default avatarJordan Crouse <jcrouse@codeaurora.org>
Signed-off-by: default avatarHarshdeep Dhatt <hdhatt@codeaurora.org>
parent 28b0ded1
Loading
Loading
Loading
Loading
+13 −9
Original line number Diff line number Diff line
@@ -5,9 +5,12 @@

#include <linux/devfreq.h>
#include <linux/module.h>
#include <linux/msm_adreno_devfreq.h>

#include "governor.h"

unsigned long (*extern_get_bw)(void) = NULL;
static getbw_func extern_get_bw;
static void *extern_get_bw_data;
unsigned long *dev_ab;
static unsigned long dev_ib;

@@ -22,12 +25,12 @@ static struct devfreq *df;
static int devfreq_vbif_get_freq(struct devfreq *df,
				unsigned long *freq)
{
	/* If the IB isn't set yet, check if it should be non-zero. */
	if (!dev_ib && extern_get_bw) {
		dev_ib = extern_get_bw();
		if (dev_ab)
			*dev_ab = dev_ib / 4;
	}
	unsigned long ab, ib;

	extern_get_bw(&ib, &ab, extern_get_bw_data);

	dev_ib = ib;
	*dev_ab = ab;

	*freq = dev_ib;
	return 0;
@@ -38,9 +41,10 @@ static int devfreq_vbif_get_freq(struct devfreq *df,
 * value from legacy vbif based bus bandwidth governor.
 * This function is called by KGSL driver.
 */
void devfreq_vbif_register_callback(void *p)
void devfreq_vbif_register_callback(getbw_func func, void *data)
{
	extern_get_bw = p;
	extern_get_bw = func;
	extern_get_bw_data = data;
}

int devfreq_vbif_update_bw(unsigned long ib, unsigned long ab)
+7 −8
Original line number Diff line number Diff line
@@ -116,9 +116,10 @@ static void _record_pwrevent(struct kgsl_device *device,
/**
 * kgsl_get_bw() - Return latest msm bus IB vote
 */
static unsigned long kgsl_get_bw(void)
static void kgsl_get_bw(unsigned long *ib, unsigned long *ab, void *data)
{
	return ib_votes[last_vote_buslevel];
	*ib = ib_votes[last_vote_buslevel];
	*ab = 0;
}
#endif

@@ -1770,15 +1771,13 @@ static void kgsl_thermal_timer(struct timer_list *t)
}

#ifdef CONFIG_DEVFREQ_GOV_QCOM_GPUBW_MON
static int kgsl_pwrctrl_vbif_init(void)
static void kgsl_pwrctrl_vbif_init(struct kgsl_device *device)
{
	devfreq_vbif_register_callback(kgsl_get_bw);
	return 0;
	devfreq_vbif_register_callback(kgsl_get_bw, device);
}
#else
static int kgsl_pwrctrl_vbif_init(void)
static void kgsl_pwrctrl_vbif_init(struct kgsl_device *device)
{
	return 0;
}
#endif

@@ -2183,7 +2182,7 @@ int kgsl_pwrctrl_init(struct kgsl_device *device)
	spin_lock_init(&pwr->limits_lock);
	pwr->sysfs_pwr_limit = kgsl_pwr_limits_add(KGSL_DEVICE_3D0);

	kgsl_pwrctrl_vbif_init();
	kgsl_pwrctrl_vbif_init(device);

	/* temperature sensor name */
	of_property_read_string(pdev->dev.of_node, "qcom,tzone-name",
+4 −4
Original line number Diff line number Diff line
/* SPDX-License-Identifier: GPL-2.0 */
/*
 * Copyright (c) 2016-2017, The Linux Foundation. All rights reserved.
 * Copyright (c) 2016-2019, The Linux Foundation. All rights reserved.
 */

#ifndef MSM_ADRENO_DEVFREQ_H
@@ -82,9 +82,9 @@ struct msm_busmon_extended_profile {
	struct devfreq_dev_profile profile;
};

#ifdef CONFIG_DEVFREQ_GOV_QCOM_GPUBW_MON
typedef void(*getbw_func)(unsigned long *, unsigned long *, void *);

int devfreq_vbif_update_bw(unsigned long ib, unsigned long ab);
int devfreq_vbif_register_callback(void *callback);
#endif
void devfreq_vbif_register_callback(getbw_func func, void *data);

#endif