From 83fb3b70f0d16ff5d2f755ab875cc4d55992c1fa Mon Sep 17 00:00:00 2001 From: Jeremy Compostella Date: Fri, 1 Nov 2024 14:15:42 -0700 Subject: drivers/wifi: Support Drive Strength BRI Rsp Table Drive Strength BRI Rsp Object provides information from the OEM platforms if they have replaced the Bluetooth Radio Interface resistor to overcome the potential STEP errors on their designs. Based on configuration, CNV firmware shall adjust the BRI Rsp line drive strength. The bri_resistor_value is encoded as follow: | Bit | Val | Description | Default | |------+-----+---------------------------------------------+---------| | 0 | 0 | Device FW default values | 1 | | | 1 | Override device FW default values | | | 3:1 | 0 | Reserved (shall be set to 0) | 0 | | 7:4 | 0 | DSBR override values (only if bit 0 is set) | 0xf | | 31:7 | 0 | Reserved (shall be set to 0) | 0 | Possible values: - 0xf1 (default): indicates that the resistor on board is 33 Ohm - 0x0 or 0xb1: indicates that the resistor on board is 10 Ohm The implementation follows document 559910 Intel Connectivity Platforms BIOS Guideline revision 9.2 specification. BUG=b:346600091 TEST=DSBR methods are added to the wifi device and bluetooth companion device and they return the data supplied by the SAR binary blob Change-Id: Iebe95815c944d045f4cf686abcd1874a8a45e300 Signed-off-by: Jeremy Compostella Reviewed-on: https://review.coreboot.org/c/coreboot/+/85017 Reviewed-by: Paul Menzel Reviewed-by: Subrata Banik Reviewed-by: Kapil Porwal Tested-by: build bot (Jenkins) --- src/drivers/wifi/generic/acpi.c | 42 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) (limited to 'src/drivers') diff --git a/src/drivers/wifi/generic/acpi.c b/src/drivers/wifi/generic/acpi.c index d3277cc1e0..44705535ef 100644 --- a/src/drivers/wifi/generic/acpi.c +++ b/src/drivers/wifi/generic/acpi.c @@ -16,8 +16,10 @@ #include "wifi_private.h" /* Domain type */ -#define DOMAIN_TYPE_WIFI 0x7 -#define DOMAIN_TYPE_BLUETOOTH 0x12 +enum sar_domain { + DOMAIN_TYPE_WIFI = 0x7, + DOMAIN_TYPE_BLUETOOTH = 0x12 +}; /* Maximum number DSM UUID bifurcations in _DSM */ #define MAX_DSM_FUNCS 2 @@ -967,6 +969,40 @@ static void sar_emit_wpfc(const struct wpfc_profile *wpfc) acpigen_write_package_end(); } +static void sar_emit_dsbr(const struct dsbr_profile *dsbr, enum sar_domain domain) +{ + if (dsbr == NULL) + return; + + /* + * Name ("DSBR", Package() { + * { + * Revision, + * Package() + * { + * DomainType, // 0x7:WiFi + * BRI Resistor Value // in Ohm + * } + } }) + */ + if (dsbr->revision != DSBR_REVISION) { + printk(BIOS_ERR, "Unsupported DSBR table revision: %d\n", + dsbr->revision); + return; + } + + acpigen_write_name("DSBR"); + acpigen_write_package(2); + acpigen_write_dword(dsbr->revision); + + acpigen_write_package(2); + acpigen_write_dword(domain); + acpigen_write_dword(dsbr->bri_resistor_value); + + acpigen_write_package_end(); + acpigen_write_package_end(); +} + static void emit_wifi_sar_acpi_structures(const struct device *dev, union wifi_sar_limits *sar_limits) { @@ -984,6 +1020,7 @@ static void emit_wifi_sar_acpi_structures(const struct device *dev, sar_emit_wtas(sar_limits->wtas); sar_emit_wbem(sar_limits->wbem); sar_emit_wpfc(sar_limits->wpfc); + sar_emit_dsbr(sar_limits->dsbr, DOMAIN_TYPE_WIFI); } static void wifi_ssdt_write_device(const struct device *dev, const char *path) @@ -1107,6 +1144,7 @@ static void wifi_ssdt_write_properties(const struct device *dev, const char *sco sar_emit_bucs(sar_limits.bucs); sar_emit_bdmm(sar_limits.bdmm); sar_emit_ebrd(sar_limits.ebrd); + sar_emit_dsbr(sar_limits.dsbr, DOMAIN_TYPE_BLUETOOTH); acpigen_write_scope_end(); } else { printk(BIOS_ERR, "Failed to get %s Bluetooth companion ACPI path\n", -- cgit v1.2.3