Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp170629pxb; Thu, 30 Sep 2021 03:40:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwO5J5WcLP8by/TGQBG2ZqMUpdyxHXzF+kgE5TKYqMCFvTMNkUt1n3ggS8pl6qkP+tBO8Ai X-Received: by 2002:a17:906:3adb:: with SMTP id z27mr5726203ejd.291.1632998443146; Thu, 30 Sep 2021 03:40:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632998443; cv=none; d=google.com; s=arc-20160816; b=v9x3RXgD8BCcqLauFGAPoA0PG64byvz+H4Ng4nTk+D1OG5ewvgDLBM5bYM0AXjMk1E 227IFj/HnHrw618birKkuilL12ecdZKYiSsayR2hBhBYj66ymQpSHESxmvL5bMefyU4X EkdPhMSS1ja96DZXhuwsH9b+v9sQFVYpji4l4n7uoNG5cVKeHAsN4hMAjpMFLzb1QNKe UeGHbctfG14mNw7XCtEpc84DBOalhBCrsSu1cZKh3PSGkxyxe8CvgABwhzr6mYmZTwsM 95mt8pNe/dj3m477u61LgC2zsqCHi63r/61T+We1kYO8sztx1qrDqePcyaEzE1XT59OQ +5/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from :authenticated-by; bh=tguLhsKcFKgy4jUi/sU3TsZifLPvG9ioAbV4Cjz3ciw=; b=DKxJ+cm2MGJfVjEqxni1l7AMOdR0/sNIgjp88uZ0+sasqHW/F8Ukfqug9SlRh7rVMl ieU9Ck4QfZIxExkxtS+SmxUDH8nW8CtwCnhc0zYHwuP2dEC1bWPOu0eJVNpsZ7/ITMzO Ov81Dm5vP6SNJ/H67chyrseFRh8np1i/4w0LS5fdRijSJpd+9/nsy44ppAx58exoQ1up bn2XVvfvDI7x+yI/E0XixkUzC4w0NKXqnaWiUKQMwKTNtJrqxBFQaCI8bqzW0K3MFCkS SCfXa6MMiTwDyRKcOE9wPM/Hh2LD/SZ+JqeQ1Y5psRUtxkV+pdYh2Bzx032sWpyEXL7T DNaQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l21si3483298edw.50.2021.09.30.03.40.19; Thu, 30 Sep 2021 03:40:43 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349869AbhI3Kii (ORCPT + 99 others); Thu, 30 Sep 2021 06:38:38 -0400 Received: from rtits2.realtek.com ([211.75.126.72]:33360 "EHLO rtits2.realtek.com.tw" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241052AbhI3Kih (ORCPT ); Thu, 30 Sep 2021 06:38:37 -0400 Authenticated-By: X-SpamFilter-By: ArmorX SpamTrap 5.73 with qID 18UAae5tB001743, This message is accepted by code: ctloc85258 Received: from mail.realtek.com (rtexh36503.realtek.com.tw[172.21.6.25]) by rtits2.realtek.com.tw (8.15.2/2.71/5.88) with ESMTPS id 18UAae5tB001743 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Thu, 30 Sep 2021 18:36:40 +0800 Received: from RTEXMBS04.realtek.com.tw (172.21.6.97) by RTEXH36503.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.2308.14; Thu, 30 Sep 2021 18:36:40 +0800 Received: from localhost.localdomain (172.21.132.99) 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.2106.2; Thu, 30 Sep 2021 18:36:39 +0800 From: To: CC: , , , , , , , , Subject: [PATCH] Bluetooth: btrtl: Ask ic_info to drop firmware Date: Thu, 30 Sep 2021 18:36:34 +0800 Message-ID: <20210930103634.1710-1-hildawu@realtek.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [172.21.132.99] X-ClientProxiedBy: RTEXH36504.realtek.com.tw (172.21.6.27) 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/30/2021 01:34: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?Q2xlYW4sIGJhc2VzOiAyMDIxLzkvMjkgpFWkyCAxMToyNzowMA==?= X-KSE-BulkMessagesFiltering-Scan-Result: protection disabled X-KSE-ServerInfo: RTEXH36503.realtek.com.tw, 9 X-KSE-AntiSpam-Interceptor-Info: fallback X-KSE-Antivirus-Interceptor-Info: fallback X-KSE-AntiSpam-Interceptor-Info: fallback Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Hilda Wu Some un-support wakeup platforms keep USB power and suspend signal is coming late, this makes Realtek some chip keep its firmware, and make it never load new firmware. So use vendor specific HCI command to ask them drop its firmware after system shutdown or resume. Signed-off-by: Hilda Wu --- drivers/bluetooth/btrtl.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/bluetooth/btrtl.c b/drivers/bluetooth/btrtl.c index 1f8afa0244d8..60ddba8962ff 100644 --- a/drivers/bluetooth/btrtl.c +++ b/drivers/bluetooth/btrtl.c @@ -594,8 +594,10 @@ struct btrtl_device_info *btrtl_initialize(struct hci_dev *hdev, hci_rev = le16_to_cpu(resp->hci_rev); lmp_subver = le16_to_cpu(resp->lmp_subver); - if (resp->hci_ver == 0x8 && le16_to_cpu(resp->hci_rev) == 0x826c && - resp->lmp_ver == 0x8 && le16_to_cpu(resp->lmp_subver) == 0xa99e) + btrtl_dev->ic_info = btrtl_match_ic(lmp_subver, hci_rev, hci_ver, + hdev->bus); + + if (!btrtl_dev->ic_info) btrtl_dev->drop_fw = true; if (btrtl_dev->drop_fw) { @@ -634,13 +636,13 @@ struct btrtl_device_info *btrtl_initialize(struct hci_dev *hdev, hci_ver = resp->hci_ver; hci_rev = le16_to_cpu(resp->hci_rev); lmp_subver = le16_to_cpu(resp->lmp_subver); + + btrtl_dev->ic_info = btrtl_match_ic(lmp_subver, hci_rev, hci_ver, + hdev->bus); } out_free: kfree_skb(skb); - btrtl_dev->ic_info = btrtl_match_ic(lmp_subver, hci_rev, hci_ver, - hdev->bus); - if (!btrtl_dev->ic_info) { rtl_dev_info(hdev, "unknown IC info, lmp subver %04x, hci rev %04x, hci ver %04x", lmp_subver, hci_rev, hci_ver); -- 2.17.1