Skip to contentSkip to conversation

Bluetooth: btintel: Send new command for PPAG

PATCH Superseded Lokendra Singh 3 participants 3 messages Aug 10, 2023 Bluetooth drivers

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Bluetooth: btintel: Send new command for PPAG

From: Seema Sreemantha <[email protected]>

Added support for the new command opcode FE0B
(HCI Intel PPAG Enable).

btmon log:
< HCI Command: Intel PPAG Enable (0x3f|0x020b) plen 4

        Enable: 0x00000002
Quoted 1 line

HCI Event: Command Complete (0x0e) plen 4

      Intel PPAG Enable (0x3f|0x020b) ncmd 1
        Status: Success (0x00)
---
 drivers/bluetooth/btintel.c | 28 +++++++++++++++++++---------
 1 file changed, 19 insertions(+), 9 deletions(-)
drivers/bluetooth/btintel.c +19 -9
index 633e8d9bf58f..71964c99f5f3 100644
@@ -2401,7 +2401,7 @@ static void btintel_set_ppag(struct hci_dev *hdev, struct intel_version_tlv *ver
 {
 	struct btintel_ppag ppag;
 	struct sk_buff *skb;
-	struct btintel_loc_aware_reg ppag_cmd;
+	struct hci_ppag_enable_cmd ppag_cmd;
 	acpi_handle handle;
 
 	/* PPAG is not supported if CRF is HrP2, Jfp2, JfP1 */
@@ -2409,6 +2409,8 @@ static void btintel_set_ppag(struct hci_dev *hdev, struct intel_version_tlv *ver
 	case 0x504:     /* Hrp2 */
 	case 0x202:     /* Jfp2 */
 	case 0x201:     /* Jfp1 */
+		bt_dev_warn(hdev, "PPAG not supported for Intel CNVr (0x%3x)",
+			    ver->cnvr_top & 0xFFF);
 		return;
 	}
 
@@ -2434,24 +2436,32 @@ static void btintel_set_ppag(struct hci_dev *hdev, struct intel_version_tlv *ver
 	}
 
 	if (ppag.domain != 0x12) {
-		bt_dev_warn(hdev, "PPAG-BT: domain is not bluetooth");
+		bt_dev_warn(hdev, "PPAG-BT: Bluetooth domain is disabled in ACPI firmware");
 		return;
 	}
 
-	/* PPAG mode, BIT0 = 0 Disabled, BIT0 = 1 Enabled */
-	if (!(ppag.mode & BIT(0))) {
-		bt_dev_dbg(hdev, "PPAG-BT: disabled");
+	/* PPAG mode
+	 * BIT 0 : 0 Disabled in EU
+	 *         1 Enabled in EU
+	 * BIT 1 : 0 Disabled in China
+	 *         1 Enabled in China
+	 */
+	if((ppag.mode & 0x01) != BIT(0) && (ppag.mode & 0x02) != BIT(1)) {
+		bt_dev_warn(hdev, "PPAG-BT: EU, China mode are disabled in CB/BIOS");
 		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);
+	/* HCI_Intel_PpagEnable_CMD - opcode: 0xFE0B
+	 * ppag_enable_flags - ppag mode
+	 */
+	ppag_cmd.ppag_enable_flags = ppag.mode;
+
+	skb = __hci_cmd_sync(hdev, 0xfe0b, 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;
 	}
+	bt_dev_info(hdev, "PPAG-BT: Enabled (Mode %d)", ppag.mode);
 	kfree_skb(skb);
 }
 
Signature · 1 line
2.25.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=774917

---Test result---

Test Summary:

CheckPatch                    FAIL      1.10 seconds
GitLint                       PASS      0.34 seconds
SubjectPrefix                 PASS      0.11 seconds
BuildKernel                   FAIL      35.53 seconds
CheckAllWarning               FAIL      39.21 seconds
CheckSparse                   FAIL      43.58 seconds
CheckSmatch                   FAIL      117.69 seconds
BuildKernel32                 FAIL      34.73 seconds
TestRunnerSetup               PASS      576.98 seconds
TestRunner_l2cap-tester       PASS      28.56 seconds
TestRunner_iso-tester         PASS      58.12 seconds
TestRunner_bnep-tester        PASS      12.75 seconds
TestRunner_mgmt-tester        PASS      239.73 seconds
TestRunner_rfcomm-tester      PASS      19.22 seconds
TestRunner_sco-tester         PASS      22.24 seconds
TestRunner_ioctl-tester       PASS      21.11 seconds
TestRunner_mesh-tester        PASS      16.45 seconds
TestRunner_smp-tester         PASS      17.02 seconds
TestRunner_userchan-tester    PASS      13.75 seconds
IncrementalBuild              FAIL      32.60 seconds

Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script
Output:
[v1] Bluetooth: btintel: Send new command for PPAG
ERROR: space required before the open parenthesis '(' #125: FILE: drivers/bluetooth/btintel.c:2449:
+ if((ppag.mode & 0x01) != BIT(0) && (ppag.mode & 0x02) != BIT(1)) {

total: 1 errors, 0 warnings, 56 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/13349282.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: In function ‘btintel_set_ppag’:
drivers/bluetooth/btintel.c:2404:29: error: storage size of ‘ppag_cmd’ isn’t known
2404 | struct hci_ppag_enable_cmd ppag_cmd;
| ^~~~~~~~
drivers/bluetooth/btintel.c:2404:29: warning: unused variable ‘ppag_cmd’ [-Wunused-variable] make[4]: *** [scripts/Makefile.build:243: drivers/bluetooth/btintel.o] Error 1 make[3]: *** [scripts/Makefile.build:477: drivers/bluetooth] Error 2
make[2]: *** [scripts/Makefile.build:477: drivers] Error 2
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [/github/workspace/src/src/Makefile:2020: .] Error 2
make: *** [Makefile:234: __sub-make] Error 2
##############################
Test: CheckAllWarning - FAIL
Desc: Run linux kernel with all warning enabled
Output:

drivers/bluetooth/btintel.c: In function ‘btintel_set_ppag’:
drivers/bluetooth/btintel.c:2404:29: error: storage size of ‘ppag_cmd’ isn’t known
2404 | struct hci_ppag_enable_cmd ppag_cmd;
| ^~~~~~~~
drivers/bluetooth/btintel.c:2404:29: warning: unused variable ‘ppag_cmd’ [-Wunused-variable] make[4]: *** [scripts/Makefile.build:243: drivers/bluetooth/btintel.o] Error 1 make[3]: *** [scripts/Makefile.build:477: drivers/bluetooth] Error 2
make[2]: *** [scripts/Makefile.build:477: drivers] Error 2
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [/github/workspace/src/src/Makefile:2020: .] Error 2
make: *** [Makefile:234: __sub-make] Error 2
##############################
Test: CheckSparse - FAIL
Desc: Run sparse tool with linux kernel
Output:

net/bluetooth/af_bluetooth.c:223: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:170:23: warning: restricted __le16 degrades to integer drivers/bluetooth/hci_mrvl.c:203: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:2658:47: warning: array of flexible structures ./include/net/bluetooth/hci.h:2744:43: warning: array of flexible structures
drivers/bluetooth/btintel.c: In function ‘btintel_set_ppag’:
drivers/bluetooth/btintel.c:2404:29: error: storage size of ‘ppag_cmd’ isn’t known
2404 | struct hci_ppag_enable_cmd ppag_cmd;
| ^~~~~~~~
drivers/bluetooth/btintel.c:2404:29: warning: unused variable ‘ppag_cmd’ [-Wunused-variable]
make[4]: *** [scripts/Makefile.build:243: drivers/bluetooth/btintel.o] Error 1
make[3]: *** [scripts/Makefile.build:477: drivers/bluetooth] Error 2
make[2]: *** [scripts/Makefile.build:477: drivers] Error 2
make[2]: *** Waiting for unfinished jobs....
net/bluetooth/hci_codec.c: note: in included file:
./include/net/bluetooth/hci_core.h:150:35: warning: array of flexible structures
net/bluetooth/sco.c: note: in included file:
./include/net/bluetooth/hci_core.h:150:35: warning: array of flexible structures
make[1]: *** [/github/workspace/src/src/Makefile:2020: .] Error 2
make: *** [Makefile:234: __sub-make] 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:2658:47: warning: array of flexible structures ./include/net/bluetooth/hci.h:2744:43: warning: array of flexible structures drivers/bluetooth/btintel.c: In function ‘btintel_set_ppag’:
drivers/bluetooth/btintel.c:2404:29: error: storage size of ‘ppag_cmd’ isn’t known
2404 | struct hci_ppag_enable_cmd ppag_cmd;
| ^~~~~~~~
drivers/bluetooth/btintel.c:2404:29: warning: unused variable ‘ppag_cmd’ [-Wunused-variable] make[4]: *** [scripts/Makefile.build:243: drivers/bluetooth/btintel.o] Error 1 make[3]: *** [scripts/Makefile.build:477: drivers/bluetooth] Error 2
make[2]: *** [scripts/Makefile.build:477: drivers] Error 2
make[2]: *** Waiting for unfinished jobs....
net/bluetooth/hci_codec.c: note: in included file:
./include/net/bluetooth/hci_core.h:150:35: warning: array of flexible structures net/bluetooth/sco.c: note: in included file:
./include/net/bluetooth/hci_core.h:150:35: warning: array of flexible structures make[1]: *** [/github/workspace/src/src/Makefile:2020: .] Error 2
make: *** [Makefile:234: __sub-make] Error 2
##############################
Test: BuildKernel32 - FAIL
Desc: Build 32bit Kernel for Bluetooth
Output:

drivers/bluetooth/btintel.c: In function ‘btintel_set_ppag’:
drivers/bluetooth/btintel.c:2404:29: error: storage size of ‘ppag_cmd’ isn’t known
2404 | struct hci_ppag_enable_cmd ppag_cmd;
| ^~~~~~~~
drivers/bluetooth/btintel.c:2404:29: warning: unused variable ‘ppag_cmd’ [-Wunused-variable] make[4]: *** [scripts/Makefile.build:243: drivers/bluetooth/btintel.o] Error 1 make[3]: *** [scripts/Makefile.build:477: drivers/bluetooth] Error 2
make[2]: *** [scripts/Makefile.build:477: drivers] Error 2
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [/github/workspace/src/src/Makefile:2020: .] Error 2
make: *** [Makefile:234: __sub-make] Error 2
##############################
Test: IncrementalBuild - FAIL
Desc: Incremental build with the patches in the series
Output:
[v1] Bluetooth: btintel: Send new command for PPAG

drivers/bluetooth/btintel.c: In function ‘btintel_set_ppag’:
drivers/bluetooth/btintel.c:2404:29: error: storage size of ‘ppag_cmd’ isn’t known
2404 | struct hci_ppag_enable_cmd ppag_cmd;
| ^~~~~~~~
drivers/bluetooth/btintel.c:2404:29: warning: unused variable ‘ppag_cmd’ [-Wunused-variable] make[4]: *** [scripts/Makefile.build:243: drivers/bluetooth/btintel.o] Error 1 make[3]: *** [scripts/Makefile.build:477: drivers/bluetooth] Error 2
make[2]: *** [scripts/Makefile.build:477: drivers] Error 2
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [/github/workspace/src/src/Makefile:2020: .] Error 2
make: *** [Makefile:234: __sub-make] Error 2

---
Regards,
Linux Bluetooth

#2 lore raw
In reply to Lokendra Singh
kernel test robot noticed the following build warnings:

Hi Lokendra,

kernel test robot noticed the following build warnings:

[auto build test WARNING on bluetooth-next/master]
[also build test WARNING on bluetooth/master linus/master v6.5-rc5 next-20230809] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Lokendra-Singh/Bluetooth-btintel-Send-new-command-for-PPAG/20230810-185334
base:   https://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next.git master
patch link:    https://lore.kernel.org/r/20230810105502.27012-1-lokendra.singh%40intel.com
patch subject: [PATCH v1] Bluetooth: btintel: Send new command for PPAG
config: x86_64-randconfig-x011-20230810 (https://download.01.org/0day-ci/archive/20230810/[email protected]/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce: (https://download.01.org/0day-ci/archive/20230810/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/

All warnings (new ones prefixed by >>):

drivers/bluetooth/btintel.c: In function 'btintel_set_ppag':
drivers/bluetooth/btintel.c:2404:36: error: storage size of 'ppag_cmd' isn't known

    2404 |         struct hci_ppag_enable_cmd ppag_cmd;
         |                                    ^~~~~~~~
>> drivers/bluetooth/btintel.c:2404:36: warning: unused variable 'ppag_cmd' [-Wunused-variable]

vim +/ppag_cmd +2404 drivers/bluetooth/btintel.c

2399
2400 static void btintel_set_ppag(struct hci_dev *hdev, struct intel_version_tlv *ver)
2401 {
2402 struct btintel_ppag ppag;
2403 struct sk_buff *skb;

> 2404		struct hci_ppag_enable_cmd ppag_cmd;
  2405		acpi_handle handle;
  2406	
  2407		/* PPAG is not supported if CRF is HrP2, Jfp2, JfP1 */
  2408		switch (ver->cnvr_top & 0xFFF) {
  2409		case 0x504:     /* Hrp2 */
  2410		case 0x202:     /* Jfp2 */
  2411		case 0x201:     /* Jfp1 */

2412 bt_dev_warn(hdev, "PPAG not supported for Intel CNVr (0x%3x)",
2413 ver->cnvr_top & 0xFFF);
2414 return;
2415 }
2416
2417 handle = ACPI_HANDLE(GET_HCIDEV_DEV(hdev));
2418 if (!handle) {
2419 bt_dev_info(hdev, "No support for BT device in ACPI firmware");
2420 return;
2421 }
2422
2423 memset(&ppag, 0, sizeof(ppag));
2424
2425 ppag.hdev = hdev;
2426 ppag.status = AE_NOT_FOUND;
2427 acpi_walk_namespace(ACPI_TYPE_PACKAGE, handle, 1, NULL,
2428 btintel_ppag_callback, &ppag, NULL);
2429
2430 if (ACPI_FAILURE(ppag.status)) {
2431 if (ppag.status == AE_NOT_FOUND) {
2432 bt_dev_dbg(hdev, "PPAG-BT: ACPI entry not found");
2433 return;
2434 }
2435 return;
2436 }
2437
2438 if (ppag.domain != 0x12) {
2439 bt_dev_warn(hdev, "PPAG-BT: Bluetooth domain is disabled in ACPI firmware");
2440 return;
2441 }
2442
2443 /* PPAG mode
2444 * BIT 0 : 0 Disabled in EU
2445 * 1 Enabled in EU
2446 * BIT 1 : 0 Disabled in China
2447 * 1 Enabled in China
2448 */
2449 if((ppag.mode & 0x01) != BIT(0) && (ppag.mode & 0x02) != BIT(1)) {
2450 bt_dev_warn(hdev, "PPAG-BT: EU, China mode are disabled in CB/BIOS");
2451 return;
2452 }
2453
2454 /* HCI_Intel_PpagEnable_CMD - opcode: 0xFE0B
2455 * ppag_enable_flags - ppag mode
2456 */
2457 ppag_cmd.ppag_enable_flags = ppag.mode;
2458
2459 skb = __hci_cmd_sync(hdev, 0xfe0b, sizeof(ppag_cmd), &ppag_cmd, HCI_CMD_TIMEOUT);
2460 if (IS_ERR(skb)) {
2461 bt_dev_warn(hdev, "Failed to send PPAG Enable (%ld)", PTR_ERR(skb));
2462 return;
2463 }
2464 bt_dev_info(hdev, "PPAG-BT: Enabled (Mode %d)", ppag.mode);
2465 kfree_skb(skb);
2466 }
2467

Signature · 2 lines
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki