From a6ffd076d05fe504f15bebab848a4e0eca354109 Mon Sep 17 00:00:00 2001 From: Daniel Lezcano Date: Fri, 10 Sep 2021 14:03:44 +0200 Subject: Initial commit Signed-off-by: Daniel Lezcano --- LibThermal.h | 84 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 LibThermal.h (limited to 'LibThermal.h') diff --git a/LibThermal.h b/LibThermal.h new file mode 100644 index 0000000..809c930 --- /dev/null +++ b/LibThermal.h @@ -0,0 +1,84 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#include + +#include "libthermal.h" + +namespace android { +namespace hardware { +namespace thermal { +namespace V2_0 { +namespace implementation { + +class LibThermalCallbacks { +public: + /* + * Callbacks called when a thermal zone event occurs + */ + int (*thermalZoneCreate)(const char *, int, void *); + int (*thermalZoneDelete) (int, void *); + int (*thermalZoneEnable)(int, void *); + int (*thermalZoneDisable)(int, void *); + + /* + * Callbacks called when a trip event occurs + */ + int (*tripHigh)(int, int, int, void *); + int (*tripLow)(int, int, int, void *); + int (*tripAdd)(int, int, int, int, int, void *); + int (*tripChange)(int, int, int, int, int, void *); + int (*tripDelete)(int, int, void *); + + /* + * Callbacks called when a cooling device event occurs + */ + int (*cdevAdd)(const char *, int, int, void *); + int (*cdevDelete)(int, void *); + int (*cdevUpdate)(int, int, void *); + + /* + * Callback called when a governor event occurs + */ + int (*govChange)(int, const char *, void *); + + /* + * Callback called when there is a temperature sampling + */ + int (*thermalZoneTemp)(int, int, void *); +}; + +class LibThermal { + +private: + struct thermal_zone *getThermalZone(int id); + struct thermal_zone *getThermalZone(std::string name); + +public: + struct thermal_handler *m_th; + struct thermal_zone *m_tz; + struct thermal_ops m_ops; + + bool init(LibThermalCallbacks &); + int getThermalZonetemp(const std::string name); + int getThermalZonetemp(struct thermal_zone *tz); + int getThermalZonetemp(int id); +}; + +} // namespace implementation +} // namespace V2_0 +} // namespace thermal +} // namespace hardware +} // namespace android -- cgit v1.2.3