diff options
author | lokilee73 <changjoo.lee@samsung.com> | 2018-12-28 18:15:49 +0900 |
---|---|---|
committer | Hyotaek Shim <hyotaek.shim@samsung.com> | 2019-02-18 10:21:59 +0000 |
commit | ab1175d9e5715e62d34111885ae8df92d129c4bc (patch) | |
tree | efbd5750b21719d77d135a77b7fc8246ec07a45e | |
parent | d1ecc12a8509aeaafbbb05f756ca9f787b8abcea (diff) | |
download | device-tw3-ab1175d9e5715e62d34111885ae8df92d129c4bc.tar.gz device-tw3-ab1175d9e5715e62d34111885ae8df92d129c4bc.tar.bz2 device-tw3-ab1175d9e5715e62d34111885ae8df92d129c4bc.zip |
Add thermal path for AP and Battery
Change-Id: If0546103bce2ebad837db45985a5f2037cb5d5e3
Signed-off-by: lokilee73 <changjoo.lee@samsung.com>
-rw-r--r-- | hw/thermal/thermal.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/hw/thermal/thermal.c b/hw/thermal/thermal.c index 0993081..ccd2c94 100644 --- a/hw/thermal/thermal.c +++ b/hw/thermal/thermal.c @@ -26,7 +26,8 @@ #include <hw/thermal.h> #include <hw/shared.h> -#define THERMAL_PATH "/sys/class/sec/temperature/ap_therm" +#define AP_PATH "/sys/class/sec/temperature/ap_therm" +#define BATTERY_PATH "/sys/class/sec/temperature/batt_therm" static struct event_data { ThermalUpdated updated_cb; @@ -35,7 +36,7 @@ static struct event_data { static guint timer; -static int thermal_get_info(struct thermal_info *info) +static int thermal_get_info(device_thermal_e type, struct thermal_info *info) { FILE *fp; char buf[32]; @@ -45,16 +46,20 @@ static int thermal_get_info(struct thermal_info *info) if (!info) return -EINVAL; - fp = fopen(THERMAL_PATH, "r"); + if (type == DEVICE_THERMAL_BATTERY) + fp = fopen(BATTERY_PATH, "r"); + else + fp = fopen(AP_PATH, "r"); + if (!fp) { - _E("Failed to open %s(%d)", THERMAL_PATH, errno); + _E("Failed to open thermal path(%d)", errno); return -errno; } len = fread(buf, 1, sizeof(buf) - 1, fp); fclose(fp); if (len == 0) { - _E("Failed to read %s(%d)", THERMAL_PATH, errno); + _E("Failed to read thermal value(%d)", errno); return -errno; } buf[len] = '\0'; @@ -73,7 +78,7 @@ static int thermal_get_info(struct thermal_info *info) } info->adc = atoi(ret + 4); /* 4 == strlen("adc:") */ - _I("AP temp(%d) adc(%d)", info->temp, info->adc); + _I("temp(%d) adc(%d)", info->temp, info->adc); return 0; } @@ -83,9 +88,9 @@ static gboolean thermal_timeout(gpointer data) struct thermal_info info; int ret; - ret = thermal_get_info(&info); + ret = thermal_get_info(DEVICE_THERMAL_AP, &info); if (ret < 0) { - _E("Failed to read thermal state (%d)", ret); + _E("Failed to read thermal info (%d)", ret); return G_SOURCE_CONTINUE; } |