From mboxrd@z Thu Jan 1 00:00:00 1970 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7D007C433FE for ; Tue, 24 May 2022 21:24:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Date:Subject:Message-ID:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=jpZr4spbvsJbsurQiLFM9/6n/PCYrf34X7SairJk20M=; b=y/9oXvGT+0qCWt 48yXbBZjRrbrftdNB81ByNfSphkxM3TpGU0RVsjZ06Psj7aplKtAFblRnNrU/6SQlsqDjSjpSWGO3 tdCr5qFCbUYIsoj5UlHqrBCry7XUB5885T58s+dDKgqEMYw7fEL6MzfXO2QcpDntDYVfJDLkL5uG5 dRluqkFSEAy8wbP+AtdFvGj2s4IIImvRnlWdfvGp2XtVwMggwGSuUu0JfHl9D/0ihfuXfxpxatxyp 5JQ/G/YUe9VdTjZWx/LRdaoJZTW7A6+ov8j2eSfHyJlLL2KBL6fsLzCGOEH62eDP4q/pY4TPgrI3X LFYXp8ByxHHATlGWurvA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ntbza-009Dnw-IH; Tue, 24 May 2022 21:23:02 +0000 Received: from sender11-of-o53.zoho.eu ([31.186.226.239]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ntbzG-009Dk8-U7 for linux-arm-kernel@lists.infradead.org; Tue, 24 May 2022 21:22:45 +0000 ARC-Seal: i=1; a=rsa-sha256; t=1653427341; cv=none; d=zohomail.eu; s=zohoarc; b=b0vA92DoaPGCbvh5GAQDzhj1RCYG3rkzYb53XhGgWwjAavb8ZmW2JW2ea/EpUjRtgISSz5QuEO1+8hlKd9G/4tfL+vDfewikWr+8j7gOSSbUINqSkTi/9jsGQzH+pLofSmSs8Nou+zjLqPo4+gSBCIsOkGvmSwTk1uxzOV5a1bw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1653427341; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=mGz9geOh9bVL8VNTmK+t7n+LCbps3NKlP/XHOE2cdBw=; b=JEUXSn1ZMumJ6Oyn2vEVEr/EKWQljGc/Rc3dtTbq7jsdn+guzK8uhRx9fuz/Duz/PDZAuspWC7dRl/D0q3OQJ5Ej04EJ+zeOXN4yK2aByeCuXOxr5xvdPHe+nrHiPp45zgR2EjPH0C3N2PNncKDNOsdc+qPUO5Wn7ve+/oyQzio= ARC-Authentication-Results: i=1; mx.zohomail.eu; spf=pass smtp.mailfrom=hostmaster@neglo.de; dmarc=pass header.from= Received: from localhost.localdomain (port-92-194-239-176.dynamic.as20676.net [92.194.239.176]) by mx.zoho.eu with SMTPS id 1653427340856773.1976815347725; Tue, 24 May 2022 23:22:20 +0200 (CEST) From: Bastian Germann To: Rob Herring , Maxime Ripard , Chen-Yu Tsai , Marcel Holtmann , Johan Hedberg , "David S . Miller" , Jakub Kicinski , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-bluetooth@vger.kernel.org, netdev@vger.kernel.org Cc: Vasily Khoruzhick , Bastian Germann Message-ID: <20220524212155.16944-2-bage@debian.org> Subject: [PATCH v2 1/3] Bluetooth: Add new quirk for broken local ext features max_page Date: Tue, 24 May 2022 23:21:52 +0200 X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220524212155.16944-1-bage@debian.org> References: <20220524212155.16944-1-bage@debian.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220524_142243_334402_58F0FE68 X-CRM114-Status: GOOD ( 11.27 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Vasily Khoruzhick Some adapters (e.g. RTL8723CS) advertise that they have more than 2 pages for local ext features, but they don't support any features declared in these pages. RTL8723CS reports max_page = 2 and declares support for sync train and secure connection, but it responds with either garbage or with error in status on corresponding commands. Signed-off-by: Vasily Khoruzhick [rebase on current tree] Signed-off-by: Bastian Germann --- include/net/bluetooth/hci.h | 7 +++++++ net/bluetooth/hci_event.c | 4 +++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index 69ef31cea582..af26e8051905 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h @@ -265,6 +265,13 @@ enum { * runtime suspend, because event filtering takes place there. */ HCI_QUIRK_BROKEN_FILTER_CLEAR_ALL, + + /* When this quirk is set, max_page for local extended features + * is set to 1, even if controller reports higher number. Some + * controllers (e.g. RTL8723CS) report more pages, but they + * don't actually support features declared there. + */ + HCI_QUIRK_BROKEN_LOCAL_EXT_FTR_MAX_PAGE, }; /* HCI device flags */ diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index 66451661283c..52b358c33344 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c @@ -837,7 +837,9 @@ static u8 hci_cc_read_local_ext_features(struct hci_dev *hdev, void *data, if (rp->status) return rp->status; - if (hdev->max_page < rp->max_page) + if (!test_bit(HCI_QUIRK_BROKEN_LOCAL_EXT_FTR_MAX_PAGE, + &hdev->quirks) && + hdev->max_page < rp->max_page) hdev->max_page = rp->max_page; if (rp->page < HCI_MAX_PAGES) -- 2.36.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel From mboxrd@z Thu Jan 1 00:00:00 1970 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2EAA7C433F5 for ; Tue, 24 May 2022 21:38:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241187AbiEXVic convert rfc822-to-8bit (ORCPT ); Tue, 24 May 2022 17:38:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241933AbiEXViY (ORCPT ); Tue, 24 May 2022 17:38:24 -0400 Received: from sender11-of-o53.zoho.eu (sender11-of-o53.zoho.eu [31.186.226.239]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A71177C178 for ; Tue, 24 May 2022 14:38:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653427341; cv=none; d=zohomail.eu; s=zohoarc; b=b0vA92DoaPGCbvh5GAQDzhj1RCYG3rkzYb53XhGgWwjAavb8ZmW2JW2ea/EpUjRtgISSz5QuEO1+8hlKd9G/4tfL+vDfewikWr+8j7gOSSbUINqSkTi/9jsGQzH+pLofSmSs8Nou+zjLqPo4+gSBCIsOkGvmSwTk1uxzOV5a1bw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.eu; s=zohoarc; t=1653427341; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=mGz9geOh9bVL8VNTmK+t7n+LCbps3NKlP/XHOE2cdBw=; b=JEUXSn1ZMumJ6Oyn2vEVEr/EKWQljGc/Rc3dtTbq7jsdn+guzK8uhRx9fuz/Duz/PDZAuspWC7dRl/D0q3OQJ5Ej04EJ+zeOXN4yK2aByeCuXOxr5xvdPHe+nrHiPp45zgR2EjPH0C3N2PNncKDNOsdc+qPUO5Wn7ve+/oyQzio= ARC-Authentication-Results: i=1; mx.zohomail.eu; spf=pass smtp.mailfrom=hostmaster@neglo.de; dmarc=pass header.from= Received: from localhost.localdomain (port-92-194-239-176.dynamic.as20676.net [92.194.239.176]) by mx.zoho.eu with SMTPS id 1653427340856773.1976815347725; Tue, 24 May 2022 23:22:20 +0200 (CEST) From: Bastian Germann To: Rob Herring , Maxime Ripard , Chen-Yu Tsai , Marcel Holtmann , Johan Hedberg , "David S . Miller" , Jakub Kicinski , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-bluetooth@vger.kernel.org, netdev@vger.kernel.org Cc: Vasily Khoruzhick , Bastian Germann Message-ID: <20220524212155.16944-2-bage@debian.org> Subject: [PATCH v2 1/3] Bluetooth: Add new quirk for broken local ext features max_page Date: Tue, 24 May 2022 23:21:52 +0200 X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220524212155.16944-1-bage@debian.org> References: <20220524212155.16944-1-bage@debian.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8BIT Content-Type: text/plain; charset=utf8 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Vasily Khoruzhick Some adapters (e.g. RTL8723CS) advertise that they have more than 2 pages for local ext features, but they don't support any features declared in these pages. RTL8723CS reports max_page = 2 and declares support for sync train and secure connection, but it responds with either garbage or with error in status on corresponding commands. Signed-off-by: Vasily Khoruzhick [rebase on current tree] Signed-off-by: Bastian Germann --- include/net/bluetooth/hci.h | 7 +++++++ net/bluetooth/hci_event.c | 4 +++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index 69ef31cea582..af26e8051905 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h @@ -265,6 +265,13 @@ enum { * runtime suspend, because event filtering takes place there. */ HCI_QUIRK_BROKEN_FILTER_CLEAR_ALL, + + /* When this quirk is set, max_page for local extended features + * is set to 1, even if controller reports higher number. Some + * controllers (e.g. RTL8723CS) report more pages, but they + * don't actually support features declared there. + */ + HCI_QUIRK_BROKEN_LOCAL_EXT_FTR_MAX_PAGE, }; /* HCI device flags */ diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index 66451661283c..52b358c33344 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c @@ -837,7 +837,9 @@ static u8 hci_cc_read_local_ext_features(struct hci_dev *hdev, void *data, if (rp->status) return rp->status; - if (hdev->max_page < rp->max_page) + if (!test_bit(HCI_QUIRK_BROKEN_LOCAL_EXT_FTR_MAX_PAGE, + &hdev->quirks) && + hdev->max_page < rp->max_page) hdev->max_page = rp->max_page; if (rp->page < HCI_MAX_PAGES) -- 2.36.1