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 27*7d6e30dfSHans de Goede /* The Chuwi Hi8 Pro uses the same Ampak AP6212 module as the Chuwi Vi8 Plus 28*7d6e30dfSHans de Goede * and the nvram for the Vi8 Plus is already in linux-firmware, so use that. 29*7d6e30dfSHans de Goede */ 30*7d6e30dfSHans de Goede static const struct brcmf_dmi_data chuwi_hi8_pro_data = { 31*7d6e30dfSHans de Goede BRCM_CC_43430_CHIP_ID, 0, "ilife-S806" 32*7d6e30dfSHans de Goede }; 33*7d6e30dfSHans de Goede 34bd1e82bbSHans de Goede static const struct brcmf_dmi_data gpd_win_pocket_data = { 35bd1e82bbSHans de Goede BRCM_CC_4356_CHIP_ID, 2, "gpd-win-pocket" 36bd1e82bbSHans de Goede }; 37bd1e82bbSHans de Goede 38bd1e82bbSHans de Goede static const struct brcmf_dmi_data jumper_ezpad_mini3_data = { 39bd1e82bbSHans de Goede BRCM_CC_43430_CHIP_ID, 0, "jumper-ezpad-mini3" 40bd1e82bbSHans de Goede }; 41bd1e82bbSHans de Goede 42bd1e82bbSHans de Goede static const struct brcmf_dmi_data meegopad_t08_data = { 43bd1e82bbSHans de Goede BRCM_CC_43340_CHIP_ID, 2, "meegopad-t08" 44bd1e82bbSHans de Goede }; 45bd1e82bbSHans de Goede 464d95f99cSHans de Goede static const struct brcmf_dmi_data pov_tab_p1006w_data = { 474d95f99cSHans de Goede BRCM_CC_43340_CHIP_ID, 2, "pov-tab-p1006w-data" 484d95f99cSHans de Goede }; 494d95f99cSHans de Goede 50af4b3a6fSHans de Goede static const struct brcmf_dmi_data predia_basic_data = { 51af4b3a6fSHans de Goede BRCM_CC_43341_CHIP_ID, 2, "predia-basic" 52af4b3a6fSHans de Goede }; 53af4b3a6fSHans de Goede 54a338c874SHans de Goede /* Note the Voyo winpad A15 tablet uses the same Ampak AP6330 module, with the 55a338c874SHans de Goede * exact same nvram file as the Prowise-PT301 tablet. Since the nvram for the 56a338c874SHans de Goede * Prowise-PT301 is already in linux-firmware we just point to that here. 57a338c874SHans de Goede */ 58a338c874SHans de Goede static const struct brcmf_dmi_data voyo_winpad_a15_data = { 59a338c874SHans de Goede BRCM_CC_4330_CHIP_ID, 4, "Prowise-PT301" 60a338c874SHans de Goede }; 61a338c874SHans de Goede 62bd1e82bbSHans de Goede static const struct dmi_system_id dmi_platform_data[] = { 63bd1e82bbSHans de Goede { 64b1a0ba8fSHans de Goede /* ACEPC T8 Cherry Trail Z8350 mini PC */ 65b1a0ba8fSHans de Goede .matches = { 66b1a0ba8fSHans de Goede DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "To be filled by O.E.M."), 67b1a0ba8fSHans de Goede DMI_EXACT_MATCH(DMI_BOARD_NAME, "Cherry Trail CR"), 68b1a0ba8fSHans de Goede DMI_EXACT_MATCH(DMI_PRODUCT_SKU, "T8"), 69b1a0ba8fSHans de Goede /* also match on somewhat unique bios-version */ 70b1a0ba8fSHans de Goede DMI_EXACT_MATCH(DMI_BIOS_VERSION, "1.000"), 71b1a0ba8fSHans de Goede }, 72b1a0ba8fSHans de Goede .driver_data = (void *)&acepc_t8_data, 73b1a0ba8fSHans de Goede }, 74b1a0ba8fSHans de Goede { 75b1a0ba8fSHans de Goede /* ACEPC T11 Cherry Trail Z8350 mini PC, same wifi as the T8 */ 76b1a0ba8fSHans de Goede .matches = { 77b1a0ba8fSHans de Goede DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "To be filled by O.E.M."), 78b1a0ba8fSHans de Goede DMI_EXACT_MATCH(DMI_BOARD_NAME, "Cherry Trail CR"), 79b1a0ba8fSHans de Goede DMI_EXACT_MATCH(DMI_PRODUCT_SKU, "T11"), 80b1a0ba8fSHans de Goede /* also match on somewhat unique bios-version */ 81b1a0ba8fSHans de Goede DMI_EXACT_MATCH(DMI_BIOS_VERSION, "1.000"), 82b1a0ba8fSHans de Goede }, 83b1a0ba8fSHans de Goede .driver_data = (void *)&acepc_t8_data, 84b1a0ba8fSHans de Goede }, 85b1a0ba8fSHans de Goede { 86*7d6e30dfSHans de Goede /* Chuwi Hi8 Pro with D2D3_Hi8Pro.233 BIOS */ 87*7d6e30dfSHans de Goede .matches = { 88*7d6e30dfSHans de Goede DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "Hampoo"), 89*7d6e30dfSHans de Goede DMI_EXACT_MATCH(DMI_BOARD_NAME, "Cherry Trail CR"), 90*7d6e30dfSHans de Goede DMI_EXACT_MATCH(DMI_PRODUCT_SKU, "MRD"), 91*7d6e30dfSHans de Goede /* Above strings are too generic, also match on BIOS date */ 92*7d6e30dfSHans de Goede DMI_MATCH(DMI_BIOS_DATE, "05/10/2016"), 93*7d6e30dfSHans de Goede }, 94*7d6e30dfSHans de Goede .driver_data = (void *)&chuwi_hi8_pro_data, 95*7d6e30dfSHans de Goede }, 96*7d6e30dfSHans de Goede { 9749c3eb30SHans de Goede /* Cyberbook T116 rugged tablet */ 9849c3eb30SHans de Goede .matches = { 9949c3eb30SHans de Goede DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "Default string"), 10049c3eb30SHans de Goede DMI_EXACT_MATCH(DMI_BOARD_NAME, "Cherry Trail CR"), 10149c3eb30SHans de Goede DMI_EXACT_MATCH(DMI_PRODUCT_SKU, "20170531"), 10249c3eb30SHans de Goede }, 10349c3eb30SHans de Goede /* The factory image nvram file is identical to the ACEPC T8 one */ 10449c3eb30SHans de Goede .driver_data = (void *)&acepc_t8_data, 10549c3eb30SHans de Goede }, 10649c3eb30SHans de Goede { 107bd1e82bbSHans de Goede /* Match for the GPDwin which unfortunately uses somewhat 108bd1e82bbSHans de Goede * generic dmi strings, which is why we test for 4 strings. 109bd1e82bbSHans de Goede * Comparing against 23 other byt/cht boards, board_vendor 110bd1e82bbSHans de Goede * and board_name are unique to the GPDwin, where as only one 111bd1e82bbSHans de Goede * other board has the same board_serial and 3 others have 112bd1e82bbSHans de Goede * the same default product_name. Also the GPDwin is the 113bd1e82bbSHans de Goede * only device to have both board_ and product_name not set. 114bd1e82bbSHans de Goede */ 115bd1e82bbSHans de Goede .matches = { 116bd1e82bbSHans de Goede DMI_MATCH(DMI_BOARD_VENDOR, "AMI Corporation"), 117bd1e82bbSHans de Goede DMI_MATCH(DMI_BOARD_NAME, "Default string"), 118bd1e82bbSHans de Goede DMI_MATCH(DMI_BOARD_SERIAL, "Default string"), 119bd1e82bbSHans de Goede DMI_MATCH(DMI_PRODUCT_NAME, "Default string"), 120bd1e82bbSHans de Goede }, 121bd1e82bbSHans de Goede .driver_data = (void *)&gpd_win_pocket_data, 122bd1e82bbSHans de Goede }, 123bd1e82bbSHans de Goede { 124bd1e82bbSHans de Goede /* Jumper EZpad mini3 */ 125bd1e82bbSHans de Goede .matches = { 126bd1e82bbSHans de Goede DMI_MATCH(DMI_SYS_VENDOR, "Insyde"), 127bd1e82bbSHans de Goede DMI_MATCH(DMI_PRODUCT_NAME, "CherryTrail"), 128bd1e82bbSHans de Goede /* jumperx.T87.KFBNEEA02 with the version-nr dropped */ 129bd1e82bbSHans de Goede DMI_MATCH(DMI_BIOS_VERSION, "jumperx.T87.KFBNEEA"), 130bd1e82bbSHans de Goede }, 131bd1e82bbSHans de Goede .driver_data = (void *)&jumper_ezpad_mini3_data, 132bd1e82bbSHans de Goede }, 133bd1e82bbSHans de Goede { 134bd1e82bbSHans de Goede /* Meegopad T08 */ 135bd1e82bbSHans de Goede .matches = { 136bd1e82bbSHans de Goede DMI_MATCH(DMI_SYS_VENDOR, "Default string"), 137bd1e82bbSHans de Goede DMI_MATCH(DMI_PRODUCT_NAME, "Default string"), 138bd1e82bbSHans de Goede DMI_MATCH(DMI_BOARD_NAME, "T3 MRD"), 139bd1e82bbSHans de Goede DMI_MATCH(DMI_BOARD_VERSION, "V1.1"), 140bd1e82bbSHans de Goede }, 141bd1e82bbSHans de Goede .driver_data = (void *)&meegopad_t08_data, 142bd1e82bbSHans de Goede }, 1434d95f99cSHans de Goede { 1444d95f99cSHans de Goede /* Point of View TAB-P1006W-232 */ 1454d95f99cSHans de Goede .matches = { 1464d95f99cSHans de Goede DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Insyde"), 1474d95f99cSHans de Goede DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "BayTrail"), 1484d95f99cSHans de Goede /* Note 105b is Foxcon's USB/PCI vendor id */ 1494d95f99cSHans de Goede DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "105B"), 1504d95f99cSHans de Goede DMI_EXACT_MATCH(DMI_BOARD_NAME, "0E57"), 1514d95f99cSHans de Goede }, 1524d95f99cSHans de Goede .driver_data = (void *)&pov_tab_p1006w_data, 1534d95f99cSHans de Goede }, 154af4b3a6fSHans de Goede { 155af4b3a6fSHans de Goede /* Predia Basic tablet (+ with keyboard dock) */ 156af4b3a6fSHans de Goede .matches = { 157af4b3a6fSHans de Goede DMI_MATCH(DMI_SYS_VENDOR, "Insyde"), 158af4b3a6fSHans de Goede DMI_MATCH(DMI_PRODUCT_NAME, "CherryTrail"), 159af4b3a6fSHans de Goede /* Mx.WT107.KUBNGEA02 with the version-nr dropped */ 160af4b3a6fSHans de Goede DMI_MATCH(DMI_BIOS_VERSION, "Mx.WT107.KUBNGEA"), 161af4b3a6fSHans de Goede }, 162af4b3a6fSHans de Goede .driver_data = (void *)&predia_basic_data, 163af4b3a6fSHans de Goede }, 164a338c874SHans de Goede { 165a338c874SHans de Goede /* Voyo winpad A15 tablet */ 166a338c874SHans de Goede .matches = { 167a338c874SHans de Goede DMI_MATCH(DMI_BOARD_VENDOR, "AMI Corporation"), 168a338c874SHans de Goede DMI_MATCH(DMI_BOARD_NAME, "Aptio CRB"), 169a338c874SHans de Goede /* Above strings are too generic, also match on BIOS date */ 170a338c874SHans de Goede DMI_MATCH(DMI_BIOS_DATE, "11/20/2014"), 171a338c874SHans de Goede }, 172a338c874SHans de Goede .driver_data = (void *)&voyo_winpad_a15_data, 173a338c874SHans de Goede }, 174bd1e82bbSHans de Goede {} 175bd1e82bbSHans de Goede }; 176bd1e82bbSHans de Goede 177bd1e82bbSHans de Goede void brcmf_dmi_probe(struct brcmf_mp_device *settings, u32 chip, u32 chiprev) 178bd1e82bbSHans de Goede { 179bd1e82bbSHans de Goede const struct dmi_system_id *match; 180bd1e82bbSHans de Goede const struct brcmf_dmi_data *data; 181bd1e82bbSHans de Goede const char *sys_vendor; 182bd1e82bbSHans de Goede const char *product_name; 183bd1e82bbSHans de Goede 184bd1e82bbSHans de Goede /* Some models have DMI strings which are too generic, e.g. 185bd1e82bbSHans de Goede * "Default string", we use a quirk table for these. 186bd1e82bbSHans de Goede */ 187bd1e82bbSHans de Goede for (match = dmi_first_match(dmi_platform_data); 188bd1e82bbSHans de Goede match; 189bd1e82bbSHans de Goede match = dmi_first_match(match + 1)) { 190bd1e82bbSHans de Goede data = match->driver_data; 191bd1e82bbSHans de Goede 192bd1e82bbSHans de Goede if (data->chip == chip && data->chiprev == chiprev) { 193bd1e82bbSHans de Goede settings->board_type = data->board_type; 194bd1e82bbSHans de Goede return; 195bd1e82bbSHans de Goede } 196bd1e82bbSHans de Goede } 197bd1e82bbSHans de Goede 198bd1e82bbSHans de Goede /* Not found in the quirk-table, use sys_vendor-product_name */ 199bd1e82bbSHans de Goede sys_vendor = dmi_get_system_info(DMI_SYS_VENDOR); 200bd1e82bbSHans de Goede product_name = dmi_get_system_info(DMI_PRODUCT_NAME); 201bd1e82bbSHans de Goede if (sys_vendor && product_name) { 202bd1e82bbSHans de Goede snprintf(dmi_board_type, sizeof(dmi_board_type), "%s-%s", 203bd1e82bbSHans de Goede sys_vendor, product_name); 204bd1e82bbSHans de Goede settings->board_type = dmi_board_type; 205bd1e82bbSHans de Goede } 206bd1e82bbSHans de Goede } 207