xref: /aosp_15_r20/hardware/interfaces/thermal/2.0/IThermal.hal (revision 4d7e907c777eeecc4c5bd7cf640a754fac206ff7)
1*4d7e907cSAndroid Build Coastguard Worker/*
2*4d7e907cSAndroid Build Coastguard Worker * Copyright (C) 2018 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 Workerimport [email protected]::IThermal;
19*4d7e907cSAndroid Build Coastguard Workerimport [email protected]::ThermalStatus;
20*4d7e907cSAndroid Build Coastguard Workerimport IThermalChangedCallback;
21*4d7e907cSAndroid Build Coastguard Worker
22*4d7e907cSAndroid Build Coastguard Workerinterface IThermal extends @1.0::IThermal {
23*4d7e907cSAndroid Build Coastguard Worker
24*4d7e907cSAndroid Build Coastguard Worker    /**
25*4d7e907cSAndroid Build Coastguard Worker     * Retrieves temperatures in Celsius.
26*4d7e907cSAndroid Build Coastguard Worker     *
27*4d7e907cSAndroid Build Coastguard Worker     * @param filterType whether to filter the result for a given type.
28*4d7e907cSAndroid Build Coastguard Worker     * @param type the TemperatureType such as battery or skin.
29*4d7e907cSAndroid Build Coastguard Worker     *
30*4d7e907cSAndroid Build Coastguard Worker     * @return status Status of the operation. If status code is FAILURE,
31*4d7e907cSAndroid Build Coastguard Worker     *    the status.debugMessage must be populated with a human-readable
32*4d7e907cSAndroid Build Coastguard Worker     *    error message.
33*4d7e907cSAndroid Build Coastguard Worker     *
34*4d7e907cSAndroid Build Coastguard Worker     * @return temperatures If status code is SUCCESS, it's filled with the
35*4d7e907cSAndroid Build Coastguard Worker     *    current temperatures. The order of temperatures of built-in
36*4d7e907cSAndroid Build Coastguard Worker     *    devices (such as CPUs, GPUs and etc.) in the list must be kept
37*4d7e907cSAndroid Build Coastguard Worker     *    the same regardless of the number of calls to this method even if
38*4d7e907cSAndroid Build Coastguard Worker     *    they go offline, if these devices exist on boot. The method
39*4d7e907cSAndroid Build Coastguard Worker     *    always returns and never removes such temperatures.
40*4d7e907cSAndroid Build Coastguard Worker     */
41*4d7e907cSAndroid Build Coastguard Worker    getCurrentTemperatures(bool filterType, TemperatureType type)
42*4d7e907cSAndroid Build Coastguard Worker        generates (ThermalStatus status, vec<Temperature> temperatures);
43*4d7e907cSAndroid Build Coastguard Worker
44*4d7e907cSAndroid Build Coastguard Worker    /**
45*4d7e907cSAndroid Build Coastguard Worker     * Retrieves static temperature thresholds in Celsius.
46*4d7e907cSAndroid Build Coastguard Worker     *
47*4d7e907cSAndroid Build Coastguard Worker     * @param filterType whether to filter the result for a given type.
48*4d7e907cSAndroid Build Coastguard Worker     * @param type the TemperatureType such as battery or skin.
49*4d7e907cSAndroid Build Coastguard Worker     *
50*4d7e907cSAndroid Build Coastguard Worker     * @return status Status of the operation. If status code is FAILURE,
51*4d7e907cSAndroid Build Coastguard Worker     *    the status.debugMessage must be populated with a human-readable error message.
52*4d7e907cSAndroid Build Coastguard Worker     * @return temperatureThresholds If status code is SUCCESS, it's filled with the
53*4d7e907cSAndroid Build Coastguard Worker     *    temperatures thresholds. The order of temperatures of built-in
54*4d7e907cSAndroid Build Coastguard Worker     *    devices (such as CPUs, GPUs and etc.) in the list must be kept
55*4d7e907cSAndroid Build Coastguard Worker     *    the same regardless of the number of calls to this method even if
56*4d7e907cSAndroid Build Coastguard Worker     *    they go offline, if these devices exist on boot. The method
57*4d7e907cSAndroid Build Coastguard Worker     *    always returns and never removes such temperatures. The thresholds
58*4d7e907cSAndroid Build Coastguard Worker     *    are returned as static values and must not change across calls. The actual
59*4d7e907cSAndroid Build Coastguard Worker     *    throttling state is determined in device thermal mitigation policy/agorithm
60*4d7e907cSAndroid Build Coastguard Worker     *    which might not be simple thresholds so these values Thermal HAL provided
61*4d7e907cSAndroid Build Coastguard Worker     *    may not be accurate to detemin the throttling status. To get accurate
62*4d7e907cSAndroid Build Coastguard Worker     *    throttling status, use getCurrentTemperatures or registerThermalChangedCallback
63*4d7e907cSAndroid Build Coastguard Worker     *    and listen to the callback.
64*4d7e907cSAndroid Build Coastguard Worker     */
65*4d7e907cSAndroid Build Coastguard Worker    getTemperatureThresholds(bool filterType, TemperatureType type)
66*4d7e907cSAndroid Build Coastguard Worker        generates (ThermalStatus status, vec<TemperatureThreshold> temperatureThresholds);
67*4d7e907cSAndroid Build Coastguard Worker
68*4d7e907cSAndroid Build Coastguard Worker   /**
69*4d7e907cSAndroid Build Coastguard Worker    * Register an IThermalChangedCallback, used by the Thermal HAL
70*4d7e907cSAndroid Build Coastguard Worker    * to receive thermal events when thermal mitigation status changed.
71*4d7e907cSAndroid Build Coastguard Worker    * Multiple registrations with different IThermalChangedCallback must be allowed.
72*4d7e907cSAndroid Build Coastguard Worker    * Multiple registrations with same IThermalChangedCallback is not allowed, client
73*4d7e907cSAndroid Build Coastguard Worker    * should unregister the given IThermalChangedCallback first.
74*4d7e907cSAndroid Build Coastguard Worker    *
75*4d7e907cSAndroid Build Coastguard Worker    * @param callback the IThermalChangedCallback to use for receiving
76*4d7e907cSAndroid Build Coastguard Worker    *    thermal events (nullptr callback will lead to failure with status code FAILURE).
77*4d7e907cSAndroid Build Coastguard Worker    * @param filterType if filter for given sensor type.
78*4d7e907cSAndroid Build Coastguard Worker    * @param type the type to be filtered.
79*4d7e907cSAndroid Build Coastguard Worker    *
80*4d7e907cSAndroid Build Coastguard Worker    * @return status Status of the operation. If status code is FAILURE,
81*4d7e907cSAndroid Build Coastguard Worker    *    the status.debugMessage must be populated with a human-readable error message.
82*4d7e907cSAndroid Build Coastguard Worker    */
83*4d7e907cSAndroid Build Coastguard Worker   registerThermalChangedCallback(IThermalChangedCallback callback,
84*4d7e907cSAndroid Build Coastguard Worker                                  bool filterType,
85*4d7e907cSAndroid Build Coastguard Worker                                  TemperatureType type)
86*4d7e907cSAndroid Build Coastguard Worker       generates (ThermalStatus status);
87*4d7e907cSAndroid Build Coastguard Worker
88*4d7e907cSAndroid Build Coastguard Worker   /**
89*4d7e907cSAndroid Build Coastguard Worker    * Unregister an IThermalChangedCallback, used by the Thermal HAL
90*4d7e907cSAndroid Build Coastguard Worker    * to receive thermal events when thermal mitigation status changed.
91*4d7e907cSAndroid Build Coastguard Worker    *
92*4d7e907cSAndroid Build Coastguard Worker    * @param callback the IThermalChangedCallback used for receiving
93*4d7e907cSAndroid Build Coastguard Worker    *    thermal events (nullptr callback will lead to failure with status code FAILURE).
94*4d7e907cSAndroid Build Coastguard Worker    *
95*4d7e907cSAndroid Build Coastguard Worker    * @return status Status of the operation. If status code is FAILURE,
96*4d7e907cSAndroid Build Coastguard Worker    *    the status.debugMessage must be populated with a human-readable error message.
97*4d7e907cSAndroid Build Coastguard Worker    */
98*4d7e907cSAndroid Build Coastguard Worker   unregisterThermalChangedCallback(IThermalChangedCallback callback)
99*4d7e907cSAndroid Build Coastguard Worker       generates (ThermalStatus status);
100*4d7e907cSAndroid Build Coastguard Worker
101*4d7e907cSAndroid Build Coastguard Worker    /**
102*4d7e907cSAndroid Build Coastguard Worker     * Retrieves the cooling devices information.
103*4d7e907cSAndroid Build Coastguard Worker     *
104*4d7e907cSAndroid Build Coastguard Worker     * @param filterType whether to filter the result for a given type.
105*4d7e907cSAndroid Build Coastguard Worker     * @param type the CoolingDevice such as CPU/GPU.
106*4d7e907cSAndroid Build Coastguard Worker     *
107*4d7e907cSAndroid Build Coastguard Worker     * @return status Status of the operation. If status code is FAILURE,
108*4d7e907cSAndroid Build Coastguard Worker     *    the status.debugMessage must be populated with the human-readable
109*4d7e907cSAndroid Build Coastguard Worker     *    error message.
110*4d7e907cSAndroid Build Coastguard Worker     * @return devices If status code is SUCCESS, it's filled with the current
111*4d7e907cSAndroid Build Coastguard Worker     *    cooling device information. The order of built-in cooling
112*4d7e907cSAndroid Build Coastguard Worker     *    devices in the list must be kept the same regardless of the number
113*4d7e907cSAndroid Build Coastguard Worker     *    of calls to this method even if they go offline, if these devices
114*4d7e907cSAndroid Build Coastguard Worker     *    exist on boot. The method always returns and never removes from
115*4d7e907cSAndroid Build Coastguard Worker     *    the list such cooling devices.
116*4d7e907cSAndroid Build Coastguard Worker     */
117*4d7e907cSAndroid Build Coastguard Worker   getCurrentCoolingDevices(bool filterType, CoolingType type)
118*4d7e907cSAndroid Build Coastguard Worker       generates (ThermalStatus status, vec<CoolingDevice> devices);
119*4d7e907cSAndroid Build Coastguard Worker};
120