Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2491661pxb; Tue, 13 Apr 2021 03:19:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwfDa5QJ6MW89T4hz/hJ9J3aXASFvxp/Uaje7FIptCQg4+vanVpfDXSwcU/IIv7B5ryOrJv X-Received: by 2002:a17:906:f759:: with SMTP id jp25mr7028524ejb.228.1618309175614; Tue, 13 Apr 2021 03:19:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618309175; cv=none; d=google.com; s=arc-20160816; b=emjHzndXVgcPfk8Qirc4a0JC4ifqoXnsTL0vpCx/9T2aUIaOmPG7dLU++jMklnHYBM eZaIEIceeXUCgwzJt82Z3ib96T4sFT4cMaNcF9B2fBEz0k06DWV3w5bhdpOlQ0jP5Zg+ i2ku2n1HGCC8HqVkWFzge5A4NBESDDN3yXdSnbRFrMkpMqu2hmoeIUfm/qgOTKu8zQDS O+4UEt47bVB6MqieEyuBPpQzMd3VVMbCe0TY9NEYVhEpj1ymtcboV4iwkKPDDyl++vtn O1Cl9tomSbpYIBGvzms2+z4OSKig7wzNz0+0te1sBfVu27XZVrM0Xfadtdo4cFNTLjTd y+aQ== 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=scmFeOLatlsWwx9zvIynOi2Aa6pfPzDACmBGZYlRZL4=; b=dRCx0aS+VZrE3gW648G4Yga2y65qRCtaPk332OdqDHl9GBB+B2apCdmt5eLjqZsnFG SJEiJmB4CCqjR5tESzG4+OGbKrFtir2aECnat1fgobJrZNyrXXWb+HW4XdE88lQkOM7m QB4gFY/WiCogZ2aWMmueuy/r18gt4HOGGMK1PKl/umscpkgG3HRt7yapo3P3JWK6bscI LpYkIjNkNVb/6TkmevdAkhUy/oSsRCkrRNWCPszHQLCrFLIeHAG0ySgpmiVvF1px72Lk WvAvMBQcgeeUn27cahf4fTlsfBJUxlJfI6VzeZs4SJwn6XHY4Mn1ILgYEpvsDN5ih7NU Zbww== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=ki82215k; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q11si9942403edd.16.2021.04.13.03.19.12; Tue, 13 Apr 2021 03:19:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=ki82215k; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231430AbhDMKSj (ORCPT + 99 others); Tue, 13 Apr 2021 06:18:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60170 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229600AbhDMKSi (ORCPT ); Tue, 13 Apr 2021 06:18:38 -0400 Received: from mail-pg1-x532.google.com (mail-pg1-x532.google.com [IPv6:2607:f8b0:4864:20::532]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3914BC061574 for ; Tue, 13 Apr 2021 03:18:19 -0700 (PDT) Received: by mail-pg1-x532.google.com with SMTP id f29so11585188pgm.8 for ; Tue, 13 Apr 2021 03:18:19 -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=scmFeOLatlsWwx9zvIynOi2Aa6pfPzDACmBGZYlRZL4=; b=ki82215krFdoHyRahX0DdBtc4C55v2rcpJJntwPfChuG4jxCjv8O/edPohu3wpzFYT WZJEwlcea4+7HLygymwxD5ulJJiPPWz1t18z1qCRkGfogTZxEBsnpxA5ht+k9nRMf/+F SYN4x/nBU9xGoQKitlqvCuxZdr15U8y9cHDY8= 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=scmFeOLatlsWwx9zvIynOi2Aa6pfPzDACmBGZYlRZL4=; b=tZH+Iw7cxelyRZxtj2m8EfGKFDJgMKjO2K02Ma8oWlH+6W354njHh2spOYVfwKr6iJ PAmiGq3QtGpWPqNp7Um8enQAjapu5J/3topIC28vYYieIZvqCrwZLB+7JMB6PQAg1S7+ 7YkV62n+cv/UYvTSXoCC+yuSb9WALNwE+Gu2HLWyxuDR4kivMWVvd/0MX3LloUY6Pf12 mboB861M/6Us+tCsU5adROyMCIf+RLxYOcviZUnmSjOWosjUO9g3uQbzWGYxP0fzJqqS FFdA0QMlgWUzj1VkVge2Rxj99x+e5Ygkpv1oeEDBzMF/2X05LNhGVXu6Tu8GwEQtZFRg sfvQ== X-Gm-Message-State: AOAM533hzM1mBtVqCKDboIEHYKWFiE3GCkg0OAdQh7tQKwqX2y9PXHMQ Cd434ag9atd7TuZS2Qln1BC2GQ== X-Received: by 2002:aa7:86c8:0:b029:249:3950:afff with SMTP id h8-20020aa786c80000b02902493950afffmr15295728pfo.79.1618309098802; Tue, 13 Apr 2021 03:18:18 -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 v11sm14020976pgg.68.2021.04.13.03.18.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Apr 2021 03:18:17 -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 v3 1/2] Bluetooth: btusb: support link statistics telemetry events Date: Tue, 13 Apr 2021 18:18:11 +0800 Message-Id: <20210413101812.323079-1-josephsih@chromium.org> X-Mailer: git-send-email 2.31.1.295.g9ea45b61b8-goog MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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 v3: - fix the long line in the commit message Changes in v2: - take care of intel_newgen as well as intel_new - fix the long lines in mgmt.c 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) -- 2.31.1.295.g9ea45b61b8-goog