summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZiyan <jaraidaniel@gmail.com>2016-01-24 13:01:49 +0100
committerZiyan <jaraidaniel@gmail.com>2016-01-24 16:02:43 +0100
commit17b183085b9321f0dbdf48b5a73f6f32559ddb46 (patch)
treed5a175694532496a02bd6e7c3b7f94084aeeb8e1
parent9ce39213f4e21a5b080a101245ec63893e3e3a14 (diff)
downloadhardware_ti_omap4-17b183085b9321f0dbdf48b5a73f6f32559ddb46.zip
hardware_ti_omap4-17b183085b9321f0dbdf48b5a73f6f32559ddb46.tar.gz
hardware_ti_omap4-17b183085b9321f0dbdf48b5a73f6f32559ddb46.tar.bz2
sgxfreq: set correct frequency limit on omap4460/4470
Commit 5e398ba changes how the initial frequency limit is selected: instead of selecting the highest avaliable one, it hardcodes it to SYS_SGX_CLOCK_SPEED, which is defined as 307200000 Hz for SGX540_120. However, omap4460/4470 devices use 384000000 Hz, so we end up underclocking them. Instead of hardcoding these frequencies, let's just use them as a reference frequency, and use the first frequency that is less than or equal to the correct reference frequency. This way, we can ensure a safe frequency set on kernels with custom SGX clock frequencies enabled. Change-Id: Ic55be55dbb5c9d4a3807096209cdf07bbbdca719
-rw-r--r--pvr-source/services4/system/omap4/sgxfreq.c20
-rw-r--r--pvr-source/services4/system/omap4/sysconfig.h2
2 files changed, 21 insertions, 1 deletions
diff --git a/pvr-source/services4/system/omap4/sgxfreq.c b/pvr-source/services4/system/omap4/sgxfreq.c
index 56123ae..8d3e96f 100644
--- a/pvr-source/services4/system/omap4/sgxfreq.c
+++ b/pvr-source/services4/system/omap4/sgxfreq.c
@@ -208,6 +208,24 @@ static const struct attribute *sgxfreq_attributes[] = {
/************************ end sysfs interface ************************/
+static unsigned long __sgxfreq_get_max_safe_freq(void)
+{
+ int i;
+ unsigned long reference_freq = SYS_SGX_CLOCK_SPEED;
+ unsigned long freq;
+
+ if (!cpu_is_omap443x())
+ reference_freq = OMAP446X_447X_REFERNECE_FREQUENCY;
+
+ for (i = sfd.freq_cnt - 1; i >= 0; i--) {
+ freq = sfd.freq_list[i];
+ if (freq <= reference_freq)
+ return freq;
+ }
+
+ return reference_freq;
+}
+
static void __set_freq(void)
{
unsigned long freq;
@@ -334,7 +352,7 @@ int sgxfreq_init(struct device *dev)
rcu_read_unlock();
mutex_init(&sfd.freq_mutex);
- sfd.freq_limit = SYS_SGX_CLOCK_SPEED;
+ sfd.freq_limit = __sgxfreq_get_max_safe_freq();
sgxfreq_set_freq_request(sfd.freq_list[sfd.freq_cnt - 1]);
sfd.sgx_data.clk_on = false;
sfd.sgx_data.active = false;
diff --git a/pvr-source/services4/system/omap4/sysconfig.h b/pvr-source/services4/system/omap4/sysconfig.h
index 64f3187..5a9c8f1 100644
--- a/pvr-source/services4/system/omap4/sysconfig.h
+++ b/pvr-source/services4/system/omap4/sysconfig.h
@@ -51,6 +51,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#define SYS_SGX_CLOCK_SPEED 304742400
#endif
+#define OMAP446X_447X_REFERNECE_FREQUENCY 384000000
+
#define SYS_SGX_HWRECOVERY_TIMEOUT_FREQ (100) // 10ms (100hz)
#define SYS_SGX_PDS_TIMER_FREQ (1000) // 1ms (1000hz)