/* func : choose the gpu dcdc supply or not by hardware version input : void output : 0 : not supply gpu dcdc 1 : supply gpu dcdc */ static int init_gpu_dcdc_supply(void) { #if 0 unsigned int version1 = 0, version2 =0, min_version1 = 0, min_version2 = 0; int supply = 0; get_hwversion_num(&version1, &version2, &min_version1,&min_version2); if((version2 >= HW_VERSION_VOLTAGE_LVEL3 - VOL_TOLERANCE) && (version2 <= HW_VERSION_VOLTAGE_LVEL4 + VOL_TOLERANCE)) // LTE, LTE wifi { supply = 1; } else if(version2 >= HW_VERSION_VOLTAGE_LVEL5 - VOL_TOLERANCE) // 101w, 102u, 101u { if(version1 <= HW_VERSION_VOLTAGE_LVEL5 + VOL_TOLERANCE) // V4 & higher than v4 supply = 1; } printk("%s:%d",__func__,supply); return supply; #else static int supply = -1; if (-1 == supply) { supply = get_gpu_dcdc_supply(); g_product_feature_array[PROD_FEATURE_GPU_DCDC_SUPPLY] = supply; printk("%s supply=%d.\n", __func__, supply); } return supply; #endif }
/* func : choose the gpu dcdc supply or not by hardware version input : void output : 0 : not supply gpu dcdc 1 : supply gpu dcdc */ static int init_gpu_dcdc_supply() { unsigned int version1 = 0, version2 =0, min_version1 = 0, min_version2 = 0; int supply = 0; get_hwversion_num(&version1, &version2, &min_version1,&min_version2); if((version2 >= HW_VERSION_VOLTAGE_LVEL4 - VOL_TOLERANCE) && (version2 <= HW_VERSION_VOLTAGE_LVEL4 + VOL_TOLERANCE) && (version1 >= HW_VERSION_VOLTAGE_LVEL5 - VOL_TOLERANCE)) // LTE 101L 103L { supply = 1; } else if((version2 <= HW_VERSION_VOLTAGE_LVEL3 + VOL_TOLERANCE) && (version2 >= HW_VERSION_VOLTAGE_LVEL3 - VOL_TOLERANCE) && (version1 >= HW_VERSION_VOLTAGE_LVEL7 - VOL_TOLERANCE)) //LTE 101wf { supply = 1; } else if((version2 >= HW_VERSION_VOLTAGE_LVEL5 - VOL_TOLERANCE) && (version1 <= HW_VERSION_VOLTAGE_LVEL5 + VOL_TOLERANCE) && (version1 >= HW_VERSION_VOLTAGE_LVEL5 - VOL_TOLERANCE)) //101w, 102u, 101u : V4 & higher than v4 { supply = 1; } else if((version2 >= HW_VERSION_VOLTAGE_LVEL5 - VOL_TOLERANCE) && (version2 <= HW_VERSION_VOLTAGE_LVEL5 + VOL_TOLERANCE) && (version1 >= HW_VERSION_VOLTAGE_LVEL4 - VOL_TOLERANCE) && (version1 <= HW_VERSION_VOLTAGE_LVEL4 + VOL_TOLERANCE)) // 101wt { supply = 1; } #if 0 else if((version2 >= HW_VERSION_VOLTAGE_LVEL7 - VOL_TOLERANCE) && (version2 <= HW_VERSION_VOLTAGE_LVEL7 + VOL_TOLERANCE)) { if(version1 <= HW_VERSION_VOLTAGE_LVEL3 + VOL_TOLERANCE) //201u supply = 1; } #endif else if(((int)version2 >= (int)(HW_VERSION_VOLTAGE_LVEL0 - VOL_TOLERANCE)) && (((int)version2 <=(int)(HW_VERSION_VOLTAGE_LVEL0 + VOL_TOLERANCE)))) { if((version1 >= HW_VERSION_VOLTAGE_LVEL3 - VOL_TOLERANCE) && version1 <= HW_VERSION_VOLTAGE_LVEL3 + VOL_TOLERANCE) // temp verb supply = 1; } printk("[product feature]%s:%d (0: not supply gpu dcdc; 1: supply gpu dcdc)\n",__func__,supply); return supply; }
/* func : choose the usb out 5v supply or not by hardware version input : void output : 0 : ES/CS before V4 1 : CS V4 or later */ static int init_usb_out_5v_supply(void) { unsigned int version1 = 0, version2 =0, min_version1 = 0, min_version2 = 0; int supply = 0; get_hwversion_num(&version1, &version2, &min_version1,&min_version2); if(min_version2 == 1) { supply = 1; } else { supply = 0; } printk("%s:%d",__func__,supply); return supply; }
/* func : choose the usb out 5v supply or not by hardware version input : void output : 0 : ES/CS before V4 1 : CS V4 or later */ static int init_usb_out_5v_supply() { unsigned int version1 = 0, version2 =0, min_version1 = 0, min_version2 = 0; int supply = 0; get_hwversion_num(&version1, &version2, &min_version1,&min_version2); if(min_version2 == 1) { supply = 1; } else { supply = 0; } printk("[product feature]%s:%d (0: ES/CS before V4; 1: CS V4 or later)\n",__func__,supply); return supply; }
/* func : set the sdp charging current by hardware version input : void output : 0 : charger current 2A 1 : charger current 500mA */ static int init_sdp_charger_current(void) { unsigned int version1 = 0, version2 =0, min_version1 = 0, min_version2 = 0; int supply = 0; get_hwversion_num(&version1, &version2, &min_version1,&min_version2); if((version2 >= HW_VERSION_VOLTAGE_LVEL3 - VOL_TOLERANCE) && (version2 <= HW_VERSION_VOLTAGE_LVEL4 + VOL_TOLERANCE)) // LTE, LTE wifi { supply = 1; } else if(version2 >= HW_VERSION_VOLTAGE_LVEL5 - VOL_TOLERANCE) // 101w, 102u, 101u { if(version1 <= HW_VERSION_VOLTAGE_LVEL5 + VOL_TOLERANCE) // V4 & higher than v4 supply = 1; } printk("%s:%d",__func__,supply); return supply; }
/* func : set the sdp charging current by hardware version input : void output : 0 : charger current 2A 1 : charger current 500mA */ static int init_sdp_charger_current() { unsigned int version1 = 0, version2 =0, min_version1 = 0, min_version2 = 0; int supply = 0; get_hwversion_num(&version1, &version2, &min_version1,&min_version2); if(version2 >= HW_VERSION_VOLTAGE_LVEL5 - VOL_TOLERANCE) // 101w, 102u, 101u { if(version1 >= HW_VERSION_VOLTAGE_LVEL6 - VOL_TOLERANCE) // only V3 or before supply = 0; else supply = 1; } else { supply = 1; } printk("[product feature]%s:%d (0: charger current 2A; 1: charger current 500mA)\n",__func__,supply); return supply; }
/* func : detect whether have mhl chip or not by hardware version input : void output : 0 : no mhl chip 1 : have mhl chip */ static int init_mhl_chip_detect() { unsigned int version1 = 0, version2 =0, min_version1 = 0, min_version2 = 0; int supply = 0; get_hwversion_num(&version1, &version2, &min_version1,&min_version2); if((version2 >= HW_VERSION_VOLTAGE_LVEL6 - VOL_TOLERANCE) &&(version2 <= HW_VERSION_VOLTAGE_LVEL6 + VOL_TOLERANCE)) { if(((version1>=HW_VERSION_VOLTAGE_LVEL3- VOL_TOLERANCE) &&(version1<=HW_VERSION_VOLTAGE_LVEL3 + VOL_TOLERANCE)) ||((version1>=HW_VERSION_VOLTAGE_LVEL4- VOL_TOLERANCE) &&(version1<=HW_VERSION_VOLTAGE_LVEL4 + VOL_TOLERANCE)))//202u 不带mhl { supply = 1; } } else if((version2 >= HW_VERSION_VOLTAGE_LVEL7 - VOL_TOLERANCE) &&(version2 <= HW_VERSION_VOLTAGE_LVEL7 + VOL_TOLERANCE)) { if(((version1>=HW_VERSION_VOLTAGE_LVEL4 - VOL_TOLERANCE) &&(version1<=HW_VERSION_VOLTAGE_LVEL4 + VOL_TOLERANCE)) ||((version1>=HW_VERSION_VOLTAGE_LVEL2- VOL_TOLERANCE) &&(version1<=HW_VERSION_VOLTAGE_LVEL2 + VOL_TOLERANCE)))//201u 不带mhl { supply = 1; } } else if((version2 >= HW_VERSION_VOLTAGE_LVEL3 - VOL_TOLERANCE) && (version1 <= HW_VERSION_VOLTAGE_LVEL3 + VOL_TOLERANCE))//201w,201u,201L { if((version1 >= HW_VERSION_VOLTAGE_LVEL2 - VOL_TOLERANCE) &&(version1 <= HW_VERSION_VOLTAGE_LVEL2 + VOL_TOLERANCE))//不带mhl { supply = 1; } } printk("[product feature]%s:%d (0: no mhl chip; 1: have mhl chip)\n",__func__,supply); return supply; }
static int hw_version_get(void) { int hw_version1 = 0, hw_version2 = 0, index=0; int hw_min_version1 = 0, hw_min_version2 = 0; int minor_veridx; memset(hw_version, 0, strlen(hw_version)); get_hwversion_num(&hw_version1,&hw_version2,&hw_min_version1,&hw_min_version2); VERSION_DBG("%s:version1=%d version2=%d,hw_min_version1=%d,hw_min_version2=%d\n", __func__, hw_version1, hw_version2,hw_min_version1,hw_min_version2); if (hw_version1 < 0 || hw_version2 < 0) { printk(KERN_ERR "%s:get major version failed(ver1=%d,ver2=%d)\n",__func__, hw_version1, hw_version2); return -1; } /* lookup the string index by the voltage values */ for (index = 0; index < VERSION_NUM; index++) { if ((hw_version1 >= (mv_to_versionidx_map[index].mV1 - VOL_TOLERANCE)) && (hw_version1 <= (mv_to_versionidx_map[index].mV1 + VOL_TOLERANCE)) && (hw_version2 >= (mv_to_versionidx_map[index].mV2 - VOL_TOLERANCE)) && (hw_version2 <= (mv_to_versionidx_map[index].mV2 + VOL_TOLERANCE))) { break; } } strcpy(hw_version, major_version[index]); minor_veridx = minversion_translate(hw_min_version1,hw_min_version2); if (minor_veridx < 0) { printk(KERN_ERR "%s:get minor version failed.\n",__func__); return -1; } /* connect the major and minor string */ strcat(hw_version, minor_version[minor_veridx]); VERSION_DBG("%s:version is %s\n", __func__, hw_version); return 0; }
static bool init_lte_hardware_detect(void) { bool is_lte = 0; unsigned int version1 = 0, version2 =0, min_version1 = 0, min_version2 = 0; get_hwversion_num(&version1, &version2, &min_version1,&min_version2); if((version2 >= HW_VERSION_VOLTAGE_LVEL4 - VOL_TOLERANCE) && (version2 <= HW_VERSION_VOLTAGE_LVEL4 + VOL_TOLERANCE)) { if(((version1>=HW_VERSION_VOLTAGE_LVEL2- VOL_TOLERANCE)&& (version1<=HW_VERSION_VOLTAGE_LVEL2 + VOL_TOLERANCE))|| ((version1>=HW_VERSION_VOLTAGE_LVEL3- VOL_TOLERANCE)&& (version1<=HW_VERSION_VOLTAGE_LVEL3 + VOL_TOLERANCE))|| ((version1>=HW_VERSION_VOLTAGE_LVEL5- VOL_TOLERANCE)&& (version1<=HW_VERSION_VOLTAGE_LVEL5 + VOL_TOLERANCE))|| ((version1>=HW_VERSION_VOLTAGE_LVEL6- VOL_TOLERANCE)&& (version1<=HW_VERSION_VOLTAGE_LVEL6 + VOL_TOLERANCE))|| ((version1>=HW_VERSION_VOLTAGE_LVEL7- VOL_TOLERANCE)&& (version1<=HW_VERSION_VOLTAGE_LVEL7 + VOL_TOLERANCE))) is_lte = 1; } printk("[product feature]%s:%d (0: no LTE ; 1: LTE)\n",__func__,is_lte); return is_lte; }
/* func : detect dcm battery by hardware version input : void output : 0 : not dcm battery 1 : dcm battery */ static int init_dcm_battery_detect() { unsigned int version1 = 0, version2 =0, min_version1 = 0, min_version2 = 0; int supply = 0; get_hwversion_num(&version1, &version2, &min_version1,&min_version2); if((version2 >= HW_VERSION_VOLTAGE_LVEL3 - VOL_TOLERANCE) && (version2 <= HW_VERSION_VOLTAGE_LVEL3 + VOL_TOLERANCE) && (version1 >= HW_VERSION_VOLTAGE_LVEL3 - VOL_TOLERANCE) && (version1 >= HW_VERSION_VOLTAGE_LVEL3 + VOL_TOLERANCE)) { supply = 1; } else { supply = 0; } printk("[product feature]%s:%d (0: not dcm hardware; 1: dcm hardware)\n",__func__,supply); return supply; }