Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause)
0002 // Copyright(c) 2021 Intel Corporation.
0003 
0004 /*
0005  * Soundwire DMI quirks
0006  */
0007 
0008 #include <linux/device.h>
0009 #include <linux/dmi.h>
0010 #include <linux/soundwire/sdw.h>
0011 #include "bus.h"
0012 
0013 struct adr_remap {
0014     u64 adr;
0015     u64 remapped_adr;
0016 };
0017 
0018 /*
0019  * Some TigerLake devices based on an initial Intel BIOS do not expose
0020  * the correct _ADR in the DSDT.
0021  * Remap the bad _ADR values to the ones reported by hardware
0022  */
0023 static const struct adr_remap intel_tgl_bios[] = {
0024     {
0025         0x000010025D070100ull,
0026         0x000020025D071100ull
0027     },
0028     {
0029         0x000110025d070100ull,
0030         0x000120025D130800ull
0031     },
0032     {}
0033 };
0034 
0035 /*
0036  * The initial version of the Dell SKU 0A3E did not expose the devices
0037  * on the correct links.
0038  */
0039 static const struct adr_remap dell_sku_0A3E[] = {
0040     /* rt715 on link0 */
0041     {
0042         0x00020025d071100ull,
0043         0x00021025d071500ull
0044     },
0045     /* rt711 on link1 */
0046     {
0047         0x000120025d130800ull,
0048         0x000120025d071100ull,
0049     },
0050     /* rt1308 on link2 */
0051     {
0052         0x000220025d071500ull,
0053         0x000220025d130800ull
0054     },
0055     {}
0056 };
0057 
0058 static const struct dmi_system_id adr_remap_quirk_table[] = {
0059     {
0060         .matches = {
0061             DMI_MATCH(DMI_SYS_VENDOR, "HP"),
0062             DMI_MATCH(DMI_PRODUCT_NAME, "HP Spectre x360 Conv"),
0063         },
0064         .driver_data = (void *)intel_tgl_bios,
0065     },
0066     {
0067         /* quirk used for NUC15 'Bishop County' LAPBC510 and LAPBC710 skews */
0068         .matches = {
0069             DMI_MATCH(DMI_SYS_VENDOR, "Intel(R) Client Systems"),
0070             DMI_MATCH(DMI_PRODUCT_NAME, "LAPBC"),
0071         },
0072         .driver_data = (void *)intel_tgl_bios,
0073     },
0074     {
0075         .matches = {
0076             DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc"),
0077             DMI_EXACT_MATCH(DMI_PRODUCT_SKU, "0A3E")
0078         },
0079         .driver_data = (void *)dell_sku_0A3E,
0080     },
0081     {}
0082 };
0083 
0084 u64 sdw_dmi_override_adr(struct sdw_bus *bus, u64 addr)
0085 {
0086     const struct dmi_system_id *dmi_id;
0087 
0088     /* check if any address remap quirk applies */
0089     dmi_id = dmi_first_match(adr_remap_quirk_table);
0090     if (dmi_id) {
0091         struct adr_remap *map;
0092 
0093         for (map = dmi_id->driver_data; map->adr; map++) {
0094             if (map->adr == addr) {
0095                 dev_dbg(bus->dev, "remapped _ADR 0x%llx as 0x%llx\n",
0096                     addr, map->remapped_adr);
0097                 addr = map->remapped_adr;
0098                 break;
0099             }
0100         }
0101     }
0102 
0103     return addr;
0104 }