mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-20 03:04:01 +08:00
ARM: OMAP4+: CPUidle: Consolidate idle driver for OMAP5 support
The OMAP5 idle driver can re-use most of OMAP4 CPUidle driver implementation. Also the next derivative SOCs are going to re-use the MPUSS so, same driver with minor updates can be re-used. Prepare the code so that its easier to add CPUidle support for OMAP5 devices. Acked-by: Nishanth Menon <nm@ti.com> Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com> Signed-off-by: Kevin Hilman <khilman@linaro.org>
This commit is contained in:
parent
e745725349
commit
db4f3dab62
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* OMAP4 CPU idle Routines
|
||||
* OMAP4+ CPU idle Routines
|
||||
*
|
||||
* Copyright (C) 2011 Texas Instruments, Inc.
|
||||
* Copyright (C) 2011-2013 Texas Instruments, Inc.
|
||||
* Santosh Shilimkar <santosh.shilimkar@ti.com>
|
||||
* Rajendra Nayak <rnayak@ti.com>
|
||||
*
|
||||
@ -23,13 +23,13 @@
|
||||
#include "clockdomain.h"
|
||||
|
||||
/* Machine specific information */
|
||||
struct omap4_idle_statedata {
|
||||
struct idle_statedata {
|
||||
u32 cpu_state;
|
||||
u32 mpu_logic_state;
|
||||
u32 mpu_state;
|
||||
};
|
||||
|
||||
static struct omap4_idle_statedata omap4_idle_data[] = {
|
||||
static struct idle_statedata omap4_idle_data[] = {
|
||||
{
|
||||
.cpu_state = PWRDM_POWER_ON,
|
||||
.mpu_state = PWRDM_POWER_ON,
|
||||
@ -52,11 +52,12 @@ static struct clockdomain *cpu_clkdm[NR_CPUS];
|
||||
|
||||
static atomic_t abort_barrier;
|
||||
static bool cpu_done[NR_CPUS];
|
||||
static struct idle_statedata *state_ptr = &omap4_idle_data[0];
|
||||
|
||||
/* Private functions */
|
||||
|
||||
/**
|
||||
* omap4_enter_idle_coupled_[simple/coupled] - OMAP4 cpuidle entry functions
|
||||
* omap_enter_idle_[simple/coupled] - OMAP4PLUS cpuidle entry functions
|
||||
* @dev: cpuidle device
|
||||
* @drv: cpuidle driver
|
||||
* @index: the index of state to be entered
|
||||
@ -65,7 +66,7 @@ static bool cpu_done[NR_CPUS];
|
||||
* specified low power state selected by the governor.
|
||||
* Returns the amount of time spent in the low power state.
|
||||
*/
|
||||
static int omap4_enter_idle_simple(struct cpuidle_device *dev,
|
||||
static int omap_enter_idle_simple(struct cpuidle_device *dev,
|
||||
struct cpuidle_driver *drv,
|
||||
int index)
|
||||
{
|
||||
@ -76,11 +77,11 @@ static int omap4_enter_idle_simple(struct cpuidle_device *dev,
|
||||
return index;
|
||||
}
|
||||
|
||||
static int omap4_enter_idle_coupled(struct cpuidle_device *dev,
|
||||
static int omap_enter_idle_coupled(struct cpuidle_device *dev,
|
||||
struct cpuidle_driver *drv,
|
||||
int index)
|
||||
{
|
||||
struct omap4_idle_statedata *cx = &omap4_idle_data[index];
|
||||
struct idle_statedata *cx = state_ptr + index;
|
||||
|
||||
local_fiq_disable();
|
||||
|
||||
@ -158,7 +159,7 @@ fail:
|
||||
return index;
|
||||
}
|
||||
|
||||
static DEFINE_PER_CPU(struct cpuidle_device, omap4_idle_dev);
|
||||
static DEFINE_PER_CPU(struct cpuidle_device, omap_idle_dev);
|
||||
|
||||
static struct cpuidle_driver omap4_idle_driver = {
|
||||
.name = "omap4_idle",
|
||||
@ -170,7 +171,7 @@ static struct cpuidle_driver omap4_idle_driver = {
|
||||
.exit_latency = 2 + 2,
|
||||
.target_residency = 5,
|
||||
.flags = CPUIDLE_FLAG_TIME_VALID,
|
||||
.enter = omap4_enter_idle_simple,
|
||||
.enter = omap_enter_idle_simple,
|
||||
.name = "C1",
|
||||
.desc = "CPUx ON, MPUSS ON"
|
||||
},
|
||||
@ -180,7 +181,7 @@ static struct cpuidle_driver omap4_idle_driver = {
|
||||
.target_residency = 960,
|
||||
.flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_COUPLED |
|
||||
CPUIDLE_FLAG_TIMER_STOP,
|
||||
.enter = omap4_enter_idle_coupled,
|
||||
.enter = omap_enter_idle_coupled,
|
||||
.name = "C2",
|
||||
.desc = "CPUx OFF, MPUSS CSWR",
|
||||
},
|
||||
@ -190,7 +191,7 @@ static struct cpuidle_driver omap4_idle_driver = {
|
||||
.target_residency = 1100,
|
||||
.flags = CPUIDLE_FLAG_TIME_VALID | CPUIDLE_FLAG_COUPLED |
|
||||
CPUIDLE_FLAG_TIMER_STOP,
|
||||
.enter = omap4_enter_idle_coupled,
|
||||
.enter = omap_enter_idle_coupled,
|
||||
.name = "C3",
|
||||
.desc = "CPUx OFF, MPUSS OSWR",
|
||||
},
|
||||
@ -202,9 +203,9 @@ static struct cpuidle_driver omap4_idle_driver = {
|
||||
/* Public functions */
|
||||
|
||||
/**
|
||||
* omap4_idle_init - Init routine for OMAP4 idle
|
||||
* omap4_idle_init - Init routine for OMAP4+ idle
|
||||
*
|
||||
* Registers the OMAP4 specific cpuidle driver to the cpuidle
|
||||
* Registers the OMAP4+ specific cpuidle driver to the cpuidle
|
||||
* framework with the valid set of states.
|
||||
*/
|
||||
int __init omap4_idle_init(void)
|
||||
@ -229,7 +230,7 @@ int __init omap4_idle_init(void)
|
||||
}
|
||||
|
||||
for_each_cpu(cpu_id, cpu_online_mask) {
|
||||
dev = &per_cpu(omap4_idle_dev, cpu_id);
|
||||
dev = &per_cpu(omap_idle_dev, cpu_id);
|
||||
dev->cpu = cpu_id;
|
||||
#ifdef CONFIG_ARCH_NEEDS_CPU_IDLE_COUPLED
|
||||
dev->coupled_cpus = *cpu_online_mask;
|
||||
|
Loading…
Reference in New Issue
Block a user