diff options
author | Javi Merino <javi.merino@arm.com> | 2015-06-05 10:29:46 +0100 |
---|---|---|
committer | Jon Medhurst <tixy@linaro.org> | 2015-11-06 18:23:43 +0000 |
commit | 3a9af3d0e25a5f0ecd9854bb2d84a5919576e7bc (patch) | |
tree | 1b76192551f804d927975c7bddb65880b39c7909 | |
parent | 10a97a2a2132ba0a783ed0bcdb51e67570216ffa (diff) | |
download | linux-linaro-tracking-3a9af3d0e25a5f0ecd9854bb2d84a5919576e7bc.tar.gz |
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-x | drivers/gpu/arm/midgard/backend/gpu/mali_kbase_devfreq.c | 12 | ||||
-rwxr-xr-x | drivers/gpu/arm/midgard/mali_kbase.h | 8 | ||||
-rwxr-xr-x | drivers/gpu/arm/midgard/platform/juno_soc/juno_mali_opp.c | 7 |
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 b30bd92f009d..18cd24287e46 100755 --- a/drivers/gpu/arm/midgard/mali_kbase.h +++ b/drivers/gpu/arm/midgard/mali_kbase.h @@ -349,6 +349,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"); |