diff options
author | Zhao Wei Liew <zhaoweiliew@gmail.com> | 2016-07-19 19:57:06 +0800 |
---|---|---|
committer | Michael Bestas <mkbestas@lineageos.org> | 2019-10-23 01:12:56 +0300 |
commit | 71131ea4e0f0a05a51443571970e4f74cb14de65 (patch) | |
tree | 5956a90ba3cd005f4c6a82e8a354cbb435dbb370 /power-8953.c | |
parent | b989cae4900c6647bd5fddfd9930c01e999025ea (diff) | |
download | vendor_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-8953.c')
-rw-r--r-- | power-8953.c | 33 |
1 files changed, 14 insertions, 19 deletions
diff --git a/power-8953.c b/power-8953.c index bd10669..1cdd01d 100644 --- a/power-8953.c +++ b/power-8953.c @@ -62,25 +62,20 @@ static void process_video_encode_hint(void* metadata); static int display_fd; #define SYS_DISPLAY_PWR "/sys/kernel/hbtp/display_pwr" -static bool is_target_SDM632() /* Returns value=632 if target is SDM632 else value 0 */ -{ - int fd; - bool is_target_SDM632 = 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_SDM632 = false; - } else { - int soc_id = atoi(buf); - if (soc_id == 349 || soc_id == 350) { - is_target_SDM632 = true; /* Above SOCID for SDM632 */ - } - } - } - close(fd); - return is_target_SDM632; +/** + * If target is SDM632: + * return true + * else: + * return false + */ +static bool is_target_SDM632(void) { + static bool is_SDM632 = false; + int soc_id; + + soc_id = get_soc_id(); + if (soc_id == 349 || soc_id == 350) is_SDM632 = true; + + return is_SDM632; } int power_hint_override(power_hint_t hint, void* data) { |