File Index
Files and directories
Sign in
FILE

dmi-quirks.c

File preview with syntax highlighting.

linux-6.19.14/drivers/soundwire/dmi-quirks.c C
  1// SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause)
  2// Copyright(c) 2021 Intel Corporation.
  3
  4/*
  5 * Soundwire DMI quirks
  6 */
  7
  8#include <linux/device.h>
  9#include <linux/dmi.h>
 10#include <linux/soundwire/sdw.h>
 11#include "bus.h"
 12
 13struct adr_remap {
 14	u64 adr;
 15	u64 remapped_adr;
 16};
 17
 18/*
 19 * Some TigerLake devices based on an initial Intel BIOS do not expose
 20 * the correct _ADR in the DSDT.
 21 * Remap the bad _ADR values to the ones reported by hardware
 22 */
 23static const struct adr_remap intel_tgl_bios[] = {
 24	{
 25		0x000010025D070100ull,
 26		0x000020025D071100ull
 27	},
 28	{
 29		0x000110025d070100ull,
 30		0x000120025D130800ull
 31	},
 32	{}
 33};
 34
 35/*
 36 * The initial version of the Dell SKU 0A3E did not expose the devices
 37 * on the correct links.
 38 */
 39static const struct adr_remap dell_sku_0A3E[] = {
 40	/* rt715 on link0 */
 41	{
 42		0x00020025d071100ull,
 43		0x00021025d071500ull
 44	},
 45	/* rt711 on link1 */
 46	{
 47		0x000120025d130800ull,
 48		0x000120025d071100ull,
 49	},
 50	/* rt1308 on link2 */
 51	{
 52		0x000220025d071500ull,
 53		0x000220025d130800ull
 54	},
 55	{}
 56};
 57
 58/*
 59 * The HP Omen 16-k0005TX does not expose the correct version of RT711 on link0
 60 * and does not expose a RT1316 on link3
 61 */
 62static const struct adr_remap hp_omen_16[] = {
 63	/* rt711-sdca on link0 */
 64	{
 65		0x000020025d071100ull,
 66		0x000030025d071101ull
 67	},
 68	/* rt1316-sdca on link3 */
 69	{
 70		0x000120025d071100ull,
 71		0x000330025d131601ull
 72	},
 73	{}
 74};
 75
 76/*
 77 * Intel NUC M15 LAPRC510 and LAPRC710
 78 */
 79static const struct adr_remap intel_rooks_county[] = {
 80	/* rt711-sdca on link0 */
 81	{
 82		0x000020025d071100ull,
 83		0x000030025d071101ull
 84	},
 85	/* rt1316-sdca on link2 */
 86	{
 87		0x000120025d071100ull,
 88		0x000230025d131601ull
 89	},
 90	{}
 91};
 92
 93static const struct dmi_system_id adr_remap_quirk_table[] = {
 94	/* TGL devices */
 95	{
 96		.matches = {
 97			DMI_MATCH(DMI_SYS_VENDOR, "HP"),
 98			DMI_MATCH(DMI_PRODUCT_NAME, "HP Spectre x360 Conv"),
 99		},
100		.driver_data = (void *)intel_tgl_bios,
101	},
102	{
103		.matches = {
104			DMI_MATCH(DMI_SYS_VENDOR, "HP"),
105			DMI_MATCH(DMI_BOARD_NAME, "8709"),
106		},
107		.driver_data = (void *)intel_tgl_bios,
108	},
109	{
110		/* quirk used for NUC15 'Bishop County' LAPBC510 and LAPBC710 skews */
111		.matches = {
112			DMI_MATCH(DMI_SYS_VENDOR, "Intel(R) Client Systems"),
113			DMI_MATCH(DMI_PRODUCT_NAME, "LAPBC"),
114		},
115		.driver_data = (void *)intel_tgl_bios,
116	},
117	{
118		/* quirk used for NUC15 LAPBC710 skew */
119		.matches = {
120			DMI_MATCH(DMI_BOARD_VENDOR, "Intel Corporation"),
121			DMI_MATCH(DMI_BOARD_NAME, "LAPBC710"),
122		},
123		.driver_data = (void *)intel_tgl_bios,
124	},
125	{
126		/*
127		 * quirk used for Avell B.ON (OEM rebrand of NUC15 'Bishop County'
128		 * LAPBC510 and LAPBC710)
129		 */
130		.matches = {
131			DMI_MATCH(DMI_SYS_VENDOR, "Avell High Performance"),
132			DMI_MATCH(DMI_PRODUCT_NAME, "B.ON"),
133		},
134		.driver_data = (void *)intel_tgl_bios,
135	},
136	{
137		/* quirk used for NUC15 'Rooks County' LAPRC510 and LAPRC710 skews */
138		.matches = {
139			DMI_MATCH(DMI_SYS_VENDOR, "Intel(R) Client Systems"),
140			DMI_MATCH(DMI_PRODUCT_NAME, "LAPRC"),
141		},
142		.driver_data = (void *)intel_rooks_county,
143	},
144	{
145		/* quirk used for NUC15 LAPRC710 skew */
146		.matches = {
147			DMI_MATCH(DMI_BOARD_VENDOR, "Intel Corporation"),
148			DMI_MATCH(DMI_BOARD_NAME, "LAPRC710"),
149		},
150		.driver_data = (void *)intel_rooks_county,
151	},
152	{
153		.matches = {
154			DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc"),
155			DMI_EXACT_MATCH(DMI_PRODUCT_SKU, "0A3E")
156		},
157		.driver_data = (void *)dell_sku_0A3E,
158	},
159	/* ADL devices */
160	{
161		.matches = {
162			DMI_MATCH(DMI_SYS_VENDOR, "HP"),
163			DMI_MATCH(DMI_PRODUCT_NAME, "OMEN by HP Gaming Laptop 16"),
164		},
165		.driver_data = (void *)hp_omen_16,
166	},
167	{}
168};
169
170u64 sdw_dmi_override_adr(struct sdw_bus *bus, u64 addr)
171{
172	const struct dmi_system_id *dmi_id;
173
174	/* check if any address remap quirk applies */
175	dmi_id = dmi_first_match(adr_remap_quirk_table);
176	if (dmi_id) {
177		struct adr_remap *map;
178
179		for (map = dmi_id->driver_data; map->adr; map++) {
180			if (map->adr == addr) {
181				dev_dbg(bus->dev, "remapped _ADR 0x%llx as 0x%llx\n",
182					addr, map->remapped_adr);
183				addr = map->remapped_adr;
184				break;
185			}
186		}
187	}
188
189	return addr;
190}
~/ Read-only file preview.