diff options
author | Minh-Quang Nguyen <minh-quang.nguyen@nutaq.com> | 2016-06-09 16:19:12 -0400 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2016-06-15 09:44:58 +0000 |
commit | cbbce0be0965c3160c4916384c3d3d5303c57ae2 (patch) | |
tree | 5d440086701274a80b37e7b8d557c0fba00dae6e /src/osmo-bts-litecell15/misc/lc15bts_temp.c | |
parent | d0d2c9217a909c1455dfabb26cd3e678493490d9 (diff) |
LC15: Hardware changes:
- Change system devices path
- Remove obsoleted sensors and add new sensors
- Change TRX and sensors numbering to 0,1 instead of 1,2 (JFD)
Change-Id: I5172daf68d3145a6398e37df87df21b0e5affe42
Diffstat (limited to 'src/osmo-bts-litecell15/misc/lc15bts_temp.c')
-rw-r--r-- | src/osmo-bts-litecell15/misc/lc15bts_temp.c | 64 |
1 files changed, 11 insertions, 53 deletions
diff --git a/src/osmo-bts-litecell15/misc/lc15bts_temp.c b/src/osmo-bts-litecell15/misc/lc15bts_temp.c index fa6300e7..aa358547 100644 --- a/src/osmo-bts-litecell15/misc/lc15bts_temp.c +++ b/src/osmo-bts-litecell15/misc/lc15bts_temp.c @@ -31,43 +31,27 @@ static const char *temp_devs[_NUM_TEMP_SENSORS] = { - [LC15BTS_TEMP_SUPPLY] = "/sys/bus/i2c/devices/2-004d/hwmon/hwmon5/temp1_", - [LC15BTS_TEMP_SOC] = "/sys/class/hwmon/hwmon1/temp1_", - [LC15BTS_TEMP_FPGA] = "/sys/devices/0.iio_hwmon/temp1_", - [LC15BTS_TEMP_MEMORY] = "/sys/bus/i2c/devices/2-004c/hwmon/hwmon4/temp1_", - [LC15BTS_TEMP_TX1] = "/sys/devices/0.ncp15xh103_tx1/temp1_", - [LC15BTS_TEMP_TX2] = "/sys/devices/0.ncp15xh103_tx2/temp1_", - [LC15BTS_TEMP_PA1] = "/sys/bus/i2c/devices/2-004d/hwmon/hwmon5/temp2_", - [LC15BTS_TEMP_PA2] = "/sys/bus/i2c/devices/2-004c/hwmon/hwmon4/temp2_", + [LC15BTS_TEMP_SUPPLY] = "/var/lc15/temp/pa-supply/temp", + [LC15BTS_TEMP_SOC] = "/var/lc15/temp/cpu/temp", + [LC15BTS_TEMP_FPGA] = "/var/lc15/temp/fpga/temp", + [LC15BTS_TEMP_LOGRF] = "/var/lc15/temp/logrf/temp", + [LC15BTS_TEMP_OCXO] = "/var/lc15/temp/ocxo/temp", + [LC15BTS_TEMP_TX0] = "/var/lc15/temp/tx0/temp", + [LC15BTS_TEMP_TX1] = "/var/lc15/temp/tx1/temp", + [LC15BTS_TEMP_PA0] = "/var/lc15/temp/pa0/temp", + [LC15BTS_TEMP_PA1] = "/var/lc15/temp/pa1/temp", }; -static const int temp_has_fault[_NUM_TEMP_SENSORS] = { - [LC15BTS_TEMP_PA1] = 1, - [LC15BTS_TEMP_PA2] = 1, -}; - -static const char *temp_type_str[_NUM_TEMP_TYPES] = { - [LC15BTS_TEMP_INPUT] = "input", - [LC15BTS_TEMP_LOWEST] = "lowest", - [LC15BTS_TEMP_HIGHEST] = "highest", - [LC15BTS_TEMP_FAULT] = "fault", -}; - -int lc15bts_temp_get(enum lc15bts_temp_sensor sensor, - enum lc15bts_temp_type type) +int lc15bts_temp_get(enum lc15bts_temp_sensor sensor) { char buf[PATH_MAX]; char tempstr[8]; - char faultstr[8]; int fd, rc; if (sensor < 0 || sensor >= _NUM_TEMP_SENSORS) return -EINVAL; - if (type >= ARRAY_SIZE(temp_type_str)) - return -EINVAL; - - snprintf(buf, sizeof(buf)-1, "%s%s", temp_devs[sensor], temp_type_str[type]); + snprintf(buf, sizeof(buf)-1, "%s", temp_devs[sensor]); buf[sizeof(buf)-1] = '\0'; fd = open(buf, O_RDONLY); @@ -86,32 +70,6 @@ int lc15bts_temp_get(enum lc15bts_temp_sensor sensor, } close(fd); - // Check fault - if (type == LC15BTS_TEMP_FAULT || !temp_has_fault[sensor]) - return atoi(tempstr); - - snprintf(buf, sizeof(buf)-1, "%s%s", temp_devs[sensor], temp_type_str[LC15BTS_TEMP_FAULT]); - buf[sizeof(buf)-1] = '\0'; - - fd = open(buf, O_RDONLY); - if (fd < 0) - return fd; - - rc = read(fd, faultstr, sizeof(faultstr)); - tempstr[sizeof(faultstr)-1] = '\0'; - if (rc < 0) { - close(fd); - return rc; - } - if (rc == 0) { - close(fd); - return -EIO; - } - close(fd); - - if (atoi(faultstr)) - return -EIO; - return atoi(tempstr); } |