Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp1592185rwb; Wed, 5 Oct 2022 01:45:23 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4gZSiv3PtqqHRKVVa7iJ4SmuuVwOnBOC/vwz3MpJ/dJfNJ4JSdmStCe9MACU2vJZYdQA0n X-Received: by 2002:a17:902:ec8a:b0:178:488b:cbc2 with SMTP id x10-20020a170902ec8a00b00178488bcbc2mr32232849plg.114.1664959523202; Wed, 05 Oct 2022 01:45:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664959523; cv=none; d=google.com; s=arc-20160816; b=JaR78s5LTtVh2RXCUvvaaoXs6DU4BEV4XyZZuqgjEa2eSvGoVzpAhzzp1c0K+G9ZBR f28IR3U09c0EhLw+HAgvuFYWUJGqu8DHmbBZTy9uMSF5VYS5hC0JLlCcKYDTFBs+1nKx K0Dee+PWATEitmrzf7+o8wDcRgs+JP3k/ME4+H4Rgeo4sPNgrt8imBK27WDhD9b6CkUV 45n8wJ4rxS+2oITBZ3KSpHKLw/xSZcY3rMojJxURBJVGJcpsRzigZUlE0erQ0sOkyp3p B196aqWZM+kkPzgxOvmEBxJI2AhfmyfIFdNfPCts4yRcaVFbI3iAJvYWdIUleIa825Mk /2AA== 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=BLmA7EvKzmkx5yF1FByHoqKbaEXsT1RLCpw/Q9d+lTc=; b=uu/gMf3WksIHsVno+v0RQ4QEfjsUJqDOdDEPidRw0TTLDRA6//1xcxGxJNOG0hA4Fz M/TY1+09bIHYb76p09RasrRysAATqToSuL+0+8ByYRuVXSPqt+Egb4oCREERa8mDuOoJ 4KfZkGfop+iQRGGDP8sM4y2/c1bBkjPeO9zhQ3Wm+o+2easMikMsqFxVgscWTFf6bIum FSM9JybsxozQ2iZLcwXi8rnc6SQ4ckE2Fd6nqsTnIS2cs3sYE87BDrz6jv4J7I92xKqq MFfgCgI9/i3FNFv8DFT6bh2XaHtzU76eN8ZEBuATq+I3056BOcNTY7ED32358mkiaime MMXw== 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 i184-20020a6387c1000000b0044c343aaeb6si1440867pge.651.2022.10.05.01.45.00; Wed, 05 Oct 2022 01:45:23 -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 S229961AbiJEInx (ORCPT + 99 others); Wed, 5 Oct 2022 04:43:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48016 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229814AbiJEInt (ORCPT ); Wed, 5 Oct 2022 04:43:49 -0400 Received: from rtits2.realtek.com.tw (rtits2.realtek.com [211.75.126.72]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 7BA1A754A2; Wed, 5 Oct 2022 01:43:47 -0700 (PDT) Authenticated-By: X-SpamFilter-By: ArmorX SpamTrap 5.77 with qID 2958h9fL5022996, This message is accepted by code: ctloc85258 Received: from mail.realtek.com (rtexh36504.realtek.com.tw[172.21.6.27]) by rtits2.realtek.com.tw (8.15.2/2.81/5.90) with ESMTPS id 2958h9fL5022996 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=FAIL); Wed, 5 Oct 2022 16:43:09 +0800 Received: from RTEXMBS04.realtek.com.tw (172.21.6.97) by RTEXH36504.realtek.com.tw (172.21.6.27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.7; Wed, 5 Oct 2022 16:43:37 +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; Wed, 5 Oct 2022 16:43:36 +0800 From: To: CC: , , , , , , , , Subject: [PATCH v4 1/2] Bluetooth: btrtl: Add btrealtek data struct Date: Wed, 5 Oct 2022 16:43:30 +0800 Message-ID: <20221005084331.1001-2-hildawu@realtek.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20221005084331.1001-1-hildawu@realtek.com> References: <20221005084331.1001-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: 10/05/2022 03:37: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?Q2xlYW4sIGJhc2VzOiAyMDIyLzEwLzUgpFekyCAwMjo1OTowMA==?= X-KSE-BulkMessagesFiltering-Scan-Result: protection disabled X-KSE-ServerInfo: RTEXH36504.realtek.com.tw, 9 X-KSE-AntiSpam-Interceptor-Info: fallback X-KSE-Antivirus-Interceptor-Info: fallback X-KSE-AntiSpam-Interceptor-Info: fallback X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS 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 v4: - Since the original 0002 patch has no dependency with this 0001 patch. So let the 0002 patch submit another. Changes in v3: - Update private flag. Changes in v2: - Set the proper priv_size to hci_alloc_dev_priv(). - Separate commits for functions. --- --- drivers/bluetooth/btrtl.h | 21 +++++++++++++++++++++ drivers/bluetooth/btusb.c | 3 +++ 2 files changed, 24 insertions(+) diff --git a/drivers/bluetooth/btrtl.h b/drivers/bluetooth/btrtl.h index 2c441bda390a..ebf0101c959b 100644 --- a/drivers/bluetooth/btrtl.h +++ b/drivers/bluetooth/btrtl.h @@ -47,6 +47,27 @@ struct rtl_vendor_config { struct rtl_vendor_config_entry entry[]; } __packed; +enum { + 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 271963805a38..4243936c0583 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c @@ -3755,6 +3755,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