From patchwork Tue Apr 13 07:45:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Hwang X-Patchwork-Id: 421183 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CDB77C433B4 for ; Tue, 13 Apr 2021 07:45:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9F3DC613B1 for ; Tue, 13 Apr 2021 07:45:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239895AbhDMHqG (ORCPT ); Tue, 13 Apr 2021 03:46:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54912 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238194AbhDMHqC (ORCPT ); Tue, 13 Apr 2021 03:46:02 -0400 Received: from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com [IPv6:2607:f8b0:4864:20::1033]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0BD6BC061756 for ; Tue, 13 Apr 2021 00:45:42 -0700 (PDT) Received: by mail-pj1-x1033.google.com with SMTP id r13so4244233pjf.2 for ; Tue, 13 Apr 2021 00:45:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=BIsFlcxBEjrAiws3WPWoHPSSG5tDzZbLZDssyc8WUio=; b=lS8pjGmIkKaQsmlZ2W4hxjDZ7mN5vgbOyfnAkby8Ppaue95//xVilrdxJVESwIXhy5 4Wf4FhR+I+qrJJiOjP5cSbXn/vbrGj/XoSmpTGrEJ7AOp1pJZRwNwqvElii2ISxV4kcj qkvxlwFAoQQ6k7NAvCwRX1rnybn1IQRmsGXOw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=BIsFlcxBEjrAiws3WPWoHPSSG5tDzZbLZDssyc8WUio=; b=T28GzeyWP6hqitHvP5nt4/M4+fFqxueRKLS3X8aJtBCVDOkNSfukmkh5VuAKrPoizC l8vtbtho6ZrkOnpSSVcpwi+wCpJaY6xdCwZe6if3X6DzClkWLb+azpJu3X9qM78Dq5Q3 uGo4dtRbXsKN9oXcRM5apn+3pewly/iC/oMugDXbCPydS5nDTS3hHNx9IhYHB8B6mgBX xZPCpwFV39WIOdFP01jSp3EKF/k/ZxKcfg86Ccs3Uhvmu3/PjmT8anT2bQg+0/wd5QGs YYWGr8MDWfMFxYZlPzhbfuIfTmirWrqqqiZlA40cQAAC9zpc1956DPRnOEpjbgy2EWVq PcaA== X-Gm-Message-State: AOAM530jRHYh6VtXWzC2CWAp+mZc4mdQa9MPmbQ+Ul19vcwBDXv+0BkC SfkNcfVVm0xvL+w04lzu66kT/wt8NwQaGQ== X-Google-Smtp-Source: ABdhPJzS/dKShWMV/NaGsPiYHLqZYeORdK7Rha1Ax9t6NNJQ+9WARF7kFx/fWXdGUxYd73ltELGMhw== X-Received: by 2002:a17:90a:c781:: with SMTP id gn1mr3520922pjb.205.1618299941280; Tue, 13 Apr 2021 00:45:41 -0700 (PDT) Received: from josephsih-z840.tpe.corp.google.com ([2401:fa00:1:b:99d4:3dd9:e3a7:45cf]) by smtp.gmail.com with ESMTPSA id c2sm11566360pfo.53.2021.04.13.00.45.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Apr 2021 00:45:40 -0700 (PDT) From: Joseph Hwang To: linux-bluetooth@vger.kernel.org, marcel@holtmann.org, luiz.dentz@gmail.com, pali@kernel.org Cc: josephsih@google.com, chromeos-bluetooth-upstreaming@chromium.org, Chethan T N , Miao-chen Chou , Kiran K , Joseph Hwang , Johan Hedberg , linux-kernel@vger.kernel.org Subject: [PATCH v2 1/2] Bluetooth: btusb: support link statistics telemetry events Date: Tue, 13 Apr 2021 15:45:20 +0800 Message-Id: <20210413074521.264802-1-josephsih@chromium.org> X-Mailer: git-send-email 2.31.1.295.g9ea45b61b8-goog MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Chethan T N This patch supports the link statistics telemetry events for Intel controllers To avoid the overhead, this debug feature is disabled by default. Reviewed-by: Miao-chen Chou Signed-off-by: Chethan T N Signed-off-by: Kiran K Signed-off-by: Joseph Hwang --- Changes in v2: - take care of intel_newgen as well as intel_new - fix the long-line issue drivers/bluetooth/btintel.c | 20 +++++++++++++++++++- drivers/bluetooth/btusb.c | 18 ------------------ 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/drivers/bluetooth/btintel.c b/drivers/bluetooth/btintel.c index e44b6993cf91..de1dbdc01e5a 100644 --- a/drivers/bluetooth/btintel.c +++ b/drivers/bluetooth/btintel.c @@ -1248,8 +1248,10 @@ EXPORT_SYMBOL_GPL(btintel_read_debug_features); int btintel_set_debug_features(struct hci_dev *hdev, const struct intel_debug_features *features) { - u8 mask[11] = { 0x0a, 0x92, 0x02, 0x07, 0x00, 0x00, 0x00, 0x00, + u8 mask[11] = { 0x0a, 0x92, 0x02, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + u8 period[5] = { 0x04, 0x91, 0x02, 0x01, 0x00 }; + u8 trace_enable = 0x02; struct sk_buff *skb; if (!features) @@ -1266,8 +1268,24 @@ int btintel_set_debug_features(struct hci_dev *hdev, PTR_ERR(skb)); return PTR_ERR(skb); } + kfree_skb(skb); + + skb = __hci_cmd_sync(hdev, 0xfc8b, 5, period, HCI_INIT_TIMEOUT); + if (IS_ERR(skb)) { + bt_dev_err(hdev, "Setting periodicity for link statistics traces failed (%ld)", + PTR_ERR(skb)); + return PTR_ERR(skb); + } + kfree_skb(skb); + skb = __hci_cmd_sync(hdev, 0xfca1, 1, &trace_enable, HCI_INIT_TIMEOUT); + if (IS_ERR(skb)) { + bt_dev_err(hdev, "Enable tracing of link statistics events failed (%ld)", + PTR_ERR(skb)); + return PTR_ERR(skb); + } kfree_skb(skb); + return 0; } EXPORT_SYMBOL_GPL(btintel_set_debug_features); diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index 192cb8c191bc..f29946f15f59 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c @@ -2811,7 +2811,6 @@ static int btusb_setup_intel_new(struct hci_dev *hdev) u32 boot_param; char ddcname[64]; int err; - struct intel_debug_features features; BT_DBG("%s", hdev->name); @@ -2865,14 +2864,6 @@ static int btusb_setup_intel_new(struct hci_dev *hdev) btintel_load_ddc_config(hdev, ddcname); } - /* Read the Intel supported features and if new exception formats - * supported, need to load the additional DDC config to enable. - */ - btintel_read_debug_features(hdev, &features); - - /* Set DDC mask for available debug features */ - btintel_set_debug_features(hdev, &features); - /* Read the Intel version information after loading the FW */ err = btintel_read_version(hdev, &ver); if (err) @@ -2911,7 +2902,6 @@ static int btusb_setup_intel_newgen(struct hci_dev *hdev) u32 boot_param; char ddcname[64]; int err; - struct intel_debug_features features; struct intel_version_tlv version; bt_dev_dbg(hdev, ""); @@ -2961,14 +2951,6 @@ static int btusb_setup_intel_newgen(struct hci_dev *hdev) */ btintel_load_ddc_config(hdev, ddcname); - /* Read the Intel supported features and if new exception formats - * supported, need to load the additional DDC config to enable. - */ - btintel_read_debug_features(hdev, &features); - - /* Set DDC mask for available debug features */ - btintel_set_debug_features(hdev, &features); - /* Read the Intel version information after loading the FW */ err = btintel_read_version_tlv(hdev, &version); if (err)