static int __init ini_cfg_init(void) { int8 auc_value[20]; #ifdef CONFIG_HWCONNECTIVITY if (!isMyConnectivityChip(CHIP_TYPE_HI110X)) { INI_ERROR("cfg ini chip type is not match, skip driver init"); return -EINVAL; } else { INI_INFO("cfg init type is matched with hi110x, continue"); } #endif INI_DEBUG("k3v2 .ini config search init!\n"); /*init mutex*/ INI_INIT_MUTEX(&file_mutex); #ifdef INI_TEST #if 1 ini_find_var_value(INI_MODU_WIFI, "wifi_ini_mode", auc_value); ini_find_var_value(INI_MODU_GNSS, "gnss_ini_mode", auc_value); ini_find_var_value(INI_MODU_BT, "bt_ini_mode", auc_value); ini_find_var_value(INI_MODU_FM, "fm_ini_mode", auc_value); ini_find_var_value(INI_MODU_WIFI_PLAT, "wifi_plat_ini_mode", auc_value); ini_find_var_value(INI_MODU_BFG_PLAT, "bfg_plat_ini_mode", auc_value); ini_find_var_value(INI_MODU_WIFI, "loglevel", auc_value); ini_find_var_value(INI_MODU_WIFI, "data_rate_down", auc_value); ini_find_var_value(INI_MODU_WIFI, "data_rate_up", auc_value); ini_find_var_value(INI_MODU_GNSS, "gnss_gpsglonass", auc_value); ini_find_var_value(INI_MODU_GNSS, "gnss_bdgps", auc_value); ini_find_var_value(INI_MODU_BT, "bt_normal", auc_value); ini_find_var_value(INI_MODU_FM, "fm_normal", auc_value); ini_find_var_value(INI_MODU_WIFI_PLAT, "wifi_plat_normal", auc_value); ini_find_var_value(INI_MODU_BFG_PLAT, "bfg_plat_normal", auc_value); #endif #endif return INI_SUCC; }
static int __init bcmsdh_module_init(void) { int error = 0; #ifdef CONFIG_HWCONNECTIVITY //For OneTrack, we need check it's the right chip type or not. //If it's not the right chip type, don't init the driver if (!isMyConnectivityChip(CHIP_TYPE_BCM)) { sd_err(("wifi-sdh chip type is not match, skip driver init")); return -EINVAL; } else { sd_info(("wifi-sdh chip type is matched with Broadcom, continue")); } #endif error = sdio_function_init(); return error; }
/** * Initializes the module. * @return On success, 0. On error, -1, and <code>errno</code> is set * appropriately. */ static int __init bluesleep_init(void) { int retval = 0; #ifdef CONFIG_HWCONNECTIVITY //For OneTrack, we need check it's the right chip type or not. //If it's not the right chip type, don't init the driver if (!isMyConnectivityChip(CHIP_TYPE_BCM)) { pr_err("BT-sleep chip type is not match, skip driver init"); return -EINVAL; } else { pr_info("BT-sleep chip type is matched with Broadcom, continue"); } #endif retval = platform_driver_register(&bluesleep_driver); if (retval) { pr_err("%s: platform_driver_register failed %d\n", __func__, retval); } return retval; }
static int __init k3_gps_bcm_init(void) { #ifdef CONFIG_HWCONNECTIVITY //For OneTrack, we need check it's the right chip type or not. //If it's not the right chip type, don't init the driver if (!isMyConnectivityChip(CHIP_TYPE_BCM)) { printk(KERN_ERR "gps chip type is not match, skip driver init"); return -EINVAL; } else { printk(KERN_INFO "gps chip type is matched with Broadcom, continue"); } #endif if(GPS_IC_TYPE_4774 != get_gps_ic_type()) { printk(KERN_INFO "gps chip type is matched with Broadcom, but is not 4774"); return -EINVAL; } printk(KERN_INFO "gps chip type is matched with Broadcom, and it is 4774\n"); return platform_driver_register(&k3_gps_bcm_driver); }
static int __init gps_bcm_common_init(void) { struct device_node* np = NULL; int ret = 0; char *gps_ic_type_str = NULL; char *gps_ref_clk_enable = NULL; #ifdef CONFIG_HWCONNECTIVITY if (!isMyConnectivityChip(CHIP_TYPE_BCM)) { printk(KERN_INFO "gps chip type is not bcm, skip to register_gps_set_ref_clk_func!"); return 0; } #endif np = of_find_compatible_node(NULL, NULL, DTS_COMP_GPS_POWER_NAME); if (!np) { printk(KERN_ERR "%s, can't find node %s\n", __func__, DTS_COMP_GPS_POWER_NAME); return -1; } ret=of_property_read_string(np, "broadcom_config,ic_type", (const char **)&gps_ic_type_str); if(ret) { printk(KERN_ERR "get broadcom_config,ic_type fail ret=%d\n",ret); gps_ic_type = GPS_IC_TYPE_4752; } else if(0 == strncmp(STR_BCM_TYPE_4752, gps_ic_type_str, sizeof(STR_BCM_TYPE_4752))) { gps_ic_type = GPS_IC_TYPE_4752; } else if(0 == strncmp(STR_BCM_TYPE_47531, gps_ic_type_str, sizeof(STR_BCM_TYPE_47531))) { gps_ic_type = GPS_IC_TYPE_47531; } else if(0 == strncmp(STR_BCM_TYPE_4774, gps_ic_type_str, sizeof(STR_BCM_TYPE_4774))) { gps_ic_type = GPS_IC_TYPE_4774; } else { printk(KERN_ERR "get broadcom_config,get ic type error\n"); gps_ic_type = -1; } printk(KERN_ERR "[%s] gps_ic_type: %d\n", __func__, gps_ic_type); ret = of_property_read_string(np, "broadcom_config,ref_clk_sel_enable", (const char **)&gps_ref_clk_enable); if(ret) { gps_ref_sel_enable = GPS_REFCLK_SEL_ENABLE; } else if(0 == strncmp("no",gps_ref_clk_enable,sizeof("no"))) { gps_ref_sel_enable = GPS_REFCLK_SEL_DISABLE; } else if(0 == strncmp("yes",gps_ref_clk_enable,sizeof("yes"))) { gps_ref_sel_enable = GPS_REFCLK_SEL_ENABLE; } else { gps_ref_sel_enable = -1; } if (GPS_REFCLK_SEL_ENABLE == gps_ref_sel_enable) { register_gps_set_ref_clk_func((void*)set_gps_ref_clk_enable_bcm); } return 0; }
int ini_cfg_init(void) { // int8 auc_value[20]; int32 ret; int8 auc_dts_ini_path[INI_FILE_PATH_LEN] = {0}; int8 auc_cust_spec_ini_path[INI_FILE_PATH_LEN] = {0}; int8 auc_cust_comm_ini_path[INI_FILE_PATH_LEN] = {0}; #ifdef CONFIG_HWCONNECTIVITY if (!isMyConnectivityChip(CHIP_TYPE_HI110X)) { INI_ERROR("cfg ini chip type is not match, skip driver init"); return -EINVAL; } else { INI_INFO("cfg init type is matched with hi110x, continue"); } #endif INI_DEBUG("hi110x ini config search init!\n"); ret = get_cust_conf_string(CUST_MODU_DTS, PROC_NAME_INI_FILE_NAME, auc_dts_ini_path, sizeof(auc_dts_ini_path)); if ( 0 > ret ) { INI_ERROR("can't find dts proc %s\n", PROC_NAME_INI_FILE_NAME); return INI_FAILED; } snprintf(auc_cust_spec_ini_path, sizeof(auc_cust_spec_ini_path), "%s%s", CUST_PATH_SPEC, auc_dts_ini_path); snprintf(auc_cust_comm_ini_path, sizeof(auc_cust_comm_ini_path), "%s%s", CUST_PATH_COMM, auc_dts_ini_path); /*如果ini文件在cust中,则使用cust中的ini文件,否则使用dts中配置的ini文件*/ /*recovery 模式下,此时ini文件可能不能访问,这种情况下,使用dts里配置的值为默认值*/ if (ini_file_exist(auc_cust_spec_ini_path)) { snprintf(g_ini_file_name, sizeof(g_ini_file_name), "%s", auc_cust_spec_ini_path); INI_INFO("%s@%s\n", PROC_NAME_INI_FILE_NAME, g_ini_file_name); } else if (ini_file_exist(auc_cust_comm_ini_path)) { snprintf(g_ini_file_name, sizeof(g_ini_file_name), "%s", auc_cust_comm_ini_path); INI_INFO("%s@%s\n", PROC_NAME_INI_FILE_NAME, g_ini_file_name); } else { snprintf(g_ini_file_name, sizeof(g_ini_file_name), "%s", auc_dts_ini_path); INI_INFO("%s@%s\n", PROC_NAME_INI_FILE_NAME, g_ini_file_name); } INI_INIT_MUTEX(&file_mutex); #ifdef INI_TEST #if 1 ini_find_var_value(INI_MODU_WIFI, "wifi_ini_mode", auc_value); ini_find_var_value(INI_MODU_GNSS, "gnss_ini_mode", auc_value); ini_find_var_value(INI_MODU_BT, "bt_ini_mode", auc_value); ini_find_var_value(INI_MODU_FM, "fm_ini_mode", auc_value); ini_find_var_value(INI_MODU_WIFI_PLAT, "wifi_plat_ini_mode", auc_value); ini_find_var_value(INI_MODU_BFG_PLAT, "bfg_plat_ini_mode", auc_value); ini_find_var_value(INI_MODU_WIFI, "loglevel", auc_value); ini_find_var_value(INI_MODU_WIFI, "data_rate_down", auc_value); ini_find_var_value(INI_MODU_WIFI, "data_rate_up", auc_value); ini_find_var_value(INI_MODU_GNSS, "gnss_gpsglonass", auc_value); ini_find_var_value(INI_MODU_GNSS, "gnss_bdgps", auc_value); ini_find_var_value(INI_MODU_BT, "bt_normal", auc_value); ini_find_var_value(INI_MODU_FM, "fm_normal", auc_value); ini_find_var_value(INI_MODU_WIFI_PLAT, "wifi_plat_normal", auc_value); ini_find_var_value(INI_MODU_BFG_PLAT, "bfg_plat_normal", auc_value); #endif #endif return INI_SUCC; }