Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp6354767rwn; Tue, 13 Sep 2022 03:04:47 -0700 (PDT) X-Google-Smtp-Source: AA6agR7g7rJVKq9+1L4fOHyqFK2INYqjJBvr7B5Z2mF4VswXAgn/qH3rsPO5CIICds58rKWjLcUc X-Received: by 2002:a63:cf56:0:b0:439:41ed:78fc with SMTP id b22-20020a63cf56000000b0043941ed78fcmr2212292pgj.419.1663063487274; Tue, 13 Sep 2022 03:04:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663063487; cv=none; d=google.com; s=arc-20160816; b=LG2Y+tmsZfzMZ5AqoEKbMqmUzBumZrcfJ0Bakb0AYo354CsqZDk8lKIh1cbNNZ/Fzg NzPbX/7YkcxY5Q5HhQWBFCBmsDtWGc9CC8nDab6v/M8e1C1AD78cCB40smT+GbrFo+8l dsb1NwX8p2OJLETaUq7e9YNGCpbq+T6Q8IuuiMqpshknxiCi0IQiI2yHbBs+2Xvh+M+2 rxx3cc6bmZUVwdqYzbBya1j4QUfAZCE04x4TXQLpySs18UNzZVLl+ssVqygqQ9Tzll9N 3N2U6F4kXNcDNW1ermpUtDWAmaMbZ3y8/Gq6MMHQgYQlE/UqJ6gDnRqbvZ0oQhHbEpeK L0iw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:authenticated-by; bh=41CnkpL6l4tEI8ssQ7EBZGpzGqUCeTbLiol4HXLm1eM=; b=VVntKpRGH0Et2eSoxo7tH9gb8PPvmPPL8rZCqG53+Ow03YLBWq1OeDrsvyfWM0RfEn XYIJRM/+qOALGDwSwQ3dLc2u6jV0oi3DuXelRj2/g0SD5hXHB22LdSkJ9lUuYHU1HOXV YKGid2nKWzBC7fcaWBqfRLcBtXzEWP0hMrpYFrvPC1Ji05K46fTgC2/sPftBg6kWVGrM /Idni4uAJ6jDxBar5eq2JgJYIW6L+EnRncnA4tuZruSxp+hUvFF6dkcENL07p7XusvrA klMm5mvAtHFbbOUC9rxD4UTUoyZXNdJuQzOVhrFtzSo5BUFJla8KR3L02OqVhMKcyPnV akwA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j4-20020a170903028400b00172aa2103bcsi7004604plr.448.2022.09.13.03.04.19; Tue, 13 Sep 2022 03:04:47 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230203AbiIMKDI (ORCPT + 99 others); Tue, 13 Sep 2022 06:03:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51202 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230088AbiIMKDH (ORCPT ); Tue, 13 Sep 2022 06:03:07 -0400 Received: from rtits2.realtek.com.tw (rtits2.realtek.com [211.75.126.72]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id DF8C157E09; Tue, 13 Sep 2022 03:03:03 -0700 (PDT) Authenticated-By: X-SpamFilter-By: ArmorX SpamTrap 5.77 with qID 28DA2Um54014143, This message is accepted by code: ctloc85258 Received: from mail.realtek.com (rtexh36505.realtek.com.tw[172.21.6.25]) by rtits2.realtek.com.tw (8.15.2/2.81/5.90) with ESMTPS id 28DA2Um54014143 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=FAIL); Tue, 13 Sep 2022 18:02:30 +0800 Received: from RTEXMBS04.realtek.com.tw (172.21.6.97) by RTEXH36505.realtek.com.tw (172.21.6.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Tue, 13 Sep 2022 18:02:50 +0800 Received: from localhost.localdomain (172.21.132.192) by RTEXMBS04.realtek.com.tw (172.21.6.97) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.7; Tue, 13 Sep 2022 18:02:50 +0800 From: To: CC: , , , , , , , , Subject: [PATCH v2 1/3] Bluetooth: btrtl: Add btrealtek data struct Date: Tue, 13 Sep 2022 18:02:42 +0800 Message-ID: <20220913100244.23660-2-hildawu@realtek.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220913100244.23660-1-hildawu@realtek.com> References: <20220913100244.23660-1-hildawu@realtek.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [172.21.132.192] X-ClientProxiedBy: RTEXH36505.realtek.com.tw (172.21.6.25) To RTEXMBS04.realtek.com.tw (172.21.6.97) X-KSE-ServerInfo: RTEXMBS04.realtek.com.tw, 9 X-KSE-AntiSpam-Interceptor-Info: trusted connection X-KSE-Antiphishing-Info: Clean X-KSE-Antiphishing-ScanningType: Deterministic X-KSE-Antiphishing-Method: None X-KSE-Antiphishing-Bases: 09/13/2022 08:01:00 X-KSE-AttachmentFiltering-Interceptor-Info: no applicable attachment filtering rules found X-KSE-Antivirus-Interceptor-Info: scan successful X-KSE-Antivirus-Info: =?big5?B?Q2xlYW4sIGJhc2VzOiAyMDIyLzkvMTMgpFekyCAwNzozMzowMA==?= X-KSE-BulkMessagesFiltering-Scan-Result: protection disabled X-KSE-ServerInfo: RTEXH36505.realtek.com.tw, 9 X-KSE-Attachment-Filter-Triggered-Rules: Clean X-KSE-Attachment-Filter-Triggered-Filters: Clean X-KSE-BulkMessagesFiltering-Scan-Result: protection disabled X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE 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 From: Hilda Wu This patch adds a data structure for btrealtek object, and the definition of vendor behavior flags. It also adds macros to set/test/get the flags. Signed-off-by: Hilda Wu --- Changes in v2: - Set the proper priv_size to hci_alloc_dev_priv(). - Separate commits for functions. --- --- drivers/bluetooth/btrtl.h | 22 ++++++++++++++++++++++ drivers/bluetooth/btusb.c | 3 +++ 2 files changed, 25 insertions(+) diff --git a/drivers/bluetooth/btrtl.h b/drivers/bluetooth/btrtl.h index 2c441bda390a..e2c99684799a 100644 --- a/drivers/bluetooth/btrtl.h +++ b/drivers/bluetooth/btrtl.h @@ -47,6 +47,28 @@ struct rtl_vendor_config { struct rtl_vendor_config_entry entry[]; } __packed; +enum { + REALTEK_WBS_FILTER, + REALTEK_ALT6_CONTINUOUS_TX_CHIP, + + __REALTEK_NUM_FLAGS, +}; + +struct btrealtek_data { + DECLARE_BITMAP(flags, __REALTEK_NUM_FLAGS); +}; + +#define btrealtek_set_flag(hdev, nr) \ + do { \ + struct btrealtek_data *realtek = hci_get_priv((hdev)); \ + set_bit((nr), realtek->flags); \ + } while (0) + +#define btrealtek_get_flag(hdev) \ + (((struct btrealtek_data *)hci_get_priv(hdev))->flags) + +#define btrealtek_test_flag(hdev, nr) test_bit((nr), btrealtek_get_flag(hdev)) + #if IS_ENABLED(CONFIG_BT_RTL) struct btrtl_device_info *btrtl_initialize(struct hci_dev *hdev, diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index c3daba17de7f..4c3aed89ff05 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c @@ -3749,6 +3749,9 @@ static int btusb_probe(struct usb_interface *intf, /* Override the rx handlers */ data->recv_event = btusb_recv_event_intel; data->recv_bulk = btusb_recv_bulk_intel; + } else if (id->driver_info & BTUSB_REALTEK) { + /* Allocate extra space for Realtek device */ + priv_size += sizeof(struct btrealtek_data); } data->recv_acl = hci_recv_frame; -- 2.17.1