diff options
author | Todd Poynor <toddpoynor@google.com> | 2012-04-24 13:39:15 -0700 |
---|---|---|
committer | Todd Poynor <toddpoynor@google.com> | 2012-04-25 18:16:40 -0700 |
commit | 2f143fba74f6be91fe8805ef8bbdffe5b8ece8b4 (patch) | |
tree | 787b7b88fd6c589db3818338ae9e1ca02c84f6f9 | |
parent | f7781bc9ddc89221c5768200667cfd7e6663d5ae (diff) | |
download | libhardware-2f143fba74f6be91fe8805ef8bbdffe5b8ece8b4.tar.gz |
hardware: libhardware: Power HAL add power hints -- DO NOT MERGE
Change-Id: I8ab0376e4f5d8ef09d5b1062cbfbb30c30c5bb96
Signed-off-by: Todd Poynor <toddpoynor@google.com>
-rw-r--r-- | include/hardware/power.h | 34 | ||||
-rw-r--r-- | modules/power/power.c | 8 |
2 files changed, 41 insertions, 1 deletions
diff --git a/include/hardware/power.h b/include/hardware/power.h index 825a74ad..1cb21341 100644 --- a/include/hardware/power.h +++ b/include/hardware/power.h @@ -30,6 +30,17 @@ __BEGIN_DECLS */ #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 * 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 - * 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); @@ -71,6 +84,25 @@ typedef struct power_module { * interactive state prior to turning on the screen. */ 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; diff --git a/modules/power/power.c b/modules/power/power.c index ef3fe94c..7d8c1122 100644 --- a/modules/power/power.c +++ b/modules/power/power.c @@ -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 = { .open = NULL, @@ -77,4 +84,5 @@ struct power_module HAL_MODULE_INFO_SYM = { .init = power_init, .setInteractive = power_set_interactive, + .powerHint = power_hint, }; |