summaryrefslogtreecommitdiffstats
path: root/power-660.c
diff options
context:
space:
mode:
authorZhao Wei Liew <zhaoweiliew@gmail.com>2016-07-19 19:57:06 +0800
committerMichael Bestas <mkbestas@lineageos.org>2019-10-23 01:12:56 +0300
commit71131ea4e0f0a05a51443571970e4f74cb14de65 (patch)
tree5956a90ba3cd005f4c6a82e8a354cbb435dbb370 /power-660.c
parentb989cae4900c6647bd5fddfd9930c01e999025ea (diff)
downloadvendor_qcom_opensource_power-71131ea4e0f0a05a51443571970e4f74cb14de65.tar.gz
vendor_qcom_opensource_power-71131ea4e0f0a05a51443571970e4f74cb14de65.tar.bz2
vendor_qcom_opensource_power-71131ea4e0f0a05a51443571970e4f74cb14de65.zip
power: Simplify soc_id checks
- Get soc_id in a common util function - Return boolean values for the target-specific soc_id checks Change-Id: I038c435d28855859f36566de7acf881037d070f2
Diffstat (limited to 'power-660.c')
-rw-r--r--power-660.c33
1 files changed, 14 insertions, 19 deletions
diff --git a/power-660.c b/power-660.c
index b2f0b70..56c5d7c 100644
--- a/power-660.c
+++ b/power-660.c
@@ -59,25 +59,20 @@ static int camera_hint_ref_count;
static void process_video_encode_hint(void* metadata);
// static void process_cam_preview_hint(void *metadata);
-/* Returns true is target is SDM630/SDM455 else false*/
-static bool is_target_SDM630() {
- int fd;
- bool is_target_SDM630 = false;
- char buf[10] = {0};
- fd = open("/sys/devices/soc0/soc_id", O_RDONLY);
- if (fd >= 0) {
- if (read(fd, buf, sizeof(buf) - 1) == -1) {
- ALOGW("Unable to read soc_id");
- is_target_SDM630 = false;
- } else {
- int soc_id = atoi(buf);
- if (soc_id == 318 || soc_id == 327 || soc_id == 385) {
- is_target_SDM630 = true; /* Above SOCID for SDM630/SDM455 */
- }
- }
- }
- close(fd);
- return is_target_SDM630;
+/**
+ * If target is SDM630/SDM455:
+ * return true
+ * else:
+ * return false
+ */
+static bool is_target_SDM630(void) {
+ static bool is_SDM630 = false;
+ int soc_id;
+
+ soc_id = get_soc_id();
+ if (soc_id == 318 || soc_id == 327 || soc_id == 385) is_SDM630 = true;
+
+ return is_SDM630;
}
int power_hint_override(power_hint_t hint, void* data) {