aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJavi Merino <javi.merino@arm.com>2015-06-05 10:29:46 +0100
committerJon Medhurst <tixy@linaro.org>2016-02-04 16:05:31 +0000
commit7636b7fcb4e417e27d95277664f1044699225f44 (patch)
treeb5723ec4f67dee5a5032cb54e6305d1333dab4d0
parent49f67a2f73c090262e4a1dad2d56da029e75c816 (diff)
mali: make setting up the OPPs a weak function
Setting up the OPPs via a module relies on the module being loaded at the right time. For Juno that means that it has to be loaded after the SCPI clocks are loaded but before the core mali driver. Getting that ordering right is quite a pain and now that the SCPI is a platform driver, using module_init is a guarantee for failure, as it's always going to happen before any platform driver is loaded. Instead, make setting up the opps a function that the driver provides as a weak, dummy function that can be overridden by platforms providing a strong function if they need to set up OPPs. Signed-off-by: Javi Merino <javi.merino@arm.com> Signed-off-by: Jon Medhurst <tixy@linaro.org>
-rwxr-xr-xdrivers/gpu/arm/midgard/backend/gpu/mali_kbase_devfreq.c12
-rwxr-xr-xdrivers/gpu/arm/midgard/mali_kbase.h8
-rwxr-xr-xdrivers/gpu/arm/midgard/platform/juno_soc/juno_mali_opp.c7
3 files changed, 22 insertions, 5 deletions
diff --git a/drivers/gpu/arm/midgard/backend/gpu/mali_kbase_devfreq.c b/drivers/gpu/arm/midgard/backend/gpu/mali_kbase_devfreq.c
index f6367a1b19b3..274bd84536fc 100755
--- a/drivers/gpu/arm/midgard/backend/gpu/mali_kbase_devfreq.c
+++ b/drivers/gpu/arm/midgard/backend/gpu/mali_kbase_devfreq.c
@@ -135,14 +135,24 @@ kbase_devfreq_status(struct device *dev, struct devfreq_dev_status *stat)
return 0;
}
+/* Weak definition to be overriden by platforms */
+int __weak setup_opps(void)
+{
+ return 0;
+}
+
static int kbase_devfreq_init_freq_table(struct kbase_device *kbdev,
struct devfreq_dev_profile *dp)
{
- int count;
+ int err, count;
int i = 0;
unsigned long freq = 0;
struct dev_pm_opp *opp;
+ err = setup_opps();
+ if (err)
+ return err;
+
rcu_read_lock();
count = dev_pm_opp_get_opp_count(kbdev->dev);
if (count < 0) {
diff --git a/drivers/gpu/arm/midgard/mali_kbase.h b/drivers/gpu/arm/midgard/mali_kbase.h
index fe58341fdef8..6a4a77e15c20 100755
--- a/drivers/gpu/arm/midgard/mali_kbase.h
+++ b/drivers/gpu/arm/midgard/mali_kbase.h
@@ -350,6 +350,14 @@ void kbase_disjoint_state_down(struct kbase_device *kbdev);
#define UINT64_MAX ((uint64_t)0xFFFFFFFFFFFFFFFFULL)
#endif
+/**
+ * Platform-specific function to setup the OPPs for Mali
+ *
+ * Platform's can define this function if they need to setup the OPPs
+ * in a platform-specific way
+ */
+int setup_opps(void);
+
#if KBASE_TRACE_ENABLE
void kbasep_trace_debugfs_init(struct kbase_device *kbdev);
diff --git a/drivers/gpu/arm/midgard/platform/juno_soc/juno_mali_opp.c b/drivers/gpu/arm/midgard/platform/juno_soc/juno_mali_opp.c
index da390900c009..c33c84f0d259 100755
--- a/drivers/gpu/arm/midgard/platform/juno_soc/juno_mali_opp.c
+++ b/drivers/gpu/arm/midgard/platform/juno_soc/juno_mali_opp.c
@@ -32,6 +32,8 @@
#endif /* Linux >= 3.13 */
+#include <mali_kbase.h>
+
static int init_juno_opps_from_scpi(struct device *dev)
{
struct scpi_ops *scpi;
@@ -58,7 +60,7 @@ static int init_juno_opps_from_scpi(struct device *dev)
return 0;
}
-static int juno_setup_opps(void)
+int setup_opps(void)
{
struct device_node *np;
struct platform_device *pdev;
@@ -83,6 +85,3 @@ static int juno_setup_opps(void)
return err;
}
-
-module_init(juno_setup_opps);
-MODULE_LICENSE("GPL");