All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johan Hovold <johan@kernel.org>
To: Paul Menzel <pmenzel@molgen.mpg.de>, Felix Zhang <mrman@mrman314.tech>
Cc: linux-bluetooth@vger.kernel.org, stable@vger.kernel.org,
	Johan Hovold <johan+linaro@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
Subject: Re: [PATCH v3] Bluetooth: Fix Bluetooth for BCM4377 on T2 Intel MacBooks
Date: Wed, 27 Dec 2023 11:30:14 +0100	[thread overview]
Message-ID: <ZYv8tp3fMiAqK8OI@hovoldconsulting.com> (raw)
In-Reply-To: <b0d94116-1fa0-4c1f-8a3e-2919fd75b635@molgen.mpg.de>

On Mon, Dec 25, 2023 at 09:26:05PM +0100, Paul Menzel wrote:

> Thank you very much for the patch. I am adding Johan to Cc field.

Thanks for the report. Guess I could use a break from the proverbial
eggnog.

> Am 25.12.23 um 21:01 schrieb Felix Zhang:
> > 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
> 
> Somehow a blank line snug in above.
> 
> > bluetoothctl, and then try to run commands like scan on, show, list,
> > it returns "No default controller available."  I have tried reloading
> > the
> 
> It’d be great if you reflowed for 75 characters per line (also below).
> 
> > 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.
> > 
> > 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:
> > 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
> > 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.

The commit you tracked this down to restored the original semantics for
HCI_QUIRK_USE_BDADDR_PROPERTY, which means that it should only be set
for devices with an invalid address.

The Broadcom BCM4377 driver has so far been setting this flag
unconditionally which now potentially results in also valid addresses
being marked as invalid.

I've just sent a patch that makes sure to only mark invalid addresses as
invalid:

	https://lore.kernel.org/lkml/20231227101003.10534-1-johan+linaro@kernel.org/

Note however that the flag still needs to be set in case your device
lacks storage for a unique device address so you cannot simply drop it
for some device classes as you do below (unless you are certain that
these devices will always have a valid address).

Devices without a valid address starts in an unconfigured state and
cannot be used until userspace has provided an address (e.g. using
btmgmt):

	btmgmt --index 0 public-addr 00:11:22:33:44:55

> > Fixes: 6945795bc81a ("Bluetooth: fix use-bdaddr-property quirk")
> > Signed-off-by: Felix Zhang <mrman@mrman314.tech>

> > @@ -2368,7 +2369,8 @@ 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);
> >   	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[] = {
> >   		.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,
> >   	},

Back to the eggnog.

Johan

  reply	other threads:[~2023-12-27 10:30 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-25 20:01 [PATCH v3] Bluetooth: Fix Bluetooth for BCM4377 on T2 Intel MacBooks Felix Zhang
2023-12-25 20:03 ` kernel test robot
2023-12-25 20:12 ` [v3] " bluez.test.bot
2023-12-25 20:26 ` [PATCH v3] " Paul Menzel
2023-12-27 10:30   ` Johan Hovold [this message]
2023-12-27 10:21 ` Neal Gompa
2023-12-28  9:46 Sven Peter
2023-12-28 12:10 ` Johan Hovold
2024-01-04  7:47   ` Aditya Garg
2024-01-04  7:50     ` Sven Peter
2024-01-04  8:21       ` Johan Hovold
2024-01-04  8:23         ` Sven Peter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZYv8tp3fMiAqK8OI@hovoldconsulting.com \
    --to=johan@kernel.org \
    --cc=admin@kodeit.net \
    --cc=alyssa@rosenzweig.io \
    --cc=asahi@lists.linux.dev \
    --cc=bagasdotme@gmail.com \
    --cc=gargaditya08@live.com \
    --cc=j@jannau.net \
    --cc=johan+linaro@kernel.org \
    --cc=johan.hedberg@gmail.com \
    --cc=kekrby@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luiz.dentz@gmail.com \
    --cc=marcan@marcan.st \
    --cc=marcel@holtmann.org \
    --cc=mrman@mrman314.tech \
    --cc=orlandoch.dev@gmail.com \
    --cc=pmenzel@molgen.mpg.de \
    --cc=stable@vger.kernel.org \
    --cc=sven@svenpeter.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.