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
This commit is contained in:
committed by
Michael Bestas
parent
3fac864721
commit
7ff6620596
33
power-660.c
33
power-660.c
@@ -56,25 +56,20 @@ static int video_encode_hint_sent;
|
||||
|
||||
static void process_video_encode_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) {
|
||||
|
||||
Reference in New Issue
Block a user