Received: by 2002:ab2:7855:0:b0:1f9:5764:f03e with SMTP id m21csp59466lqp; Tue, 21 May 2024 18:30:03 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUnJ0HV3Rrloh6i/dlBVtg2Joqls/7YFBOOpHqW9n0XLTV/Cy4hHnCqsJOMQ3xs48SXYc2NgrNmGZ3k/b3Ye8XiazW/7EraW/j7Hd0NGQ== X-Google-Smtp-Source: AGHT+IEv2xnxzW7cuUU+W/gHbE2XC/XVwmuOBExEDdj45rMFF+kIMIfcERX3munFSVi7mBE7yqUh X-Received: by 2002:a17:903:188:b0:1e9:664a:3d77 with SMTP id d9443c01a7336-1f31c9f503bmr5730785ad.69.1716341402515; Tue, 21 May 2024 18:30:02 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716341402; cv=pass; d=google.com; s=arc-20160816; b=DK+gyOaabwMXj5Ln/l7xHDWh4fXAazQ27jzDFQ6VdYpuIW5nBD8rJhZRLqGo6jPxlm P65Jg0UyDfVkGoyHtElYqRcUL/xnpGVDIVA6rHf5iXMRpo43sTjftdn+4pAtz7ngtPsb 2G5rrwS5JnbyEt+cDkKu2N0sFiZg1N03/j/gehS8FHqKDcQ6VnzMUDzVSnOxQyVBLnCe KTPKpwQIlx4yLy9Ot8fMRnWn4r54xeW1z5rRuWUh4w45CPFOlVADnoPqJlf8NupuNnv/ bdJByGm0GrIS+NAgea3p/IqlcaVODz8ZHfD9jZue5OD9rtNhjuogOsSLWcWqBXUflZv2 5fuQ== 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=S48HwVze0tC0vQi+ZjTYzaDtT4hvcJM7nVwaYQY0EJU=; fh=r+caDsybghXgprPPVIsvCi17UuwbYbfFTkHa5g8OjQY=; b=USWwEZz5K5HtGGg54aA2Xf6TO0YQcNBdjiUjUv195T18+YvOMhgCqBd8EmDaxuzYIc MfTjDhFQPvX4Fgi9Lrsntc9VfZQwlp8oQvRigI3RfQrY9/LhVHnUKwGCpIdI3tGiqYKm aXrXeK2gflWOtQwlFKFXDlj525Ond4zV61Bmpathdwy2C4Ky7SX8yqKqICcjHaBjcWG/ H0/bAZrxHYeyNsIQki5ccNJiRW2sYJ+MMfQ8RQrC70A33K0QGk9NoyMuFnM1gXQL5d9k rPKHntX/V76t2zdsd5aNaq7bf37bBXZV6SxclCjbkJQdy+yIRPX5MFoOJCB7R+a3oYpA 3Czw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@infineon.com header.s=IFXMAIL header.b="jILIC/mv"; 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-4850-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-4850-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=infineon.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id d9443c01a7336-1ef0c268577si23797985ad.577.2024.05.21.18.30.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 May 2024 18:30:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth+bounces-4850-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@infineon.com header.s=IFXMAIL header.b="jILIC/mv"; 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-4850-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-4850-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 2ABDC2810A2 for ; Wed, 22 May 2024 01:30:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 663154C6D; Wed, 22 May 2024 01:28:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=infineon.com header.i=@infineon.com header.b="jILIC/mv" X-Original-To: linux-bluetooth@vger.kernel.org Received: from smtp9.infineon.com (smtp9.infineon.com [217.10.52.204]) (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 83EC328EA; Wed, 22 May 2024 01:28:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.10.52.204 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716341327; cv=none; b=Df/IDMaHaR2zaVRKhmjWEV14cERvbjeyT2HQ7R8MKJlmZdwzvAYrMgNkEmxvRInTpk777MIHzlyfAhpNyzX24lExAVsaXLG9mI9Kjeo2N2b1ttyTbdaQl2SVZdzw+eW7P6scEBkiLbVzeJDa0csxYAHQD3MlKKmSVk7smosN2rM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716341327; c=relaxed/simple; bh=x2OX+yVenw6qmbZS4My6MkduStfU5KCOgXfHggeJ+u0=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=V7y9OJYm0XorYaDZj5SR4m3Fz3CoWQSElpiOfXu8TeadlvwtMrkyXIOITxY9DM4uZfoNoWVZ98kNNvWZiEkTelCZDNiJpltVbn15xArxlhrZBMeuDk9DjJ+T4mQBH2eMe3o5kDpscQiiu+LCvSO07e0QcvZH4rMPKAfpfbLCRno= 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=jILIC/mv; arc=none smtp.client-ip=217.10.52.204 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=1716341326; x=1747877326; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=x2OX+yVenw6qmbZS4My6MkduStfU5KCOgXfHggeJ+u0=; b=jILIC/mvXBLNeXT3PPk58BK8HRNH8GBK9MwvQzaqLb8DNen+esbzK6hc 6gAqDuOJDkWyNE0Wg3Nhoq9kSDpvG+JQD6EM/0vM9EhJTb1mxea8wRptH DNEDFHmUDjPiS2HGHiaFg7f0c9ALsbtQ0zxzn2fDyjPp5L8SsNtupGSGy s=; X-IronPort-AV: E=McAfee;i="6600,9927,11079"; a="19653651" X-IronPort-AV: E=Sophos;i="6.08,179,1712613600"; d="scan'208";a="19653651" Received: from unknown (HELO MUCSE805.infineon.com) ([172.23.29.31]) by smtp9.infineon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 May 2024 03:28:38 +0200 Received: from MUCSE832.infineon.com (172.23.7.104) by MUCSE805.infineon.com (172.23.29.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Wed, 22 May 2024 03:28:38 +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; Wed, 22 May 2024 03:28:35 +0200 From: Nobuaki Tsunashima To: Marcel Holtmann , Luiz Augusto von Dentz CC: , , "Nobuaki Tsunashima" Subject: [PATCH v3] Bluetooth: Apply HCI_QUIRK_BROKEN_READ_TRANSMIT_POWER to CYW4373 Date: Wed, 22 May 2024 17:17:35 +0900 Message-ID: <20240522081735.469503-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. Due to the issue, Bluetooth driver of 5.15 and later kernel fails to hci up. Especially in USB i/f case, it would be difficult to download patch FW that includes Its fix unless hci is up. The patch forces the driver to skip LE_Read_Transmit_Power Command when it detects CYW4373 with ROM FW build. Signed-off-by: Nobuaki Tsunashima --- 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..c763e368d6ad 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; + u16 baseline; +}; +#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; + int 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