Commit e1297b96 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] Added rtas_set_power_level()

From: John Rose <johnrose@austin.ibm.com>

Added rtas_set_power_level()
parent 323a26b1
...@@ -258,6 +258,33 @@ rtas_get_power_level(int powerdomain, int *level) ...@@ -258,6 +258,33 @@ rtas_get_power_level(int powerdomain, int *level)
return rc; return rc;
} }
int
rtas_set_power_level(int powerdomain, int level, int *setlevel)
{
int token = rtas_token("set-power-level");
unsigned int wait_time;
long returned_level;
int rc;
if (token == RTAS_UNKNOWN_SERVICE)
return RTAS_UNKNOWN_OP;
while (1) {
rc = (int) rtas_call(token, 2, 2, &returned_level, powerdomain,
level);
if (rc == RTAS_BUSY)
udelay(1);
else if (rtas_is_extended_busy(rc)) {
wait_time = rtas_extended_busy_delay_time(rc);
udelay(wait_time * 1000);
}
else
break;
}
*setlevel = (int) returned_level;
return rc;
}
int int
rtas_get_sensor(int sensor, int index, int *state) rtas_get_sensor(int sensor, int index, int *state)
{ {
...@@ -472,4 +499,5 @@ EXPORT_SYMBOL(rtas_data_buf_lock); ...@@ -472,4 +499,5 @@ EXPORT_SYMBOL(rtas_data_buf_lock);
EXPORT_SYMBOL(rtas_extended_busy_delay_time); EXPORT_SYMBOL(rtas_extended_busy_delay_time);
EXPORT_SYMBOL(rtas_get_sensor); EXPORT_SYMBOL(rtas_get_sensor);
EXPORT_SYMBOL(rtas_get_power_level); EXPORT_SYMBOL(rtas_get_power_level);
EXPORT_SYMBOL(rtas_set_power_level);
EXPORT_SYMBOL(rtas_set_indicator); EXPORT_SYMBOL(rtas_set_indicator);
...@@ -177,6 +177,7 @@ extern void rtas_power_off(void); ...@@ -177,6 +177,7 @@ extern void rtas_power_off(void);
extern void rtas_halt(void); extern void rtas_halt(void);
extern int rtas_get_sensor(int sensor, int index, int *state); extern int rtas_get_sensor(int sensor, int index, int *state);
extern int rtas_get_power_level(int powerdomain, int *level); extern int rtas_get_power_level(int powerdomain, int *level);
extern int rtas_set_power_level(int powerdomain, int level, int *setlevel);
extern int rtas_set_indicator(int indicator, int index, int new_value); extern int rtas_set_indicator(int indicator, int index, int new_value);
/* Given an RTAS status code of 9900..9905 compute the hinted delay */ /* Given an RTAS status code of 9900..9905 compute the hinted delay */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment