summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Compostella <jeremy.compostella@intel.com>2024-10-28 14:03:29 -0700
committerJérémy Compostella <jeremy.compostella@intel.com>2024-11-27 21:27:53 +0000
commit354cba21a41aa868b7b41804c2859f920d2e1b17 (patch)
tree31e69334fa56cf9150617fa16b4be72ec45ad1ce
parent8943e40b18911552b28e841394068bed80612829 (diff)
drivers/wifi: Support Bluetooth Per-Platform Antenna Gain
The ACPI BPAG method provide information to controls the antenna gain method to be used per country. The antenna gain mode is a bit field (0 - disabled, 1 -enabled) defined as follow: - Bit 0 - Antenna gain in EU - Bit 1 - Antenna gain in China Mainland The implementation follows document 559910 Intel Connectivity Platforms BIOS Guideline revision 9.2 specification. BUG=b:346600091 TEST=BPAG method is added to the bluetooth companion device and return the data supplied by the SAR binary blob Change-Id: Iebe95815c944d045f4cf686abcd1874a8a45e210 Signed-off-by: Jeremy Compostella <jeremy.compostella@intel.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/84941 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Subrata Banik <subratabanik@google.com> Reviewed-by: Kapil Porwal <kapilporwal@google.com>
-rw-r--r--src/drivers/wifi/generic/acpi.c36
-rw-r--r--src/include/sar.h9
-rw-r--r--src/vendorcode/google/chromeos/sar.c9
3 files changed, 53 insertions, 1 deletions
diff --git a/src/drivers/wifi/generic/acpi.c b/src/drivers/wifi/generic/acpi.c
index 9ed17e0b5c..0a5bee728f 100644
--- a/src/drivers/wifi/generic/acpi.c
+++ b/src/drivers/wifi/generic/acpi.c
@@ -666,6 +666,41 @@ static void sar_emit_wbem(const struct wbem_profile *wbem)
acpigen_write_package_end();
}
+static void sar_emit_bpag(const struct bpag_profile *bpag)
+{
+ if (bpag == NULL)
+ return;
+
+ /*
+ * Name ("BPAG", Package () {
+ * Revision,
+ * Package () {
+ * Domain Type, // 0x12:Bluetooth
+ * Bluetooth Per-Platform Antenna Gain Mode
+ * }
+ * })
+ */
+ if (bpag->revision == 0 || bpag->revision > BPAG_REVISION) {
+ printk(BIOS_ERR, "Unsupported BPAG table revision: %d\n",
+ bpag->revision);
+ return;
+ }
+
+ acpigen_write_name("BPAG");
+ acpigen_write_package(2);
+ acpigen_write_dword(bpag->revision);
+
+ /*
+ * Emit 'Domain Type' + 'Antenna Gain Mode'
+ */
+ acpigen_write_package(2);
+ acpigen_write_dword(DOMAIN_TYPE_BLUETOOTH);
+ acpigen_write_dword(bpag->antenna_gain_country_enablement);
+
+ 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)
{
@@ -798,6 +833,7 @@ static void wifi_ssdt_write_properties(const struct device *dev, const char *sco
if (path) { /* Bluetooth device under USB Hub scope or PCIe root port */
acpigen_write_scope(path);
sar_emit_brds(sar_limits.bsar);
+ sar_emit_bpag(sar_limits.bpag);
acpigen_write_scope_end();
} else {
printk(BIOS_ERR, "Failed to get %s Bluetooth companion ACPI path\n",
diff --git a/src/include/sar.h b/src/include/sar.h
index b0274b501a..b9c83c3a05 100644
--- a/src/include/sar.h
+++ b/src/include/sar.h
@@ -9,10 +9,11 @@
#define MAX_DENYLIST_ENTRY 16
#define MAX_DSAR_SET_COUNT 3
#define MAX_GEO_OFFSET_REVISION 3
-#define MAX_PROFILE_COUNT 7
+#define MAX_PROFILE_COUNT 8
#define MAX_SAR_REVISION 2
#define BSAR_REVISION 1
#define WBEM_REVISION 0
+#define BPAG_REVISION 2
#define REVISION_SIZE 1
#define SAR_REV0_CHAINS_COUNT 2
#define SAR_REV0_SUBBANDS_COUNT 5
@@ -81,6 +82,11 @@ struct wbem_profile {
uint32_t bandwidth_320mhz_country_enablement;
} __packed;
+struct bpag_profile {
+ uint8_t revision;
+ uint32_t antenna_gain_country_enablement;
+} __packed;
+
struct sar_header {
char marker[SAR_STR_PREFIX_SIZE];
uint8_t version;
@@ -97,6 +103,7 @@ union wifi_sar_limits {
struct dsm_profile *dsm;
struct bsar_profile *bsar;
struct wbem_profile *wbem;
+ struct bpag_profile *bpag;
};
void *profile[MAX_PROFILE_COUNT];
};
diff --git a/src/vendorcode/google/chromeos/sar.c b/src/vendorcode/google/chromeos/sar.c
index e8d4410f4b..dcf647398e 100644
--- a/src/vendorcode/google/chromeos/sar.c
+++ b/src/vendorcode/google/chromeos/sar.c
@@ -110,6 +110,14 @@ static size_t wbem_table_size(const struct wbem_profile *wbem)
return sizeof(struct wbem_profile);
}
+static size_t bpag_table_size(const struct bpag_profile *bpag)
+{
+ if (bpag == NULL)
+ return 0;
+
+ return sizeof(struct bpag_profile);
+}
+
static bool valid_legacy_length(size_t bin_len)
{
if (bin_len == LEGACY_SAR_WGDS_BIN_SIZE)
@@ -163,6 +171,7 @@ static int fill_wifi_sar_limits(union wifi_sar_limits *sar_limits, const uint8_t
expected_sar_bin_size += dsm_table_size(sar_limits->dsm);
expected_sar_bin_size += bsar_table_size(sar_limits->bsar);
expected_sar_bin_size += wbem_table_size(sar_limits->wbem);
+ expected_sar_bin_size += bpag_table_size(sar_limits->bpag);
if (sar_bin_size != expected_sar_bin_size) {
printk(BIOS_ERR, "Invalid SAR size, expected: %zu, obtained: %zu\n",