From patchwork Sun Sep 26 07:07:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Hwang X-Patchwork-Id: 12517967 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 E3FEDC433EF for ; Sun, 26 Sep 2021 07:08:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A84A461100 for ; Sun, 26 Sep 2021 07:08:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231159AbhIZHJe (ORCPT ); Sun, 26 Sep 2021 03:09:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37242 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230507AbhIZHJd (ORCPT ); Sun, 26 Sep 2021 03:09:33 -0400 Received: from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EF17AC061604 for ; Sun, 26 Sep 2021 00:07:57 -0700 (PDT) Received: by mail-pj1-x102e.google.com with SMTP id k23so10076583pji.0 for ; Sun, 26 Sep 2021 00:07:57 -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=8+qybuPdV2p2L2842TlhuzKJnVmEI/QhcRxK1YwGgr0=; b=GFsz4uvGy4omybAXn7UDVf5OuFNKnNJNsIKtYxjEWCXoefNzK4WyncyuoNcFNIvCFt NFMoYPmQNmoik12Ii/HWei+xL2VWHYXH/Ov64/vGpiVxsX84pd1tCyzndVGt0BqIjmiT WoVKJIDrTB400NpM3r7cSr+BMeFXC+EXFMuGo= 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=8+qybuPdV2p2L2842TlhuzKJnVmEI/QhcRxK1YwGgr0=; b=aDbIJigxHbkbv87n0u+LCFjKE6Rn8FSD9/8OG3WCERrLln2VJp+EFaqJNjo1Ebs5gO A8IEFajhoI42BbyrK5awh8KfZHZnm5x03u87XwbmzIFCCJGF8HSNbnciYXnVshdSmmB7 ZHZK2inp6d6K/JEdgL9t+/iDB1nZpw7VvEK5AS3PR5Y6fQLlDypC4vw3usQRlMbS6Gc/ 6lZN1ZAMqihuP2Ib7KmcQXT6OIo5i6zLrrQgHgwr3VSkqwx22RJcfEnti7CyYiYWKVhQ 8L7NC2cYdkky6MW/wCu18Xy2Q8wGe+D9EGqHR3D1neJeyd5/Cm4dsq67zfyV0w+fPAmS sVqA== X-Gm-Message-State: AOAM530km7OwFXSopia9YPfftxZ+IFQ233VVI7jO64TtdVeTwbNN9REu phDvH/fNGghD522kVebycDVetaIU1HgOkQ== X-Google-Smtp-Source: ABdhPJwrTP1ZkgDkGbuIUCYoTLj739Wm0GTfFfMOhXs/g1J285zxL6OLTcSd88aulYpYMb1ikVkFmQ== X-Received: by 2002:a17:90a:cb88:: with SMTP id a8mr846837pju.230.1632640077115; Sun, 26 Sep 2021 00:07:57 -0700 (PDT) Received: from josephsih-z840.tpe.corp.google.com ([2401:fa00:1:10:8152:3867:7050:3260]) by smtp.gmail.com with ESMTPSA id o17sm13796174pfp.126.2021.09.26.00.07.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Sep 2021 00:07:56 -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 v4 1/4] Bluetooth: aosp: Support AOSP Bluetooth Quality Report Date: Sun, 26 Sep 2021 15:07:46 +0800 Message-Id: <20210926150657.v4.1.Iaa4a0269e51d8e8d8784a6ac8e05899b49a1377d@changeid> X-Mailer: git-send-email 2.33.0.685.g46640cef36-goog 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 capability through hci_set_aosp_capable. Then hci_core will set up the hdev->set_quality_report callback accordingly. 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 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. net/bluetooth/aosp.c | 79 ++++++++++++++++++++++++++++++++++++++++ net/bluetooth/aosp.h | 7 ++++ net/bluetooth/hci_core.c | 17 +++++++++ 3 files changed, 103 insertions(+) diff --git a/net/bluetooth/aosp.c b/net/bluetooth/aosp.c index a1b7762335a5..c2b22bc83fb2 100644 --- a/net/bluetooth/aosp.c +++ b/net/bluetooth/aosp.c @@ -33,3 +33,82 @@ 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; +} + +int aosp_set_quality_report(struct hci_dev *hdev, bool enable) +{ + bt_dev_info(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..384e111c1260 100644 --- a/net/bluetooth/aosp.h +++ b/net/bluetooth/aosp.h @@ -8,9 +8,16 @@ void aosp_do_open(struct hci_dev *hdev); void aosp_do_close(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 int aosp_set_quality_report(struct hci_dev *hdev, bool enable) +{ + return false; +} + #endif diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index aeec5a3031a6..a2c22a4921d4 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c @@ -1315,6 +1315,21 @@ static void hci_dev_get_bd_addr_from_property(struct hci_dev *hdev) bacpy(&hdev->public_addr, &ba); } +static void hci_set_quality_report(struct hci_dev *hdev) +{ +#ifdef CONFIG_BT_AOSPEXT + if (hdev->aosp_capable) { + /* The hdev->set_quality_report callback is setup here for + * the vendors that support AOSP quality report specification. + * Note that Intel, while supporting a distinct telemetry + * quality report specification, sets up the + * hdev->set_quality_report callback in the btusb module. + */ + hdev->set_quality_report = aosp_set_quality_report; + } +#endif +} + static int hci_dev_do_open(struct hci_dev *hdev) { int ret = 0; @@ -1394,6 +1409,8 @@ static int hci_dev_do_open(struct hci_dev *hdev) if (ret) goto setup_failed; + hci_set_quality_report(hdev); + if (test_bit(HCI_QUIRK_USE_BDADDR_PROPERTY, &hdev->quirks)) { if (!bacmp(&hdev->public_addr, BDADDR_ANY)) hci_dev_get_bd_addr_from_property(hdev); From patchwork Sun Sep 26 07:07:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Hwang X-Patchwork-Id: 12517969 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 06AEFC433EF for ; Sun, 26 Sep 2021 07:08:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DCE6461090 for ; Sun, 26 Sep 2021 07:08:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231185AbhIZHJh (ORCPT ); Sun, 26 Sep 2021 03:09:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37252 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231175AbhIZHJf (ORCPT ); Sun, 26 Sep 2021 03:09:35 -0400 Received: from mail-pl1-x636.google.com (mail-pl1-x636.google.com [IPv6:2607:f8b0:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1E342C061575 for ; Sun, 26 Sep 2021 00:08:00 -0700 (PDT) Received: by mail-pl1-x636.google.com with SMTP id bb10so9527646plb.2 for ; Sun, 26 Sep 2021 00:08:00 -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=BpdS2aFlZ1zRpA2zLjv6Hye68VZ4PQccnLWfxs3dzj0=; b=Qm2GEOaABbYbteFqTxtWZKpUKZtGwnqtMBlQvHFmsUZkmQD/W3xV0nYQQt50A7tQnY iPZGoXICtVi+F2gFDcis4h/KAzHfGZczNWmswg11JuMNDYbnEtHuE65argCUpJN58edo pJFP0t+mZyBJ8m8/P1hFoSYB9XLxBs6a7fbEg= 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=BpdS2aFlZ1zRpA2zLjv6Hye68VZ4PQccnLWfxs3dzj0=; b=25i1g1TrEpsvAtz9ZOeT/8/ApHws67OqSFpe//35PIcGxmNbbFvZ8hG3RsEGJv4uL6 VBuNQc9L5uhBuCXAH5ZGxuxWUIr8NbCoC1QAnlIGFqc26QSd40RgM35BeR2BDTcjMuCY dOX5OXPw2HzbFfxegKcTojuPDBKnMAlp7N3FzNOtefKPhMFZVkw4Xtfx5MdqxGG5kHSl rRbAdkQWxSBDaJNx1HCpF36D37SNeCedsu7h4cgml6/77ylSJR+gnpzDVUYY7NlZw05y lCFMOmR5f43K8bZjH3L3YjRmOmYo7lt9kXF6D31DI4o4BpQhZaOFVn1GWNv80qzVKPsa 5cOQ== X-Gm-Message-State: AOAM531P+sRZC7bJZ5lAlRk+wpjDuJL/huNvn2Fd2JdtDQnpaX3f4PiL owbam8EpzDNgLRI4OKPu91f6HMFkKu9B3w== X-Google-Smtp-Source: ABdhPJyPMGD42kP6K9XFuoYHdaQ0hgJvV4v6nloABIy+D4XMtfeXdrE9m+o67F5nf9a78rrn3Xc3KQ== X-Received: by 2002:a17:90a:1b2a:: with SMTP id q39mr12316659pjq.219.1632640079446; Sun, 26 Sep 2021 00:07:59 -0700 (PDT) Received: from josephsih-z840.tpe.corp.google.com ([2401:fa00:1:10:8152:3867:7050:3260]) by smtp.gmail.com with ESMTPSA id o17sm13796174pfp.126.2021.09.26.00.07.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Sep 2021 00:07:59 -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 , kernel test robot , Miao-chen Chou , Johan Hedberg , linux-kernel@vger.kernel.org Subject: [PATCH v4 2/4] Bluetooth: hci_qca: enable Qualcomm WCN399x for AOSP extension Date: Sun, 26 Sep 2021 15:07:47 +0800 Message-Id: <20210926150657.v4.2.I287dfe4fd9801db8ea35dc095ea05c23e8b9129d@changeid> X-Mailer: git-send-email 2.33.0.685.g46640cef36-goog In-Reply-To: <20210926150657.v4.1.Iaa4a0269e51d8e8d8784a6ac8e05899b49a1377d@changeid> References: <20210926150657.v4.1.Iaa4a0269e51d8e8d8784a6ac8e05899b49a1377d@changeid> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org This patch enables Qualcomm WCN399x to support the AOSP extension. Reported-by: kernel test robot Reviewed-by: Miao-chen Chou Signed-off-by: Joseph Hwang --- Changes in v4: - Call hci_set_aosp_capable in the driver. Changes in v3: - Fix the auto build test ERROR "undefined symbol: btandroid_set_quality_report" that occurred with some kernel configs. Changes in v2: - Fix the title drivers/bluetooth/hci_qca.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c index 53deea2eb7b4..e2566d606c93 100644 --- a/drivers/bluetooth/hci_qca.c +++ b/drivers/bluetooth/hci_qca.c @@ -1730,6 +1730,7 @@ static int qca_setup(struct hci_uart *hu) if (qca_is_wcn399x(soc_type) || qca_is_wcn6750(soc_type)) { set_bit(HCI_QUIRK_USE_BDADDR_PROPERTY, &hdev->quirks); + hci_set_aosp_capable(hdev); ret = qca_read_soc_version(hdev, &ver, soc_type); if (ret) From patchwork Sun Sep 26 07:07:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Hwang X-Patchwork-Id: 12517971 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 34E62C433F5 for ; Sun, 26 Sep 2021 07:08:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1338861090 for ; Sun, 26 Sep 2021 07:08:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231217AbhIZHJk (ORCPT ); Sun, 26 Sep 2021 03:09:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231200AbhIZHJi (ORCPT ); Sun, 26 Sep 2021 03:09:38 -0400 Received: from mail-pl1-x635.google.com (mail-pl1-x635.google.com [IPv6:2607:f8b0:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 42714C061714 for ; Sun, 26 Sep 2021 00:08:02 -0700 (PDT) Received: by mail-pl1-x635.google.com with SMTP id j14so9517031plx.4 for ; Sun, 26 Sep 2021 00:08:02 -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=SrwP2ShS2h50zXhgDpTauRMRNVTw9mBZJ1dbGK6KY/0=; b=WZjMDAuO/Xi35ye6CfouBkO1F2KmVL7s+JZ1xCZnhT6WPgRloF5Tvqx/pte/v9aLI1 YBorUmXaHuFxP62zeAZxQneNu97K44PZzUlRPikwp6BrZShUl1j6kp2lzyOx8Alhun40 5uSGGAGu0irnCU2DN+ycDzCEIcvogGMRJAVLQ= 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=SrwP2ShS2h50zXhgDpTauRMRNVTw9mBZJ1dbGK6KY/0=; b=rnZTciAjMS+Hlv0bjWiwGJf61U0vMWD87VrX9mw9Luk7FkLFnz3Q0L0/EQNf0FMMLE prge+o+ZdiOHpQ3dW1a73lhlXa3L2PGJMpvRyXdqxlOZ36HzYYWHtnnEGZa8ey7CCpA5 4B5PgX/9NDjdJKtemS3KKeG0ACVqygstBCGNc9mO5p9GGcSU3MdnNY9OljVrzblcBGt7 q83LVgSEXLxYna7FTAeOTAw5O4PSC0C01oek+5FA3vLczofliVLdazAlnK0fp6z4VtEs WiNBCDYpVn0B/xe5JE5iOH3a4anGIqg6BFqJQl1Grf7pnUCaSltS404lKkBblzspRq2T 0dZA== X-Gm-Message-State: AOAM531oa+p9t1+HQekg4H/kuIoTpmnvO8JEicJ+BEpnNUvndtgoCj+o Y9G478NWOA7R5CQFUFI1/7WaZVSy/3Jm0g== X-Google-Smtp-Source: ABdhPJwGXxrcV/M268IELeB71DmoGPZly4RZOOOicWodSKhPCoK2HFuqtnX/c+NMSkIRNclP/BZN5w== X-Received: by 2002:a17:90b:3145:: with SMTP id ip5mr12362908pjb.161.1632640081588; Sun, 26 Sep 2021 00:08:01 -0700 (PDT) Received: from josephsih-z840.tpe.corp.google.com ([2401:fa00:1:10:8152:3867:7050:3260]) by smtp.gmail.com with ESMTPSA id o17sm13796174pfp.126.2021.09.26.00.07.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Sep 2021 00:08:01 -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 , Johan Hedberg , linux-kernel@vger.kernel.org Subject: [PATCH v4 3/4] Bluetooth: btrtl: enable Realtek 8822C/8852A to support AOSP extension Date: Sun, 26 Sep 2021 15:07:48 +0800 Message-Id: <20210926150657.v4.3.Iba6327b2544d1904bbcb17f369dcd3761b566153@changeid> X-Mailer: git-send-email 2.33.0.685.g46640cef36-goog In-Reply-To: <20210926150657.v4.1.Iaa4a0269e51d8e8d8784a6ac8e05899b49a1377d@changeid> References: <20210926150657.v4.1.Iaa4a0269e51d8e8d8784a6ac8e05899b49a1377d@changeid> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org This patch enables Realtek 8822C and 8852A to support the AOSP extension. Reviewed-by: Miao-chen Chou Signed-off-by: Joseph Hwang --- Changes in v4: - Call hci_set_aosp_capable in the driver. Changes in v3: - Fix the auto build test ERROR "undefined symbol: btandroid_set_quality_report" that occurred with some kernel configs. Changes in v2: - Fix the title drivers/bluetooth/btrtl.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/bluetooth/btrtl.c b/drivers/bluetooth/btrtl.c index 1f8afa0244d8..5a1090b7c69a 100644 --- a/drivers/bluetooth/btrtl.c +++ b/drivers/bluetooth/btrtl.c @@ -746,6 +746,7 @@ void btrtl_set_quirks(struct hci_dev *hdev, struct btrtl_device_info *btrtl_dev) case CHIP_ID_8852A: set_bit(HCI_QUIRK_VALID_LE_STATES, &hdev->quirks); set_bit(HCI_QUIRK_WIDEBAND_SPEECH_SUPPORTED, &hdev->quirks); + hci_set_aosp_capable(hdev); break; default: rtl_dev_dbg(hdev, "Central-peripheral role not enabled."); From patchwork Sun Sep 26 07:07:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joseph Hwang X-Patchwork-Id: 12517973 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 5FB08C43219 for ; Sun, 26 Sep 2021 07:08:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 407E76103D for ; Sun, 26 Sep 2021 07:08:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231199AbhIZHJl (ORCPT ); Sun, 26 Sep 2021 03:09:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231215AbhIZHJk (ORCPT ); Sun, 26 Sep 2021 03:09:40 -0400 Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53611C061714 for ; Sun, 26 Sep 2021 00:08:04 -0700 (PDT) Received: by mail-pj1-x1031.google.com with SMTP id r7so9486015pjo.3 for ; Sun, 26 Sep 2021 00:08:04 -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=gcIEd4ZvWF+aMbmrEEJnlNTin4YD1gvu+ViZoUNmNvo=; b=jJAV9mLyVsaIXtIiQW1QM4n5E6tb/RywIYfDaKvTYWIViLwMH+ctv9FfDe9PCJqUJn LNQaLlGohM+VgiSQO5SPCAhOuIQZs3uFJk/lHmn+o2lwVMR+x77VttLZps7YvMMviJss f+gtZoMb5jcbtBBvxtOsjGVEXSywDeiC7Uv3I= 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=gcIEd4ZvWF+aMbmrEEJnlNTin4YD1gvu+ViZoUNmNvo=; b=GVi/iUrWQnRYC5jGBeEgUNs4xBqQJh/Zjn+gr/LhCmycgIVce/Jtsg9OFkWHDfP+A7 RRaF2uOKJYm3DmDOuqrGqKO94RBsiwxfcEG/H9GSLIMsd+05YYjMuqAgcfBPwEy2lumQ kIU9VTTn10bqV2gz2m8co8yvBZz0FkbjZBUAp6tQEO99OR3eJcNPDSzXPpLf0OXhyBbH WLLWxViDwi+ehdPaCRxpE7ZrOf+TiNGgiQsT3XcjhARJZ1cCE7AcZZ7kz2hkefTZUDH/ HjJNgpwflwU/8orC9F8CNas+mD5bHv9DfWmekEQnT6WvJMmj9rCohAomnL8O6vrA1jJd a/3A== X-Gm-Message-State: AOAM530OaErC+9m1AeCqeQEZRn3d6AfKhIysaiRpv0kAFkKFsNBERwqg ZwWaQG6dLGT4yj4S2y6yjm9f+Nqb2O+5hA== X-Google-Smtp-Source: ABdhPJyA3JwkzYmaC5UlPk3wMvfiBiwsns5IfJ/Y/qNO9U61quLxc2j2ZNekzpefLokQyCU2vOUYRg== X-Received: by 2002:a17:90a:680c:: with SMTP id p12mr12119779pjj.33.1632640083723; Sun, 26 Sep 2021 00:08:03 -0700 (PDT) Received: from josephsih-z840.tpe.corp.google.com ([2401:fa00:1:10:8152:3867:7050:3260]) by smtp.gmail.com with ESMTPSA id o17sm13796174pfp.126.2021.09.26.00.08.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Sep 2021 00:08:03 -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 , Johan Hedberg , linux-kernel@vger.kernel.org Subject: [PATCH v4 4/4] Bluetooth: btusb: enable Mediatek MT7921 to support AOSP extension Date: Sun, 26 Sep 2021 15:07:49 +0800 Message-Id: <20210926150657.v4.4.I257ac5cfaf955d15670479efc311bbab702397f4@changeid> X-Mailer: git-send-email 2.33.0.685.g46640cef36-goog In-Reply-To: <20210926150657.v4.1.Iaa4a0269e51d8e8d8784a6ac8e05899b49a1377d@changeid> References: <20210926150657.v4.1.Iaa4a0269e51d8e8d8784a6ac8e05899b49a1377d@changeid> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org This patch enables Mediatek MT7921 to support the AOSP extension. Reviewed-by: Miao-chen Chou Signed-off-by: Joseph Hwang --- Changes in v4: - Call hci_set_aosp_capable in the driver. - This patch is added in this Series-changes 4. drivers/bluetooth/btusb.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index da85cc14f931..de0228e2245b 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c @@ -60,6 +60,7 @@ static struct usb_driver btusb_driver; #define BTUSB_VALID_LE_STATES 0x800000 #define BTUSB_QCA_WCN6855 0x1000000 #define BTUSB_INTEL_BROKEN_INITIAL_NCMD 0x4000000 +#define BTUSB_AOSP 0x8000000 static const struct usb_device_id btusb_table[] = { /* Generic Bluetooth USB device */ @@ -394,6 +395,7 @@ static const struct usb_device_id blacklist_table[] = { /* MediaTek Bluetooth devices */ { USB_VENDOR_AND_INTERFACE_INFO(0x0e8d, 0xe0, 0x01, 0x01), .driver_info = BTUSB_MEDIATEK | + BTUSB_AOSP | BTUSB_WIDEBAND_SPEECH | BTUSB_VALID_LE_STATES }, @@ -407,6 +409,7 @@ static const struct usb_device_id blacklist_table[] = { /* Additional MediaTek MT7921 Bluetooth devices */ { USB_DEVICE(0x04ca, 0x3802), .driver_info = BTUSB_MEDIATEK | + BTUSB_AOSP | BTUSB_WIDEBAND_SPEECH | BTUSB_VALID_LE_STATES }, { USB_DEVICE(0x13d3, 0x3563), .driver_info = BTUSB_MEDIATEK | @@ -3867,6 +3870,9 @@ 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; + + if (id->driver_info & BTUSB_AOSP) + hci_set_aosp_capable(hdev); } if (id->driver_info & BTUSB_SWAVE) {