1daeccac2SArend van Spriel // SPDX-License-Identifier: ISC 2bd1e82bbSHans de Goede /* 3bd1e82bbSHans de Goede * Copyright 2018 Hans de Goede <hdegoede@redhat.com> 4bd1e82bbSHans de Goede */ 5bd1e82bbSHans de Goede 6bd1e82bbSHans de Goede #include <linux/dmi.h> 7bd1e82bbSHans de Goede #include <linux/mod_devicetable.h> 8bd1e82bbSHans de Goede #include "core.h" 9bd1e82bbSHans de Goede #include "common.h" 10bd1e82bbSHans de Goede #include "brcm_hw_ids.h" 11bd1e82bbSHans de Goede 12bd1e82bbSHans de Goede /* The DMI data never changes so we can use a static buf for this */ 13bd1e82bbSHans de Goede static char dmi_board_type[128]; 14bd1e82bbSHans de Goede 15bd1e82bbSHans de Goede struct brcmf_dmi_data { 16bd1e82bbSHans de Goede u32 chip; 17bd1e82bbSHans de Goede u32 chiprev; 18bd1e82bbSHans de Goede const char *board_type; 19bd1e82bbSHans de Goede }; 20bd1e82bbSHans de Goede 21bd1e82bbSHans de Goede /* NOTE: Please keep all entries sorted alphabetically */ 22bd1e82bbSHans de Goede 23b1a0ba8fSHans de Goede static const struct brcmf_dmi_data acepc_t8_data = { 24b1a0ba8fSHans de Goede BRCM_CC_4345_CHIP_ID, 6, "acepc-t8" 25b1a0ba8fSHans de Goede }; 26b1a0ba8fSHans de Goede 27bd1e82bbSHans de Goede static const struct brcmf_dmi_data gpd_win_pocket_data = { 28bd1e82bbSHans de Goede BRCM_CC_4356_CHIP_ID, 2, "gpd-win-pocket" 29bd1e82bbSHans de Goede }; 30bd1e82bbSHans de Goede 31bd1e82bbSHans de Goede static const struct brcmf_dmi_data jumper_ezpad_mini3_data = { 32bd1e82bbSHans de Goede BRCM_CC_43430_CHIP_ID, 0, "jumper-ezpad-mini3" 33bd1e82bbSHans de Goede }; 34bd1e82bbSHans de Goede 35bd1e82bbSHans de Goede static const struct brcmf_dmi_data meegopad_t08_data = { 36bd1e82bbSHans de Goede BRCM_CC_43340_CHIP_ID, 2, "meegopad-t08" 37bd1e82bbSHans de Goede }; 38bd1e82bbSHans de Goede 394d95f99cSHans de Goede static const struct brcmf_dmi_data pov_tab_p1006w_data = { 404d95f99cSHans de Goede BRCM_CC_43340_CHIP_ID, 2, "pov-tab-p1006w-data" 414d95f99cSHans de Goede }; 424d95f99cSHans de Goede 43af4b3a6fSHans de Goede static const struct brcmf_dmi_data predia_basic_data = { 44af4b3a6fSHans de Goede BRCM_CC_43341_CHIP_ID, 2, "predia-basic" 45af4b3a6fSHans de Goede }; 46af4b3a6fSHans de Goede 47a338c874SHans de Goede /* Note the Voyo winpad A15 tablet uses the same Ampak AP6330 module, with the 48a338c874SHans de Goede * exact same nvram file as the Prowise-PT301 tablet. Since the nvram for the 49a338c874SHans de Goede * Prowise-PT301 is already in linux-firmware we just point to that here. 50a338c874SHans de Goede */ 51a338c874SHans de Goede static const struct brcmf_dmi_data voyo_winpad_a15_data = { 52a338c874SHans de Goede BRCM_CC_4330_CHIP_ID, 4, "Prowise-PT301" 53a338c874SHans de Goede }; 54a338c874SHans de Goede 55bd1e82bbSHans de Goede static const struct dmi_system_id dmi_platform_data[] = { 56bd1e82bbSHans de Goede { 57b1a0ba8fSHans de Goede /* ACEPC T8 Cherry Trail Z8350 mini PC */ 58b1a0ba8fSHans de Goede .matches = { 59b1a0ba8fSHans de Goede DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "To be filled by O.E.M."), 60b1a0ba8fSHans de Goede DMI_EXACT_MATCH(DMI_BOARD_NAME, "Cherry Trail CR"), 61b1a0ba8fSHans de Goede DMI_EXACT_MATCH(DMI_PRODUCT_SKU, "T8"), 62b1a0ba8fSHans de Goede /* also match on somewhat unique bios-version */ 63b1a0ba8fSHans de Goede DMI_EXACT_MATCH(DMI_BIOS_VERSION, "1.000"), 64b1a0ba8fSHans de Goede }, 65b1a0ba8fSHans de Goede .driver_data = (void *)&acepc_t8_data, 66b1a0ba8fSHans de Goede }, 67b1a0ba8fSHans de Goede { 68b1a0ba8fSHans de Goede /* ACEPC T11 Cherry Trail Z8350 mini PC, same wifi as the T8 */ 69b1a0ba8fSHans de Goede .matches = { 70b1a0ba8fSHans de Goede DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "To be filled by O.E.M."), 71b1a0ba8fSHans de Goede DMI_EXACT_MATCH(DMI_BOARD_NAME, "Cherry Trail CR"), 72b1a0ba8fSHans de Goede DMI_EXACT_MATCH(DMI_PRODUCT_SKU, "T11"), 73b1a0ba8fSHans de Goede /* also match on somewhat unique bios-version */ 74b1a0ba8fSHans de Goede DMI_EXACT_MATCH(DMI_BIOS_VERSION, "1.000"), 75b1a0ba8fSHans de Goede }, 76b1a0ba8fSHans de Goede .driver_data = (void *)&acepc_t8_data, 77b1a0ba8fSHans de Goede }, 78b1a0ba8fSHans de Goede { 79*49c3eb30SHans de Goede /* Cyberbook T116 rugged tablet */ 80*49c3eb30SHans de Goede .matches = { 81*49c3eb30SHans de Goede DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "Default string"), 82*49c3eb30SHans de Goede DMI_EXACT_MATCH(DMI_BOARD_NAME, "Cherry Trail CR"), 83*49c3eb30SHans de Goede DMI_EXACT_MATCH(DMI_PRODUCT_SKU, "20170531"), 84*49c3eb30SHans de Goede }, 85*49c3eb30SHans de Goede /* The factory image nvram file is identical to the ACEPC T8 one */ 86*49c3eb30SHans de Goede .driver_data = (void *)&acepc_t8_data, 87*49c3eb30SHans de Goede }, 88*49c3eb30SHans de Goede { 89bd1e82bbSHans de Goede /* Match for the GPDwin which unfortunately uses somewhat 90bd1e82bbSHans de Goede * generic dmi strings, which is why we test for 4 strings. 91bd1e82bbSHans de Goede * Comparing against 23 other byt/cht boards, board_vendor 92bd1e82bbSHans de Goede * and board_name are unique to the GPDwin, where as only one 93bd1e82bbSHans de Goede * other board has the same board_serial and 3 others have 94bd1e82bbSHans de Goede * the same default product_name. Also the GPDwin is the 95bd1e82bbSHans de Goede * only device to have both board_ and product_name not set. 96bd1e82bbSHans de Goede */ 97bd1e82bbSHans de Goede .matches = { 98bd1e82bbSHans de Goede DMI_MATCH(DMI_BOARD_VENDOR, "AMI Corporation"), 99bd1e82bbSHans de Goede DMI_MATCH(DMI_BOARD_NAME, "Default string"), 100bd1e82bbSHans de Goede DMI_MATCH(DMI_BOARD_SERIAL, "Default string"), 101bd1e82bbSHans de Goede DMI_MATCH(DMI_PRODUCT_NAME, "Default string"), 102bd1e82bbSHans de Goede }, 103bd1e82bbSHans de Goede .driver_data = (void *)&gpd_win_pocket_data, 104bd1e82bbSHans de Goede }, 105bd1e82bbSHans de Goede { 106bd1e82bbSHans de Goede /* Jumper EZpad mini3 */ 107bd1e82bbSHans de Goede .matches = { 108bd1e82bbSHans de Goede DMI_MATCH(DMI_SYS_VENDOR, "Insyde"), 109bd1e82bbSHans de Goede DMI_MATCH(DMI_PRODUCT_NAME, "CherryTrail"), 110bd1e82bbSHans de Goede /* jumperx.T87.KFBNEEA02 with the version-nr dropped */ 111bd1e82bbSHans de Goede DMI_MATCH(DMI_BIOS_VERSION, "jumperx.T87.KFBNEEA"), 112bd1e82bbSHans de Goede }, 113bd1e82bbSHans de Goede .driver_data = (void *)&jumper_ezpad_mini3_data, 114bd1e82bbSHans de Goede }, 115bd1e82bbSHans de Goede { 116bd1e82bbSHans de Goede /* Meegopad T08 */ 117bd1e82bbSHans de Goede .matches = { 118bd1e82bbSHans de Goede DMI_MATCH(DMI_SYS_VENDOR, "Default string"), 119bd1e82bbSHans de Goede DMI_MATCH(DMI_PRODUCT_NAME, "Default string"), 120bd1e82bbSHans de Goede DMI_MATCH(DMI_BOARD_NAME, "T3 MRD"), 121bd1e82bbSHans de Goede DMI_MATCH(DMI_BOARD_VERSION, "V1.1"), 122bd1e82bbSHans de Goede }, 123bd1e82bbSHans de Goede .driver_data = (void *)&meegopad_t08_data, 124bd1e82bbSHans de Goede }, 1254d95f99cSHans de Goede { 1264d95f99cSHans de Goede /* Point of View TAB-P1006W-232 */ 1274d95f99cSHans de Goede .matches = { 1284d95f99cSHans de Goede DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Insyde"), 1294d95f99cSHans de Goede DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "BayTrail"), 1304d95f99cSHans de Goede /* Note 105b is Foxcon's USB/PCI vendor id */ 1314d95f99cSHans de Goede DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "105B"), 1324d95f99cSHans de Goede DMI_EXACT_MATCH(DMI_BOARD_NAME, "0E57"), 1334d95f99cSHans de Goede }, 1344d95f99cSHans de Goede .driver_data = (void *)&pov_tab_p1006w_data, 1354d95f99cSHans de Goede }, 136af4b3a6fSHans de Goede { 137af4b3a6fSHans de Goede /* Predia Basic tablet (+ with keyboard dock) */ 138af4b3a6fSHans de Goede .matches = { 139af4b3a6fSHans de Goede DMI_MATCH(DMI_SYS_VENDOR, "Insyde"), 140af4b3a6fSHans de Goede DMI_MATCH(DMI_PRODUCT_NAME, "CherryTrail"), 141af4b3a6fSHans de Goede /* Mx.WT107.KUBNGEA02 with the version-nr dropped */ 142af4b3a6fSHans de Goede DMI_MATCH(DMI_BIOS_VERSION, "Mx.WT107.KUBNGEA"), 143af4b3a6fSHans de Goede }, 144af4b3a6fSHans de Goede .driver_data = (void *)&predia_basic_data, 145af4b3a6fSHans de Goede }, 146a338c874SHans de Goede { 147a338c874SHans de Goede /* Voyo winpad A15 tablet */ 148a338c874SHans de Goede .matches = { 149a338c874SHans de Goede DMI_MATCH(DMI_BOARD_VENDOR, "AMI Corporation"), 150a338c874SHans de Goede DMI_MATCH(DMI_BOARD_NAME, "Aptio CRB"), 151a338c874SHans de Goede /* Above strings are too generic, also match on BIOS date */ 152a338c874SHans de Goede DMI_MATCH(DMI_BIOS_DATE, "11/20/2014"), 153a338c874SHans de Goede }, 154a338c874SHans de Goede .driver_data = (void *)&voyo_winpad_a15_data, 155a338c874SHans de Goede }, 156bd1e82bbSHans de Goede {} 157bd1e82bbSHans de Goede }; 158bd1e82bbSHans de Goede 159bd1e82bbSHans de Goede void brcmf_dmi_probe(struct brcmf_mp_device *settings, u32 chip, u32 chiprev) 160bd1e82bbSHans de Goede { 161bd1e82bbSHans de Goede const struct dmi_system_id *match; 162bd1e82bbSHans de Goede const struct brcmf_dmi_data *data; 163bd1e82bbSHans de Goede const char *sys_vendor; 164bd1e82bbSHans de Goede const char *product_name; 165bd1e82bbSHans de Goede 166bd1e82bbSHans de Goede /* Some models have DMI strings which are too generic, e.g. 167bd1e82bbSHans de Goede * "Default string", we use a quirk table for these. 168bd1e82bbSHans de Goede */ 169bd1e82bbSHans de Goede for (match = dmi_first_match(dmi_platform_data); 170bd1e82bbSHans de Goede match; 171bd1e82bbSHans de Goede match = dmi_first_match(match + 1)) { 172bd1e82bbSHans de Goede data = match->driver_data; 173bd1e82bbSHans de Goede 174bd1e82bbSHans de Goede if (data->chip == chip && data->chiprev == chiprev) { 175bd1e82bbSHans de Goede settings->board_type = data->board_type; 176bd1e82bbSHans de Goede return; 177bd1e82bbSHans de Goede } 178bd1e82bbSHans de Goede } 179bd1e82bbSHans de Goede 180bd1e82bbSHans de Goede /* Not found in the quirk-table, use sys_vendor-product_name */ 181bd1e82bbSHans de Goede sys_vendor = dmi_get_system_info(DMI_SYS_VENDOR); 182bd1e82bbSHans de Goede product_name = dmi_get_system_info(DMI_PRODUCT_NAME); 183bd1e82bbSHans de Goede if (sys_vendor && product_name) { 184bd1e82bbSHans de Goede snprintf(dmi_board_type, sizeof(dmi_board_type), "%s-%s", 185bd1e82bbSHans de Goede sys_vendor, product_name); 186bd1e82bbSHans de Goede settings->board_type = dmi_board_type; 187bd1e82bbSHans de Goede } 188bd1e82bbSHans de Goede } 189