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

Commit daf3903c authored by Suman Tatiraju's avatar Suman Tatiraju
Browse files

PM / devfreq: Check for GPU busy time before sending the sample



Sometimes GPU busy time is very low during sampling. Accumulate
the statistics and send them with the next sample.

Change-Id: I77e568b48afc3a4922c7c341d9478705b7ae3a30
Signed-off-by: default avatarSuman Tatiraju <sumant@codeaurora.org>
parent c35ae825
Loading
Loading
Loading
Loading
+11 −5
Original line number Diff line number Diff line
/* Copyright (c) 2010-2013, The Linux Foundation. All rights reserved.
/* Copyright (c) 2010-2014, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -29,6 +29,10 @@ static DEFINE_SPINLOCK(tz_lock);
 * per frame for 60fps content.
 */
#define FLOOR		        5000
/*
 * MIN_BUSY is 1 msec for the sample to be sent
 */
#define MIN_BUSY		1000
#define LONG_FLOOR		50000
#define HIST			5
#define TARGET			80
@@ -116,11 +120,13 @@ static int tz_get_target_freq(struct devfreq *devfreq, unsigned long *freq,
	/*
	 * Do not waste CPU cycles running this algorithm if
	 * the GPU just started, or if less than FLOOR time
	 * has passed since the last run.
	 * has passed since the last run or the gpu hasn't been
	 * busier than MIN_BUSY.
	 */
	if ((stats.total_time == 0) ||
		(priv->bin.total_time < FLOOR)) {
		return 1;
		(priv->bin.total_time < FLOOR) ||
		(unsigned int) priv->bin.busy_time < MIN_BUSY) {
		return 0;
	}

	level = devfreq_get_freq_level(devfreq, stats.current_frequency);