Wei Wang | 61c2a33 | 2020-01-08 16:51:47 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2020 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 | */ |
| 16 | |
| 17 | package android.hardware.power; |
| 18 | |
| 19 | import android.hardware.power.Boost; |
| 20 | import android.hardware.power.Mode; |
| 21 | |
| 22 | @VintfStability |
| 23 | interface IPower { |
| 24 | /** |
| 25 | * setMode() is called to enable/disable specific hint mode, which |
| 26 | * may result in adjustment of power/performance parameters of the |
| 27 | * cpufreq governor and other controls on device side. |
| 28 | * |
| 29 | * A particular platform may choose to ignore any mode hint. |
| 30 | * |
| 31 | * @param type Mode which is to be enable/disable. |
| 32 | * @param enabled true to enable, false to disable the mode. |
| 33 | */ |
| 34 | oneway void setMode(in Mode type, in boolean enabled); |
| 35 | |
| 36 | /** |
| 37 | * isModeSupported() is called to query if the given mode hint is |
| 38 | * supported by vendor. |
| 39 | * |
| 40 | * @return true if the hint passed is supported on this platform. |
| 41 | * If false, setting the mode will have no effect. |
| 42 | * @param type Mode to be queried |
| 43 | */ |
| 44 | boolean isModeSupported(in Mode type); |
| 45 | |
Dan Stoza | cca8027 | 2020-01-13 13:06:13 -0800 | [diff] [blame^] | 46 | /** |
Wei Wang | 61c2a33 | 2020-01-08 16:51:47 -0800 | [diff] [blame] | 47 | * setBoost() indicates the device may need to boost some resources, as the |
| 48 | * the load is likely to increase before the kernel governors can react. |
| 49 | * Depending on the boost, it may be appropriate to raise the frequencies of |
| 50 | * CPU, GPU, memory subsystem, or stop CPU from going into deep sleep state. |
| 51 | * A particular platform may choose to ignore this hint. |
| 52 | * |
| 53 | * @param type Boost type which is to be set with a timeout. |
| 54 | * @param durationMs The expected duration of the user's interaction, if |
| 55 | * known, or 0 if the expected duration is unknown. |
| 56 | * a negative value indicates canceling previous boost. |
| 57 | * A given platform can choose to boost some time based on durationMs, |
| 58 | * and may also pick an appropriate timeout for 0 case. |
| 59 | */ |
| 60 | oneway void setBoost(in Boost type, in int durationMs); |
| 61 | |
| 62 | /** |
| 63 | * isBoostSupported() is called to query if the given boost hint is |
| 64 | * supported by vendor. When returns false, set the boost will have |
| 65 | * no effect on the platform. |
| 66 | * |
| 67 | * @return true if the hint passed is supported on this platform. |
| 68 | * If false, setting the boost will have no effect. |
| 69 | * @param type Boost to be queried |
| 70 | */ |
| 71 | boolean isBoostSupported(in Boost type); |
| 72 | } |