Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: ISC
0002 /*
0003  * Copyright 2018 Hans de Goede <hdegoede@redhat.com>
0004  */
0005 
0006 #include <linux/dmi.h>
0007 #include <linux/mod_devicetable.h>
0008 #include "core.h"
0009 #include "common.h"
0010 #include "brcm_hw_ids.h"
0011 
0012 /* The DMI data never changes so we can use a static buf for this */
0013 static char dmi_board_type[128];
0014 
0015 struct brcmf_dmi_data {
0016     u32 chip;
0017     u32 chiprev;
0018     const char *board_type;
0019 };
0020 
0021 /* NOTE: Please keep all entries sorted alphabetically */
0022 
0023 static const struct brcmf_dmi_data acepc_t8_data = {
0024     BRCM_CC_4345_CHIP_ID, 6, "acepc-t8"
0025 };
0026 
0027 static const struct brcmf_dmi_data gpd_win_pocket_data = {
0028     BRCM_CC_4356_CHIP_ID, 2, "gpd-win-pocket"
0029 };
0030 
0031 static const struct brcmf_dmi_data jumper_ezpad_mini3_data = {
0032     BRCM_CC_43430_CHIP_ID, 0, "jumper-ezpad-mini3"
0033 };
0034 
0035 static const struct brcmf_dmi_data meegopad_t08_data = {
0036     BRCM_CC_43340_CHIP_ID, 2, "meegopad-t08"
0037 };
0038 
0039 static const struct brcmf_dmi_data pov_tab_p1006w_data = {
0040     BRCM_CC_43340_CHIP_ID, 2, "pov-tab-p1006w-data"
0041 };
0042 
0043 static const struct brcmf_dmi_data predia_basic_data = {
0044     BRCM_CC_43341_CHIP_ID, 2, "predia-basic"
0045 };
0046 
0047 /* Note the Voyo winpad A15 tablet uses the same Ampak AP6330 module, with the
0048  * exact same nvram file as the Prowise-PT301 tablet. Since the nvram for the
0049  * Prowise-PT301 is already in linux-firmware we just point to that here.
0050  */
0051 static const struct brcmf_dmi_data voyo_winpad_a15_data = {
0052     BRCM_CC_4330_CHIP_ID, 4, "Prowise-PT301"
0053 };
0054 
0055 static const struct dmi_system_id dmi_platform_data[] = {
0056     {
0057         /* ACEPC T8 Cherry Trail Z8350 mini PC */
0058         .matches = {
0059             DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "To be filled by O.E.M."),
0060             DMI_EXACT_MATCH(DMI_BOARD_NAME, "Cherry Trail CR"),
0061             DMI_EXACT_MATCH(DMI_PRODUCT_SKU, "T8"),
0062             /* also match on somewhat unique bios-version */
0063             DMI_EXACT_MATCH(DMI_BIOS_VERSION, "1.000"),
0064         },
0065         .driver_data = (void *)&acepc_t8_data,
0066     },
0067     {
0068         /* ACEPC T11 Cherry Trail Z8350 mini PC, same wifi as the T8 */
0069         .matches = {
0070             DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "To be filled by O.E.M."),
0071             DMI_EXACT_MATCH(DMI_BOARD_NAME, "Cherry Trail CR"),
0072             DMI_EXACT_MATCH(DMI_PRODUCT_SKU, "T11"),
0073             /* also match on somewhat unique bios-version */
0074             DMI_EXACT_MATCH(DMI_BIOS_VERSION, "1.000"),
0075         },
0076         .driver_data = (void *)&acepc_t8_data,
0077     },
0078     {
0079         /* Cyberbook T116 rugged tablet */
0080         .matches = {
0081             DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "Default string"),
0082             DMI_EXACT_MATCH(DMI_BOARD_NAME, "Cherry Trail CR"),
0083             DMI_EXACT_MATCH(DMI_PRODUCT_SKU, "20170531"),
0084         },
0085         /* The factory image nvram file is identical to the ACEPC T8 one */
0086         .driver_data = (void *)&acepc_t8_data,
0087     },
0088     {
0089         /* Match for the GPDwin which unfortunately uses somewhat
0090          * generic dmi strings, which is why we test for 4 strings.
0091          * Comparing against 23 other byt/cht boards, board_vendor
0092          * and board_name are unique to the GPDwin, where as only one
0093          * other board has the same board_serial and 3 others have
0094          * the same default product_name. Also the GPDwin is the
0095          * only device to have both board_ and product_name not set.
0096          */
0097         .matches = {
0098             DMI_MATCH(DMI_BOARD_VENDOR, "AMI Corporation"),
0099             DMI_MATCH(DMI_BOARD_NAME, "Default string"),
0100             DMI_MATCH(DMI_BOARD_SERIAL, "Default string"),
0101             DMI_MATCH(DMI_PRODUCT_NAME, "Default string"),
0102         },
0103         .driver_data = (void *)&gpd_win_pocket_data,
0104     },
0105     {
0106         /* Jumper EZpad mini3 */
0107         .matches = {
0108             DMI_MATCH(DMI_SYS_VENDOR, "Insyde"),
0109             DMI_MATCH(DMI_PRODUCT_NAME, "CherryTrail"),
0110             /* jumperx.T87.KFBNEEA02 with the version-nr dropped */
0111             DMI_MATCH(DMI_BIOS_VERSION, "jumperx.T87.KFBNEEA"),
0112         },
0113         .driver_data = (void *)&jumper_ezpad_mini3_data,
0114     },
0115     {
0116         /* Meegopad T08 */
0117         .matches = {
0118             DMI_MATCH(DMI_SYS_VENDOR, "Default string"),
0119             DMI_MATCH(DMI_PRODUCT_NAME, "Default string"),
0120             DMI_MATCH(DMI_BOARD_NAME, "T3 MRD"),
0121             DMI_MATCH(DMI_BOARD_VERSION, "V1.1"),
0122         },
0123         .driver_data = (void *)&meegopad_t08_data,
0124     },
0125     {
0126         /* Point of View TAB-P1006W-232 */
0127         .matches = {
0128             DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Insyde"),
0129             DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "BayTrail"),
0130             /* Note 105b is Foxcon's USB/PCI vendor id */
0131             DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "105B"),
0132             DMI_EXACT_MATCH(DMI_BOARD_NAME, "0E57"),
0133         },
0134         .driver_data = (void *)&pov_tab_p1006w_data,
0135     },
0136     {
0137         /* Predia Basic tablet (+ with keyboard dock) */
0138         .matches = {
0139             DMI_MATCH(DMI_SYS_VENDOR, "Insyde"),
0140             DMI_MATCH(DMI_PRODUCT_NAME, "CherryTrail"),
0141             /* Mx.WT107.KUBNGEA02 with the version-nr dropped */
0142             DMI_MATCH(DMI_BIOS_VERSION, "Mx.WT107.KUBNGEA"),
0143         },
0144         .driver_data = (void *)&predia_basic_data,
0145     },
0146     {
0147         /* Voyo winpad A15 tablet */
0148         .matches = {
0149             DMI_MATCH(DMI_BOARD_VENDOR, "AMI Corporation"),
0150             DMI_MATCH(DMI_BOARD_NAME, "Aptio CRB"),
0151             /* Above strings are too generic, also match on BIOS date */
0152             DMI_MATCH(DMI_BIOS_DATE, "11/20/2014"),
0153         },
0154         .driver_data = (void *)&voyo_winpad_a15_data,
0155     },
0156     {}
0157 };
0158 
0159 void brcmf_dmi_probe(struct brcmf_mp_device *settings, u32 chip, u32 chiprev)
0160 {
0161     const struct dmi_system_id *match;
0162     const struct brcmf_dmi_data *data;
0163     const char *sys_vendor;
0164     const char *product_name;
0165 
0166     /* Some models have DMI strings which are too generic, e.g.
0167      * "Default string", we use a quirk table for these.
0168      */
0169     for (match = dmi_first_match(dmi_platform_data);
0170          match;
0171          match = dmi_first_match(match + 1)) {
0172         data = match->driver_data;
0173 
0174         if (data->chip == chip && data->chiprev == chiprev) {
0175             settings->board_type = data->board_type;
0176             return;
0177         }
0178     }
0179 
0180     /* Not found in the quirk-table, use sys_vendor-product_name */
0181     sys_vendor = dmi_get_system_info(DMI_SYS_VENDOR);
0182     product_name = dmi_get_system_info(DMI_PRODUCT_NAME);
0183     if (sys_vendor && product_name) {
0184         snprintf(dmi_board_type, sizeof(dmi_board_type), "%s-%s",
0185              sys_vendor, product_name);
0186         settings->board_type = dmi_board_type;
0187     }
0188 }