diff options
author | Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> | 2014-07-17 10:30:07 +0100 |
---|---|---|
committer | Catalin Marinas <catalin.marinas@arm.com> | 2014-09-12 10:48:55 +0100 |
commit | d64f84f696463c58e1908510e45b0f5d450f737a (patch) | |
tree | 6a401e81c34556e447117a8450b3fe86947f12f5 /arch/arm64/kernel/cpuidle.c | |
parent | 714f59925595b9c2ea9c22b107b340d38e3b3bc9 (diff) | |
download | linux-stable-d64f84f696463c58e1908510e45b0f5d450f737a.tar.gz linux-stable-d64f84f696463c58e1908510e45b0f5d450f737a.tar.bz2 linux-stable-d64f84f696463c58e1908510e45b0f5d450f737a.zip |
arm64: kernel: introduce cpu_init_idle CPU operation
The CPUidle subsystem on ARM64 machines requires the idle states
implementation back-end to initialize idle states parameter upon
boot. This patch adds a hook in the CPU operations structure that
should be initialized by the CPU operations back-end in order to
provide a function that initializes cpu idle states.
This patch also adds the infrastructure to arm64 kernel required
to export the CPU operations based initialization interface, so
that drivers (ie CPUidle) can use it when they are initialized
at probe time.
Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Diffstat (limited to 'arch/arm64/kernel/cpuidle.c')
-rw-r--r-- | arch/arm64/kernel/cpuidle.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/arch/arm64/kernel/cpuidle.c b/arch/arm64/kernel/cpuidle.c new file mode 100644 index 000000000000..19d17f51db37 --- /dev/null +++ b/arch/arm64/kernel/cpuidle.c @@ -0,0 +1,31 @@ +/* + * ARM64 CPU idle arch support + * + * Copyright (C) 2014 ARM Ltd. + * Author: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#include <linux/of.h> +#include <linux/of_device.h> + +#include <asm/cpuidle.h> +#include <asm/cpu_ops.h> + +int cpu_init_idle(unsigned int cpu) +{ + int ret = -EOPNOTSUPP; + struct device_node *cpu_node = of_cpu_device_node_get(cpu); + + if (!cpu_node) + return -ENODEV; + + if (cpu_ops[cpu] && cpu_ops[cpu]->cpu_init_idle) + ret = cpu_ops[cpu]->cpu_init_idle(cpu_node, cpu); + + of_node_put(cpu_node); + return ret; +} |