Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp263431lqb; Thu, 23 May 2024 18:31:53 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVLj7pwVLYIQXUIVANnbHezPFdoXbbtdH0qqTtnQ8fqUC+T4DTuDTdeLshgaMc64xQ5ghEQbJ83T0/tUHz76lClhVctYcw/4NuDpiB6rA== X-Google-Smtp-Source: AGHT+IFQFoKMBjn9E7/TLxpofMLb35gR7WhE9tr5+MXVKGrVXuX4gfZU5nGydDqk2/vi2qLiuGsz X-Received: by 2002:a2e:7a0a:0:b0:2d8:713c:8313 with SMTP id 38308e7fff4ca-2e95b278476mr3256031fa.45.1716514313105; Thu, 23 May 2024 18:31:53 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716514313; cv=pass; d=google.com; s=arc-20160816; b=Mft+buqQQ82p9ThbFPHBC8CdCMg1fQPk83OpnyzuQJ+ufNQynKHi+FsNcyEYZ2y9yu SxL0X/3BvstBIe8upWSh+s6z7ve6PKtredaCExKqlqeVZA4espB7bwnrTToXGrNaekbB b3oxlNulR5vXb4LcVa4dF/TCtLruTsOAmnFcbeYdK6p+umq0KpZ6oNZZNq+WeLrFVdBy O1krlDBSKLLdOtSrngaos1D+iF6SdPtsqy4BRZEk99/35hye87120w0sWJ+g1oV/pgxP Ypbt11nHwEB7y+n1oyYZF4oM9A9RhP6dKJu8CgLemJ9n2Eh3KV6nuE+E4D57CTJtfWdi n3xA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=DjdDRhXn4YoOESNuDfKZ3/8I5g3PSEDpDvDA+CIY3fI=; fh=r+caDsybghXgprPPVIsvCi17UuwbYbfFTkHa5g8OjQY=; b=dueXBLY1hkbpB9cPZcDAO+5w+Xy1gL07VDSPzI/A4I3nALO971LaKIF3T0yrUydDOb 8pZufdsikV8R59bQ2uPgPRIF2KlEDHf56GPrun6XTAeRRbgmvbu1C0E+pnH4MC37NiM/ /GRN6dHjaLQQCcy1uYISRdstnIqWGrG+3G2OV0Bq0h6IZ3qKneMZ3dIqoIfEIWPdFo9M L3VWlpwMQJSXHA3oQWojt2D1JziX7PNnkvHNAbIod8PcZCXOu1b9OIPos9PpSy20ZODv SWubAnZ7/ux8KTs/B2ErZHbh1z7oNTQ6rgweMVmcCjBVc6e9zqoDpABTY8JgGVAQ3xv9 JeFg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@infineon.com header.s=IFXMAIL header.b=iXMNXKYv; arc=pass (i=1 spf=pass spfdomain=infineon.com dkim=pass dkdomain=infineon.com dmarc=pass fromdomain=infineon.com); spf=pass (google.com: domain of linux-bluetooth+bounces-4911-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-4911-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=infineon.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-578524b6a76si266785a12.506.2024.05.23.18.31.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 May 2024 18:31:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth+bounces-4911-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@infineon.com header.s=IFXMAIL header.b=iXMNXKYv; arc=pass (i=1 spf=pass spfdomain=infineon.com dkim=pass dkdomain=infineon.com dmarc=pass fromdomain=infineon.com); spf=pass (google.com: domain of linux-bluetooth+bounces-4911-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-4911-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=infineon.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id CA8221F23A58 for ; Fri, 24 May 2024 01:31:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6EB7CBA5E; Fri, 24 May 2024 01:31:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=infineon.com header.i=@infineon.com header.b="iXMNXKYv" X-Original-To: linux-bluetooth@vger.kernel.org Received: from smtp2.infineon.com (smtp2.infineon.com [217.10.52.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9728019B; Fri, 24 May 2024 01:31:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.10.52.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716514304; cv=none; b=sis75zSGjLsK7mBq0CqFt29ioq676qgiUHP8U3s8i8hunLfmhXm/CBBU6qgRHeNJltcIy5P7yxQZeIqlw3+TMKUWcn9zwu2SrogB09hjx7Zd/LATyNCOGOg1Q1K8tBu4VXbQswIGrTN+OtgcrGVf/hOgY+yjnPbGE204/hZNFfI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716514304; c=relaxed/simple; bh=hS8TiiH1WQ8HBxgia2bpb9rfgZ+xhKtMyuS/NsF3gWM=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=c8WBk/HTuqYJJhEAGy1wReSFBaAiw4Gas6gPQZPlbjoWCuCK3hdo2TbDUlc0Jh2t1MK59ePZaDRXsaCI7hFJDr35UMwVgH3f38esIsb0rVP/HOyZi8un47+cbLtap31iujnrMBDVTBb//TSQJgNQUPYxrq6zOU9fkLF8AYoi7k4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infineon.com; spf=pass smtp.mailfrom=infineon.com; dkim=pass (1024-bit key) header.d=infineon.com header.i=@infineon.com header.b=iXMNXKYv; arc=none smtp.client-ip=217.10.52.18 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infineon.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=infineon.com DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=infineon.com; i=@infineon.com; q=dns/txt; s=IFXMAIL; t=1716514303; x=1748050303; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=hS8TiiH1WQ8HBxgia2bpb9rfgZ+xhKtMyuS/NsF3gWM=; b=iXMNXKYv/NdsSrPihhOt166IdRrO/rNcgVpeimHp24gG79HSuS/XYA+o 5+YwQ+0VJLdEZKQEOJquGP5sm3Ro4JTduCWUWcVVS9LpevnAbQvpQZchT pOlgP6CgK+1umwWZoV4buZj+an0PJG7zaPffargNlKiJRCtMnkXt9ElGF c=; X-IronPort-AV: E=McAfee;i="6600,9927,11081"; a="76904617" X-IronPort-AV: E=Sophos;i="6.08,184,1712613600"; d="scan'208";a="76904617" Received: from unknown (HELO MUCSE814.infineon.com) ([172.23.29.40]) by smtp2.infineon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 May 2024 03:31:35 +0200 Received: from MUCSE832.infineon.com (172.23.7.104) by MUCSE814.infineon.com (172.23.29.40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Fri, 24 May 2024 03:31:34 +0200 Received: from icw-osk-deskmini.osa.infineon.com (10.161.6.196) by MUCSE832.infineon.com (172.23.7.104) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Fri, 24 May 2024 03:31:32 +0200 From: Nobuaki Tsunashima To: Marcel Holtmann , Luiz Augusto von Dentz CC: , , "Nobuaki Tsunashima" Subject: [PATCH v4] Bluetooth: btbcm: Apply HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER to CYW4373 Date: Fri, 24 May 2024 10:31:27 +0900 Message-ID: <20240524013127.434500-1-nobuaki.tsunashima@infineon.com> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: MUCSE824.infineon.com (172.23.29.55) To MUCSE832.infineon.com (172.23.7.104) From: Nobuaki Tsunashima CYW4373 ROM FW has an issue that it claims LE_Read_Transmit_Power command as supported in a response of Read_Local_Supported_Command command but rejects the LE_Read_Transmit_Power command with "Unknown HCI Command" status. Because Bluetooth driver of kernel 5.11 added sending the LE_Read_Transmit_Power command in initialize phase, hci up fails due to the issue. Especially in USB i/f case, it would be difficult to download patch FW that includes its fix unless hci is up. The driver already contains infrastructure to apply the quirk for the issue, but currently it only supports DMI based matching. Add support to match by chip id and baseline FW version to detect CYW4373 ROM FW build in generic system. Fixes: 7c395ea521e6 ("Bluetooth: Query LE tx power on startup") Signed-off-by: Nobuaki Tsunashima --- V3 -> V4: Fix a few coding style warnings and refine comments for clarify. V2 -> V3: Fix a few coding style warnings and change the subject as more specific. V1 -> V2: Fix several coding style warnings. drivers/bluetooth/btbcm.c | 32 +++++++++++++++++++++++++++++++- drivers/bluetooth/btusb.c | 4 ++++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/drivers/bluetooth/btbcm.c b/drivers/bluetooth/btbcm.c index 0a5445ac5e1b..29e3f83a19fa 100644 --- a/drivers/bluetooth/btbcm.c +++ b/drivers/bluetooth/btbcm.c @@ -437,18 +437,48 @@ static const struct dmi_system_id disable_broken_read_transmit_power[] = { { } }; +struct bcm_chip_version_table { + u8 chip_id; /* Chip ID */ + u16 baseline; /* Baseline version of patch FW */ +}; +#define BCM_ROMFW_BASELINE_NUM 0xFFFF +static const struct bcm_chip_version_table disable_broken_read_transmit_power_by_chip_ver[] = { + { 0x87, BCM_ROMFW_BASELINE_NUM } /* CYW4373/4373E */ +}; +static bool btbcm_is_disable_broken_read_tx_power_by_chip_ver(u8 chip_id, u16 baseline) +{ + int i; + size_t table_size = ARRAY_SIZE(disable_broken_read_transmit_power_by_chip_ver); + const struct bcm_chip_version_table *entry = + &disable_broken_read_transmit_power_by_chip_ver[0]; + + for (i = 0 ; i < table_size ; i++, entry++) { + if ((chip_id == entry->chip_id) && (baseline == entry->baseline)) + return true; + } + + return false; +} + static int btbcm_read_info(struct hci_dev *hdev) { struct sk_buff *skb; + u8 chip_id; + u16 baseline; /* Read Verbose Config Version Info */ skb = btbcm_read_verbose_config(hdev); if (IS_ERR(skb)) return PTR_ERR(skb); - + chip_id = skb->data[1]; + baseline = skb->data[3] | (skb->data[4] << 8); bt_dev_info(hdev, "BCM: chip id %u", skb->data[1]); kfree_skb(skb); + /* Check Chip ID and disable broken Read LE Min/Max Tx Power */ + if (btbcm_is_disable_broken_read_tx_power_by_chip_ver(chip_id, baseline)) + set_bit(HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER, &hdev->quirks); + return 0; } diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c index d31edad7a056..52561c8d8828 100644 --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c @@ -142,6 +142,10 @@ static const struct usb_device_id btusb_table[] = { { USB_VENDOR_AND_INTERFACE_INFO(0x04ca, 0xff, 0x01, 0x01), .driver_info = BTUSB_BCM_PATCHRAM }, + /* Cypress devices with vendor specific id */ + { USB_VENDOR_AND_INTERFACE_INFO(0x04b4, 0xff, 0x01, 0x01), + .driver_info = BTUSB_BCM_PATCHRAM }, + /* Broadcom devices with vendor specific id */ { USB_VENDOR_AND_INTERFACE_INFO(0x0a5c, 0xff, 0x01, 0x01), .driver_info = BTUSB_BCM_PATCHRAM }, -- 2.25.1