From patchwork Mon Dec 25 20:21:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Felix Zhang X-Patchwork-Id: 13504728 Received: from mx.mrman314.tech (unknown [135.0.77.242]) (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 906E052F93; Mon, 25 Dec 2023 20:21:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=mrman314.tech Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=mrman314.tech Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=mrman314.tech header.i=@mrman314.tech header.b="LM/63485" Received: from [192.168.6.27] (unknown [160.32.192.137]) by mx.mrman314.tech (Postfix) with ESMTPSA id BCBCB2F491D8; Mon, 25 Dec 2023 15:21:04 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mrman314.tech; s=default; t=1703535665; bh=yauFSrZ35qZveVfrCHmJZPgq1pMyNFwrF76x3pw4ntY=; h=Subject:From:To:Cc:Date; b=LM/63485/ppUMvKkHXbaHXSgTFr9quhNmfd7vHAbg4xOme4Wh9TcLwcmgDbvTf4GX wQEcfarwbaVXxnkLSJSY9yUMd2ES+sq9TPhsR4nDVi2LJAdqv1v1t0yz9JRRF+voBT koRTiG+gA2kzJNVOFMLkbMge70mVv5s+si8NPtwU= Message-ID: Subject: [PATCH v4] Bluetooth: Fix Bluetooth for BCM4377 on T2 Intel MacBooks From: Felix Zhang To: linux-bluetooth@vger.kernel.org Cc: stable@vger.kernel.org, marcan@marcan.st, bagasdotme@gmail.com, sven@svenpeter.dev, alyssa@rosenzweig.io, marcel@holtmann.org, johan.hedberg@gmail.com, luiz.dentz@gmail.com, orlandoch.dev@gmail.com, kekrby@gmail.com, admin@kodeit.net, j@jannau.net, gargaditya08@live.com, asahi@lists.linux.dev, linux-kernel@vger.kernel.org Date: Mon, 25 Dec 2023 15:21:04 -0500 Autocrypt: addr=mrman@mrman314.tech; prefer-encrypt=mutual; keydata=mQGNBGUsCUUBDACnhuspj8JCsQgAs2xjCKTjw7WC9ku9/8q6Mv+OtDnvrp92Kw7lv00t/8UIw3bHEwkPgJcO6o4q1VwsqqsxDUsmr/b9tbBdxMNwvMrVf4KooF/AtwSQ8QQcWolPOIfO4O/I9oMoynpBGp8T1pJyhcZ7HzeRIEifxTal+Z5vvDX/Tknc9KMsZWxqdSaxLUm906utKLVzDsg7F/CUrdt4LGbMDO+R2ace8V7+dkSoQPrSiGY3hD1Pr2LRHaklYmytpgRvLNeB4nqDMV29xSLdYg5MlHUfFN9WCeiLED1uaVkpZRDQARPQANilxR13eN3RjElCAl9OSBHmC8E/9mOx4RE51pvOMJ3bUKuGBoZexO4KU+l3XXar02qtySLFQDh/FX222yWXuwlml4O7vjaXFLC1xMWgeBg47iT6RzQ/cvL9Z27bPu2XbQpNRMjvs3hgZV9KMPeJ0Tn/jBMTAj/x5CzvXCGLxp6nZRum8CmJ3Zn+GdDt07OvEO97uE4wneNELQsAEQEAAbQiZmVsaXggKGJhbGwpIDxtcm1hbkBtcm1hbjMxNC50ZWNoPokBzgQTAQgAOBYhBBuvsei2n9NslousW/bR59FOoklFBQJlLAlFAhsDBQsJCAcCBhUKCQgLAgQWAgMBAh4BAheAAAoJEPbR59FOoklFo7gL/2y6abLq2p68qk5c1YIXpXy+pUNILLZgqa6B/IcUXZIwPX1zXzi13fIioLHmJaofGwHNMcz9V1/ei+mFRSZS28YKfcrFIcpBTh7SrVpC3hrMdkqEO3N7HXkHUX1mfhUOFSfyHqxD9Cpw1coAnkjciQB6gYCuCsPwTgJjKJb5SwFT6F/LjOmJCkAvZAoY2hnYeNyzmz/Fbm8HAYZPzBc36IifSyU5ejtGB3ej5gv9IiouveTT96DX/VGxHpRoAdOywUHI7xGpNxOOPHHTNREdFZJVTKLYoA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4JtTQ3ZUt/1VA+VtRZjBDB2DaQqQo03WHuqRernqDRVaP1iuFwpw+tzySXx+u3Q5rNCdT7DFqxh4l2FkqgSKRJSAmt5urvTuKw4TGJnmH8yPm/iKHfodnSyvR+V2J3Aa7Cgl197qpwbzdkaqTHL3+w05SE2SEdPcPY8XSxAj3nojqwg3HNjL2bAeMftQQuelLFHN6meDDSEqEn2HSAf+O4mOcjTsC1aQiiGM3bTdnEyboQgXALDc+W5EQo= User-Agent: Evolution 3.50.2 Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Starting v6.5, Bluetooth does not work at all on my T2 MacBookAir9,1 with the BCM4377 chip.  When I boot up the computer, go into bluetoothctl, and then try to run commands like scan on, show, list, it returns "No default controller available."  I have tried reloading the kernel module, in which the log outputs "{Added,Removed} hci0 (unconfigured)."  With this patch, I am able to use Bluetooth as normal without any errors regarding hci0 being unconfigured.  However, an issue is still present where sometimes hci_bcm4377 will have to be reloaded in order to get bluetooth to work.  I believe this was still present before the previously mentioned commit. I would also like to thank Kerem Karabay for assisting me with this patch. Fixes: 6945795bc81a ("Bluetooth: fix use-bdaddr-property quirk") Cc: Signed-off-by: Felix Zhang Reviewed-by: Sven Peter Reviewed-by: Neal Gompa --- v4: * Adjust the format to pass the CI (again). * Shorten description ---  drivers/bluetooth/hci_bcm4377.c | 6 +++++-  1 file changed, 5 insertions(+), 1 deletion(-)   if (bcm4377->hw->broken_mws_transport_config) @@ -2465,6 +2467,7 @@ static const struct bcm4377_hw bcm4377_hw_variants[] = {   .has_bar0_core2_window2 = true,   .broken_mws_transport_config = true,   .broken_le_coded = true, + .use_bdaddr_property = true,   .send_calibration = bcm4378_send_calibration,   .send_ptb = bcm4378_send_ptb,   }, @@ -2479,6 +2482,7 @@ static const struct bcm4377_hw bcm4377_hw_variants[] = {   .clear_pciecfg_subsystem_ctrl_bit19 = true,   .broken_mws_transport_config = true,   .broken_le_coded = true, + .use_bdaddr_property = true,   .send_calibration = bcm4387_send_calibration,   .send_ptb = bcm4378_send_ptb,   }, diff --git a/drivers/bluetooth/hci_bcm4377.c b/drivers/bluetooth/hci_bcm4377.c index a61757835695..5c6fef1aa0f6 100644 --- a/drivers/bluetooth/hci_bcm4377.c +++ b/drivers/bluetooth/hci_bcm4377.c @@ -513,6 +513,7 @@ struct bcm4377_hw {   unsigned long broken_ext_scan : 1;   unsigned long broken_mws_transport_config : 1;   unsigned long broken_le_coded : 1; + unsigned long use_bdaddr_property : 1;     int (*send_calibration)(struct bcm4377_data *bcm4377);   int (*send_ptb)(struct bcm4377_data *bcm4377, @@ -2368,5 +2369,6 @@ static int bcm4377_probe(struct pci_dev *pdev, const struct pci_device_id *id)   hdev->set_bdaddr = bcm4377_hci_set_bdaddr;   hdev->setup = bcm4377_hci_setup;   - set_bit(HCI_QUIRK_USE_BDADDR_PROPERTY, &hdev->quirks); + if (bcm4377->hw->use_bdaddr_property) + set_bit(HCI_QUIRK_USE_BDADDR_PROPERTY, &hdev->quirks);