Add API to read the device SOC ID.

CRs-Fixed: 2385448
Change-Id: Ia154c908e610e2e475171d9a45822bae84210d5b
This commit is contained in:
Ashish Dhiman 2019-01-28 12:48:11 +05:30 committed by Gerrit - the friendly Code Review server
parent 704ec016f5
commit 4d2c7279b5
2 changed files with 22 additions and 0 deletions

View file

@ -208,3 +208,24 @@ detected:
LOC_LOGW("HAL: %s returned %d", __FUNCTION__, gTarget);
return gTarget;
}
int loc_read_device_soc_id()
{
char buf[10] = {0};
int soc_id = 0;
int fd = open("/sys/devices/soc0/soc_id", O_RDONLY);
if (fd >= 0)
{
if (read(fd, buf, sizeof(buf) - 1) == -1)
{
LOC_LOGI ("%s: unable to read soc_id", __FUNCTION__);
}
else
{
soc_id = atoi(buf);
LOC_LOGI ("%s: Soc ID :%d", __FUNCTION__, soc_id);
}
close(fd);
}
return soc_id;
}

View file

@ -54,6 +54,7 @@ void loc_get_platform_name(char *platform_name, int array_length);
/*The character array passed to this function should have length
of atleast PROPERTY_VALUE_MAX*/
void loc_get_auto_platform_name(char *platform_name, int array_length);
int loc_read_device_soc_id();
/* Please remember to update 'target_name' in loc_log.cpp,
if do any changes to this enum. */