A mechanism to detect APQ chip set
The current changes to default the operation mode to Standalone by the CHIP ID. A new method is used for solving this issue. CRs-Fixed: 510462 Change-Id: I58fd85e2c28bf824edeaef62660c62c34761bd37
This commit is contained in:
parent
e7cafab287
commit
e5e62728a2
5 changed files with 80 additions and 41 deletions
|
@ -205,7 +205,7 @@ const GpsInterface* gps_get_hardware_interface ()
|
||||||
// for gps.c
|
// for gps.c
|
||||||
extern "C" const GpsInterface* get_gps_interface()
|
extern "C" const GpsInterface* get_gps_interface()
|
||||||
{
|
{
|
||||||
targetEnumType target = TARGET_OTHER;
|
unsigned int target = TARGET_DEFAULT;
|
||||||
if (NULL == loc_afw_data.context) {
|
if (NULL == loc_afw_data.context) {
|
||||||
loc_eng_read_config();
|
loc_eng_read_config();
|
||||||
|
|
||||||
|
@ -214,8 +214,8 @@ extern "C" const GpsInterface* get_gps_interface()
|
||||||
|
|
||||||
target = get_target();
|
target = get_target();
|
||||||
LOC_LOGD("Target name check returned %s", loc_get_target_name(target));
|
LOC_LOGD("Target name check returned %s", loc_get_target_name(target));
|
||||||
//APQ8064 and APQ8030
|
//APQ8064
|
||||||
if((target == TARGET_APQ8064_STANDALONE) || (target == TARGET_APQ8030_STANDALONE)) {
|
if( getTargetGnssType(target) == GNSS_GSS ) {
|
||||||
gps_conf.CAPABILITIES &= ~(GPS_CAPABILITY_MSA | GPS_CAPABILITY_MSB);
|
gps_conf.CAPABILITIES &= ~(GPS_CAPABILITY_MSA | GPS_CAPABILITY_MSB);
|
||||||
gss_fd = open("/dev/gss", O_RDONLY);
|
gss_fd = open("/dev/gss", O_RDONLY);
|
||||||
if (gss_fd < 0) {
|
if (gss_fd < 0) {
|
||||||
|
@ -226,7 +226,7 @@ extern "C" const GpsInterface* get_gps_interface()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//MPQ8064
|
//MPQ8064
|
||||||
else if(target == TARGET_MPQ8064) {
|
else if( getTargetGnssType(target) == GNSS_NONE) {
|
||||||
LOC_LOGE("No GPS HW on this target (MPQ8064). Not returning interface");
|
LOC_LOGE("No GPS HW on this target (MPQ8064). Not returning interface");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,6 +39,9 @@
|
||||||
#endif /* USE_GLIB */
|
#endif /* USE_GLIB */
|
||||||
#include "log_util.h"
|
#include "log_util.h"
|
||||||
#include "platform_lib_includes.h"
|
#include "platform_lib_includes.h"
|
||||||
|
|
||||||
|
#define BUFFER_SIZE 120
|
||||||
|
|
||||||
// Logging Improvements
|
// Logging Improvements
|
||||||
const char *loc_logger_boolStr[]={"False","True"};
|
const char *loc_logger_boolStr[]={"False","True"};
|
||||||
const char VOID_RET[] = "None";
|
const char VOID_RET[] = "None";
|
||||||
|
@ -105,12 +108,12 @@ const char* log_succ_fail_string(int is_succ)
|
||||||
//Target names
|
//Target names
|
||||||
loc_name_val_s_type target_name[] =
|
loc_name_val_s_type target_name[] =
|
||||||
{
|
{
|
||||||
NAME_VAL(TARGET_OTHER),
|
NAME_VAL(GNSS_NONE),
|
||||||
NAME_VAL(TARGET_APQ8064_STANDALONE),
|
NAME_VAL(GNSS_MSM),
|
||||||
NAME_VAL(TARGET_APQ8064_FUSION3),
|
NAME_VAL(GNSS_GSS),
|
||||||
NAME_VAL(TARGET_MPQ8064),
|
NAME_VAL(GNSS_MDM),
|
||||||
NAME_VAL(TARGET_MSM8930),
|
NAME_VAL(GNSS_GRIFFON),
|
||||||
NAME_VAL(TARGET_APQ8030_STANDALONE)
|
NAME_VAL(GNSS_UNKNOWN)
|
||||||
};
|
};
|
||||||
|
|
||||||
static int target_name_num = sizeof(target_name)/sizeof(loc_name_val_s_type);
|
static int target_name_num = sizeof(target_name)/sizeof(loc_name_val_s_type);
|
||||||
|
@ -128,10 +131,26 @@ RETURN VALUE
|
||||||
The target name string
|
The target name string
|
||||||
|
|
||||||
===========================================================================*/
|
===========================================================================*/
|
||||||
const char *loc_get_target_name(targetEnumType target)
|
const char *loc_get_target_name(unsigned int target)
|
||||||
{
|
{
|
||||||
return loc_get_name_from_val(target_name, target_name_num, (long)target);
|
int index = 0;
|
||||||
|
char ret[BUFFER_SIZE];
|
||||||
|
|
||||||
|
index = getTargetGnssType(target);
|
||||||
|
if( index >= target_name_num || index < 0)
|
||||||
|
index = target_name_num - 1;
|
||||||
|
|
||||||
|
if( (target & HAS_SSC) == HAS_SSC ) {
|
||||||
|
sprintf(ret, " %s with SSC",
|
||||||
|
loc_get_name_from_val(target_name, target_name_num, (long)index) );
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
sprintf(ret, " %s without SSC",
|
||||||
|
loc_get_name_from_val(target_name, target_name_num, (long)index) );
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*===========================================================================
|
/*===========================================================================
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,7 @@ typedef struct
|
||||||
const char* loc_get_name_from_mask(loc_name_val_s_type table[], int table_size, long mask);
|
const char* loc_get_name_from_mask(loc_name_val_s_type table[], int table_size, long mask);
|
||||||
const char* loc_get_name_from_val(loc_name_val_s_type table[], int table_size, long value);
|
const char* loc_get_name_from_val(loc_name_val_s_type table[], int table_size, long value);
|
||||||
const char* loc_get_msg_q_status(int status);
|
const char* loc_get_msg_q_status(int status);
|
||||||
const char* loc_get_target_name(targetEnumType target);
|
const char* loc_get_target_name(unsigned int target);
|
||||||
|
|
||||||
extern const char* log_succ_fail_string(int is_succ);
|
extern const char* log_succ_fail_string(int is_succ);
|
||||||
|
|
||||||
|
|
|
@ -81,9 +81,9 @@ static int read_a_line(const char * file_path, char * line, int line_size)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
targetEnumType get_target(void)
|
unsigned int get_target(void)
|
||||||
{
|
{
|
||||||
targetEnumType target = TARGET_OTHER;
|
unsigned int target = TARGET_DEFAULT;
|
||||||
|
|
||||||
char hw_platform[] = "/sys/devices/system/soc/soc0/hw_platform";
|
char hw_platform[] = "/sys/devices/system/soc/soc0/hw_platform";
|
||||||
char id[] = "/sys/devices/system/soc/soc0/id";
|
char id[] = "/sys/devices/system/soc/soc0/id";
|
||||||
|
@ -92,27 +92,35 @@ targetEnumType get_target(void)
|
||||||
char rd_hw_platform[LINE_LEN];
|
char rd_hw_platform[LINE_LEN];
|
||||||
char rd_id[LINE_LEN];
|
char rd_id[LINE_LEN];
|
||||||
char rd_mdm[LINE_LEN];
|
char rd_mdm[LINE_LEN];
|
||||||
|
char baseband[LINE_LEN];
|
||||||
|
|
||||||
|
property_get("ro.baseband", baseband, "");
|
||||||
read_a_line(hw_platform, rd_hw_platform, LINE_LEN);
|
read_a_line(hw_platform, rd_hw_platform, LINE_LEN);
|
||||||
read_a_line( id, rd_id, LINE_LEN);
|
read_a_line( id, rd_id, LINE_LEN);
|
||||||
|
|
||||||
if( (!memcmp(rd_hw_platform, STR_LIQUID, LENGTH(STR_LIQUID)) && IS_STR_END(rd_hw_platform[LENGTH(STR_LIQUID)])) ||
|
if( !memcmp(baseband, STR_APQ, LENGTH(STR_APQ)) ){
|
||||||
(!memcmp(rd_hw_platform, STR_SURF, LENGTH(STR_SURF)) && IS_STR_END(rd_hw_platform[LENGTH(STR_SURF)])) ||
|
if( !memcmp(rd_id, MPQ8064_ID_1, LENGTH(MPQ8064_ID_1))
|
||||||
(!memcmp(rd_hw_platform, STR_MTP, LENGTH(STR_MTP)) && IS_STR_END(rd_hw_platform[LENGTH(STR_MTP)]))) {
|
&& IS_STR_END(rd_id[LENGTH(MPQ8064_ID_1)]) )
|
||||||
if (!read_a_line( mdm, rd_mdm, LINE_LEN))
|
target = TARGET_MPQ;
|
||||||
target = TARGET_APQ8064_FUSION3;
|
else
|
||||||
else if( (!memcmp(rd_id, APQ8064_ID_1, LENGTH(APQ8064_ID_1)) && IS_STR_END(rd_id[LENGTH(APQ8064_ID_1)])) ||
|
target = TARGET_APQ_SA;
|
||||||
(!memcmp(rd_id, APQ8064_ID_2, LENGTH(APQ8064_ID_2)) && IS_STR_END(rd_id[LENGTH(APQ8064_ID_2)])) )
|
}
|
||||||
target = TARGET_APQ8064_STANDALONE;
|
else {
|
||||||
else if((!memcmp(rd_id, APQ8030_ID_1, LENGTH(APQ8030_ID_1)) && IS_STR_END(rd_id[LENGTH(APQ8030_ID_1)])))
|
if( (!memcmp(rd_hw_platform, STR_LIQUID, LENGTH(STR_LIQUID))
|
||||||
target = TARGET_APQ8030_STANDALONE;
|
&& IS_STR_END(rd_hw_platform[LENGTH(STR_LIQUID)])) ||
|
||||||
|
(!memcmp(rd_hw_platform, STR_SURF, LENGTH(STR_SURF))
|
||||||
|
&& IS_STR_END(rd_hw_platform[LENGTH(STR_SURF)])) ||
|
||||||
|
(!memcmp(rd_hw_platform, STR_MTP, LENGTH(STR_MTP))
|
||||||
|
&& IS_STR_END(rd_hw_platform[LENGTH(STR_MTP)]))) {
|
||||||
|
|
||||||
|
if (!read_a_line( mdm, rd_mdm, LINE_LEN))
|
||||||
|
target = TARGET_MDM;
|
||||||
|
}
|
||||||
|
else if( (!memcmp(rd_id, MSM8930_ID_1, LENGTH(MSM8930_ID_1))
|
||||||
|
&& IS_STR_END(rd_id[LENGTH(MSM8930_ID_1)])) ||
|
||||||
|
(!memcmp(rd_id, MSM8930_ID_2, LENGTH(MSM8930_ID_2))
|
||||||
|
&& IS_STR_END(rd_id[LENGTH(MSM8930_ID_2)])) )
|
||||||
|
target = TARGET_MSM_NO_SSC;
|
||||||
}
|
}
|
||||||
else if (!memcmp(rd_id, APQ8074_ID_1, LENGTH(APQ8074_ID_1)) && IS_STR_END(rd_id[LENGTH(APQ8074_ID_1)]))
|
|
||||||
target = TARGET_APQ8064_STANDALONE;
|
|
||||||
else if( !memcmp(rd_id, MPQ8064_ID_1, LENGTH(MPQ8064_ID_1)) && IS_STR_END(rd_id[LENGTH(MPQ8064_ID_1)]) )
|
|
||||||
target = TARGET_MPQ8064;
|
|
||||||
else if( (!memcmp(rd_id, MSM8930_ID_1, LENGTH(MSM8930_ID_1)) && IS_STR_END(rd_id[LENGTH(MSM8930_ID_1)])) ||
|
|
||||||
(!memcmp(rd_id, MSM8930_ID_2, LENGTH(MSM8930_ID_2)) && IS_STR_END(rd_id[LENGTH(MSM8930_ID_2)])) )
|
|
||||||
target = TARGET_MSM8930;
|
|
||||||
return target;
|
return target;
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,22 +28,34 @@
|
||||||
*/
|
*/
|
||||||
#ifndef LOC_TARGET_H
|
#ifndef LOC_TARGET_H
|
||||||
#define LOC_TARGET_H
|
#define LOC_TARGET_H
|
||||||
|
#define TARGET_SET(gnss,ssc) ( (gnss<<1)|ssc )
|
||||||
|
#define TARGET_DEFAULT TARGET_SET(GNSS_MSM, HAS_SSC)
|
||||||
|
#define TARGET_MDM TARGET_SET(GNSS_MDM, HAS_SSC)
|
||||||
|
#define TARGET_APQ_SA TARGET_SET(GNSS_GSS, NO_SSC)
|
||||||
|
#define TARGET_MPQ TARGET_SET(GNSS_NONE,NO_SSC)
|
||||||
|
#define TARGET_MSM_NO_SSC TARGET_SET(GNSS_MSM, NO_SSC)
|
||||||
|
#define getTargetGnssType(target) (target>>1)
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef enum {
|
unsigned int get_target(void);
|
||||||
TARGET_OTHER = 0,
|
|
||||||
TARGET_APQ8064_STANDALONE,
|
|
||||||
TARGET_APQ8064_FUSION3,
|
|
||||||
TARGET_MPQ8064,
|
|
||||||
TARGET_MSM8930,
|
|
||||||
TARGET_APQ8030_STANDALONE
|
|
||||||
}targetEnumType;
|
|
||||||
|
|
||||||
targetEnumType get_target(void);
|
typedef enum {
|
||||||
|
GNSS_NONE = 0,
|
||||||
|
GNSS_MSM,
|
||||||
|
GNSS_GSS,
|
||||||
|
GNSS_MDM,
|
||||||
|
GNSS_GRIFFON,
|
||||||
|
GNSS_UNKNOWN
|
||||||
|
}GNSS_TARGET;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
NO_SSC = 0,
|
||||||
|
HAS_SSC
|
||||||
|
}SSC_TYPE;
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue