Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef __ASM_ARM_CPUIDLE_H
0003 #define __ASM_ARM_CPUIDLE_H
0004 
0005 #include <asm/proc-fns.h>
0006 
0007 #ifdef CONFIG_CPU_IDLE
0008 extern int arm_cpuidle_simple_enter(struct cpuidle_device *dev,
0009         struct cpuidle_driver *drv, int index);
0010 #define __cpuidle_method_section __used __section("__cpuidle_method_of_table")
0011 #else
0012 static inline int arm_cpuidle_simple_enter(struct cpuidle_device *dev,
0013         struct cpuidle_driver *drv, int index) { return -ENODEV; }
0014 #define __cpuidle_method_section __maybe_unused /* drop silently */
0015 #endif
0016 
0017 /* Common ARM WFI state */
0018 #define ARM_CPUIDLE_WFI_STATE_PWR(p) {\
0019     .enter                  = arm_cpuidle_simple_enter,\
0020     .exit_latency           = 1,\
0021     .target_residency       = 1,\
0022     .power_usage        = p,\
0023     .name                   = "WFI",\
0024     .desc                   = "ARM WFI",\
0025 }
0026 
0027 /*
0028  * in case power_specified == 1, give a default WFI power value needed
0029  * by some governors
0030  */
0031 #define ARM_CPUIDLE_WFI_STATE ARM_CPUIDLE_WFI_STATE_PWR(UINT_MAX)
0032 
0033 struct device_node;
0034 
0035 struct cpuidle_ops {
0036     int (*suspend)(unsigned long arg);
0037     int (*init)(struct device_node *, int cpu);
0038 };
0039 
0040 struct of_cpuidle_method {
0041     const char *method;
0042     const struct cpuidle_ops *ops;
0043 };
0044 
0045 #define CPUIDLE_METHOD_OF_DECLARE(name, _method, _ops)          \
0046     static const struct of_cpuidle_method __cpuidle_method_of_table_##name \
0047     __cpuidle_method_section = { .method = _method, .ops = _ops }
0048 
0049 extern int arm_cpuidle_suspend(int index);
0050 
0051 extern int arm_cpuidle_init(int cpu);
0052 
0053 struct arm_cpuidle_irq_context { };
0054 
0055 #define arm_cpuidle_save_irq_context(c)     (void)c
0056 #define arm_cpuidle_restore_irq_context(c)  (void)c
0057 
0058 #endif