1 // SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause)
2 // Copyright(c) 2021 Intel Corporation.
8 #include <linux/device.h>
10 #include <linux/soundwire/sdw.h>
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
23 static const struct adr_remap intel_tgl_bios[] = {
25 0x000010025D070100ull,
29 0x000110025d070100ull,
36 * The initial version of the Dell SKU 0A3E did not expose the devices
37 * on the correct links.
39 static const struct adr_remap dell_sku_0A3E[] = {
47 0x000120025d130800ull,
48 0x000120025d071100ull,
52 0x000220025d071500ull,
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
62 static const struct adr_remap hp_omen_16[] = {
63 /* rt711-sdca on link0 */
65 0x000020025d071100ull,
68 /* rt1316-sdca on link3 */
70 0x000120025d071100ull,
77 * Intel NUC M15 LAPRC510 and LAPRC710
79 static const struct adr_remap intel_rooks_county[] = {
80 /* rt711-sdca on link0 */
82 0x000020025d071100ull,
85 /* rt1316-sdca on link2 */
87 0x000120025d071100ull,
93 static const struct dmi_system_id adr_remap_quirk_table[] = {
97 DMI_MATCH(DMI_SYS_VENDOR, "HP"),
98 DMI_MATCH(DMI_PRODUCT_NAME, "HP Spectre x360 Conv"),
100 .driver_data = (void *)intel_tgl_bios,
104 DMI_MATCH(DMI_SYS_VENDOR, "HP"),
105 DMI_MATCH(DMI_BOARD_NAME, "8709"),
107 .driver_data = (void *)intel_tgl_bios,
110 /* quirk used for NUC15 'Bishop County' LAPBC510 and LAPBC710 skews */
112 DMI_MATCH(DMI_SYS_VENDOR, "Intel(R) Client Systems"),
113 DMI_MATCH(DMI_PRODUCT_NAME, "LAPBC"),
115 .driver_data = (void *)intel_tgl_bios,
118 /* quirk used for NUC15 LAPBC710 skew */
120 DMI_MATCH(DMI_BOARD_VENDOR, "Intel Corporation"),
121 DMI_MATCH(DMI_BOARD_NAME, "LAPBC710"),
123 .driver_data = (void *)intel_tgl_bios,
126 /* quirk used for NUC15 'Rooks County' LAPRC510 and LAPRC710 skews */
128 DMI_MATCH(DMI_SYS_VENDOR, "Intel(R) Client Systems"),
129 DMI_MATCH(DMI_PRODUCT_NAME, "LAPRC"),
131 .driver_data = (void *)intel_rooks_county,
135 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc"),
136 DMI_EXACT_MATCH(DMI_PRODUCT_SKU, "0A3E")
138 .driver_data = (void *)dell_sku_0A3E,
143 DMI_MATCH(DMI_SYS_VENDOR, "HP"),
144 DMI_MATCH(DMI_PRODUCT_NAME, "OMEN by HP Gaming Laptop 16-k0xxx"),
146 .driver_data = (void *)hp_omen_16,
151 u64 sdw_dmi_override_adr(struct sdw_bus *bus, u64 addr)
153 const struct dmi_system_id *dmi_id;
155 /* check if any address remap quirk applies */
156 dmi_id = dmi_first_match(adr_remap_quirk_table);
158 struct adr_remap *map;
160 for (map = dmi_id->driver_data; map->adr; map++) {
161 if (map->adr == addr) {
162 dev_dbg(bus->dev, "remapped _ADR 0x%llx as 0x%llx\n",
163 addr, map->remapped_adr);
164 addr = map->remapped_adr;