unsigned int ASUS3GAvailable() { unsigned int ret = 0; if (!HW_DRF_VAL(TEGRA_DEVKIT, MISC_HW, PROJECT, ventana_hw)) { //Only TF101 has 3G SKU definition return HW_DRF_VAL(TEGRA_DEVKIT, MISC_HW, SKU, ventana_hw); } return ret; }
unsigned int ASUSWiMAXAvailable() { unsigned int ret = 0; if (ASUS3GAvailable()) return ret; /* 3G module is equipped */ if (!HW_DRF_VAL(TEGRA_DEVKIT, MISC_HW, PROJECT, ventana_hw)) { //Only TF101 has WiMAX SKU definition return HW_DRF_VAL(TEGRA_DEVKIT, MISC_HW, WIMAX, ventana_hw); } return ret; }
const char *tegra3_get_project_name(void) { unsigned int project_id = HW_DRF_VAL(TEGRA3_DEVKIT, MISC_HW, PROJECT, cardhu_pcbid); return (project_id < TEGRA3_PROJECT_MAX) ? tegra3_project_name[project_id] : "unknown"; }
bool tegra3_check_touch_module(unsigned vendor) { unsigned int touch_pcbid = 0; const char *project = tegra3_get_project_name(); bool ret = false; /* Fetch PCB_ID[2] and PCB_ID[6] and recompose it */ touch_pcbid = (HW_DRF_VAL(TEGRA3_DEVKIT, MISC_HW, TOUCHL, cardhu_pcbid)) + (HW_DRF_VAL(TEGRA3_DEVKIT, MISC_HW, TOUCHH, cardhu_pcbid) << 1); if (vendor < TOUCH_VENDOR_ELAN) { if (!strcmp(project, "TF201") || !strcmp(project, "TF201G")) ret = (vendor == touch_pcbid) ? true : false; } else { if (!strcmp(project, "TF201X") || !strcmp(project, "TF201XG")) ret = ((vendor % TOUCH_VENDOR_ELAN) == touch_pcbid) ? true : false; } return ret; }
unsigned int ASUSCheckTouchVendor(unsigned int vendor) { unsigned int ret = 0; if (HW_DRF_VAL(TEGRA_DEVKIT, MISC_HW, PROJECT, ventana_hw) < 2) { //All valid projects (TF101/SL101) have touch panel module //definition switch (vendor) { case TOUCH_VENDOR_SINTEK: ret = HW_DRF_VAL(TEGRA_DEVKIT, MISC_HW, TOUCH, ventana_hw) ? 0 : 1; break; case TOUCH_VENDOR_WINTEK: ret = HW_DRF_VAL(TEGRA_DEVKIT, MISC_HW, TOUCH, ventana_hw) ? 1 : 0; break; default: pr_err("[MISC]: Check TOUCH with undefined vendor.\n"); } } return ret; }
unsigned int ASUSCheckWLANVendor(unsigned int vendor) { unsigned int ret = 0; if (HW_DRF_VAL(TEGRA_DEVKIT, MISC_HW, PROJECT, ventana_hw) < 2) { //All valid projects (TF101/SL101) have BT/WLAN module //definition switch (vendor) { case BT_WLAN_VENDOR_MURATA: ret = HW_DRF_VAL(TEGRA_DEVKIT, MISC_HW, VENDOR, ventana_hw) ? 0 : 1; break; case BT_WLAN_VENDOR_AZW: ret = HW_DRF_VAL(TEGRA_DEVKIT, MISC_HW, VENDOR, ventana_hw) ? 1 : 0; break; default: pr_err("[MISC]: Check WLAN with undefined vendor.\n"); } } return ret; }
unsigned int ASUSGetProjectID() { unsigned int ret = 0; ret = HW_DRF_VAL(TEGRA_DEVKIT, MISC_HW, PROJECT, ventana_hw); switch (ret) { case 0: //TF101(EP101) case 1: //SL101(EP102) ret += 101; break; default: pr_err("[MISC]: Illegal project identification.\n"); } return ret; }
unsigned int tegra3_query_touch_module_pcbid(void) { unsigned int touch_pcbid = 0; unsigned int project = tegra3_get_project_id(); unsigned int ret = -1; /* Check if running target platform */ if ((project == TEGRA3_PROJECT_TF300T) || (project == TEGRA3_PROJECT_TF300TG) || (project == TEGRA3_PROJECT_TF300TL)) { pr_err("[MISC]: %s is not supported on %s.\n", __func__, tegra3_get_project_name()); return ret; } /* Fetch PCB_ID[2] and PCB_ID[6] and recompose it */ touch_pcbid = (HW_DRF_VAL(TEGRA3_DEVKIT, MISC_HW, TOUCHL, cardhu_pcbid)) + (HW_DRF_VAL(TEGRA3_DEVKIT, MISC_HW, TOUCHH, cardhu_pcbid) << 1); if ((project == TEGRA3_PROJECT_TF201) || (project == TEGRA3_PROJECT_TF700T)) ret = touch_pcbid; return ret; }
static void ASUSGetPcbid() { unsigned int pcbid; unsigned int ret = 0; ret = HW_DRF_VAL(TEGRA_DEVKIT, MISC_HW, PROJECT, ventana_hw); if(ret == 0 || ret ==1) { //TF101 or SL101 pcbid = ventana_hw >> 4; int i = VENTANA_PCBID_OUTPUT_LENGTH - 2; while (i+1) { ventana_pcbid[i--] = (1 & pcbid) ? '1' : '0'; pcbid >>= 1; } ventana_pcbid[VENTANA_PCBID_OUTPUT_LENGTH-1] = 'b'; }
unsigned int tegra3_query_wifi_module_pcbid(void) { unsigned int wifi_pcbid = 0; unsigned int project = tegra3_get_project_id(); unsigned int ret = -1; /* Check if running target platform is valid */ if (project == TEGRA3_PROJECT_INVALID) { pr_err("[MISC]: %s is not supported on %s.\n", __func__, tegra3_get_project_name()); return ret; } wifi_pcbid = HW_DRF_VAL(TEGRA3_DEVKIT, MISC_HW, WIFI, cardhu_pcbid); ret = wifi_pcbid; return ret; }
unsigned int tegra3_get_project_id(void) { unsigned int project_id = tegra3_project_name_index; if (tegra3_misc_enabled) { project_id = HW_DRF_VAL(TEGRA3_DEVKIT, MISC_HW, PROJECT, cardhu_pcbid); /* WARN if project id was not matched with PCBID */ WARN_ONCE(project_id != tegra3_project_name_index, "[MISC]: project ID in kernel cmdline was not matched with PCBID\n"); } else { pr_info("[MISC]: adopt kernel cmdline prior to %s ready.\n", __func__); } return (project_id < TEGRA3_PROJECT_MAX) ? project_id : TEGRA3_PROJECT_INVALID; }
static void ASUSGetProjectName() { unsigned int ret = 0; ret = HW_DRF_VAL(TEGRA_DEVKIT, MISC_HW, PROJECT, ventana_hw); if(ret == 0) { //TF101 if(ASUS3GAvailable()) { strcpy(ventana_projectname,"TF101G"); } else { if(ASUSWiMAXAvailable()) strcpy(ventana_projectname,"TF101-WiMAX"); else strcpy(ventana_projectname,"TF101"); } } else if(ret == 1) { //SL101 strcpy(ventana_projectname,"SL101"); } else { pr_err("[MISC]: Illegal project identification.\n"); strcpy(ventana_projectname,"unknown project name"); } }
unsigned int tegra3_query_audio_codec_pcbid(void) { unsigned int codec_pcbid = 0; unsigned int project = tegra3_get_project_id(); unsigned int ret = -1; /* Check if running target platform */ if ((project == TEGRA3_PROJECT_TF201) || (project == TEGRA3_PROJECT_TF700T)) { pr_err("[MISC]: %s is not supported on %s.\n", __func__, tegra3_get_project_name()); return ret; } codec_pcbid = HW_DRF_VAL(TEGRA3_DEVKIT, MISC_HW, ACODEC, cardhu_pcbid); if ((project == TEGRA3_PROJECT_TF300T) || (project == TEGRA3_PROJECT_TF300TG) || (project == TEGRA3_PROJECT_TF300TL)) { ret = codec_pcbid; } return ret; }