1*daeccac2SArend 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 43bd1e82bbSHans de Goede static const struct dmi_system_id dmi_platform_data[] = { 44bd1e82bbSHans de Goede { 45b1a0ba8fSHans de Goede /* ACEPC T8 Cherry Trail Z8350 mini PC */ 46b1a0ba8fSHans de Goede .matches = { 47b1a0ba8fSHans de Goede DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "To be filled by O.E.M."), 48b1a0ba8fSHans de Goede DMI_EXACT_MATCH(DMI_BOARD_NAME, "Cherry Trail CR"), 49b1a0ba8fSHans de Goede DMI_EXACT_MATCH(DMI_PRODUCT_SKU, "T8"), 50b1a0ba8fSHans de Goede /* also match on somewhat unique bios-version */ 51b1a0ba8fSHans de Goede DMI_EXACT_MATCH(DMI_BIOS_VERSION, "1.000"), 52b1a0ba8fSHans de Goede }, 53b1a0ba8fSHans de Goede .driver_data = (void *)&acepc_t8_data, 54b1a0ba8fSHans de Goede }, 55b1a0ba8fSHans de Goede { 56b1a0ba8fSHans de Goede /* ACEPC T11 Cherry Trail Z8350 mini PC, same wifi as the T8 */ 57b1a0ba8fSHans de Goede .matches = { 58b1a0ba8fSHans de Goede DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "To be filled by O.E.M."), 59b1a0ba8fSHans de Goede DMI_EXACT_MATCH(DMI_BOARD_NAME, "Cherry Trail CR"), 60b1a0ba8fSHans de Goede DMI_EXACT_MATCH(DMI_PRODUCT_SKU, "T11"), 61b1a0ba8fSHans de Goede /* also match on somewhat unique bios-version */ 62b1a0ba8fSHans de Goede DMI_EXACT_MATCH(DMI_BIOS_VERSION, "1.000"), 63b1a0ba8fSHans de Goede }, 64b1a0ba8fSHans de Goede .driver_data = (void *)&acepc_t8_data, 65b1a0ba8fSHans de Goede }, 66b1a0ba8fSHans de Goede { 67bd1e82bbSHans de Goede /* Match for the GPDwin which unfortunately uses somewhat 68bd1e82bbSHans de Goede * generic dmi strings, which is why we test for 4 strings. 69bd1e82bbSHans de Goede * Comparing against 23 other byt/cht boards, board_vendor 70bd1e82bbSHans de Goede * and board_name are unique to the GPDwin, where as only one 71bd1e82bbSHans de Goede * other board has the same board_serial and 3 others have 72bd1e82bbSHans de Goede * the same default product_name. Also the GPDwin is the 73bd1e82bbSHans de Goede * only device to have both board_ and product_name not set. 74bd1e82bbSHans de Goede */ 75bd1e82bbSHans de Goede .matches = { 76bd1e82bbSHans de Goede DMI_MATCH(DMI_BOARD_VENDOR, "AMI Corporation"), 77bd1e82bbSHans de Goede DMI_MATCH(DMI_BOARD_NAME, "Default string"), 78bd1e82bbSHans de Goede DMI_MATCH(DMI_BOARD_SERIAL, "Default string"), 79bd1e82bbSHans de Goede DMI_MATCH(DMI_PRODUCT_NAME, "Default string"), 80bd1e82bbSHans de Goede }, 81bd1e82bbSHans de Goede .driver_data = (void *)&gpd_win_pocket_data, 82bd1e82bbSHans de Goede }, 83bd1e82bbSHans de Goede { 84bd1e82bbSHans de Goede /* Jumper EZpad mini3 */ 85bd1e82bbSHans de Goede .matches = { 86bd1e82bbSHans de Goede DMI_MATCH(DMI_SYS_VENDOR, "Insyde"), 87bd1e82bbSHans de Goede DMI_MATCH(DMI_PRODUCT_NAME, "CherryTrail"), 88bd1e82bbSHans de Goede /* jumperx.T87.KFBNEEA02 with the version-nr dropped */ 89bd1e82bbSHans de Goede DMI_MATCH(DMI_BIOS_VERSION, "jumperx.T87.KFBNEEA"), 90bd1e82bbSHans de Goede }, 91bd1e82bbSHans de Goede .driver_data = (void *)&jumper_ezpad_mini3_data, 92bd1e82bbSHans de Goede }, 93bd1e82bbSHans de Goede { 94bd1e82bbSHans de Goede /* Meegopad T08 */ 95bd1e82bbSHans de Goede .matches = { 96bd1e82bbSHans de Goede DMI_MATCH(DMI_SYS_VENDOR, "Default string"), 97bd1e82bbSHans de Goede DMI_MATCH(DMI_PRODUCT_NAME, "Default string"), 98bd1e82bbSHans de Goede DMI_MATCH(DMI_BOARD_NAME, "T3 MRD"), 99bd1e82bbSHans de Goede DMI_MATCH(DMI_BOARD_VERSION, "V1.1"), 100bd1e82bbSHans de Goede }, 101bd1e82bbSHans de Goede .driver_data = (void *)&meegopad_t08_data, 102bd1e82bbSHans de Goede }, 1034d95f99cSHans de Goede { 1044d95f99cSHans de Goede /* Point of View TAB-P1006W-232 */ 1054d95f99cSHans de Goede .matches = { 1064d95f99cSHans de Goede DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Insyde"), 1074d95f99cSHans de Goede DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "BayTrail"), 1084d95f99cSHans de Goede /* Note 105b is Foxcon's USB/PCI vendor id */ 1094d95f99cSHans de Goede DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "105B"), 1104d95f99cSHans de Goede DMI_EXACT_MATCH(DMI_BOARD_NAME, "0E57"), 1114d95f99cSHans de Goede }, 1124d95f99cSHans de Goede .driver_data = (void *)&pov_tab_p1006w_data, 1134d95f99cSHans de Goede }, 114bd1e82bbSHans de Goede {} 115bd1e82bbSHans de Goede }; 116bd1e82bbSHans de Goede 117bd1e82bbSHans de Goede void brcmf_dmi_probe(struct brcmf_mp_device *settings, u32 chip, u32 chiprev) 118bd1e82bbSHans de Goede { 119bd1e82bbSHans de Goede const struct dmi_system_id *match; 120bd1e82bbSHans de Goede const struct brcmf_dmi_data *data; 121bd1e82bbSHans de Goede const char *sys_vendor; 122bd1e82bbSHans de Goede const char *product_name; 123bd1e82bbSHans de Goede 124bd1e82bbSHans de Goede /* Some models have DMI strings which are too generic, e.g. 125bd1e82bbSHans de Goede * "Default string", we use a quirk table for these. 126bd1e82bbSHans de Goede */ 127bd1e82bbSHans de Goede for (match = dmi_first_match(dmi_platform_data); 128bd1e82bbSHans de Goede match; 129bd1e82bbSHans de Goede match = dmi_first_match(match + 1)) { 130bd1e82bbSHans de Goede data = match->driver_data; 131bd1e82bbSHans de Goede 132bd1e82bbSHans de Goede if (data->chip == chip && data->chiprev == chiprev) { 133bd1e82bbSHans de Goede settings->board_type = data->board_type; 134bd1e82bbSHans de Goede return; 135bd1e82bbSHans de Goede } 136bd1e82bbSHans de Goede } 137bd1e82bbSHans de Goede 138bd1e82bbSHans de Goede /* Not found in the quirk-table, use sys_vendor-product_name */ 139bd1e82bbSHans de Goede sys_vendor = dmi_get_system_info(DMI_SYS_VENDOR); 140bd1e82bbSHans de Goede product_name = dmi_get_system_info(DMI_PRODUCT_NAME); 141bd1e82bbSHans de Goede if (sys_vendor && product_name) { 142bd1e82bbSHans de Goede snprintf(dmi_board_type, sizeof(dmi_board_type), "%s-%s", 143bd1e82bbSHans de Goede sys_vendor, product_name); 144bd1e82bbSHans de Goede settings->board_type = dmi_board_type; 145bd1e82bbSHans de Goede } 146bd1e82bbSHans de Goede } 147