Skip to content

Commit

Permalink
cpufreq: [HACK] get arm_big_little compiling on arm64
Browse files Browse the repository at this point in the history
Currently the addition of switcher code has created too much
dependencies to get this driver compiling on ARM64. For time being add
dirty compilation hacks to test CPUFreq on development platforms.

This is not intended for mainline in its current form and needs to be
reworked for upstream purposes.

Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
  • Loading branch information
sudeep-holla authored and dliviu committed Apr 21, 2015
1 parent 29c33a5 commit b9ceaa0
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 6 deletions.
2 changes: 1 addition & 1 deletion drivers/cpufreq/Kconfig.arm
Expand Up @@ -5,7 +5,7 @@
# big LITTLE core layer and glue drivers
config ARM_BIG_LITTLE_CPUFREQ
tristate "Generic ARM big LITTLE CPUfreq driver"
depends on ARM && BIG_LITTLE && ARM_CPU_TOPOLOGY && HAVE_CLK
depends on HAVE_CLK
select PM_OPP
help
This enables the Generic CPUfreq driver for ARM big.LITTLE platforms.
Expand Down
27 changes: 22 additions & 5 deletions drivers/cpufreq/arm_big_little.c
Expand Up @@ -31,7 +31,6 @@
#include <linux/slab.h>
#include <linux/topology.h>
#include <linux/types.h>
#include <asm/bL_switcher.h>

#include "arm_big_little.h"

Expand All @@ -41,12 +40,16 @@
#define MAX_CLUSTERS 2

#ifdef CONFIG_BL_SWITCHER
#include <asm/bL_switcher.h>
static bool bL_switching_enabled;
#define is_bL_switching_enabled() bL_switching_enabled
#define set_switching_enabled(x) (bL_switching_enabled = (x))
#else
#define is_bL_switching_enabled() false
#define set_switching_enabled(x) do { } while (0)
#define bL_switch_request(...) do { } while (0)
#define bL_switcher_put_enabled() do { } while (0)
#define bL_switcher_get_enabled() do { } while (0)
#endif

#define ACTUAL_FREQ(cluster, freq) ((cluster == A7_CLUSTER) ? freq << 1 : freq)
Expand Down Expand Up @@ -506,6 +509,7 @@ static struct cpufreq_driver bL_cpufreq_driver = {
.attr = cpufreq_generic_attr,
};

#ifdef CONFIG_BL_SWITCHER
static int bL_cpufreq_switcher_notifier(struct notifier_block *nfb,
unsigned long action, void *_arg)
{
Expand Down Expand Up @@ -538,6 +542,20 @@ static struct notifier_block bL_switcher_notifier = {
.notifier_call = bL_cpufreq_switcher_notifier,
};

static int __bLs_register_notifier(void)
{
return bL_switcher_register_notifier(&bL_switcher_notifier);
}

static int __bLs_unregister_notifier(void)
{
return bL_switcher_unregister_notifier(&bL_switcher_notifier);
}
#else
static int __bLs_register_notifier(void) { return 0; }
static int __bLs_unregister_notifier(void) { return 0; }
#endif

int bL_cpufreq_register(struct cpufreq_arm_bL_ops *ops)
{
int ret, i;
Expand All @@ -555,8 +573,7 @@ int bL_cpufreq_register(struct cpufreq_arm_bL_ops *ops)

arm_bL_ops = ops;

ret = bL_switcher_get_enabled();
set_switching_enabled(ret);
set_switching_enabled(bL_switcher_get_enabled());

for (i = 0; i < MAX_CLUSTERS; i++)
mutex_init(&cluster_lock[i]);
Expand All @@ -567,7 +584,7 @@ int bL_cpufreq_register(struct cpufreq_arm_bL_ops *ops)
__func__, ops->name, ret);
arm_bL_ops = NULL;
} else {
ret = bL_switcher_register_notifier(&bL_switcher_notifier);
ret = __bLs_register_notifier();
if (ret) {
cpufreq_unregister_driver(&bL_cpufreq_driver);
arm_bL_ops = NULL;
Expand All @@ -591,7 +608,7 @@ void bL_cpufreq_unregister(struct cpufreq_arm_bL_ops *ops)
}

bL_switcher_get_enabled();
bL_switcher_unregister_notifier(&bL_switcher_notifier);
__bLs_unregister_notifier();
cpufreq_unregister_driver(&bL_cpufreq_driver);
bL_switcher_put_enabled();
pr_info("%s: Un-registered platform driver: %s\n", __func__,
Expand Down

0 comments on commit b9ceaa0

Please sign in to comment.