]>
git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blob - arch/arm64/kernel/cpuidle.c
2 * ARM64 CPU idle arch support
4 * Copyright (C) 2014 ARM Ltd.
5 * Author: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
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.
13 #include <linux/of_device.h>
15 #include <asm/cpuidle.h>
16 #include <asm/cpu_ops.h>
18 int cpu_init_idle(unsigned int cpu
)
20 int ret
= -EOPNOTSUPP
;
21 struct device_node
*cpu_node
= of_cpu_device_node_get(cpu
);
26 if (cpu_ops
[cpu
] && cpu_ops
[cpu
]->cpu_init_idle
)
27 ret
= cpu_ops
[cpu
]->cpu_init_idle(cpu_node
, cpu
);
29 of_node_put(cpu_node
);
34 * cpu_suspend() - function to enter a low-power idle state
35 * @arg: argument to pass to CPU suspend operations
37 * Return: 0 on success, -EOPNOTSUPP if CPU suspend hook not initialized, CPU
38 * operations back-end error code otherwise.
40 int cpu_suspend(unsigned long arg
)
42 int cpu
= smp_processor_id();
45 * If cpu_ops have not been registered or suspend
46 * has not been initialized, cpu_suspend call fails early.
48 if (!cpu_ops
[cpu
] || !cpu_ops
[cpu
]->cpu_suspend
)
50 return cpu_ops
[cpu
]->cpu_suspend(arg
);