Commit | Line | Data |
---|---|---|
d64f84f6 LP |
1 | /* |
2 | * ARM64 CPU idle arch support | |
3 | * | |
4 | * Copyright (C) 2014 ARM Ltd. | |
5 | * Author: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> | |
6 | * | |
7 | * This program is free software; you can redistribute it and/or modify | |
8 | * it under the terms of the GNU General Public License version 2 as | |
9 | * published by the Free Software Foundation. | |
10 | */ | |
11 | ||
12 | #include <linux/of.h> | |
13 | #include <linux/of_device.h> | |
14 | ||
15 | #include <asm/cpuidle.h> | |
16 | #include <asm/cpu_ops.h> | |
17 | ||
ea389daa | 18 | int __init arm_cpuidle_init(unsigned int cpu) |
d64f84f6 LP |
19 | { |
20 | int ret = -EOPNOTSUPP; | |
d64f84f6 | 21 | |
b5fda7ed JZ |
22 | if (cpu_ops[cpu] && cpu_ops[cpu]->cpu_suspend && |
23 | cpu_ops[cpu]->cpu_init_idle) | |
819a8826 | 24 | ret = cpu_ops[cpu]->cpu_init_idle(cpu); |
d64f84f6 | 25 | |
d64f84f6 LP |
26 | return ret; |
27 | } | |
af3cfdbf LP |
28 | |
29 | /** | |
30 | * cpu_suspend() - function to enter a low-power idle state | |
31 | * @arg: argument to pass to CPU suspend operations | |
32 | * | |
33 | * Return: 0 on success, -EOPNOTSUPP if CPU suspend hook not initialized, CPU | |
34 | * operations back-end error code otherwise. | |
35 | */ | |
af391b15 | 36 | int arm_cpuidle_suspend(int index) |
af3cfdbf LP |
37 | { |
38 | int cpu = smp_processor_id(); | |
39 | ||
af391b15 | 40 | return cpu_ops[cpu]->cpu_suspend(index); |
af3cfdbf | 41 | } |