Path: blob/main/sys/contrib/dev/broadcom/brcm80211/brcmfmac/dmi.c
178665 views
// SPDX-License-Identifier: ISC1/*2* Copyright 2018 Hans de Goede <[email protected]>3*/45#include <linux/dmi.h>6#include <linux/mod_devicetable.h>7#include "core.h"8#include "common.h"9#include "brcm_hw_ids.h"1011/* The DMI data never changes so we can use a static buf for this */12static char dmi_board_type[128];1314struct brcmf_dmi_data {15u32 chip;16u32 chiprev;17const char *board_type;18};1920/* NOTE: Please keep all entries sorted alphabetically */2122static const struct brcmf_dmi_data acepc_t8_data = {23BRCM_CC_4345_CHIP_ID, 6, "acepc-t8"24};2526static const struct brcmf_dmi_data acer_a1_840_data = {27BRCM_CC_43340_CHIP_ID, 2, "acer-a1-840"28};2930/* The Chuwi Hi8 Pro uses the same Ampak AP6212 module as the Chuwi Vi8 Plus31* and the nvram for the Vi8 Plus is already in linux-firmware, so use that.32*/33static const struct brcmf_dmi_data chuwi_hi8_pro_data = {34BRCM_CC_43430_CHIP_ID, 0, "ilife-S806"35};3637static const struct brcmf_dmi_data gpd_win_pocket_data = {38BRCM_CC_4356_CHIP_ID, 2, "gpd-win-pocket"39};4041static const struct brcmf_dmi_data jumper_ezpad_mini3_data = {42BRCM_CC_43430_CHIP_ID, 0, "jumper-ezpad-mini3"43};4445static const struct brcmf_dmi_data meegopad_t08_data = {46BRCM_CC_43340_CHIP_ID, 2, "meegopad-t08"47};4849static const struct brcmf_dmi_data pov_tab_p1006w_data = {50BRCM_CC_43340_CHIP_ID, 2, "pov-tab-p1006w-data"51};5253static const struct brcmf_dmi_data predia_basic_data = {54BRCM_CC_43341_CHIP_ID, 2, "predia-basic"55};5657/* Note the Voyo winpad A15 tablet uses the same Ampak AP6330 module, with the58* exact same nvram file as the Prowise-PT301 tablet. Since the nvram for the59* Prowise-PT301 is already in linux-firmware we just point to that here.60*/61static const struct brcmf_dmi_data voyo_winpad_a15_data = {62BRCM_CC_4330_CHIP_ID, 4, "Prowise-PT301"63};6465static const struct dmi_system_id dmi_platform_data[] = {66{67/* ACEPC T8 Cherry Trail Z8350 mini PC */68.matches = {69DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "To be filled by O.E.M."),70DMI_EXACT_MATCH(DMI_BOARD_NAME, "Cherry Trail CR"),71DMI_EXACT_MATCH(DMI_PRODUCT_SKU, "T8"),72/* also match on somewhat unique bios-version */73DMI_EXACT_MATCH(DMI_BIOS_VERSION, "1.000"),74},75.driver_data = (void *)&acepc_t8_data,76},77{78/* ACEPC T11 Cherry Trail Z8350 mini PC, same wifi as the T8 */79.matches = {80DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "To be filled by O.E.M."),81DMI_EXACT_MATCH(DMI_BOARD_NAME, "Cherry Trail CR"),82DMI_EXACT_MATCH(DMI_PRODUCT_SKU, "T11"),83/* also match on somewhat unique bios-version */84DMI_EXACT_MATCH(DMI_BIOS_VERSION, "1.000"),85},86.driver_data = (void *)&acepc_t8_data,87},88{89/* ACEPC W5 Pro Cherry Trail Z8350 HDMI stick, same wifi as the T8 */90.matches = {91DMI_MATCH(DMI_BOARD_NAME, "T3 MRD"),92DMI_MATCH(DMI_CHASSIS_TYPE, "3"),93DMI_MATCH(DMI_BIOS_VENDOR, "American Megatrends Inc."),94},95.driver_data = (void *)&acepc_t8_data,96},97{98/* Acer Iconia One 8 A1-840 (non FHD version) */99.matches = {100DMI_MATCH(DMI_SYS_VENDOR, "Insyde"),101DMI_MATCH(DMI_PRODUCT_NAME, "BayTrail"),102/* Above strings are too generic also match BIOS date */103DMI_MATCH(DMI_BIOS_DATE, "04/01/2014"),104},105.driver_data = (void *)&acer_a1_840_data,106},107{108/* Chuwi Hi8 Pro with D2D3_Hi8Pro.233 BIOS */109.matches = {110DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "Hampoo"),111DMI_EXACT_MATCH(DMI_BOARD_NAME, "Cherry Trail CR"),112DMI_EXACT_MATCH(DMI_PRODUCT_SKU, "MRD"),113/* Above strings are too generic, also match on BIOS date */114DMI_MATCH(DMI_BIOS_DATE, "05/10/2016"),115},116.driver_data = (void *)&chuwi_hi8_pro_data,117},118{119/* Cyberbook T116 rugged tablet */120.matches = {121DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "Default string"),122DMI_EXACT_MATCH(DMI_BOARD_NAME, "Cherry Trail CR"),123DMI_EXACT_MATCH(DMI_PRODUCT_SKU, "20170531"),124},125/* The factory image nvram file is identical to the ACEPC T8 one */126.driver_data = (void *)&acepc_t8_data,127},128{129/* Match for the GPDwin which unfortunately uses somewhat130* generic dmi strings, which is why we test for 4 strings.131* Comparing against 23 other byt/cht boards, board_vendor132* and board_name are unique to the GPDwin, where as only one133* other board has the same board_serial and 3 others have134* the same default product_name. Also the GPDwin is the135* only device to have both board_ and product_name not set.136*/137.matches = {138DMI_MATCH(DMI_BOARD_VENDOR, "AMI Corporation"),139DMI_MATCH(DMI_BOARD_NAME, "Default string"),140DMI_MATCH(DMI_BOARD_SERIAL, "Default string"),141DMI_MATCH(DMI_PRODUCT_NAME, "Default string"),142},143.driver_data = (void *)&gpd_win_pocket_data,144},145{146/* Jumper EZpad mini3 */147.matches = {148DMI_MATCH(DMI_SYS_VENDOR, "Insyde"),149DMI_MATCH(DMI_PRODUCT_NAME, "CherryTrail"),150/* jumperx.T87.KFBNEEA02 with the version-nr dropped */151DMI_MATCH(DMI_BIOS_VERSION, "jumperx.T87.KFBNEEA"),152},153.driver_data = (void *)&jumper_ezpad_mini3_data,154},155{156/* Meegopad T08 */157.matches = {158DMI_MATCH(DMI_SYS_VENDOR, "Default string"),159DMI_MATCH(DMI_PRODUCT_NAME, "Default string"),160DMI_MATCH(DMI_BOARD_NAME, "T3 MRD"),161DMI_MATCH(DMI_BOARD_VERSION, "V1.1"),162},163.driver_data = (void *)&meegopad_t08_data,164},165{166/* Point of View TAB-P1006W-232 */167.matches = {168DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Insyde"),169DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "BayTrail"),170/* Note 105b is Foxcon's USB/PCI vendor id */171DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "105B"),172DMI_EXACT_MATCH(DMI_BOARD_NAME, "0E57"),173},174.driver_data = (void *)&pov_tab_p1006w_data,175},176{177/* Predia Basic tablet (+ with keyboard dock) */178.matches = {179DMI_MATCH(DMI_SYS_VENDOR, "Insyde"),180DMI_MATCH(DMI_PRODUCT_NAME, "CherryTrail"),181/* Mx.WT107.KUBNGEA02 with the version-nr dropped */182DMI_MATCH(DMI_BIOS_VERSION, "Mx.WT107.KUBNGEA"),183},184.driver_data = (void *)&predia_basic_data,185},186{187/* Voyo winpad A15 tablet */188.matches = {189DMI_MATCH(DMI_BOARD_VENDOR, "AMI Corporation"),190DMI_MATCH(DMI_BOARD_NAME, "Aptio CRB"),191/* Above strings are too generic, also match on BIOS date */192DMI_MATCH(DMI_BIOS_DATE, "11/20/2014"),193},194.driver_data = (void *)&voyo_winpad_a15_data,195},196{}197};198199void brcmf_dmi_probe(struct brcmf_mp_device *settings, u32 chip, u32 chiprev)200{201const struct dmi_system_id *match;202const struct brcmf_dmi_data *data;203const char *sys_vendor;204const char *product_name;205206/* Some models have DMI strings which are too generic, e.g.207* "Default string", we use a quirk table for these.208*/209for (match = dmi_first_match(dmi_platform_data);210match;211match = dmi_first_match(match + 1)) {212data = match->driver_data;213214if (data->chip == chip && data->chiprev == chiprev) {215settings->board_type = data->board_type;216return;217}218}219220/* Not found in the quirk-table, use sys_vendor-product_name */221sys_vendor = dmi_get_system_info(DMI_SYS_VENDOR);222product_name = dmi_get_system_info(DMI_PRODUCT_NAME);223if (sys_vendor && product_name) {224snprintf(dmi_board_type, sizeof(dmi_board_type), "%s-%s",225sys_vendor, product_name);226settings->board_type = dmi_board_type;227}228}229230231