Skip to contentSkip to conversation

Bluetooth: btintel: Set Per Platform Antenna Gain(PPAG)

PATCH Superseded Kiran K 3 participants 3 messages Feb 6, 2023 Bluetooth drivers

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Kiran K

author
#0 lore raw

PATCH v2 1/1 Bluetooth: btintel: Set Per Platform Antenna Gain(PPAG)

From: Seema Sreemantha <[email protected]>

Antenna gain is defined as the antenna’s ability to increase the Tx power in a given direction. Intel is certifying its products with fixed reference antenna peak gain values (3/5dBi). The feature takes into account the actual antenna gain, and increases output power values, which results in a performance improvement.

After firmware download is completed, driver reads from ACPI table and configures PPAG as required. ACPI table entry for PPAG is defined as below.

Name (PPAG, Package (0x02)

{
    0x00000001,
    Package (0x02)
    {
        0x00000012, /* Bluetooth Domain */
        0x00000001  /* 1 - Enable PPAG, 0 - Disable PPAG */
    }
})

btmon log:
< HCI Command: Intel Configure Per Platform Antenna Gain (0x3f|0x0219) plen 12

        Mcc: 0x00000000
        Selector: Enable
        Delta: 0x00000000
Quoted 1 line

HCI Event: Command Complete (0x0e) plen 4

      Intel Configure Per Platform Antenna Gain (0x3f|0x0219) ncmd 1
        Status: Success (0x00)

---
changes in v2:
- Address review comments

 drivers/bluetooth/btintel.c | 115 ++++++++++++++++++++++++++++++++++++
 drivers/bluetooth/btintel.h |  13 ++++
 2 files changed, 128 insertions(+)
drivers/bluetooth/btintel.c +115 -0
index d4e2cb9a4eb4..608fa1e59e89 100644
@@ -24,6 +24,9 @@
 #define ECDSA_OFFSET		644
 #define ECDSA_HEADER_LEN	320
 
+#define BTINTEL_PPAG_NAME   "PPAG"
+#define BTINTEL_PPAG_PREFIX "\\_SB_.PCI0.XHCI.RHUB"
+
 #define CMD_WRITE_BOOT_PARAMS	0xfc0e
 struct cmd_write_boot_params {
 	__le32 boot_addr;
@@ -1278,6 +1281,63 @@ static int btintel_read_debug_features(struct hci_dev *hdev,
 	return 0;
 }
 
+static acpi_status btintel_ppag_callback(acpi_handle handle, u32 lvl, void *data,
+					 void **ret)
+{
+	acpi_status status;
+	size_t len;
+	struct btintel_ppag *ppag = data;
+	union acpi_object *p, *elements;
+	struct acpi_buffer string = {ACPI_ALLOCATE_BUFFER, NULL};
+	struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL};
+	struct hci_dev *hdev = ppag->hdev;
+
+	status = acpi_get_name(handle, ACPI_FULL_PATHNAME, &string);
+	if (ACPI_FAILURE(status)) {
+		bt_dev_warn(hdev, "ACPI Failure: %s", acpi_format_exception(status));
+		return status;
+	}
+
+	if (strncmp(BTINTEL_PPAG_PREFIX, string.pointer,
+		    strlen(BTINTEL_PPAG_PREFIX))) {
+		kfree(string.pointer);
+		return AE_OK;
+	}
+
+	len = strlen(string.pointer);
+	if (strncmp((char *)string.pointer + len - 4, BTINTEL_PPAG_NAME, 4)) {
+		kfree(string.pointer);
+		return AE_OK;
+	}
+	kfree(string.pointer);
+
+	status = acpi_evaluate_object(handle, NULL, NULL, &buffer);
+	if (ACPI_FAILURE(status)) {
+		bt_dev_warn(hdev, "ACPI Failure: %s", acpi_format_exception(status));
+		return status;
+	}
+
+	p = buffer.pointer;
+	ppag = (struct btintel_ppag *)data;
+
+	if (p->type != ACPI_TYPE_PACKAGE || p->package.count != 2) {
+		kfree(buffer.pointer);
+		bt_dev_warn(hdev, "Invalid object type: %d or package count: %d",
+			    p->type, p->package.count);
+		return AE_ERROR;
+	}
+
+	elements = p->package.elements;
+
+	/* PPAG table is located at element[1] */
+	p = &elements[1];
+
+	ppag->domain = (u32)p->package.elements[0].integer.value;
+	ppag->mode = (u32)p->package.elements[1].integer.value;
+	kfree(buffer.pointer);
+	return AE_CTRL_TERMINATE;
+}
+
 static int btintel_set_debug_features(struct hci_dev *hdev,
 			       const struct intel_debug_features *features)
 {
@@ -2251,6 +2311,58 @@ static int btintel_configure_offload(struct hci_dev *hdev)
 	return err;
 }
 
+static void btintel_set_ppag(struct hci_dev *hdev, struct intel_version_tlv *ver)
+{
+	acpi_status status;
+	struct btintel_ppag ppag;
+	struct sk_buff *skb;
+	struct btintel_loc_aware_reg ppag_cmd;
+
+    /* PPAG is not supported if CRF is HrP2, Jfp2, JfP1 */
+	switch (ver->cnvr_top & 0xFFF) {
+	case 0x504:     /* Hrp2 */
+	case 0x202:     /* Jfp2 */
+	case 0x201:     /* Jfp1 */
+		return;
+	}
+
+	memset(&ppag, 0, sizeof(ppag));
+
+	ppag.hdev = hdev;
+	status = acpi_walk_namespace(ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
+				     ACPI_UINT32_MAX, NULL,
+				     btintel_ppag_callback, &ppag, NULL);
+
+	if (ACPI_FAILURE(status)) {
+		/* Do not log warning message if ACPI entry is not found */
+		if (status == AE_NOT_FOUND)
+			return;
+		bt_dev_warn(hdev, "PPAG: ACPI Failure: %s", acpi_format_exception(status));
+		return;
+	}
+
+	if (ppag.domain != 0x12) {
+		bt_dev_warn(hdev, "PPAG-BT Domain disabled");
+		return;
+	}
+
+	/* PPAG mode, BIT0 = 0 Disabled, BIT0 = 1 Enabled */
+	if (!(ppag.mode & BIT(0))) {
+		bt_dev_dbg(hdev, "PPAG disabled");
+		return;
+	}
+
+	ppag_cmd.mcc = cpu_to_le32(0);
+	ppag_cmd.sel = cpu_to_le32(0); /* 0 - Enable , 1 - Disable, 2 - Testing mode */
+	ppag_cmd.delta = cpu_to_le32(0);
+	skb = __hci_cmd_sync(hdev, 0xfe19, sizeof(ppag_cmd), &ppag_cmd, HCI_CMD_TIMEOUT);
+	if (IS_ERR(skb)) {
+		bt_dev_warn(hdev, "Failed to send PPAG Enable (%ld)", PTR_ERR(skb));
+		return;
+	}
+	kfree_skb(skb);
+}
+
 static int btintel_bootloader_setup_tlv(struct hci_dev *hdev,
 					struct intel_version_tlv *ver)
 {
@@ -2297,6 +2409,9 @@ static int btintel_bootloader_setup_tlv(struct hci_dev *hdev,
 
 	hci_dev_clear_flag(hdev, HCI_QUALITY_REPORT);
 
+	/* Set PPAG feature */
+	btintel_set_ppag(hdev, ver);
+
 	/* Read the Intel version information after loading the FW  */
 	err = btintel_read_version_tlv(hdev, &new_ver);
 	if (err)
drivers/bluetooth/btintel.h +13 -0
index e0060e58573c..8e7da877efae 100644
@@ -137,6 +137,19 @@ struct intel_offload_use_cases {
 	__u8	preset[8];
 } __packed;
 
+/* structure to store the PPAG data read from ACPI table */
+struct btintel_ppag {
+	u32	domain;
+	u32     mode;
+	struct hci_dev *hdev;
+};
+
+struct btintel_loc_aware_reg {
+	__le32 mcc;
+	__le32 sel;
+	__le32 delta;
+} __packed;
+
 #define INTEL_HW_PLATFORM(cnvx_bt)	((u8)(((cnvx_bt) & 0x0000ff00) >> 8))
 #define INTEL_HW_VARIANT(cnvx_bt)	((u8)(((cnvx_bt) & 0x003f0000) >> 16))
 #define INTEL_CNVX_TOP_TYPE(cnvx_top)	((cnvx_top) & 0x00000fff)
Signature · 1 line
2.17.1
#1 lore raw

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=719005

---Test result---

Test Summary:

CheckPatch                    FAIL      1.60 seconds
GitLint                       PASS      0.27 seconds
SubjectPrefix                 PASS      0.09 seconds
BuildKernel                   FAIL      28.74 seconds
CheckAllWarning               FAIL      30.86 seconds
CheckSparse                   FAIL      33.99 seconds
CheckSmatch                   FAIL      95.92 seconds
BuildKernel32                 FAIL      27.11 seconds
TestRunnerSetup               PASS      437.75 seconds
TestRunner_l2cap-tester       PASS      16.30 seconds
TestRunner_iso-tester         PASS      16.67 seconds
TestRunner_bnep-tester        PASS      5.48 seconds
TestRunner_mgmt-tester        PASS      109.75 seconds
TestRunner_rfcomm-tester      PASS      8.69 seconds
TestRunner_sco-tester         PASS      8.04 seconds
TestRunner_ioctl-tester       PASS      9.44 seconds
TestRunner_mesh-tester        PASS      6.90 seconds
TestRunner_smp-tester         PASS      7.96 seconds
TestRunner_userchan-tester    PASS      5.66 seconds
IncrementalBuild              FAIL      25.12 seconds

Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script
Output:
[v2] Bluetooth: btintel: Set Per Platform Antenna Gain(PPAG)
WARNING: Possible unwrapped commit description (prefer a maximum 75 chars per line) #93:
< HCI Command: Intel Configure Per Platform Antenna Gain (0x3f|0x0219) plen 12

total: 0 errors, 1 warnings, 158 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or --fix-inplace.

/github/workspace/src/src/13129345.patch has style problems, please review.

NOTE: Ignored message types: UNKNOWN_COMMIT_ID

NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.

##############################
Test: BuildKernel - FAIL
Desc: Build Kernel for Bluetooth
Output:

drivers/bluetooth/btintel.c:1284:8: error: unknown type name ‘acpi_status’
1284 | static acpi_status btintel_ppag_callback(acpi_handle handle, u32 lvl, void *data,

      |        ^~~~~~~~~~~
drivers/bluetooth/btintel.c:1284:42: error: unknown type name ‘acpi_handle’; did you mean ‘hci_handle’?
 1284 | static acpi_status btintel_ppag_callback(acpi_handle handle, u32 lvl, void *data,
      |                                          ^~~~~~~~~~~
      |                                          hci_handle
drivers/bluetooth/btintel.c: In function ‘btintel_set_ppag’:
drivers/bluetooth/btintel.c:2316:2: error: unknown type name ‘acpi_status’; did you mean ‘si_status’?
 2316 |  acpi_status status;
      |  ^~~~~~~~~~~
      |  si_status
drivers/bluetooth/btintel.c:2332:11: error: implicit declaration of function ‘acpi_walk_namespace’ [-Werror=implicit-function-declaration]
 2332 |  status = acpi_walk_namespace(ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
      |           ^~~~~~~~~~~~~~~~~~~
drivers/bluetooth/btintel.c:2332:31: error: ‘ACPI_TYPE_ANY’ undeclared (first use in this function)
 2332 |  status = acpi_walk_namespace(ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
      |                               ^~~~~~~~~~~~~
drivers/bluetooth/btintel.c:2332:31: note: each undeclared identifier is reported only once for each function it appears in
drivers/bluetooth/btintel.c:2332:46: error: ‘ACPI_ROOT_OBJECT’ undeclared (first use in this function)
 2332 |  status = acpi_walk_namespace(ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
      |                                              ^~~~~~~~~~~~~~~~
drivers/bluetooth/btintel.c:2333:10: error: ‘ACPI_UINT32_MAX’ undeclared (first use in this function)
 2333 |          ACPI_UINT32_MAX, NULL,
      |          ^~~~~~~~~~~~~~~
drivers/bluetooth/btintel.c:2334:10: error: ‘btintel_ppag_callback’ undeclared (first use in this function)
 2334 |          btintel_ppag_callback, &ppag, NULL);
      |          ^~~~~~~~~~~~~~~~~~~~~
drivers/bluetooth/btintel.c:2336:6: error: implicit declaration of function ‘ACPI_FAILURE’ [-Werror=implicit-function-declaration]
 2336 |  if (ACPI_FAILURE(status)) {
      |      ^~~~~~~~~~~~
drivers/bluetooth/btintel.c:2338:17: error: ‘AE_NOT_FOUND’ undeclared (first use in this function)
 2338 |   if (status == AE_NOT_FOUND)
      |                 ^~~~~~~~~~~~
In file included from drivers/bluetooth/btintel.c:14:
drivers/bluetooth/btintel.c:2340:47: error: implicit declaration of function ‘acpi_format_exception’ [-Werror=implicit-function-declaration]
 2340 |   bt_dev_warn(hdev, "PPAG: ACPI Failure: %s", acpi_format_exception(status));
      |                                               ^~~~~~~~~~~~~~~~~~~~~

./include/net/bluetooth/bluetooth.h:243:47: note: in definition of macro ‘BT_WARN’
243 | #define BT_WARN(fmt, ...) bt_warn(fmt "\n", ##__VA_ARGS__)
| ^~~~~~~~~~~
drivers/bluetooth/btintel.c:2340:3: note: in expansion of macro ‘bt_dev_warn’

 2340 |   bt_dev_warn(hdev, "PPAG: ACPI Failure: %s", acpi_format_exception(status));
      |   ^~~~~~~~~~~
./include/net/bluetooth/bluetooth.h:257:10: warning: format ‘%s’ expects argument of type ‘char *’, but argument 3 has type ‘int’ [-Wformat=]
  257 |  BT_WARN("%s: " fmt, bt_dev_name(hdev), ##__VA_ARGS__)
      |          ^~~~~~

./include/net/bluetooth/bluetooth.h:243:35: note: in definition of macro ‘BT_WARN’
243 | #define BT_WARN(fmt, ...) bt_warn(fmt "\n", ##__VA_ARGS__)
| ^~~
drivers/bluetooth/btintel.c:2340:3: note: in expansion of macro ‘bt_dev_warn’

 2340 |   bt_dev_warn(hdev, "PPAG: ACPI Failure: %s", acpi_format_exception(status));
      |   ^~~~~~~~~~~
drivers/bluetooth/btintel.c:2340:43: note: format string is defined here
 2340 |   bt_dev_warn(hdev, "PPAG: ACPI Failure: %s", acpi_format_exception(status));
      |                                          ~^
      |                                           |
      |                                           char *
      |                                          %d

cc1: some warnings being treated as errors
make[3]: *** [scripts/Makefile.build:252: drivers/bluetooth/btintel.o] Error 1 make[2]: *** [scripts/Makefile.build:504: drivers/bluetooth] Error 2 make[1]: *** [scripts/Makefile.build:504: drivers] Error 2 make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:2021: .] Error 2
##############################
Test: CheckAllWarning - FAIL
Desc: Run linux kernel with all warning enabled
Output:

drivers/bluetooth/btintel.c:1284:8: error: unknown type name ‘acpi_status’
1284 | static acpi_status btintel_ppag_callback(acpi_handle handle, u32 lvl, void *data,

      |        ^~~~~~~~~~~
drivers/bluetooth/btintel.c:1284:42: error: unknown type name ‘acpi_handle’; did you mean ‘hci_handle’?
 1284 | static acpi_status btintel_ppag_callback(acpi_handle handle, u32 lvl, void *data,
      |                                          ^~~~~~~~~~~
      |                                          hci_handle
drivers/bluetooth/btintel.c: In function ‘btintel_set_ppag’:
drivers/bluetooth/btintel.c:2316:2: error: unknown type name ‘acpi_status’; did you mean ‘si_status’?
 2316 |  acpi_status status;
      |  ^~~~~~~~~~~
      |  si_status
drivers/bluetooth/btintel.c:2332:11: error: implicit declaration of function ‘acpi_walk_namespace’ [-Werror=implicit-function-declaration]
 2332 |  status = acpi_walk_namespace(ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
      |           ^~~~~~~~~~~~~~~~~~~
drivers/bluetooth/btintel.c:2332:31: error: ‘ACPI_TYPE_ANY’ undeclared (first use in this function)
 2332 |  status = acpi_walk_namespace(ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
      |                               ^~~~~~~~~~~~~
drivers/bluetooth/btintel.c:2332:31: note: each undeclared identifier is reported only once for each function it appears in
drivers/bluetooth/btintel.c:2332:46: error: ‘ACPI_ROOT_OBJECT’ undeclared (first use in this function)
 2332 |  status = acpi_walk_namespace(ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
      |                                              ^~~~~~~~~~~~~~~~
drivers/bluetooth/btintel.c:2333:10: error: ‘ACPI_UINT32_MAX’ undeclared (first use in this function)
 2333 |          ACPI_UINT32_MAX, NULL,
      |          ^~~~~~~~~~~~~~~
drivers/bluetooth/btintel.c:2334:10: error: ‘btintel_ppag_callback’ undeclared (first use in this function)
 2334 |          btintel_ppag_callback, &ppag, NULL);
      |          ^~~~~~~~~~~~~~~~~~~~~
drivers/bluetooth/btintel.c:2336:6: error: implicit declaration of function ‘ACPI_FAILURE’ [-Werror=implicit-function-declaration]
 2336 |  if (ACPI_FAILURE(status)) {
      |      ^~~~~~~~~~~~
drivers/bluetooth/btintel.c:2338:17: error: ‘AE_NOT_FOUND’ undeclared (first use in this function)
 2338 |   if (status == AE_NOT_FOUND)
      |                 ^~~~~~~~~~~~
In file included from drivers/bluetooth/btintel.c:14:
drivers/bluetooth/btintel.c:2340:47: error: implicit declaration of function ‘acpi_format_exception’ [-Werror=implicit-function-declaration]
 2340 |   bt_dev_warn(hdev, "PPAG: ACPI Failure: %s", acpi_format_exception(status));
      |                                               ^~~~~~~~~~~~~~~~~~~~~

./include/net/bluetooth/bluetooth.h:243:47: note: in definition of macro ‘BT_WARN’
243 | #define BT_WARN(fmt, ...) bt_warn(fmt "\n", ##__VA_ARGS__)
| ^~~~~~~~~~~
drivers/bluetooth/btintel.c:2340:3: note: in expansion of macro ‘bt_dev_warn’

 2340 |   bt_dev_warn(hdev, "PPAG: ACPI Failure: %s", acpi_format_exception(status));
      |   ^~~~~~~~~~~
./include/net/bluetooth/bluetooth.h:257:10: warning: format ‘%s’ expects argument of type ‘char *’, but argument 3 has type ‘int’ [-Wformat=]
  257 |  BT_WARN("%s: " fmt, bt_dev_name(hdev), ##__VA_ARGS__)
      |          ^~~~~~

./include/net/bluetooth/bluetooth.h:243:35: note: in definition of macro ‘BT_WARN’
243 | #define BT_WARN(fmt, ...) bt_warn(fmt "\n", ##__VA_ARGS__)
| ^~~
drivers/bluetooth/btintel.c:2340:3: note: in expansion of macro ‘bt_dev_warn’

 2340 |   bt_dev_warn(hdev, "PPAG: ACPI Failure: %s", acpi_format_exception(status));
      |   ^~~~~~~~~~~
drivers/bluetooth/btintel.c:2340:43: note: format string is defined here
 2340 |   bt_dev_warn(hdev, "PPAG: ACPI Failure: %s", acpi_format_exception(status));
      |                                          ~^
      |                                           |
      |                                           char *
      |                                          %d

cc1: some warnings being treated as errors
make[3]: *** [scripts/Makefile.build:252: drivers/bluetooth/btintel.o] Error 1 make[2]: *** [scripts/Makefile.build:504: drivers/bluetooth] Error 2 make[1]: *** [scripts/Makefile.build:504: drivers] Error 2 make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:2021: .] Error 2
##############################
Test: CheckSparse - FAIL
Desc: Run sparse tool with linux kernel
Output:

net/bluetooth/af_bluetooth.c:178:25: warning: context imbalance in 'bt_accept_enqueue' - different lock contexts for basic block drivers/bluetooth/hci_ag6xx.c:257:24: warning: restricted __le32 degrades to integer drivers/bluetooth/hci_mrvl.c:168:23: warning: restricted __le16 degrades to integer drivers/bluetooth/hci_mrvl.c:201:23: warning: restricted __le16 degrades to integer net/bluetooth/hci_event.c: note: in included file (through include/net/bluetooth/hci_core.h):
./include/net/bluetooth/hci.h:2631:47: warning: array of flexible structures ./include/net/bluetooth/hci.h:2717:43: warning: array of flexible structures drivers/bluetooth/btintel.c:1284:8: error: unknown type name ‘acpi_status’
1284 | static acpi_status btintel_ppag_callback(acpi_handle handle, u32 lvl, void *data,

      |        ^~~~~~~~~~~
drivers/bluetooth/btintel.c:1284:42: error: unknown type name ‘acpi_handle’; did you mean ‘hci_handle’?
 1284 | static acpi_status btintel_ppag_callback(acpi_handle handle, u32 lvl, void *data,
      |                                          ^~~~~~~~~~~
      |                                          hci_handle
drivers/bluetooth/btintel.c: In function ‘btintel_set_ppag’:
drivers/bluetooth/btintel.c:2316:2: error: unknown type name ‘acpi_status’; did you mean ‘si_status’?
 2316 |  acpi_status status;
      |  ^~~~~~~~~~~
      |  si_status
drivers/bluetooth/btintel.c:2332:11: error: implicit declaration of function ‘acpi_walk_namespace’ [-Werror=implicit-function-declaration]
 2332 |  status = acpi_walk_namespace(ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
      |           ^~~~~~~~~~~~~~~~~~~
drivers/bluetooth/btintel.c:2332:31: error: ‘ACPI_TYPE_ANY’ undeclared (first use in this function)
 2332 |  status = acpi_walk_namespace(ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
      |                               ^~~~~~~~~~~~~
drivers/bluetooth/btintel.c:2332:31: note: each undeclared identifier is reported only once for each function it appears in
drivers/bluetooth/btintel.c:2332:46: error: ‘ACPI_ROOT_OBJECT’ undeclared (first use in this function)
 2332 |  status = acpi_walk_namespace(ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
      |                                              ^~~~~~~~~~~~~~~~
drivers/bluetooth/btintel.c:2333:10: error: ‘ACPI_UINT32_MAX’ undeclared (first use in this function)
 2333 |          ACPI_UINT32_MAX, NULL,
      |          ^~~~~~~~~~~~~~~
drivers/bluetooth/btintel.c:2334:10: error: ‘btintel_ppag_callback’ undeclared (first use in this function)
 2334 |          btintel_ppag_callback, &ppag, NULL);
      |          ^~~~~~~~~~~~~~~~~~~~~
drivers/bluetooth/btintel.c:2336:6: error: implicit declaration of function ‘ACPI_FAILURE’ [-Werror=implicit-function-declaration]
 2336 |  if (ACPI_FAILURE(status)) {
      |      ^~~~~~~~~~~~
drivers/bluetooth/btintel.c:2338:17: error: ‘AE_NOT_FOUND’ undeclared (first use in this function)
 2338 |   if (status == AE_NOT_FOUND)
      |                 ^~~~~~~~~~~~
In file included from drivers/bluetooth/btintel.c:14:
drivers/bluetooth/btintel.c:2340:47: error: implicit declaration of function ‘acpi_format_exception’ [-Werror=implicit-function-declaration]
 2340 |   bt_dev_warn(hdev, "PPAG: ACPI Failure: %s", acpi_format_exception(status));
      |                                               ^~~~~~~~~~~~~~~~~~~~~

./include/net/bluetooth/bluetooth.h:243:47: note: in definition of macro ‘BT_WARN’
243 | #define BT_WARN(fmt, ...) bt_warn(fmt "\n", ##__VA_ARGS__)
| ^~~~~~~~~~~
drivers/bluetooth/btintel.c:2340:3: note: in expansion of macro ‘bt_dev_warn’

 2340 |   bt_dev_warn(hdev, "PPAG: ACPI Failure: %s", acpi_format_exception(status));
      |   ^~~~~~~~~~~
./include/net/bluetooth/bluetooth.h:257:10: warning: format ‘%s’ expects argument of type ‘char *’, but argument 3 has type ‘int’ [-Wformat=]
  257 |  BT_WARN("%s: " fmt, bt_dev_name(hdev), ##__VA_ARGS__)
      |          ^~~~~~

./include/net/bluetooth/bluetooth.h:243:35: note: in definition of macro ‘BT_WARN’
243 | #define BT_WARN(fmt, ...) bt_warn(fmt "\n", ##__VA_ARGS__)
| ^~~
drivers/bluetooth/btintel.c:2340:3: note: in expansion of macro ‘bt_dev_warn’

 2340 |   bt_dev_warn(hdev, "PPAG: ACPI Failure: %s", acpi_format_exception(status));
      |   ^~~~~~~~~~~
drivers/bluetooth/btintel.c:2340:43: note: format string is defined here
 2340 |   bt_dev_warn(hdev, "PPAG: ACPI Failure: %s", acpi_format_exception(status));
      |                                          ~^
      |                                           |
      |                                           char *
      |                                          %d

cc1: some warnings being treated as errors
make[3]: *** [scripts/Makefile.build:252: drivers/bluetooth/btintel.o] Error 1 make[2]: *** [scripts/Makefile.build:504: drivers/bluetooth] Error 2 make[1]: *** [scripts/Makefile.build:504: drivers] Error 2
make[1]: *** Waiting for unfinished jobs.... net/bluetooth/hci_codec.c: note: in included file:
./include/net/bluetooth/hci_core.h:148:35: warning: array of flexible structures net/bluetooth/sco.c: note: in included file:
./include/net/bluetooth/hci_core.h:148:35: warning: array of flexible structures
make: *** [Makefile:2021: .] Error 2
##############################
Test: CheckSmatch - FAIL
Desc: Run smatch tool with source
Output:

net/bluetooth/hci_event.c: note: in included file (through include/net/bluetooth/hci_core.h):
./include/net/bluetooth/hci.h:2631:47: warning: array of flexible structures ./include/net/bluetooth/hci.h:2717:43: warning: array of flexible structures drivers/bluetooth/btintel.c:1284:8: error: unknown type name ‘acpi_status’
1284 | static acpi_status btintel_ppag_callback(acpi_handle handle, u32 lvl, void *data,

      |        ^~~~~~~~~~~
drivers/bluetooth/btintel.c:1284:42: error: unknown type name ‘acpi_handle’; did you mean ‘hci_handle’?
 1284 | static acpi_status btintel_ppag_callback(acpi_handle handle, u32 lvl, void *data,
      |                                          ^~~~~~~~~~~
      |                                          hci_handle
drivers/bluetooth/btintel.c: In function ‘btintel_set_ppag’:
drivers/bluetooth/btintel.c:2316:2: error: unknown type name ‘acpi_status’; did you mean ‘si_status’?
 2316 |  acpi_status status;
      |  ^~~~~~~~~~~
      |  si_status
drivers/bluetooth/btintel.c:2332:11: error: implicit declaration of function ‘acpi_walk_namespace’ [-Werror=implicit-function-declaration]
 2332 |  status = acpi_walk_namespace(ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
      |           ^~~~~~~~~~~~~~~~~~~
drivers/bluetooth/btintel.c:2332:31: error: ‘ACPI_TYPE_ANY’ undeclared (first use in this function)
 2332 |  status = acpi_walk_namespace(ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
      |                               ^~~~~~~~~~~~~
drivers/bluetooth/btintel.c:2332:31: note: each undeclared identifier is reported only once for each function it appears in
drivers/bluetooth/btintel.c:2332:46: error: ‘ACPI_ROOT_OBJECT’ undeclared (first use in this function)
 2332 |  status = acpi_walk_namespace(ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
      |                                              ^~~~~~~~~~~~~~~~
drivers/bluetooth/btintel.c:2333:10: error: ‘ACPI_UINT32_MAX’ undeclared (first use in this function)
 2333 |          ACPI_UINT32_MAX, NULL,
      |          ^~~~~~~~~~~~~~~
drivers/bluetooth/btintel.c:2334:10: error: ‘btintel_ppag_callback’ undeclared (first use in this function)
 2334 |          btintel_ppag_callback, &ppag, NULL);
      |          ^~~~~~~~~~~~~~~~~~~~~
drivers/bluetooth/btintel.c:2336:6: error: implicit declaration of function ‘ACPI_FAILURE’ [-Werror=implicit-function-declaration]
 2336 |  if (ACPI_FAILURE(status)) {
      |      ^~~~~~~~~~~~
drivers/bluetooth/btintel.c:2338:17: error: ‘AE_NOT_FOUND’ undeclared (first use in this function)
 2338 |   if (status == AE_NOT_FOUND)
      |                 ^~~~~~~~~~~~
In file included from drivers/bluetooth/btintel.c:14:
drivers/bluetooth/btintel.c:2340:47: error: implicit declaration of function ‘acpi_format_exception’ [-Werror=implicit-function-declaration]
 2340 |   bt_dev_warn(hdev, "PPAG: ACPI Failure: %s", acpi_format_exception(status));
      |                                               ^~~~~~~~~~~~~~~~~~~~~

./include/net/bluetooth/bluetooth.h:243:47: note: in definition of macro ‘BT_WARN’
243 | #define BT_WARN(fmt, ...) bt_warn(fmt "\n", ##__VA_ARGS__)
| ^~~~~~~~~~~
drivers/bluetooth/btintel.c:2340:3: note: in expansion of macro ‘bt_dev_warn’

 2340 |   bt_dev_warn(hdev, "PPAG: ACPI Failure: %s", acpi_format_exception(status));
      |   ^~~~~~~~~~~
./include/net/bluetooth/bluetooth.h:257:10: warning: format ‘%s’ expects argument of type ‘char *’, but argument 3 has type ‘int’ [-Wformat=]
  257 |  BT_WARN("%s: " fmt, bt_dev_name(hdev), ##__VA_ARGS__)
      |          ^~~~~~

./include/net/bluetooth/bluetooth.h:243:35: note: in definition of macro ‘BT_WARN’
243 | #define BT_WARN(fmt, ...) bt_warn(fmt "\n", ##__VA_ARGS__)
| ^~~
drivers/bluetooth/btintel.c:2340:3: note: in expansion of macro ‘bt_dev_warn’

 2340 |   bt_dev_warn(hdev, "PPAG: ACPI Failure: %s", acpi_format_exception(status));
      |   ^~~~~~~~~~~
drivers/bluetooth/btintel.c:2340:43: note: format string is defined here
 2340 |   bt_dev_warn(hdev, "PPAG: ACPI Failure: %s", acpi_format_exception(status));
      |                                          ~^
      |                                           |
      |                                           char *
      |                                          %d

cc1: some warnings being treated as errors
make[3]: *** [scripts/Makefile.build:252: drivers/bluetooth/btintel.o] Error 1 make[2]: *** [scripts/Makefile.build:504: drivers/bluetooth] Error 2 make[1]: *** [scripts/Makefile.build:504: drivers] Error 2
make[1]: *** Waiting for unfinished jobs.... net/bluetooth/hci_codec.c: note: in included file:
./include/net/bluetooth/hci_core.h:148:35: warning: array of flexible structures net/bluetooth/sco.c: note: in included file:
./include/net/bluetooth/hci_core.h:148:35: warning: array of flexible structures
make: *** [Makefile:2021: .] Error 2
##############################
Test: BuildKernel32 - FAIL
Desc: Build 32bit Kernel for Bluetooth
Output:

drivers/bluetooth/btintel.c:1284:8: error: unknown type name ‘acpi_status’
1284 | static acpi_status btintel_ppag_callback(acpi_handle handle, u32 lvl, void *data,

      |        ^~~~~~~~~~~
drivers/bluetooth/btintel.c:1284:42: error: unknown type name ‘acpi_handle’; did you mean ‘hci_handle’?
 1284 | static acpi_status btintel_ppag_callback(acpi_handle handle, u32 lvl, void *data,
      |                                          ^~~~~~~~~~~
      |                                          hci_handle
drivers/bluetooth/btintel.c: In function ‘btintel_set_ppag’:
drivers/bluetooth/btintel.c:2316:2: error: unknown type name ‘acpi_status’; did you mean ‘si_status’?
 2316 |  acpi_status status;
      |  ^~~~~~~~~~~
      |  si_status
drivers/bluetooth/btintel.c:2332:11: error: implicit declaration of function ‘acpi_walk_namespace’ [-Werror=implicit-function-declaration]
 2332 |  status = acpi_walk_namespace(ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
      |           ^~~~~~~~~~~~~~~~~~~
drivers/bluetooth/btintel.c:2332:31: error: ‘ACPI_TYPE_ANY’ undeclared (first use in this function)
 2332 |  status = acpi_walk_namespace(ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
      |                               ^~~~~~~~~~~~~
drivers/bluetooth/btintel.c:2332:31: note: each undeclared identifier is reported only once for each function it appears in
drivers/bluetooth/btintel.c:2332:46: error: ‘ACPI_ROOT_OBJECT’ undeclared (first use in this function)
 2332 |  status = acpi_walk_namespace(ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
      |                                              ^~~~~~~~~~~~~~~~
drivers/bluetooth/btintel.c:2333:10: error: ‘ACPI_UINT32_MAX’ undeclared (first use in this function)
 2333 |          ACPI_UINT32_MAX, NULL,
      |          ^~~~~~~~~~~~~~~
drivers/bluetooth/btintel.c:2334:10: error: ‘btintel_ppag_callback’ undeclared (first use in this function)
 2334 |          btintel_ppag_callback, &ppag, NULL);
      |          ^~~~~~~~~~~~~~~~~~~~~
drivers/bluetooth/btintel.c:2336:6: error: implicit declaration of function ‘ACPI_FAILURE’ [-Werror=implicit-function-declaration]
 2336 |  if (ACPI_FAILURE(status)) {
      |      ^~~~~~~~~~~~
drivers/bluetooth/btintel.c:2338:17: error: ‘AE_NOT_FOUND’ undeclared (first use in this function)
 2338 |   if (status == AE_NOT_FOUND)
      |                 ^~~~~~~~~~~~
In file included from drivers/bluetooth/btintel.c:14:
drivers/bluetooth/btintel.c:2340:47: error: implicit declaration of function ‘acpi_format_exception’ [-Werror=implicit-function-declaration]
 2340 |   bt_dev_warn(hdev, "PPAG: ACPI Failure: %s", acpi_format_exception(status));
      |                                               ^~~~~~~~~~~~~~~~~~~~~

./include/net/bluetooth/bluetooth.h:243:47: note: in definition of macro ‘BT_WARN’
243 | #define BT_WARN(fmt, ...) bt_warn(fmt "\n", ##__VA_ARGS__)
| ^~~~~~~~~~~
drivers/bluetooth/btintel.c:2340:3: note: in expansion of macro ‘bt_dev_warn’

 2340 |   bt_dev_warn(hdev, "PPAG: ACPI Failure: %s", acpi_format_exception(status));
      |   ^~~~~~~~~~~
./include/net/bluetooth/bluetooth.h:257:10: warning: format ‘%s’ expects argument of type ‘char *’, but argument 3 has type ‘int’ [-Wformat=]
  257 |  BT_WARN("%s: " fmt, bt_dev_name(hdev), ##__VA_ARGS__)
      |          ^~~~~~

./include/net/bluetooth/bluetooth.h:243:35: note: in definition of macro ‘BT_WARN’
243 | #define BT_WARN(fmt, ...) bt_warn(fmt "\n", ##__VA_ARGS__)
| ^~~
drivers/bluetooth/btintel.c:2340:3: note: in expansion of macro ‘bt_dev_warn’

 2340 |   bt_dev_warn(hdev, "PPAG: ACPI Failure: %s", acpi_format_exception(status));
      |   ^~~~~~~~~~~
drivers/bluetooth/btintel.c:2340:43: note: format string is defined here
 2340 |   bt_dev_warn(hdev, "PPAG: ACPI Failure: %s", acpi_format_exception(status));
      |                                          ~^
      |                                           |
      |                                           char *
      |                                          %d

cc1: some warnings being treated as errors
make[3]: *** [scripts/Makefile.build:252: drivers/bluetooth/btintel.o] Error 1 make[2]: *** [scripts/Makefile.build:504: drivers/bluetooth] Error 2 make[1]: *** [scripts/Makefile.build:504: drivers] Error 2 make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:2021: .] Error 2
##############################
Test: IncrementalBuild - FAIL
Desc: Incremental build with the patches in the series
Output:
[v2] Bluetooth: btintel: Set Per Platform Antenna Gain(PPAG)

drivers/bluetooth/btintel.c:1284:8: error: unknown type name ‘acpi_status’
1284 | static acpi_status btintel_ppag_callback(acpi_handle handle, u32 lvl, void *data,

      |        ^~~~~~~~~~~
drivers/bluetooth/btintel.c:1284:42: error: unknown type name ‘acpi_handle’; did you mean ‘hci_handle’?
 1284 | static acpi_status btintel_ppag_callback(acpi_handle handle, u32 lvl, void *data,
      |                                          ^~~~~~~~~~~
      |                                          hci_handle
drivers/bluetooth/btintel.c: In function ‘btintel_set_ppag’:
drivers/bluetooth/btintel.c:2316:2: error: unknown type name ‘acpi_status’; did you mean ‘si_status’?
 2316 |  acpi_status status;
      |  ^~~~~~~~~~~
      |  si_status
drivers/bluetooth/btintel.c:2332:11: error: implicit declaration of function ‘acpi_walk_namespace’ [-Werror=implicit-function-declaration]
 2332 |  status = acpi_walk_namespace(ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
      |           ^~~~~~~~~~~~~~~~~~~
drivers/bluetooth/btintel.c:2332:31: error: ‘ACPI_TYPE_ANY’ undeclared (first use in this function)
 2332 |  status = acpi_walk_namespace(ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
      |                               ^~~~~~~~~~~~~
drivers/bluetooth/btintel.c:2332:31: note: each undeclared identifier is reported only once for each function it appears in
drivers/bluetooth/btintel.c:2332:46: error: ‘ACPI_ROOT_OBJECT’ undeclared (first use in this function)
 2332 |  status = acpi_walk_namespace(ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
      |                                              ^~~~~~~~~~~~~~~~
drivers/bluetooth/btintel.c:2333:10: error: ‘ACPI_UINT32_MAX’ undeclared (first use in this function)
 2333 |          ACPI_UINT32_MAX, NULL,
      |          ^~~~~~~~~~~~~~~
drivers/bluetooth/btintel.c:2334:10: error: ‘btintel_ppag_callback’ undeclared (first use in this function)
 2334 |          btintel_ppag_callback, &ppag, NULL);
      |          ^~~~~~~~~~~~~~~~~~~~~
drivers/bluetooth/btintel.c:2336:6: error: implicit declaration of function ‘ACPI_FAILURE’ [-Werror=implicit-function-declaration]
 2336 |  if (ACPI_FAILURE(status)) {
      |      ^~~~~~~~~~~~
drivers/bluetooth/btintel.c:2338:17: error: ‘AE_NOT_FOUND’ undeclared (first use in this function)
 2338 |   if (status == AE_NOT_FOUND)
      |                 ^~~~~~~~~~~~
In file included from drivers/bluetooth/btintel.c:14:
drivers/bluetooth/btintel.c:2340:47: error: implicit declaration of function ‘acpi_format_exception’ [-Werror=implicit-function-declaration]
 2340 |   bt_dev_warn(hdev, "PPAG: ACPI Failure: %s", acpi_format_exception(status));
      |                                               ^~~~~~~~~~~~~~~~~~~~~

./include/net/bluetooth/bluetooth.h:243:47: note: in definition of macro ‘BT_WARN’
243 | #define BT_WARN(fmt, ...) bt_warn(fmt "\n", ##__VA_ARGS__)
| ^~~~~~~~~~~
drivers/bluetooth/btintel.c:2340:3: note: in expansion of macro ‘bt_dev_warn’

 2340 |   bt_dev_warn(hdev, "PPAG: ACPI Failure: %s", acpi_format_exception(status));
      |   ^~~~~~~~~~~
./include/net/bluetooth/bluetooth.h:257:10: warning: format ‘%s’ expects argument of type ‘char *’, but argument 3 has type ‘int’ [-Wformat=]
  257 |  BT_WARN("%s: " fmt, bt_dev_name(hdev), ##__VA_ARGS__)
      |          ^~~~~~

./include/net/bluetooth/bluetooth.h:243:35: note: in definition of macro ‘BT_WARN’
243 | #define BT_WARN(fmt, ...) bt_warn(fmt "\n", ##__VA_ARGS__)
| ^~~
drivers/bluetooth/btintel.c:2340:3: note: in expansion of macro ‘bt_dev_warn’

 2340 |   bt_dev_warn(hdev, "PPAG: ACPI Failure: %s", acpi_format_exception(status));
      |   ^~~~~~~~~~~
drivers/bluetooth/btintel.c:2340:43: note: format string is defined here
 2340 |   bt_dev_warn(hdev, "PPAG: ACPI Failure: %s", acpi_format_exception(status));
      |                                          ~^
      |                                           |
      |                                           char *
      |                                          %d

cc1: some warnings being treated as errors
make[3]: *** [scripts/Makefile.build:252: drivers/bluetooth/btintel.o] Error 1 make[2]: *** [scripts/Makefile.build:504: drivers/bluetooth] Error 2 make[1]: *** [scripts/Makefile.build:504: drivers] Error 2 make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:2021: .] Error 2

---
Regards,
Linux Bluetooth

#2 lore raw
In reply to Kiran K

Dear Kiran, dear Seema,

Thank you for the patch.

Am 06.02.23 um 07:23 schrieb Kiran K:

Quoted 1 line

From: Seema Sreemantha <[email protected]>

Please add a space before the ( in the commit message summary.

Quoted 11 lines

Antenna gain is defined as the antenna’s ability to increase the Tx power in a given direction. Intel is certifying its products with fixed reference antenna peak gain values (3/5dBi). The feature takes into account the actual antenna gain, and increases output power values, which results in a performance improvement.

After firmware download is completed, driver reads from ACPI table and configures PPAG as required. ACPI table entry for PPAG is defined as below.

It’d be great if you reflowed the text for 72/75 characters per line so less lines are used.

Quoted 110 lines

Name (PPAG, Package (0x02)

{
     0x00000001,
     Package (0x02)
     {
         0x00000012, /* Bluetooth Domain */
         0x00000001  /* 1 - Enable PPAG, 0 - Disable PPAG */
     }
})

btmon log:
< HCI Command: Intel Configure Per Platform Antenna Gain (0x3f|0x0219) plen 12

         Mcc: 0x00000000
         Selector: Enable
         Delta: 0x00000000
Quoted 1 line

HCI Event: Command Complete (0x0e) plen 4

       Intel Configure Per Platform Antenna Gain (0x3f|0x0219) ncmd 1
         Status: Success (0x00)

---
changes in v2:
- Address review comments

  drivers/bluetooth/btintel.c | 115 ++++++++++++++++++++++++++++++++++++
  drivers/bluetooth/btintel.h |  13 ++++
  2 files changed, 128 insertions(+)
drivers/bluetooth/btintel.c +60 -0
index d4e2cb9a4eb4..608fa1e59e89 100644
@@ -24,6 +24,9 @@
  #define ECDSA_OFFSET		644
  #define ECDSA_HEADER_LEN	320
 
+#define BTINTEL_PPAG_NAME   "PPAG"
+#define BTINTEL_PPAG_PREFIX "\\_SB_.PCI0.XHCI.RHUB"
+
  #define CMD_WRITE_BOOT_PARAMS	0xfc0e
  struct cmd_write_boot_params {
  	__le32 boot_addr;
@@ -1278,6 +1281,63 @@ static int btintel_read_debug_features(struct hci_dev *hdev,
  	return 0;
  }
 
+static acpi_status btintel_ppag_callback(acpi_handle handle, u32 lvl, void *data,
+					 void **ret)
+{
+	acpi_status status;
+	size_t len;
+	struct btintel_ppag *ppag = data;
+	union acpi_object *p, *elements;
+	struct acpi_buffer string = {ACPI_ALLOCATE_BUFFER, NULL};
+	struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL};
+	struct hci_dev *hdev = ppag->hdev;
+
+	status = acpi_get_name(handle, ACPI_FULL_PATHNAME, &string);
+	if (ACPI_FAILURE(status)) {
+		bt_dev_warn(hdev, "ACPI Failure: %s", acpi_format_exception(status));
+		return status;
+	}
+
+	if (strncmp(BTINTEL_PPAG_PREFIX, string.pointer,
+		    strlen(BTINTEL_PPAG_PREFIX))) {
+		kfree(string.pointer);
+		return AE_OK;
+	}
+
+	len = strlen(string.pointer);
+	if (strncmp((char *)string.pointer + len - 4, BTINTEL_PPAG_NAME, 4)) {
+		kfree(string.pointer);
+		return AE_OK;
+	}
+	kfree(string.pointer);
+
+	status = acpi_evaluate_object(handle, NULL, NULL, &buffer);
+	if (ACPI_FAILURE(status)) {
+		bt_dev_warn(hdev, "ACPI Failure: %s", acpi_format_exception(status));
+		return status;
+	}
+
+	p = buffer.pointer;
+	ppag = (struct btintel_ppag *)data;
+
+	if (p->type != ACPI_TYPE_PACKAGE || p->package.count != 2) {
+		kfree(buffer.pointer);
+		bt_dev_warn(hdev, "Invalid object type: %d or package count: %d",
+			    p->type, p->package.count);
+		return AE_ERROR;
+	}
+
+	elements = p->package.elements;
+
+	/* PPAG table is located at element[1] */
+	p = &elements[1];
+
+	ppag->domain = (u32)p->package.elements[0].integer.value;
+	ppag->mode = (u32)p->package.elements[1].integer.value;
+	kfree(buffer.pointer);
+	return AE_CTRL_TERMINATE;
+}
+
  static int btintel_set_debug_features(struct hci_dev *hdev,
  			       const struct intel_debug_features *features)
  {
@@ -2251,6 +2311,58 @@ static int btintel_configure_offload(struct hci_dev *hdev)
  	return err;

drivers/bluetooth/btintel.c static int btintel_configure_offload(struct hci_dev *hdev) · line 2321

Quoted 10 lines
drivers/bluetooth/btintel.c +8 -0
  }
 
+static void btintel_set_ppag(struct hci_dev *hdev, struct intel_version_tlv *ver)
+{
+	acpi_status status;
+	struct btintel_ppag ppag;
+	struct sk_buff *skb;
+	struct btintel_loc_aware_reg ppag_cmd;
+
+    /* PPAG is not supported if CRF is HrP2, Jfp2, JfP1 */

At least in Mozilla Thunderbird, this does not look properly indented. Please use tabs in the beginning.

Quoted 6 lines
drivers/bluetooth/btintel.c +6 -0
+	switch (ver->cnvr_top & 0xFFF) {
+	case 0x504:     /* Hrp2 */
+	case 0x202:     /* Jfp2 */
+	case 0x201:     /* Jfp1 */
+		return;
+	}

drivers/bluetooth/btintel.c static int btintel_configure_offload(struct hci_dev *hdev) · line 2337

Quoted 10 lines
drivers/bluetooth/btintel.c +10 -0
+
+	memset(&ppag, 0, sizeof(ppag));
+
+	ppag.hdev = hdev;
+	status = acpi_walk_namespace(ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
+				     ACPI_UINT32_MAX, NULL,
+				     btintel_ppag_callback, &ppag, NULL);
+
+	if (ACPI_FAILURE(status)) {
+		/* Do not log warning message if ACPI entry is not found */

The comment seems useless, as it’s describing what the code does. (Maybe a debug message should be added.)

drivers/bluetooth/btintel.c static int btintel_configure_offload(struct hci_dev *hdev) · line 2345

Quoted 8 lines
drivers/bluetooth/btintel.c +8 -0
+		if (status == AE_NOT_FOUND)
+			return;
+		bt_dev_warn(hdev, "PPAG: ACPI Failure: %s", acpi_format_exception(status));
+		return;
+	}
+
+	if (ppag.domain != 0x12) {
+		bt_dev_warn(hdev, "PPAG-BT Domain disabled");

Please elaborate and be more specific. Maybe:

drivers/bluetooth/btintel.c static int btintel_configure_offload(struct hci_dev *hdev) · line 2351

Quoted 8 lines

PPAG-BT Domain disabled in ACPI firwmare.

drivers/bluetooth/btintel.c +6 -0
+		return;
+	}
+
+	/* PPAG mode, BIT0 = 0 Disabled, BIT0 = 1 Enabled */
+	if (!(ppag.mode & BIT(0))) {
+		bt_dev_dbg(hdev, "PPAG disabled");

Maybe be consistent and keep using PPAG-BT. Maybe also add the term mode in there.

drivers/bluetooth/btintel.c static int btintel_configure_offload(struct hci_dev *hdev) · line 2358

Quoted 7 lines
drivers/bluetooth/btintel.c +7 -0
+		return;
+	}
+
+	ppag_cmd.mcc = cpu_to_le32(0);
+	ppag_cmd.sel = cpu_to_le32(0); /* 0 - Enable , 1 - Disable, 2 - Testing mode */
+	ppag_cmd.delta = cpu_to_le32(0);
+	skb = __hci_cmd_sync(hdev, 0xfe19, sizeof(ppag_cmd), &ppag_cmd, HCI_CMD_TIMEOUT);

Where does 0xfe19 come from?

drivers/bluetooth/btintel.c static int btintel_configure_offload(struct hci_dev *hdev) · line 2360

Quoted 2 lines
drivers/bluetooth/btintel.c +2 -0
+	if (IS_ERR(skb)) {
+		bt_dev_warn(hdev, "Failed to send PPAG Enable (%ld)", PTR_ERR(skb));

Should this be error level? What could a user do? Contact the hardware vendor?

Kind regards,

Paul

Quoted 42 lines
drivers/bluetooth/btintel.c +8 -0
+		return;
+	}
+	kfree_skb(skb);
+}
+
  static int btintel_bootloader_setup_tlv(struct hci_dev *hdev,
  					struct intel_version_tlv *ver)
  {
@@ -2297,6 +2409,9 @@ static int btintel_bootloader_setup_tlv(struct hci_dev *hdev,
 
  	hci_dev_clear_flag(hdev, HCI_QUALITY_REPORT);
 
+	/* Set PPAG feature */
+	btintel_set_ppag(hdev, ver);
+
  	/* Read the Intel version information after loading the FW  */
  	err = btintel_read_version_tlv(hdev, &new_ver);
  	if (err)
drivers/bluetooth/btintel.h +13 -0
index e0060e58573c..8e7da877efae 100644
@@ -137,6 +137,19 @@ struct intel_offload_use_cases {
  	__u8	preset[8];
  } __packed;
 
+/* structure to store the PPAG data read from ACPI table */
+struct btintel_ppag {
+	u32	domain;
+	u32     mode;
+	struct hci_dev *hdev;
+};
+
+struct btintel_loc_aware_reg {
+	__le32 mcc;
+	__le32 sel;
+	__le32 delta;
+} __packed;
+
  #define INTEL_HW_PLATFORM(cnvx_bt)	((u8)(((cnvx_bt) & 0x0000ff00) >> 8))
  #define INTEL_HW_VARIANT(cnvx_bt)	((u8)(((cnvx_bt) & 0x003f0000) >> 16))
  #define INTEL_CNVX_TOP_TYPE(cnvx_top)	((cnvx_top) & 0x00000fff)