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

Commit 421fb1fd authored by Lucille Sylvester's avatar Lucille Sylvester
Browse files

msm: kgsl: Set BIMC vote limits by reading the bus table



Currently a fixed number of BIMC votes are required per GPU
frequency.  Read the enumerated votes directly from the bus
table and set min/max limits on the votes dynamically.

Change-Id: I7d8118f658e6a8225291b8353301413252f1f3f7
Signed-off-by: default avatarLucille Sylvester <lsylvest@codeaurora.org>
parent 16103798
Loading
Loading
Loading
Loading
+24 −1
Original line number Diff line number Diff line
@@ -1015,6 +1015,7 @@ EXPORT_SYMBOL(kgsl_pwrctrl_irq);
int kgsl_pwrctrl_init(struct kgsl_device *device)
{
	int i, k, m, n = 0, result = 0;
	int freq_i;
	struct clk *clk;
	struct platform_device *pdev =
		container_of(device->parentdev, struct platform_device, dev);
@@ -1105,6 +1106,17 @@ int kgsl_pwrctrl_init(struct kgsl_device *device)

	/* Set if independent bus BW voting is supported */
	pwr->bus_control = pdata->bus_control;

	/*
	 * Set the range permitted for BIMC votes per-GPU frequency.
	 * For the moment assume the BIMC votes are listed in order
	 * per GPU frequency.  If this is no longer needed in the bus
	 * table the min/max values can be explicitly set in the dtsi
	 * file.
	 */
	freq_i = pwr->min_pwrlevel;
	pwr->pwrlevels[freq_i].bus_min = 1;

	/*
	 * Pull the BW vote out of the bus table.  They will be used to
	 * calculate the ratio between the votes.
@@ -1116,8 +1128,17 @@ int kgsl_pwrctrl_init(struct kgsl_device *device)
		if (vector->dst == MSM_BUS_SLAVE_EBI_CH0 &&
				vector->ib != 0) {
			for (k = 0; k < n; k++)
				if (vector->ib == pwr->bus_ib[k])
				if (vector->ib == pwr->bus_ib[k]) {
					static uint64_t last_ib = 0xFFFFFFFF;
					if (vector->ib <= last_ib) {
						pwr->pwrlevels[freq_i--].
							bus_max = i - 1;
						pwr->pwrlevels[freq_i].
							bus_min = i;
					}
					last_ib = vector->ib;
					break;
				}
			/* if this is a new ib value, save it */
			if (k == n) {
				pwr->bus_ib[k] = vector->ib;
@@ -1133,6 +1154,8 @@ int kgsl_pwrctrl_init(struct kgsl_device *device)
			}
		}
	}
	pwr->pwrlevels[freq_i].bus_max = i - 1;

	return result;

clk_err:
+8 −6
Original line number Diff line number Diff line
@@ -185,6 +185,7 @@ int kgsl_devfreq_target(struct device *dev, unsigned long *freq, u32 flags)
{
	struct kgsl_device *device = dev_get_drvdata(dev);
	struct kgsl_pwrctrl *pwr;
	struct kgsl_pwrlevel *pwr_level;
	int level, i, b;
	unsigned long cur_freq;

@@ -208,6 +209,7 @@ int kgsl_devfreq_target(struct device *dev, unsigned long *freq, u32 flags)
	mutex_lock(&device->mutex);
	cur_freq = kgsl_pwrctrl_active_freq(pwr);
	level = pwr->active_pwrlevel;
	pwr_level = &pwr->pwrlevels[level];

	if (*freq != cur_freq) {
		level = pwr->max_pwrlevel;
@@ -224,13 +226,13 @@ int kgsl_devfreq_target(struct device *dev, unsigned long *freq, u32 flags)
		 */
		b = pwr->bus_mod;
		if ((flags & DEVFREQ_FLAG_FAST_HINT) &&
			(pwr->bus_mod != FAST_BUS))
			pwr->bus_mod = (pwr->bus_mod == SLOW_BUS) ?
					0 : FAST_BUS;
			((pwr_level->bus_freq + pwr->bus_mod)
				< pwr_level->bus_max))
			pwr->bus_mod++;
		else if ((flags & DEVFREQ_FLAG_SLOW_HINT) &&
			(pwr->bus_mod != SLOW_BUS))
			pwr->bus_mod = (pwr->bus_mod == FAST_BUS) ?
					0 : SLOW_BUS;
			((pwr_level->bus_freq + pwr->bus_mod)
				> pwr_level->bus_min))
			pwr->bus_mod--;
		if (pwr->bus_mod != b)
			kgsl_pwrctrl_buslevel_update(device, true);
	}
+5 −1
Original line number Diff line number Diff line
@@ -54,12 +54,16 @@ struct kgsl_device_iommu_data {
 * struct kgsl_pwrlevel - Struct holding different pwrlevel info obtained from
 * from dtsi file
 * @gpu_freq:		GPU frequency vote in Hz
 * @bus_freq:		Bus bandwidth vote in Mbps
 * @bus_freq:		Bus bandwidth vote index
 * @bus_min:		Min bus index @gpu_freq
 * @bus_max:		Max bus index @gpu_freq
 * @io_fraction:	IO percetage vote to the CPU
 */
struct kgsl_pwrlevel {
	unsigned int gpu_freq;
	unsigned int bus_freq;
	unsigned int bus_min;
	unsigned int bus_max;
	unsigned int io_fraction;
};