Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp1020369rwr; Thu, 4 May 2023 12:57:15 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4q3mOF4LqoCSFFnm4Tb1elc0QV1v8ENYbjcATWws1DbnuY7GaztJjatdOE4bnrNoEnWQfn X-Received: by 2002:a17:90a:bd82:b0:250:2311:1545 with SMTP id z2-20020a17090abd8200b0025023111545mr405850pjr.9.1683230234809; Thu, 04 May 2023 12:57:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683230234; cv=none; d=google.com; s=arc-20160816; b=JCWdOQG2uGd5cebwpq48GYcxhSp4ak47ehnYaoaaWy4hyJKuf+P7TzfE54qRV03747 TlCenc6EgVCG7JaRYI4ZKSGuyOSORU0B//mSuA8+0GcOZdes9gQJxj1sjCEi7tFLf9IP 2bonsll4rpEiyshur4GSUqcMcPOykeaV6rG0xJDrk74hjtKW+PnKO1+kJ3XimzhkBXTe sdRDGUxTmvNnfKMy6cLTTUet6UljZeFlxhT8ZxTnpjq/Mvbh/oVBj+A+If4fEwBA7SGM ZdYhz3NZGl0JpWrcHmNEVBxkTNA60JDTmfFz27xrzMC6IQNv3vI1ujj/w8Bvflqc4Lmg d3Dw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=E+ERZ2hRVwLTq0tPehogwVolQ7yct/cbHqMNwQuCya8=; b=VJCKFKYniwnY6cDsdXAhXqSkm6drq34FcHFCFQ0jtV6v7HSYvsR8+BWwhA4UiLxlgw fC74jkc+XL5hqU5LWq+sghw0R4dxU+sDA9hKljImMnfni0XsB0bbZwhyFQjQ1Vtrxr/W fTGzSX07rE6jMMYKv/saxxsEoKs2CnOx7q0TDjaC2aWjCGeEZMaZR3MEm/DLQ8qnuwYs GGVTjsOWM4q6kWqKpoeEQSOXOGR0SWMJe7hqqTZerrQbrplSQtxlqX9KGJhhICUm7+Uy sQUao1aHQpf0oarvlUbvJ3Uw4G/Xz1muAeoVbxQTpI2fmDA/h/56Q3A7B6pRD0zx0Pql xKtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=K1kjF7Pe; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ob16-20020a17090b391000b0024753ec4dccsi10902258pjb.124.2023.05.04.12.56.54; Thu, 04 May 2023 12:57:14 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=K1kjF7Pe; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231896AbjEDT4j (ORCPT + 99 others); Thu, 4 May 2023 15:56:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42788 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231980AbjEDTzA (ORCPT ); Thu, 4 May 2023 15:55:00 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B3F871AEF8; Thu, 4 May 2023 12:48:25 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2B246637E4; Thu, 4 May 2023 19:48:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BD2B4C433D2; Thu, 4 May 2023 19:48:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1683229699; bh=FvrSJUikkWNbNIQ3+qrp1LMbtL1YCbI/C8cobqun7mc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K1kjF7Pezj/h3RLjFYyYVBqYgDhoAAThAS0xH8uVn6JEBjgbaqyt20ZoF6ZJNFFjp qxb5k3ocIhb+7Q3yWKN+bNrSg1CT37TV0We9xGsjXXmJPQmHSNHnyy3kE7+mRitfg9 8uybE9NT9UU5rXlCezCq1Z+Npcn9CQPJqz6rLhmpLjXjSfnjyi6AXdDLjPdNuZs6i6 4qaZsoVZGb3qePGqMaDaQHEk2ihPpsTKeNmdohbdSfIJXFE5W9YbT5kkoWZE01swvK pD9Fx5YcczeG2MjxzKUXlBJvnF38y48XBNnwlktFfMlbiG/SMBmmJ3tYMfSaX7lwZu HTv2EPa74gQiw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Raul Cheleguini , imoc , Luiz Augusto von Dentz , Sasha Levin , marcel@holtmann.org, johan.hedberg@gmail.com, luiz.dentz@gmail.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, linux-bluetooth@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH AUTOSEL 6.1 47/49] Bluetooth: Add new quirk for broken set random RPA timeout for ATS2851 Date: Thu, 4 May 2023 15:46:24 -0400 Message-Id: <20230504194626.3807438-47-sashal@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230504194626.3807438-1-sashal@kernel.org> References: <20230504194626.3807438-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, 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: Raul Cheleguini [ Upstream commit 91b6d02ddcd113352bdd895990b252065c596de7 ] The ATS2851 based controller advertises support for command "LE Set Random Private Address Timeout" but does not actually implement it, impeding the controller initialization. Add the quirk HCI_QUIRK_BROKEN_SET_RPA_TIMEOUT to unblock the controller initialization. < HCI Command: LE Set Resolvable Private... (0x08|0x002e) plen 2 Timeout: 900 seconds > HCI Event: Command Status (0x0f) plen 4 LE Set Resolvable Private Address Timeout (0x08|0x002e) ncmd 1 Status: Unknown HCI Command (0x01) Co-developed-by: imoc Signed-off-by: imoc Signed-off-by: Raul Cheleguini Signed-off-by: Luiz Augusto von Dentz Signed-off-by: Sasha Levin --- drivers/bluetooth/btusb.c | 1 + include/net/bluetooth/hci.h | 8 ++++++++ net/bluetooth/hci_sync.c | 6 +++++- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index 3991dcd2ebf79..faad19b396d50 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c @@ -4020,6 +4020,7 @@ static int btusb_probe(struct usb_interface *intf, /* Support is advertised, but not implemented */ set_bit(HCI_QUIRK_BROKEN_ERR_DATA_REPORTING, &hdev->quirks); set_bit(HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER, &hdev->quirks); + set_bit(HCI_QUIRK_BROKEN_SET_RPA_TIMEOUT, &hdev->quirks); set_bit(HCI_QUIRK_BROKEN_EXT_SCAN, &hdev->quirks); } diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h index f80ae7d237342..b350d92136c8d 100644 --- a/include/net/bluetooth/hci.h +++ b/include/net/bluetooth/hci.h @@ -301,6 +301,14 @@ enum { * don't actually support features declared there. */ HCI_QUIRK_BROKEN_LOCAL_EXT_FEATURES_PAGE_2, + + /* + * When this quirk is set, the HCI_OP_LE_SET_RPA_TIMEOUT command is + * skipped during initialization. This is required for the Actions + * Semiconductor ATS2851 based controllers, which erroneously claims + * to support it. + */ + HCI_QUIRK_BROKEN_SET_RPA_TIMEOUT, }; /* HCI device flags */ diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c index 9361fb3685cc7..e8b78104a4071 100644 --- a/net/bluetooth/hci_sync.c +++ b/net/bluetooth/hci_sync.c @@ -4075,7 +4075,8 @@ static int hci_le_set_rpa_timeout_sync(struct hci_dev *hdev) { __le16 timeout = cpu_to_le16(hdev->rpa_timeout); - if (!(hdev->commands[35] & 0x04)) + if (!(hdev->commands[35] & 0x04) || + test_bit(HCI_QUIRK_BROKEN_SET_RPA_TIMEOUT, &hdev->quirks)) return 0; return __hci_cmd_sync_status(hdev, HCI_OP_LE_SET_RPA_TIMEOUT, @@ -4515,6 +4516,9 @@ static const struct { "HCI Set Event Filter command not supported."), HCI_QUIRK_BROKEN(ENHANCED_SETUP_SYNC_CONN, "HCI Enhanced Setup Synchronous Connection command is " + "advertised, but not supported."), + HCI_QUIRK_BROKEN(SET_RPA_TIMEOUT, + "HCI LE Set Random Private Address Timeout command is " "advertised, but not supported.") }; -- 2.39.2