summaryrefslogtreecommitdiff
path: root/LibThermal.h
diff options
context:
space:
mode:
authorDaniel Lezcano <daniel.lezcano@linaro.org>2021-09-10 14:03:44 +0200
committerDaniel Lezcano <daniel.lezcano@linaro.org>2021-09-10 14:03:44 +0200
commita6ffd076d05fe504f15bebab848a4e0eca354109 (patch)
tree8bc500289584939ac3a145c3513c6c03f1bdc386 /LibThermal.h
Initial commitHEADmaster
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Diffstat (limited to 'LibThermal.h')
-rw-r--r--LibThermal.h84
1 files changed, 84 insertions, 0 deletions
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 <string>
+
+#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