Skip to content

Commit da9f970

Browse files
committed
MIPS: cpuidle wait instruction state
Defines a macro intended to allow trivial use of the regular MIPS wait instruction from cpuidle drivers, which may simply invoke the macro within their array of states. Signed-off-by: Paul Burton <paul.burton@imgtec.com>
1 parent 0155a06 commit da9f970

2 files changed

Lines changed: 25 additions & 0 deletions

File tree

‎arch/mips/include/asm/idle.h‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#ifndef __ASM_IDLE_H
22
#define __ASM_IDLE_H
33

4+
#include <linux/cpuidle.h>
45
#include <linux/linkage.h>
56

67
extern void (*cpu_wait)(void);
@@ -20,4 +21,17 @@ static inline int address_is_in_r4k_wait_irqoff(unsigned long addr)
2021
addr < (unsigned long)__pastwait;
2122
}
2223

24+
extern int mips_cpuidle_wait_enter(struct cpuidle_device *dev,
25+
struct cpuidle_driver *drv, int index);
26+
27+
#define MIPS_CPUIDLE_WAIT_STATE {\
28+
.enter = mips_cpuidle_wait_enter,\
29+
.exit_latency = 1,\
30+
.target_residency = 1,\
31+
.power_usage = UINT_MAX,\
32+
.flags = CPUIDLE_FLAG_TIME_VALID,\
33+
.name = "wait",\
34+
.desc = "MIPS wait",\
35+
}
36+
2337
#endif /* __ASM_IDLE_H */

‎arch/mips/kernel/idle.c‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,3 +250,14 @@ void arch_cpu_idle(void)
250250
else
251251
local_irq_enable();
252252
}
253+
254+
#ifdef CONFIG_CPU_IDLE
255+
256+
int mips_cpuidle_wait_enter(struct cpuidle_device *dev,
257+
struct cpuidle_driver *drv, int index)
258+
{
259+
arch_cpu_idle();
260+
return index;
261+
}
262+
263+
#endif

0 commit comments

Comments
 (0)