Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp2459986rdb; Mon, 25 Dec 2023 12:01:58 -0800 (PST) X-Google-Smtp-Source: AGHT+IEGvWYjs6EmYbObWGS5VGeodJt4KEoYx7NICtOlciZxWHaZZLiP+NzZadHd0O9RvxO/g/rf X-Received: by 2002:a05:620a:1122:b0:77f:8e5d:8722 with SMTP id p2-20020a05620a112200b0077f8e5d8722mr7419382qkk.63.1703534517839; Mon, 25 Dec 2023 12:01:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703534517; cv=none; d=google.com; s=arc-20160816; b=cU4QYeNAKcWes0bFvVFYRCmtZct+fQg3BUBI1LLX+JHF3KaLoD1me+teN/K5aoRz4v 816HwSNjzOr6uB5JdJA3YtuMisxpM8+x+Zqu5siCiNDC2a+5WGYSbSi8qQSTZ48tOKxQ UNUbldd5sPq3YhBNL/KQBcC7V6JUfaj4bvqnjc7JkffGCkjqupkkzSVqmqiap/wJPKFj EXL4uMtk/d0ADxdQn8bBIFcaxdoYsRz14o8xhyF3bH6LY0WB/2aZFjFy201NsshFEZdy +pacGHX95/fdn77V2t+5s0eknVokRMB+u1x5yGNk6BVkCgw4KKpCvtt1NgA2jQzjO5ZN r5fQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :user-agent:content-transfer-encoding:autocrypt:date:cc:to:from :subject:message-id:dkim-signature; bh=kft7fyQ45rsmR6RoSOId1iWRjXoj3GJc3v+YOJZ2rhc=; fh=53j6tDfTq8iISs52tIYxfRtthtsZcuiC6Y+YL2uGYIU=; b=nvJwJeJz94vYnPXhi4BZrCEh1p60V530odnsruNDWa1lfOuzWR8FyrmwITA3JeCtAC ihGsf/TLpMvsmcGrF5FSZTBBlx3CQk5NJE5SwSFvpVYUFHEIygzGOKd0Y3jBI9iIdGtA BfW2mxUcMbpaWGWPrV3I/MJKcm/hVgOYU3Okvw1qEIxD24/DtDVBh399OzQRJumwJW31 +eQQ0USLb4fzKfbCcdF3H2tO/x8xNSzF9sUPUKfTVJuuL/TTfa8zkZT0dv0GL65JAjf0 b7QxiSOr9Hk4+484drrP8MZf+77AMPhZEqBJX7kHoGy6/uoTLoLCpwgVs2qcrDN1A8JE DNJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mrman314.tech header.s=default header.b=2vh2F2sf; spf=pass (google.com: domain of linux-bluetooth+bounces-733-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-733-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=mrman314.tech Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id vq22-20020a05620a559600b0077f04dc5d27si10903512qkn.112.2023.12.25.12.01.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Dec 2023 12:01:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-bluetooth+bounces-733-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@mrman314.tech header.s=default header.b=2vh2F2sf; spf=pass (google.com: domain of linux-bluetooth+bounces-733-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-bluetooth+bounces-733-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=mrman314.tech 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 8A5FC1C20E8A for ; Mon, 25 Dec 2023 20:01:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A42555380C; Mon, 25 Dec 2023 20:01:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=mrman314.tech header.i=@mrman314.tech header.b="2vh2F2sf" X-Original-To: linux-bluetooth@vger.kernel.org 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 9A05C537F8; Mon, 25 Dec 2023 20:01:45 +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 Received: from [192.168.6.27] (unknown [160.32.192.137]) by mx.mrman314.tech (Postfix) with ESMTPSA id 4B4B82F4127F; Mon, 25 Dec 2023 15:01:37 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mrman314.tech; s=default; t=1703534498; bh=HGRyqV7DcGb8aHF62Jx1i+xG/Q9Evhw8BLp5rP7bfO0=; h=Subject:From:To:Cc:Date; b=2vh2F2sfJqNEWXSd18j7BLe0F6x98b7u+5bPmWnbMvDmyXMUCZjy5wQaJo9WJV+tb N+8rXNUZdc2HIzP/vXfAmuE+iLndseYEusCXAA8ucIakhKbYjPPhskQlHDElWNQeOs 0BT0EnIlzxt+jAbvR0hVkn5lLy+/p/dqKwYZiivE= Message-ID: <77419ffacc5b4875e920e038332575a2a5bff29f.camel@mrman314.tech> Subject: [PATCH v3] 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:01:33 -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/Fbm8HAYZPzBc36IifSyU5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wwFAQH9NeU0MewpyrmGuuebtl5oUiNWf4lcEdDKco+LO04pM7v12268M4VsCIqItWQTJ4JtTQ3ZUt/1VA+VtRZjBDB2DaQqQo03WHuqRernqDRVaP1iuFwpw+tzySXx+u3Q5rNCdT7DFqxh4l2FkqgSKRJSAmt5urvTuKw4TGJnmH8yPm/iKHfodnSyvR+V2J3Aa7Cgl197qpwbzdkaqTHL3+w05SE2SEdPcPY8XSxAj3nojqwg3HNjL2bAeMftQQuelLFHN6meDDSEqEn2HSAf+O4mOcjTsC1aQiiGM3bTdnEyboQgXALDc+W5EQo= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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=C2=A0returns "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=C2=A0 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. Due to the bit HCI_QUIRK_USE_BDADDR_PROPERTY being always set in drivers/bluetooth/hci_bcm4377.c (line 2371), the chip would be left unconfigured on kernels compiled after commit 6945795bc81a ("Bluetooth:=C2=A0 fix use-bdaddr-property quirk") due to a change in its logic. On the M1 Macs, the device would be configured in the devicetree. However, that is not the case on T2 Macs. Because the bluetooth adapter is left=C2=A0 unconfigured, it is not usable in the operating system. In order to circumvent this issue, a flag is added to prevent the bit from being set on the BCM4377, while setting it on the other devices. Because I do not have an M1 device to test this patch on, I am not sure whether the patch breaks anything for said devices. I would be very grateful if anyone is willing to test this patch on their M1 device. I would also like to thank Kerem Karabay for assisting me with this patch. Fixes: 6945795bc81a ("Bluetooth: fix use-bdaddr-property quirk") Signed-off-by: Felix Zhang --- v3: * Adjust the format to pass the CI (again). --- drivers/bluetooth/hci_bcm4377.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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; =20 int (*send_calibration)(struct bcm4377_data *bcm4377); int (*send_ptb)(struct bcm4377_data *bcm4377, @@ -2368,7 +2369,8 @@ static int bcm4377_probe(struct pci_dev *pdev, const struct pci_device_id *id) hdev->set_bdaddr =3D bcm4377_hci_set_bdaddr; hdev->setup =3D bcm4377_hci_setup; =20 - set_bit(HCI_QUIRK_USE_BDADDR_PROPERTY, &hdev->quirks); + if (bcm4377->hw->use_bdaddr_property) + set_bit(HCI_QUIRK_USE_BDADDR_PROPERTY, &hdev->quirks); if (bcm4377->hw->broken_mws_transport_config) set_bit(HCI_QUIRK_BROKEN_MWS_TRANSPORT_CONFIG, &hdev- >quirks); if (bcm4377->hw->broken_ext_scan) @@ -2465,6 +2467,7 @@ static const struct bcm4377_hw bcm4377_hw_variants[] =3D { .has_bar0_core2_window2 =3D true, .broken_mws_transport_config =3D true, .broken_le_coded =3D true, + .use_bdaddr_property =3D true, .send_calibration =3D bcm4378_send_calibration, .send_ptb =3D bcm4378_send_ptb, }, @@ -2479,6 +2482,7 @@ static const struct bcm4377_hw bcm4377_hw_variants[] =3D { .clear_pciecfg_subsystem_ctrl_bit19 =3D true, .broken_mws_transport_config =3D true, .broken_le_coded =3D true, + .use_bdaddr_property =3D true, .send_calibration =3D bcm4387_send_calibration, .send_ptb =3D bcm4378_send_ptb, }, --=20 2.43.0