hardware: libhardware: Power HAL add power hints -- DO NOT MERGE
Change-Id: I8ab0376e4f5d8ef09d5b1062cbfbb30c30c5bb96 Signed-off-by: Todd Poynor <toddpoynor@google.com>
This commit is contained in:
parent
f7781bc9dd
commit
2f143fba74
2 changed files with 41 additions and 1 deletions
|
@ -30,6 +30,17 @@ __BEGIN_DECLS
|
||||||
*/
|
*/
|
||||||
#define POWER_HARDWARE_MODULE_ID "power"
|
#define POWER_HARDWARE_MODULE_ID "power"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Power hint identifiers passed to (*powerHint)
|
||||||
|
*/
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
/*
|
||||||
|
* VSYNC pulse request from SurfaceFlinger started or stopped.
|
||||||
|
*/
|
||||||
|
POWER_HINT_VSYNC = 0x00000001,
|
||||||
|
} power_hint_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Every hardware module must have a data structure named HAL_MODULE_INFO_SYM
|
* Every hardware module must have a data structure named HAL_MODULE_INFO_SYM
|
||||||
* and the fields of this data structure must begin with hw_module_t
|
* and the fields of this data structure must begin with hw_module_t
|
||||||
|
@ -40,7 +51,9 @@ typedef struct power_module {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* (*init)() performs power management setup actions at runtime
|
* (*init)() performs power management setup actions at runtime
|
||||||
* startup, such as to set default cpufreq parameters.
|
* startup, such as to set default cpufreq parameters. This is
|
||||||
|
* called only by the Power HAL instance loaded by
|
||||||
|
* PowerManagerService.
|
||||||
*/
|
*/
|
||||||
void (*init)(struct power_module *module);
|
void (*init)(struct power_module *module);
|
||||||
|
|
||||||
|
@ -71,6 +84,25 @@ typedef struct power_module {
|
||||||
* interactive state prior to turning on the screen.
|
* interactive state prior to turning on the screen.
|
||||||
*/
|
*/
|
||||||
void (*setInteractive)(struct power_module *module, int on);
|
void (*setInteractive)(struct power_module *module, int on);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* (*powerHint) is called to pass hints on power requirements, which
|
||||||
|
* may result in adjustment of power/performance parameters of the
|
||||||
|
* cpufreq governor and other controls. The possible hints are:
|
||||||
|
*
|
||||||
|
* POWER_HINT_VSYNC
|
||||||
|
*
|
||||||
|
* Foreground app has started or stopped requesting a VSYNC pulse
|
||||||
|
* from SurfaceFlinger. If the app has started requesting VSYNC
|
||||||
|
* then CPU and GPU load is expected soon, and it may be appropriate
|
||||||
|
* to raise speeds of CPU, memory bus, etc. The data parameter is
|
||||||
|
* non-zero to indicate VSYNC pulse is now requested, or zero for
|
||||||
|
* VSYNC pulse no longer requested.
|
||||||
|
*
|
||||||
|
* A particular platform may choose to ignore any hint.
|
||||||
|
*/
|
||||||
|
void (*powerHint)(struct power_module *module, power_hint_t hint,
|
||||||
|
void *data);
|
||||||
} power_module_t;
|
} power_module_t;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -59,6 +59,13 @@ static void power_set_interactive(struct power_module *module, int on)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void power_hint(struct power_module *module, power_hint_t hint,
|
||||||
|
void *data) {
|
||||||
|
switch (hint) {
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static struct hw_module_methods_t power_module_methods = {
|
static struct hw_module_methods_t power_module_methods = {
|
||||||
.open = NULL,
|
.open = NULL,
|
||||||
|
@ -77,4 +84,5 @@ struct power_module HAL_MODULE_INFO_SYM = {
|
||||||
|
|
||||||
.init = power_init,
|
.init = power_init,
|
||||||
.setInteractive = power_set_interactive,
|
.setInteractive = power_set_interactive,
|
||||||
|
.powerHint = power_hint,
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue