@@ -487,6 +487,27 @@ void cpuidle_unregister_device(struct cpuidle_device *dev)
EXPORT_SYMBOL_GPL(cpuidle_unregister_device);
+int cpuidle_register_states(struct cpuidle_device *dev,
+ struct cpuidle_state *states,
+ int state_count)
+{
+ if (!dev || !states)
+ return -EINVAL;
+
+ if (state_count <= 0)
+ return -EINVAL;
+
+ cpuidle_pause_and_lock();
+
+ dev->states = states;
+ dev->state_count = state_count;
+
+ cpuidle_resume_and_unlock();
+
+ return 0;
+}
+EXPORT_SYMBOL_GPL(cpuidle_register_states);
+
#ifdef CONFIG_SMP
static void smp_callback(void *v)
@@ -151,7 +151,9 @@ extern void cpuidle_driver_unref(void);
extern void cpuidle_unregister_driver(struct cpuidle_driver *drv);
extern int cpuidle_register_device(struct cpuidle_device *dev);
extern void cpuidle_unregister_device(struct cpuidle_device *dev);
-
+extern int cpuidle_register_states(struct cpuidle_device *dev,
+ struct cpuidle_state *states,
+ int state_count);
extern void cpuidle_pause_and_lock(void);
extern void cpuidle_resume_and_unlock(void);
extern void cpuidle_pause(void);
@@ -163,7 +165,6 @@ extern int cpuidle_wrap_enter(struct cpuidle_device *dev,
int (*enter)(struct cpuidle_device *dev,
struct cpuidle_driver *drv, int index));
extern int cpuidle_play_dead(void);
-
#else
static inline void disable_cpuidle(void) { }
static inline int cpuidle_idle_call(void) { return -ENODEV; }
@@ -176,7 +177,10 @@ static inline void cpuidle_unregister_driver(struct cpuidle_driver *drv) { }
static inline int cpuidle_register_device(struct cpuidle_device *dev)
{return -ENODEV; }
static inline void cpuidle_unregister_device(struct cpuidle_device *dev) { }
-
+static inline int cpuidle_register_states(struct cpuidle_device *dev,
+ struct cpuidle_state *states,
+ int state_count)
+{ return -ENODEV; }
static inline void cpuidle_pause_and_lock(void) { }
static inline void cpuidle_resume_and_unlock(void) { }
static inline void cpuidle_pause(void) { }