1/*
2 * Copyright (C) 2016 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package android.hardware.power@1.0;
17
18/**
19 * Constructor for the interface performs power management setup actions at
20 * runtime startup, such as to set default cpufreq parameters.
21 */
22interface IPower {
23    /**
24     * setInteractive() performs power management actions upon the
25     * system entering interactive state (that is, the system is awake
26     * and ready for interaction, often with UI devices such as
27     * display and touchscreen enabled) or non-interactive state (the
28     * system appears asleep, display usually turned off). The
29     * non-interactive state may be entered after a period of
30     * inactivity in order to conserve battery power during
31     * such inactive periods.
32     *
33     * Typical actions are to turn on or off devices and adjust
34     * cpufreq parameters. This function may also call the
35     * appropriate interfaces to allow the kernel to suspend the
36     * system to low-power sleep state when entering non-interactive
37     * state, and to disallow low-power suspend when the system is in
38     * interactive state. When low-power suspend state is allowed, the
39     * kernel may suspend the system whenever no wakelocks are held.
40     *
41     * For example,
42     * This function can be called to enter non-interactive state after
43     * turning off the screen (if present) and called to enter
44     * interactive state prior to turning on the screen.
45     *
46     * @param interactive is true when the system is transitioning to an
47     * interactive state and false when transitioning to a
48     * non-interactive state.
49     */
50    setInteractive(bool interactive);
51
52    /**
53     * powerHint() is called to pass hints on power requirements which
54     * may result in adjustment of power/performance parameters of the
55     * cpufreq governor and other controls.
56     *
57     * A particular platform may choose to ignore any hint.
58     *
59     * @param hint PowerHint which is passed
60     * @param data contains additional information about the hint
61     * and is described along with the comments for each of the hints.
62     */
63    powerHint(PowerHint hint, int32_t data);
64
65    /**
66     * setFeature() is called to turn on or off a particular feature
67     * depending on the state parameter.
68     *
69     * @param feature Feature which needs to be set
70     * @param activate true/false to enable/disable the feature
71     */
72    setFeature(Feature feature, bool activate);
73
74    /**
75     * Platform-level sleep state stats:
76     * Report cumulative info on the statistics on platform-level sleep states
77     * since boot.
78     *
79     * Higher the index in the returned <states> vector deeper the state is
80     * i.e. lesser steady-state power is consumed by the platform to be
81     * resident in that state.
82     *
83     * @return states of power states the device supports
84     * @return retval SUCCESS on success or FILESYSTEM_ERROR on filesystem
85     * nodes access error.
86     */
87    getPlatformLowPowerStats()
88            generates (vec<PowerStatePlatformSleepState> states, Status retval);
89};
90