Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH v4] Bluetooth: btintel: Add UEFI BPMO support for PeP
@ 2026-11-24  5:56 Catherine L
  2026-11-24  7:08 ` [v4] " bluez.test.bot
  0 siblings, 1 reply; 2+ messages in thread
From: Catherine L @ 2026-11-24  5:56 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: kiran.k, chethan.tumkur.narayan, Catherine L

PeP and later CNVr platforms allow the BIOS to supply a per-modulation
SAR offset table (BPMO) through the UefiCnvBtBPMO UEFI variable. The
firmware subtracts these per-chain, per-modulation offsets from the
BRDS limit, giving finer SAR granularity than a single limit per band.

Read UefiCnvBtBPMO in the UEFI SAR path after the BRDS and BSSS
handling. When the CNVr is PeP or later, UEFI BRDS revision 2 is
enabled, the SAR tables are locked, and the BPMO revision 0 variable
is enabled, write the BPMO enable flag (DDC 0x0359) followed by the
chain A (DDC 0x035A) and chain B (DDC 0x035B) offset tables.

The values are passed to the firmware unchanged. The existing SAR
initialization complete command (0xfe25) is still sent once, after all
SAR DDC writes. A missing, disabled or unsupported BPMO variable is not
treated as an error, and the firmware keeps its default of no offset.

The existing ACPI and UEFI BRDS/BSSS flows are unchanged.

Signed-off-by: Catherine L <catherine.l@intel.com>
---
Changes in v4:
- addressed sashiko comments

Changes in v3:
- Added Fixes tag

Changes in v2:
- addressed sashiko comments
- rebased patch
---
 drivers/bluetooth/btintel.c | 75 ++++++++++++++++++++++++++++++++++++-
 drivers/bluetooth/btintel.h |  7 ++++
 2 files changed, 80 insertions(+), 2 deletions(-)

diff --git a/drivers/bluetooth/btintel.c b/drivers/bluetooth/btintel.c
index 15c00d833f27..37fd2e31fd79 100644
--- a/drivers/bluetooth/btintel.c
+++ b/drivers/bluetooth/btintel.c
@@ -30,6 +30,7 @@
 
 #define BTINTEL_EFI_DSBR	L"UefiCnvCommonDSBR"
 #define BTINTEL_EFI_BRDS	L"UefiCnvBtBRDS"
+#define BTINTEL_EFI_BPMO	L"UefiCnvBtBPMO"
 #define BTINTEL_EFI_BSSS	L"UefiCnvBtBSSS"
 #define BTINTEL_EFI_GLUI	L"UefiCnvCommonGLUI"
 
@@ -62,6 +63,13 @@ struct btintel_uefi_sar {
 	u8 chain_b[5];
 } __packed;
 
+struct btintel_bpmo {
+	u8	header;
+	__le32	mode;
+	u8	chain_a[BTINTEL_BPMO_NUM_MODULATIONS];
+	u8	chain_b[BTINTEL_BPMO_NUM_MODULATIONS];
+} __packed;
+
 enum {
 	DSM_SET_WDISABLE2_DELAY = 1,
 	DSM_SET_RESET_METHOD = 3,
@@ -3739,7 +3747,64 @@ static int btintel_uefi_read_sar(struct hci_dev *hdev, efi_char16_t *name,
 	return 0;
 }
 
-static int btintel_set_uefi_sar(struct hci_dev *hdev)
+static int btintel_uefi_set_bpmo(struct hci_dev *hdev, u8 lock_status)
+{
+	u8 buffer[sizeof(struct btintel_cp_ddc_write) +
+		  BTINTEL_BPMO_NUM_MODULATIONS];
+	struct btintel_cp_ddc_write *cmd = (void *)buffer;
+	unsigned long size = sizeof(struct btintel_bpmo);
+	struct btintel_bpmo bpmo;
+	efi_status_t status;
+	int ret;
+
+	if (lock_status != BTINTEL_UEFI_LOCK_LOCKED &&
+	    lock_status != BTINTEL_UEFI_LOCK_TEST_MODE)
+		return -EOPNOTSUPP;
+
+	if (!IS_ENABLED(CONFIG_EFI) ||
+	    !efi_rt_services_supported(EFI_RT_SUPPORTED_GET_VARIABLE))
+		return -EOPNOTSUPP;
+
+	status = efi.get_variable(BTINTEL_EFI_BPMO, &btintel_efi_sar_guid, NULL,
+				  &size, &bpmo);
+	if (status == EFI_NOT_FOUND)
+		return -ENOENT;
+	if (status != EFI_SUCCESS) {
+		bt_dev_dbg(hdev, "Failed to read UEFI BPMO variable: 0x%lx",
+			   status);
+		return -EOPNOTSUPP;
+	}
+
+	if (size != sizeof(bpmo) || bpmo.header != 0) {
+		bt_dev_dbg(hdev, "Unsupported UEFI BPMO variable");
+		return -EOPNOTSUPP;
+	}
+	if (!(le32_to_cpu(bpmo.mode) & BIT(0))) {
+		bt_dev_dbg(hdev, "UEFI BPMO is disabled");
+		return -EOPNOTSUPP;
+	}
+
+	cmd->len = 3;
+	cmd->id = cpu_to_le16(BTINTEL_DDC_ID_SAR_BPMO_ENABLE);
+	cmd->data[0] = 0x01;
+	ret = btintel_send_sar_ddc(hdev, cmd, sizeof(*cmd) + 1);
+	if (ret)
+		return ret;
+
+	cmd->len = 2 + BTINTEL_BPMO_NUM_MODULATIONS;
+	cmd->id = cpu_to_le16(BTINTEL_DDC_ID_SAR_BPMO_CHAIN_A);
+	memcpy(cmd->data, bpmo.chain_a, BTINTEL_BPMO_NUM_MODULATIONS);
+	ret = btintel_send_sar_ddc(hdev, cmd, sizeof(buffer));
+	if (ret)
+		return ret;
+
+	cmd->id = cpu_to_le16(BTINTEL_DDC_ID_SAR_BPMO_CHAIN_B);
+	memcpy(cmd->data, bpmo.chain_b, BTINTEL_BPMO_NUM_MODULATIONS);
+	return btintel_send_sar_ddc(hdev, cmd, sizeof(buffer));
+}
+
+static int btintel_set_uefi_sar(struct hci_dev *hdev,
+				struct intel_version_tlv *ver)
 {
 	/* 5G8 and 5G9 share a limit but have separate DDC identifiers. */
 	static const struct {
@@ -3826,6 +3891,12 @@ static int btintel_set_uefi_sar(struct hci_dev *hdev)
 		ret = 0;
 	}
 
+	if (INTEL_CNVX_TOP_TYPE(ver->cnvr_top) >= BTINTEL_CNVR_PEP) {
+		ret = btintel_uefi_set_bpmo(hdev, lock_status);
+		if (ret == -ENOENT || ret == -EOPNOTSUPP)
+			ret = 0;
+	}
+
 complete:
 	skb = __hci_cmd_sync(hdev, 0xfe25, sizeof(enable), &enable,
 			     HCI_CMD_TIMEOUT);
@@ -3853,7 +3924,7 @@ static int btintel_set_specific_absorption_rate(struct hci_dev *hdev,
 	/* Supported SCP2+ platforms use this UEFI DDC map regardless of CNVr. */
 	if (hw_variant >= BTINTEL_HWID_SCP2 &&
 	    hw_variant != BTINTEL_HWID_BZRIW)
-		btintel_set_uefi_sar(hdev);
+		btintel_set_uefi_sar(hdev, ver);
 
 	/*
 	 * Platforms with UEFI BSSS do not provide ACPI BRDS. If UEFI BRDS is
diff --git a/drivers/bluetooth/btintel.h b/drivers/bluetooth/btintel.h
index 372c6d7d8cbe..766cd69503f6 100644
--- a/drivers/bluetooth/btintel.h
+++ b/drivers/bluetooth/btintel.h
@@ -71,6 +71,7 @@ struct intel_tlv {
 /* CNVR */
 #define BTINTEL_CNVR_FMP2		0x910
 #define BTINTEL_CNVR_WHP2		0xA10	/* Whale Peak2 - Panther Lake */
+#define BTINTEL_CNVR_PEP		0xA30   /* Pelican Peak2 / Pelican Peak STC */
 
 #define BTINTEL_IMG_BOOTLOADER		0x01	/* Bootloader image */
 #define BTINTEL_IMG_IML			0x02	/* Intermediate image */
@@ -87,6 +88,12 @@ struct intel_tlv {
 #define BTINTEL_HWID_SCP2F	0x21	/* Scorpius Peak2-F - Nova Lake */
 #define BTINTEL_HWID_BZRIW	0x22	/* BlazarIW - Wildcat Lake */
 
+#define BTINTEL_BPMO_NUM_MODULATIONS	16
+
+#define BTINTEL_DDC_ID_SAR_BPMO_ENABLE		0x0359
+#define BTINTEL_DDC_ID_SAR_BPMO_CHAIN_A		0x035A
+#define BTINTEL_DDC_ID_SAR_BPMO_CHAIN_B		0x035B
+
 extern const guid_t btintel_guid_dsm;
 
 struct intel_version_tlv {
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-24  7:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-24  5:56 [PATCH v4] Bluetooth: btintel: Add UEFI BPMO support for PeP Catherine L
2026-11-24  7:08 ` [v4] " bluez.test.bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox