summaryrefslogtreecommitdiff
path: root/src/drivers/wifi
diff options
context:
space:
mode:
authorSugnan Prabhu S <sugnan.prabhu.s@intel.com>2021-08-31 07:11:35 +0530
committerTim Wawrzynczak <twawrzynczak@chromium.org>2021-09-02 22:54:35 +0000
commitd1fc832c527699265c7d04517010cc4b0ea6aabd (patch)
tree74deb12c6e985c6502b5d038a3f8f3fde0fbee21 /src/drivers/wifi
parentfcb4f2d77e4d0c09bf8e433d724ef0ea272df815 (diff)
wifi: Add support for per-platform antenna gain
Add support for the PPAG ACPI BIOS configuration table as per the connectivity document: 559910_Intel_Connectivity_Platforms_BIOS_Guidelines_Rev6_4.pdf BUG=b:193665559 TEST=Generated SAR file with the PPAG related configuration values and verified that the SSDT has the PPAG ACPI table. Change-Id: Ie8d25113feeeb4a4242cfd7d72a5091d2d5fb389 Signed-off-by: Sugnan Prabhu S <sugnan.prabhu.s@intel.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/57060 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Diffstat (limited to 'src/drivers/wifi')
-rw-r--r--src/drivers/wifi/generic/acpi.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/src/drivers/wifi/generic/acpi.c b/src/drivers/wifi/generic/acpi.c
index aa49be35e2..ed5b632216 100644
--- a/src/drivers/wifi/generic/acpi.c
+++ b/src/drivers/wifi/generic/acpi.c
@@ -42,6 +42,13 @@ static const uint8_t *wgds_fetch_set(struct geo_profile *wgds, size_t set_num)
return wgds_table + (wgds->bands_count * set_num);
}
+static const uint8_t *ppag_fetch_set(struct gain_profile *ppag, size_t set_num)
+{
+ const uint8_t *ppag_table = &ppag->ppag_table[0];
+
+ return ppag_table + (ppag->bands_count * set_num);
+}
+
static void sar_emit_wrds(const struct sar_profile *sar)
{
int i;
@@ -216,6 +223,50 @@ static void sar_emit_wgds(struct geo_profile *wgds)
acpigen_write_package_end();
}
+static void sar_emit_ppag(struct gain_profile *ppag)
+{
+ int i;
+ size_t package_size, set_num;
+ const uint8_t *set;
+
+ if (ppag == NULL)
+ return;
+
+ /*
+ * Name ("PPAG", Package () {
+ * Revision,
+ * Package () {
+ * Domain Type, // 0x7:WiFi
+ * PPAG Mode, // Defines the mode of ANT_gain control to be used
+ * ANT_gain Table Chain A // Defines the ANT_gain in dBi for chain A
+ * ANT_gain Table Chain B // Defines the ANT_gain in dBi for chain B
+ * }
+ * })
+ */
+ if (ppag->revision > MAX_ANT_GAINS_REVISION) {
+ printk(BIOS_ERR, "Invalid PPAG revision: %d\n", ppag->revision);
+ return;
+ }
+
+ package_size = 1 + 1 + ppag->chains_count * ppag->bands_count;
+
+ acpigen_write_name("PPAG");
+ acpigen_write_package(2);
+ acpigen_write_dword(ppag->revision);
+ acpigen_write_package(package_size);
+ acpigen_write_dword(DOMAIN_TYPE_WIFI);
+ acpigen_write_dword(ppag->mode);
+
+ for (set_num = 0; set_num < ppag->chains_count; set_num++) {
+ set = ppag_fetch_set(ppag, set_num);
+ for (i = 0; i < ppag->bands_count; i++)
+ acpigen_write_byte(set[i]);
+ }
+
+ acpigen_write_package_end();
+ acpigen_write_package_end();
+}
+
static void emit_sar_acpi_structures(const struct device *dev)
{
union wifi_sar_limits sar_limits;
@@ -236,6 +287,7 @@ static void emit_sar_acpi_structures(const struct device *dev)
sar_emit_wrds(sar_limits.sar);
sar_emit_ewrd(sar_limits.sar);
sar_emit_wgds(sar_limits.wgds);
+ sar_emit_ppag(sar_limits.ppag);
free(sar_limits.sar);
}