2014-07-17 17:30:07 +08:00
|
|
|
/*
|
|
|
|
* 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>
|
|
|
|
|
2015-02-02 23:32:46 +08:00
|
|
|
int arm_cpuidle_init(unsigned int cpu)
|
2014-07-17 17:30:07 +08:00
|
|
|
{
|
|
|
|
int ret = -EOPNOTSUPP;
|
|
|
|
|
|
|
|
if (cpu_ops[cpu] && cpu_ops[cpu]->cpu_init_idle)
|
2015-05-13 21:12:46 +08:00
|
|
|
ret = cpu_ops[cpu]->cpu_init_idle(cpu);
|
2014-07-17 17:30:07 +08:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
2015-01-27 02:33:44 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* cpu_suspend() - function to enter a low-power idle state
|
|
|
|
* @arg: argument to pass to CPU suspend operations
|
|
|
|
*
|
|
|
|
* Return: 0 on success, -EOPNOTSUPP if CPU suspend hook not initialized, CPU
|
|
|
|
* operations back-end error code otherwise.
|
|
|
|
*/
|
|
|
|
int cpu_suspend(unsigned long arg)
|
|
|
|
{
|
|
|
|
int cpu = smp_processor_id();
|
|
|
|
|
|
|
|
/*
|
|
|
|
* If cpu_ops have not been registered or suspend
|
|
|
|
* has not been initialized, cpu_suspend call fails early.
|
|
|
|
*/
|
|
|
|
if (!cpu_ops[cpu] || !cpu_ops[cpu]->cpu_suspend)
|
|
|
|
return -EOPNOTSUPP;
|
|
|
|
return cpu_ops[cpu]->cpu_suspend(arg);
|
|
|
|
}
|