aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/kernel
diff options
context:
space:
mode:
authorDaniel Lezcano <daniel.lezcano@linaro.org>2015-03-24 05:49:55 -0400
committerDaniel Lezcano <daniel.lezcano@linaro.org>2015-03-25 04:53:43 -0400
commit9a309d6fd213911321acbfe839e0bdb3a7a9f4bf (patch)
tree9f29da7fa458f6a6a88048a14e7f510edfb84fa7 /arch/arm/kernel
parenta0d46a3dfdc3f3d639b3fa84b84a58e116e4bf2c (diff)
ARM: cpuidle: Document the code
Add kernel-doc format documentation in the code. Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Diffstat (limited to 'arch/arm/kernel')
-rw-r--r--arch/arm/kernel/cpuidle.c59
1 files changed, 59 insertions, 0 deletions
diff --git a/arch/arm/kernel/cpuidle.c b/arch/arm/kernel/cpuidle.c
index 2b0dae3cd058..318da33465f4 100644
--- a/arch/arm/kernel/cpuidle.c
+++ b/arch/arm/kernel/cpuidle.c
@@ -21,6 +21,17 @@ static const struct of_cpuidle_method __cpuidle_method_of_table_sentinel
21 21
22static struct cpuidle_ops cpuidle_ops[NR_CPUS]; 22static struct cpuidle_ops cpuidle_ops[NR_CPUS];
23 23
24/**
25 * arm_cpuidle_simple_enter() - a wrapper to cpu_do_idle()
26 * @dev: not used
27 * @drv: not used
28 * @index: not used
29 *
30 * A trivial wrapper to allow the cpu_do_idle function to be assigned as a
31 * cpuidle callback by matching the function signature.
32 *
33 * Returns the index passed as parameter
34 */
24int arm_cpuidle_simple_enter(struct cpuidle_device *dev, 35int arm_cpuidle_simple_enter(struct cpuidle_device *dev,
25 struct cpuidle_driver *drv, int index) 36 struct cpuidle_driver *drv, int index)
26{ 37{
@@ -29,6 +40,16 @@ int arm_cpuidle_simple_enter(struct cpuidle_device *dev,
29 return index; 40 return index;
30} 41}
31 42
43/**
44 * arm_cpuidle_suspend() - function to enter low power idle states
45 * @index: an integer used as an identifier for the low level PM callbacks
46 *
47 * This function calls the underlying arch specific low level PM code as
48 * registered at the init time.
49 *
50 * Returns -EOPNOTSUPP if no suspend callback is defined, the result of the
51 * callback otherwise.
52 */
32int arm_cpuidle_suspend(int index) 53int arm_cpuidle_suspend(int index)
33{ 54{
34 int ret = -EOPNOTSUPP; 55 int ret = -EOPNOTSUPP;
@@ -40,6 +61,15 @@ int arm_cpuidle_suspend(int index)
40 return ret; 61 return ret;
41} 62}
42 63
64/**
65 * arm_cpuidle_get_ops() - find a registered cpuidle_ops by name
66 * @method: the method name
67 *
68 * Search in the __cpuidle_method_of_table array the cpuidle ops matching the
69 * method name.
70 *
71 * Returns a struct cpuidle_ops pointer, NULL if not found.
72 */
43static struct cpuidle_ops *__init arm_cpuidle_get_ops(const char *method) 73static struct cpuidle_ops *__init arm_cpuidle_get_ops(const char *method)
44{ 74{
45 struct of_cpuidle_method *m = __cpuidle_method_of_table; 75 struct of_cpuidle_method *m = __cpuidle_method_of_table;
@@ -51,6 +81,19 @@ static struct cpuidle_ops *__init arm_cpuidle_get_ops(const char *method)
51 return NULL; 81 return NULL;
52} 82}
53 83
84/**
85 * arm_cpuidle_read_ops() - Initialize the cpuidle ops with the device tree
86 * @dn: a pointer to a struct device node corresponding to a cpu node
87 * @cpu: the cpu identifier
88 *
89 * Get the method name defined in the 'enable-method' property, retrieve the
90 * associated cpuidle_ops and do a struct copy. This copy is needed because all
91 * cpuidle_ops are tagged __initdata and will be unloaded after the init
92 * process.
93 *
94 * Return 0 on sucess, -ENOENT if no 'enable-method' is defined, -EOPNOTSUPP if
95 * no cpuidle_ops is registered for the 'enable-method'.
96 */
54static int __init arm_cpuidle_read_ops(struct device_node *dn, int cpu) 97static int __init arm_cpuidle_read_ops(struct device_node *dn, int cpu)
55{ 98{
56 const char *enable_method; 99 const char *enable_method;
@@ -75,6 +118,22 @@ static int __init arm_cpuidle_read_ops(struct device_node *dn, int cpu)
75 return 0; 118 return 0;
76} 119}
77 120
121/**
122 * arm_cpuidle_init() - Initialize cpuidle_ops for a specific cpu
123 * @cpu: the cpu to be initialized
124 *
125 * Initialize the cpuidle ops with the device for the cpu and then call
126 * the cpu's idle initialization callback. This may fail if the underlying HW
127 * is not operational.
128 *
129 * Returns:
130 * 0 on success,
131 * -ENODEV if it fails to find the cpu node in the device tree,
132 * -EOPNOTSUPP if it does not find a registered cpuidle_ops for this cpu,
133 * -ENOENT if it fails to find an 'enable-method' property,
134 * -ENXIO if the HW reports a failure or a misconfiguration,
135 * -ENOMEM if the HW report an memory allocation failure
136 */
78int __init arm_cpuidle_init(int cpu) 137int __init arm_cpuidle_init(int cpu)
79{ 138{
80 struct device_node *cpu_node = of_cpu_device_node_get(cpu); 139 struct device_node *cpu_node = of_cpu_device_node_get(cpu);