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