Linux Audio

Check our new training course

Linux kernel drivers training

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