From b955a220deccff8beb73c32bc4c320a4cd8d2c72 Mon Sep 17 00:00:00 2001 From: lokilee73 Date: Fri, 28 Dec 2018 17:50:35 +0900 Subject: [PATCH] Add device_thermal_e Change-Id: I29a0c82d3973e9a6a01d16cba2def98362c30bc5 Signed-off-by: lokilee73 --- hw/thermal.h | 9 ++++++++- unittest/device_haltests.cpp | 4 ++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/hw/thermal.h b/hw/thermal.h index 08dd056..8eef95f 100644 --- a/hw/thermal.h +++ b/hw/thermal.h @@ -32,6 +32,13 @@ */ #define THERMAL_HARDWARE_DEVICE_VERSION MAKE_VERSION(0,1) +typedef enum +{ + DEVICE_THERMAL_AP, /* AP temperature */ + DEVICE_THERMAL_CP, /* CP temperature */ + DEVICE_THERMAL_BATTERY, /* Battery temperature */ +} device_thermal_e; + struct thermal_info { int temp; int adc; @@ -43,7 +50,7 @@ struct thermal_device { struct hw_common common; /* Get thermal state */ - int (*get_info)(struct thermal_info *info); + int (*get_info)(device_thermal_e type, struct thermal_info *info); /* Register thermal event */ int (*register_changed_event)(ThermalUpdated updated_cb, void *data); diff --git a/unittest/device_haltests.cpp b/unittest/device_haltests.cpp index 9a7dea1..1dba1b4 100644 --- a/unittest/device_haltests.cpp +++ b/unittest/device_haltests.cpp @@ -758,7 +758,7 @@ TEST_F(THERMALHalTest, InitP) EXPECT_EQ(ret, 0) << "Fail to open thermal device (" << ret << ")"; } -TEST_F(THERMALHalTest, GetStateP) +TEST_F(THERMALHalTest, GetInfoP) { struct thermal_info thermal; int ret; @@ -767,7 +767,7 @@ TEST_F(THERMALHalTest, GetStateP) cout << "There is no function for get_info" << endl; return; } - ret = thermal_dev->get_info(&thermal); + ret = thermal_dev->get_info(DEVICE_THERMAL_AP, &thermal); EXPECT_EQ(ret, 0) << "Fail to get_info (" << ret << ")"; } -- 2.34.1