From patchwork Tue Oct 19 12:07:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Hwang X-Patchwork-Id: 12569707 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A9D02C433EF for ; Tue, 19 Oct 2021 12:07:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8AFD160FD8 for ; Tue, 19 Oct 2021 12:07:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235540AbhJSMJh (ORCPT ); Tue, 19 Oct 2021 08:09:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60060 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235431AbhJSMJh (ORCPT ); Tue, 19 Oct 2021 08:09:37 -0400 Received: from mail-pg1-x52d.google.com (mail-pg1-x52d.google.com [IPv6:2607:f8b0:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 80613C061746 for ; Tue, 19 Oct 2021 05:07:24 -0700 (PDT) Received: by mail-pg1-x52d.google.com with SMTP id c4so12092553pgv.11 for ; Tue, 19 Oct 2021 05:07:24 -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=mVmaGFLR4mR+Ps4pLiOUdexGniIqHe1BvZrlKrHaafw=; b=eZ7KME3dVRwV8n9OV2vvqLBIROV+94NVObD5NDO4Lhj7Jv/pqGAU1wPs/oI3IFve9o gUE4M1IcaNHA7xIlqYVnoWxSre4z04Nipz8AI9+onKgcehSrlmJwggrjSD/9IbkGRdjC VwZPy2+IxjiGYW1XvHKXcEkDS8p0v0u3MCBvw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=mVmaGFLR4mR+Ps4pLiOUdexGniIqHe1BvZrlKrHaafw=; b=d2m+TPCm905MVtvLeIlPC5ABtXy6/BP3ZpHWqcDqtjF/feBpD7ITCgtXzf+C0hu8JN X7acRLhUzqsnUM84aFD9KGzxtTCKLhkhjSt33uB5Xj9WtmSuYSAW6jr5uv01HuLdDYbu u+xFLENDprcstIk8tV/ELxIc3MfW+OuFwzRa+Xqu/oI6xYUjUv984fNvXOjage40LAU9 Ke0pbayVpn4AU++p7PB4p0CBL6easeBM58rQgnfkad9O9kads/Gyxpuz0PqFdW1dnXJ7 JiEI7p6Tcnkg8q0UI0YMwtrdPq44kjwDueK12gcL8OyU9c96T8SD0CiN87LJsodEoBl1 J3Tg== X-Gm-Message-State: AOAM532TlSEVI+am+oeYhlnJsU5eK35QCdusol3mWmvHoYcQMlhtc3e6 Me/ZAGHxXxQew2/o/FX3oUoFXfb6RqaPaQ== X-Google-Smtp-Source: ABdhPJxbeLhQNzOykO63gRBryXeRsr3j7bGN9ONO4ZIzhlpFISunCXW/AT4+ox/cL8ZWTwO20/48zQ== X-Received: by 2002:aa7:8b1a:0:b0:44d:37c7:dbb6 with SMTP id f26-20020aa78b1a000000b0044d37c7dbb6mr35215726pfd.11.1634645243631; Tue, 19 Oct 2021 05:07:23 -0700 (PDT) Received: from josephsih-z840.tpe.corp.google.com ([2401:fa00:1:10:1d7c:b745:dee:c8a4]) by smtp.gmail.com with ESMTPSA id k16sm5236160pgt.57.2021.10.19.05.07.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Oct 2021 05:07:22 -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, Joseph Hwang , "David S. Miller" , Jakub Kicinski , Johan Hedberg , linux-kernel@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH v5 1/3] Bluetooth: Add struct of reading AOSP vendor capabilities Date: Tue, 19 Oct 2021 20:07:13 +0800 Message-Id: <20211019200701.v5.1.I139e71adfd3f00b88fe9edb63d013f9cd3e24506@changeid> X-Mailer: git-send-email 2.33.0.1079.g6e70778dc9-goog MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org This patch adds the struct of reading AOSP vendor capabilities. New capabilities are added incrementally. Note that the version_supported octets will be used to determine whether a capability has been defined for the version. Signed-off-by: Joseph Hwang --- Changes in v5: - This is a new patch. - Add struct aosp_rp_le_get_vendor_capabilities so that next patch can determine whether a particular capability is supported or not. net/bluetooth/aosp.c | 45 +++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 42 insertions(+), 3 deletions(-) diff --git a/net/bluetooth/aosp.c b/net/bluetooth/aosp.c index a1b7762335a5..3f0ea57a68de 100644 --- a/net/bluetooth/aosp.c +++ b/net/bluetooth/aosp.c @@ -8,9 +8,32 @@ #include "aosp.h" +#define AOSP_OP_LE_GET_VENDOR_CAPABILITIES 0x153 +struct aosp_rp_le_get_vendor_capabilities { + __u8 status; + __u8 max_advt_instances; + __u8 offloaded_resolution_of_private_address; + __u16 total_scan_results_storage; + __u8 max_irk_list_sz; + __u8 filtering_support; + __u8 max_filter; + __u8 activity_energy_info_support; + __u16 version_supported; + __u16 total_num_of_advt_tracked; + __u8 extended_scan_support; + __u8 debug_logging_supported; + __u8 le_address_generation_offloading_support; + __u32 a2dp_source_offload_capability_mask; + __u8 bluetooth_quality_report_support; + __u32 dynamic_audio_buffer_support; +} __packed; + void aosp_do_open(struct hci_dev *hdev) { struct sk_buff *skb; + struct aosp_rp_le_get_vendor_capabilities *rp; + u16 opcode; + u16 version_supported; if (!hdev->aosp_capable) return; @@ -18,10 +41,26 @@ void aosp_do_open(struct hci_dev *hdev) bt_dev_dbg(hdev, "Initialize AOSP extension"); /* LE Get Vendor Capabilities Command */ - skb = __hci_cmd_sync(hdev, hci_opcode_pack(0x3f, 0x153), 0, NULL, - HCI_CMD_TIMEOUT); - if (IS_ERR(skb)) + opcode = hci_opcode_pack(0x3f, AOSP_OP_LE_GET_VENDOR_CAPABILITIES); + skb = __hci_cmd_sync(hdev, opcode, 0, NULL, HCI_CMD_TIMEOUT); + if (IS_ERR(skb)) { + bt_dev_warn(hdev, "AOSP get vendor capabilities (%ld)", + PTR_ERR(skb)); + return; + } + + bt_dev_info(hdev, "aosp le vendor capabilities length %d", skb->len); + + rp = (struct aosp_rp_le_get_vendor_capabilities *)skb->data; + + if (rp->status) { + bt_dev_err(hdev, "AOSP LE Get Vendor Capabilities status %d", + rp->status); return; + } + + version_supported = le16_to_cpu(rp->version_supported); + bt_dev_info(hdev, "AOSP version 0x%4.4x", version_supported); kfree_skb(skb); } From patchwork Tue Oct 19 12:07:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Hwang X-Patchwork-Id: 12569709 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2DE51C433F5 for ; Tue, 19 Oct 2021 12:07:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 17B3B6113D for ; Tue, 19 Oct 2021 12:07:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235564AbhJSMJk (ORCPT ); Tue, 19 Oct 2021 08:09:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60072 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235546AbhJSMJj (ORCPT ); Tue, 19 Oct 2021 08:09:39 -0400 Received: from mail-pg1-x531.google.com (mail-pg1-x531.google.com [IPv6:2607:f8b0:4864:20::531]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2BF4DC061746 for ; Tue, 19 Oct 2021 05:07:27 -0700 (PDT) Received: by mail-pg1-x531.google.com with SMTP id t184so6155290pgd.8 for ; Tue, 19 Oct 2021 05:07:27 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=P1QGNl0cgWp6Q/NbeZQ6qfaTxP4VB5dnkkqXn90EmY0=; b=Vxl/6Q3yWLYkk4Ha9ewMxHqJoLuh/9D97IyuCcd6lk1Uoj6PzXsGZ2JxWmCrKrJzPP A9NxWi0N5z1535w4yIyKJy0fFCt2Hd5LOufhgvSBp4OpzRgz/jjTkuIMQuvr2rjLiAPG aYgUxjUq7BmvYhaGK4PWP50L4S6NO44tgyhzM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=P1QGNl0cgWp6Q/NbeZQ6qfaTxP4VB5dnkkqXn90EmY0=; b=bjchF6HS1/kozNFH2oF6ECj9o6jIOKuXfy+Vo8cAxWnTG5gN4OGYlEU0mQKJwsuZLg GdtzqmTQeE8jpcezjUm7OQr1XWQUxKbEZoRZRg5K+lS9p6Igef4UjLBEXAk25+AemvcC 4lsAFDuY5TCujBL9EUb4FcJrIeRv73E9QVH8REbO19bv86BRT2IUY6lrXsRZgNLLoFjV iF9ESg6wGilO9ZQn9CIk8aVBpThhjLes9TtOWSjcYzVIOc4+GQw2XvmrLxA3llEs1AlM owmnmDiIzO3g1mlTXf4DpLih+lX5WgVW1x/GNzaJq38k8HFJ+GwInTquIR58MWk/1JCq cL+A== X-Gm-Message-State: AOAM5330L/vevxtezXwx5VFqM2qUjq0A4KXxstj5NkupgpK4WqyS6A3K Tae61cUTg98r2WPqMn6GDOEMXtWy+ulMAw== X-Google-Smtp-Source: ABdhPJzL9l3Yqv0saCu2ioyR3TkiKF1Yn6+8erncYztS/TxBImWZSJdpiW5rxArXr9Y30Uusk1rtOg== X-Received: by 2002:a05:6a00:16d2:b029:300:200b:6572 with SMTP id l18-20020a056a0016d2b0290300200b6572mr34757209pfc.62.1634645246298; Tue, 19 Oct 2021 05:07:26 -0700 (PDT) Received: from josephsih-z840.tpe.corp.google.com ([2401:fa00:1:10:1d7c:b745:dee:c8a4]) by smtp.gmail.com with ESMTPSA id k16sm5236160pgt.57.2021.10.19.05.07.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Oct 2021 05:07:25 -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, Joseph Hwang , Miao-chen Chou , "David S. Miller" , Jakub Kicinski , Johan Hedberg , linux-kernel@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH v5 2/3] Bluetooth: aosp: Support AOSP Bluetooth Quality Report Date: Tue, 19 Oct 2021 20:07:14 +0800 Message-Id: <20211019200701.v5.2.Iaa4a0269e51d8e8d8784a6ac8e05899b49a1377d@changeid> X-Mailer: git-send-email 2.33.0.1079.g6e70778dc9-goog In-Reply-To: <20211019200701.v5.1.I139e71adfd3f00b88fe9edb63d013f9cd3e24506@changeid> References: <20211019200701.v5.1.I139e71adfd3f00b88fe9edb63d013f9cd3e24506@changeid> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org This patch adds the support of the AOSP Bluetooth Quality Report (BQR) events. Multiple vendors have supported the AOSP Bluetooth Quality Report. When a Bluetooth controller supports the capability, it can enable the aosp capability through hci_set_aosp_capable. Then hci_core will set up the hdev->aosp_set_quality_report callback through aosp_do_open if the controller responds to support the quality report capability. Note that Intel also supports a distinct telemetry quality report specification. Intel sets up the hdev->set_quality_report callback in the btusb driver module. Reviewed-by: Miao-chen Chou Signed-off-by: Joseph Hwang --- Changes in v5: - Fix the patch per [RFC PATCH] Bluetooth: Add framework for AOSP quality report setting - Declare aosp_set_quality_report. - Use aosp_do_open() to set hdev->aosp_set_quality_report. - Add aosp_has_quality_report(). - In mgmt, use hdev->aosp_set_quality_report and hdev->set_quality_report separately. Changes in v4: - Move the AOSP BQR support from the driver level to net/bluetooth/aosp. - Fix the drivers to use hci_set_aosp_capable to enable aosp. - Add Mediatek to support the capability too. Changes in v3: - Fix the auto build test ERROR "undefined symbol: btandroid_set_quality_report" that occurred with some kernel configs. - Note that the mgmt-tester "Read Exp Feature - Success" failed. But on my test device, the same test passed. Please kindly let me know what may be going wrong. These patches do not actually modify read/set experimental features. - As to CheckPatch failed. No need to modify the MAINTAINERS file. Thanks. Changes in v2: - Fix the titles of patches 2/3 and 3/3 and reduce their lengths. include/net/bluetooth/hci_core.h | 1 + net/bluetooth/aosp.c | 97 ++++++++++++++++++++++++++++++++ net/bluetooth/aosp.h | 13 +++++ net/bluetooth/mgmt.c | 18 ++++-- 4 files changed, 124 insertions(+), 5 deletions(-) diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index dd8840e70e25..32b3774227f2 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h @@ -603,6 +603,7 @@ struct hci_dev { #if IS_ENABLED(CONFIG_BT_AOSPEXT) bool aosp_capable; + bool aosp_quality_report; #endif int (*open)(struct hci_dev *hdev); diff --git a/net/bluetooth/aosp.c b/net/bluetooth/aosp.c index 3f0ea57a68de..0d4497656feb 100644 --- a/net/bluetooth/aosp.c +++ b/net/bluetooth/aosp.c @@ -62,6 +62,16 @@ void aosp_do_open(struct hci_dev *hdev) version_supported = le16_to_cpu(rp->version_supported); bt_dev_info(hdev, "AOSP version 0x%4.4x", version_supported); + /* The bluetooth_quality_report_support is defined at version 0x0062. + * Refer to https://cs.android.com/android/platform/superproject/+/ + * master:system/bt/gd/hci/controller.cc;l=477 + */ + if (version_supported >= 0x0062 && + rp->bluetooth_quality_report_support) { + hdev->aosp_quality_report = true; + bt_dev_info(hdev, "bluetooth quality report is supported"); + } + kfree_skb(skb); } @@ -72,3 +82,90 @@ void aosp_do_close(struct hci_dev *hdev) bt_dev_dbg(hdev, "Cleanup of AOSP extension"); } + +/* BQR command */ +#define BQR_OPCODE hci_opcode_pack(0x3f, 0x015e) + +/* BQR report action */ +#define REPORT_ACTION_ADD 0x00 +#define REPORT_ACTION_DELETE 0x01 +#define REPORT_ACTION_CLEAR 0x02 + +/* BQR event masks */ +#define QUALITY_MONITORING BIT(0) +#define APPRAOCHING_LSTO BIT(1) +#define A2DP_AUDIO_CHOPPY BIT(2) +#define SCO_VOICE_CHOPPY BIT(3) + +#define DEFAULT_BQR_EVENT_MASK (QUALITY_MONITORING | APPRAOCHING_LSTO | \ + A2DP_AUDIO_CHOPPY | SCO_VOICE_CHOPPY) + +/* Reporting at milliseconds so as not to stress the controller too much. + * Range: 0 ~ 65535 ms + */ +#define DEFALUT_REPORT_INTERVAL_MS 5000 + +struct aosp_bqr_cp { + __u8 report_action; + __u32 event_mask; + __u16 min_report_interval; +} __packed; + +static int enable_quality_report(struct hci_dev *hdev) +{ + struct sk_buff *skb; + struct aosp_bqr_cp cp; + + cp.report_action = REPORT_ACTION_ADD; + cp.event_mask = DEFAULT_BQR_EVENT_MASK; + cp.min_report_interval = DEFALUT_REPORT_INTERVAL_MS; + + skb = __hci_cmd_sync(hdev, BQR_OPCODE, sizeof(cp), &cp, + HCI_CMD_TIMEOUT); + if (IS_ERR(skb)) { + bt_dev_err(hdev, "Enabling Android BQR failed (%ld)", + PTR_ERR(skb)); + return PTR_ERR(skb); + } + + kfree_skb(skb); + return 0; +} + +static int disable_quality_report(struct hci_dev *hdev) +{ + struct sk_buff *skb; + struct aosp_bqr_cp cp = { 0 }; + + cp.report_action = REPORT_ACTION_CLEAR; + + skb = __hci_cmd_sync(hdev, BQR_OPCODE, sizeof(cp), &cp, + HCI_CMD_TIMEOUT); + if (IS_ERR(skb)) { + bt_dev_err(hdev, "Disabling Android BQR failed (%ld)", + PTR_ERR(skb)); + return PTR_ERR(skb); + } + + kfree_skb(skb); + return 0; +} + +bool aosp_has_quality_report(struct hci_dev *hdev) +{ + return hdev->aosp_quality_report; +} + +int aosp_set_quality_report(struct hci_dev *hdev, bool enable) +{ + if (!aosp_has_quality_report(hdev)) + return -EOPNOTSUPP; + + bt_dev_dbg(hdev, "quality report enable %d", enable); + + /* Enable or disable the quality report feature. */ + if (enable) + return enable_quality_report(hdev); + else + return disable_quality_report(hdev); +} diff --git a/net/bluetooth/aosp.h b/net/bluetooth/aosp.h index 328fc6d39f70..2fd8886d51b2 100644 --- a/net/bluetooth/aosp.h +++ b/net/bluetooth/aosp.h @@ -8,9 +8,22 @@ void aosp_do_open(struct hci_dev *hdev); void aosp_do_close(struct hci_dev *hdev); +bool aosp_has_quality_report(struct hci_dev *hdev); +int aosp_set_quality_report(struct hci_dev *hdev, bool enable); + #else static inline void aosp_do_open(struct hci_dev *hdev) {} static inline void aosp_do_close(struct hci_dev *hdev) {} +static inline bool aosp_has_quality_report(struct hci_dev *hdev) +{ + return false; +} + +static inline int aosp_set_quality_report(struct hci_dev *hdev, bool enable) +{ + return -EOPNOTSUPP; +} + #endif diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index 44683443300c..d6c322763567 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c @@ -39,6 +39,7 @@ #include "mgmt_config.h" #include "msft.h" #include "eir.h" +#include "aosp.h" #define MGMT_VERSION 1 #define MGMT_REVISION 21 @@ -3863,7 +3864,8 @@ static int read_exp_features_info(struct sock *sk, struct hci_dev *hdev, idx++; } - if (hdev && hdev->set_quality_report) { + if (hdev && (aosp_has_quality_report(hdev) || + hdev->set_quality_report)) { if (hci_dev_test_flag(hdev, HCI_QUALITY_REPORT)) flags = BIT(0); else @@ -4127,7 +4129,8 @@ static int set_quality_report_func(struct sock *sk, struct hci_dev *hdev, val = !!cp->param[0]; changed = (val != hci_dev_test_flag(hdev, HCI_QUALITY_REPORT)); - if (!hdev->set_quality_report) { + if (!aosp_has_quality_report(hdev) && !hdev->set_quality_report) { + BT_INFO("quality report not supported"); err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_EXP_FEATURE, MGMT_STATUS_NOT_SUPPORTED); @@ -4135,13 +4138,18 @@ static int set_quality_report_func(struct sock *sk, struct hci_dev *hdev, } if (changed) { - err = hdev->set_quality_report(hdev, val); + if (hdev->set_quality_report) + err = hdev->set_quality_report(hdev, val); + else + err = aosp_set_quality_report(hdev, val); + if (err) { err = mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_EXP_FEATURE, MGMT_STATUS_FAILED); goto unlock_quality_report; } + if (val) hci_dev_set_flag(hdev, HCI_QUALITY_REPORT); else @@ -4153,8 +4161,8 @@ static int set_quality_report_func(struct sock *sk, struct hci_dev *hdev, memcpy(rp.uuid, quality_report_uuid, 16); rp.flags = cpu_to_le32(val ? BIT(0) : 0); hci_sock_set_flag(sk, HCI_MGMT_EXP_FEATURE_EVENTS); - err = mgmt_cmd_complete(sk, hdev->id, - MGMT_OP_SET_EXP_FEATURE, 0, + + err = mgmt_cmd_complete(sk, hdev->id, MGMT_OP_SET_EXP_FEATURE, 0, &rp, sizeof(rp)); if (changed) From patchwork Tue Oct 19 12:07:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Hwang X-Patchwork-Id: 12569711 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D3762C433F5 for ; Tue, 19 Oct 2021 12:07:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B5740610A3 for ; Tue, 19 Oct 2021 12:07:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235573AbhJSMJn (ORCPT ); Tue, 19 Oct 2021 08:09:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60090 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235566AbhJSMJm (ORCPT ); Tue, 19 Oct 2021 08:09:42 -0400 Received: from mail-pj1-x1034.google.com (mail-pj1-x1034.google.com [IPv6:2607:f8b0:4864:20::1034]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C9AB1C061745 for ; Tue, 19 Oct 2021 05:07:29 -0700 (PDT) Received: by mail-pj1-x1034.google.com with SMTP id q10-20020a17090a1b0a00b001a076a59640so1838778pjq.0 for ; Tue, 19 Oct 2021 05:07:29 -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:in-reply-to:references :mime-version:content-transfer-encoding; bh=FVIQT82jcRb7GPMNtR+z9+ttpCLcsjQyVlSrcNJwXOo=; b=EX+vS61JMITPqLH96+nqUjYjcawuaPHoSesPYtZl1n7rBxiwMf2CPx/+7ad2X7WcuS kW8kp5lC6ebvYfNylNrL0KzX3tR0lDDDStyiQC9S9qO7CvZAiy/XJN0LaaebFnT+n3Ns E1+rykixHr7OAAQVvKS7e6ZQi53IZ5JY05XqM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=FVIQT82jcRb7GPMNtR+z9+ttpCLcsjQyVlSrcNJwXOo=; b=pG1IpTZEGAFiR42R2qRq5k8AEad/2dMo2JBrU7k4XRBBR9qNAPxFD6cd+EBzqjgnaJ B4nhcT4skGspnoZjUBdhuDot82EEOHWwtQrWli7aGSEzVxIgVpL/0rpP8HU/6eI2JyUl v514ClHD8JkpYymiAomBFkJq1gqjhzNfwiWsdqlmpFombNHbI8ZR3flP9i4qTg8964qN mgaxncemPqZORulhMdJXDW0mdSBjN8YBc9dIhjAkJ+yNAZ/o1gKJI/Jfl2l9xuhWj4va vWxwbp68PfVYQ6y/dINwWZDG/Y3L7GGhhqXEzWlukJGHprwxqXO7zGxdG072Utab+Cx+ mwVA== X-Gm-Message-State: AOAM532oqk62M1/mbaqfRazuDr5vkG99M0EDhG70NadGjLNfAO6sJbSz IWyL8oComLE7cy6Bw8vVO25YXPeRwP8LMw== X-Google-Smtp-Source: ABdhPJzjbEBfYj1NJaCL6KZizsoAX8NL57PBxlOdEyuR5fwk5opRhttrYLoodMKKcptVYabTjzO6Tw== X-Received: by 2002:a17:90b:4f90:: with SMTP id qe16mr6333304pjb.137.1634645249158; Tue, 19 Oct 2021 05:07:29 -0700 (PDT) Received: from josephsih-z840.tpe.corp.google.com ([2401:fa00:1:10:1d7c:b745:dee:c8a4]) by smtp.gmail.com with ESMTPSA id k16sm5236160pgt.57.2021.10.19.05.07.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Oct 2021 05:07:28 -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, Joseph Hwang , Miao-chen Chou , Mark-YW Chen , Johan Hedberg , Matthias Brugger , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: [PATCH v5 3/3] Bluetooth: btusb: enable Mediatek to support AOSP extension Date: Tue, 19 Oct 2021 20:07:15 +0800 Message-Id: <20211019200701.v5.3.I257ac5cfaf955d15670479efc311bbab702397f4@changeid> X-Mailer: git-send-email 2.33.0.1079.g6e70778dc9-goog In-Reply-To: <20211019200701.v5.1.I139e71adfd3f00b88fe9edb63d013f9cd3e24506@changeid> References: <20211019200701.v5.1.I139e71adfd3f00b88fe9edb63d013f9cd3e24506@changeid> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org This patch enables Mediatek to support the AOSP extension. Reviewed-by: Miao-chen Chou Reviewed-by: Mark-YW Chen Signed-off-by: Joseph Hwang --- Changes in v5: - Let the vendor command in aosp_do_open() to determine what capabilities are supported. Changes in v4: - Call hci_set_aosp_capable in the driver. - This patch is added in this Series-changes 4. drivers/bluetooth/btusb.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index 87b71740fad8..30c63031592d 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c @@ -3876,6 +3876,7 @@ static int btusb_probe(struct usb_interface *intf, hdev->set_bdaddr = btusb_set_bdaddr_mtk; set_bit(HCI_QUIRK_NON_PERSISTENT_SETUP, &hdev->quirks); data->recv_acl = btusb_recv_acl_mtk; + hci_set_aosp_capable(hdev); } if (id->driver_info & BTUSB_SWAVE) {