Received: by 2002:a05:6358:51dd:b0:131:369:b2a3 with SMTP id 29csp1237079rwl; Thu, 10 Aug 2023 08:18:14 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFpdWrrJxUTAPM/LLzXVNn0+E3yK1Y73ZWsU2qSK0TA++7kYW/nlnNtmrYbh6kjdJ9uxqb0 X-Received: by 2002:a17:902:b415:b0:1b8:9b74:636b with SMTP id x21-20020a170902b41500b001b89b74636bmr2005401plr.68.1691680693923; Thu, 10 Aug 2023 08:18:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691680693; cv=none; d=google.com; s=arc-20160816; b=nPX27Mf9h+Gd+NpOz2mNej12F1NRIKOtPkd9J0hiw4Azs9DCTzfaMY5MPwCfdM/HlG 4PAuySaXlIo3QbHTLwsKbbX0x9n7KzwnLa4GXzFfGH+LvQLS4j8SEp0G9tHr7A9KYzEe CexuTF8uK89s66hVb/g06wnmPE/c/OLddzmckBWDeu1cey4iP3knDNleHwJyWW99UN3u 9H2h3T7MmmOOLCWkriEat7ehyyDLtCFCrU2XwgX4DuziTASn3DhXSpZ3Y4Z8I8qutwRt 8u5Kegs0rjvfBu0R6tA7PhehEJskDrG9QeuwusOPC+LVMrk/BBELrlx/dKw3vdpeZZD+ sM9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=8NRs67bl1S+kO1yVUDBi7DStWbHFcnFLtc2Jn7CZUHY=; fh=SX//rBOczLUFr5ecuFWLu56FMkAdBMflGrUUqBboyrY=; b=VH5UvuxYNJ1QsCbeUIgVTSTy+p0vdo+9KRzG4OnjhR/9h7IPx3w8ielqmh4D3X8T9H CPnUCydzhkHSAMXuit48bZqy7nO6baPgEYWL8QqhoCFGjIa8sAVfBKle0PZQ4aOPwZvg +dGEo3JNmZ22ySCuDcWu9I804U0F161XR8LVzzD9OWkdDYSt4xks5DKMWHMU1CTO/r92 y9gTF4YYK0s+Vwn1le+IbvpktlnxZzniCpP569d7znEG9iw9HVDRoaBowoH871wpun+1 Y0fSntGIsdmc0xr//UBP21ME4Js+zpVM+Xu1yr8OeE4Fkt5jaykz64ay0mo9mSgApZaz 5Gjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=BQFMYK7p; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w6-20020a170902e88600b001bc3948d598si1662720plg.448.2023.08.10.08.17.58; Thu, 10 Aug 2023 08:18:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=BQFMYK7p; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234425AbjHJOx0 (ORCPT + 99 others); Thu, 10 Aug 2023 10:53:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232030AbjHJOxZ (ORCPT ); Thu, 10 Aug 2023 10:53:25 -0400 Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.115]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 57B5A26A0 for ; Thu, 10 Aug 2023 07:53:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1691679205; x=1723215205; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=45X/ZfiDWS2puw40oOVVOOkMvVBayKSkp2hmndMyr6Q=; b=BQFMYK7p2VKTp+woAg/hpfR6ISt1l0P5lXbCGSYPwtWcsODZLfSQ/wks ok0qZCRU+DpNHPatZIQ6XG1DQhuODdlDm+hkFu1fElSbiOd8F3Mjp9HtN v6Zabo/F7u4UdrtbmtK7zOxCsD9mjPRBjfUSXfkzJIJfZoYT/PsUdmhhe fvMTOTm+T+M90iWK3bwaTkuhIp6AlDsbbXjC6NqzlkKshcB+8GHKuFDC4 ymBf4heY2F6RuedfZgbANpOARlAmDcRBQEg0Kgr24H0xn6f1VOxu6Bmja SnOCD80UqL2yeTysQFcEVWe8TgILzB2xqRsUSjxwE6ROdLQZm/zjCSvto A==; X-IronPort-AV: E=McAfee;i="6600,9927,10798"; a="371435175" X-IronPort-AV: E=Sophos;i="6.01,162,1684825200"; d="scan'208";a="371435175" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Aug 2023 07:53:25 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10798"; a="682148503" X-IronPort-AV: E=Sophos;i="6.01,162,1684825200"; d="scan'208";a="682148503" Received: from castle-black.iind.intel.com ([10.66.185.63]) by orsmga003.jf.intel.com with ESMTP; 10 Aug 2023 07:53:21 -0700 From: Lokendra Singh To: linux-bluetooth@vger.kernel.org Cc: ravishankar.srivatsa@intel.com, chethan.tumkur.narayan@intel.com, luiz.von.dentz@intel.com, tedd.an@intel.com, kiran.k@intel.com, Lokendra Singh , Seema Sreemantha Subject: [PATCH v2] Bluetooth: btintel: Send new command for PPAG Date: Thu, 10 Aug 2023 20:26:55 +0530 Message-Id: <20230810145653.1780-1-lokendra.singh@intel.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org 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 > HCI Event: Command Complete (0x0e) plen 4 Intel PPAG Enable (0x3f|0x020b) ncmd 1 Status: Success (0x00) Signed-off-by: Seema Sreemantha Signed-off-by: Lokendra Singh --- drivers/bluetooth/btintel.c | 28 +++++++++++++++++++--------- drivers/bluetooth/btintel.h | 8 +++----- 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/drivers/bluetooth/btintel.c b/drivers/bluetooth/btintel.c index 633e8d9bf58f..d2c93b88c527 100644 --- a/drivers/bluetooth/btintel.c +++ b/drivers/bluetooth/btintel.c @@ -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); } diff --git a/drivers/bluetooth/btintel.h b/drivers/bluetooth/btintel.h index 2ed646609dee..01e87f68fab0 100644 --- a/drivers/bluetooth/btintel.h +++ b/drivers/bluetooth/btintel.h @@ -137,11 +137,9 @@ struct intel_offload_use_cases { __u8 preset[8]; } __packed; -struct btintel_loc_aware_reg { - __le32 mcc; - __le32 sel; - __le32 delta; -} __packed; +struct hci_ppag_enable_cmd { + u32 ppag_enable_flags; +}; #define INTEL_TLV_TYPE_ID 0x01 -- 2.25.1