All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Loic Poulain" <loic.poulain@oss.qualcomm.com>
Cc: linux-pci@vger.kernel.org, devicetree@vger.kernel.org,
	robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v8 5/8] Bluetooth: hci_qca: Support QCA2066 on M.2 connector via pwrseq
Date: Mon, 23 Nov 2026 10:37:46 +0000	[thread overview]
Message-ID: <sashiko-outbox-229057@kernel.org> (raw)
In-Reply-To: <20261123-monza-wireless-v8-5-a8b38604be6c@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 3 potential
issues to consider:
- [High] Bluetooth: hci_qca: unguarded QCA6390 and default cases in
  qca_serdev_probe()
- [Medium] Bluetooth: hci_qca: stale QCA2066 default-branch logic in
  qca_power_on()
- [Medium] Bluetooth: hci_qca: asymmetric bt_en GPIO handling in
  qca_power_off()
--

commit 85edd5303f1b81a5f668119805aeb29135fdf56f
Author: Loic Poulain <loic.poulain@oss.qualcomm.com>

Bluetooth: hci_qca: Support QCA2066 on M.2 connector via pwrseq

This commit moves the M.2 pwrseq lookup in qca_serdev_probe() ahead of the
SoC type switch and enables pwrseq in the default branch of qca_power_on().

> diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
> index 08efce663eea4..f8b572a5c3d2d 100644
> --- a/drivers/bluetooth/hci_qca.c
> +++ b/drivers/bluetooth/hci_qca.c
> @@ -1907,6 +1907,9 @@ static int qca_power_on(struct hci_dev *hdev)
>  			/* Controller needs time to bootup. */
>  			msleep(150);
>  		}
> +
> +		if (qcadev->bt_power.pwrseq)
> +			ret = pwrseq_enable(qcadev->bt_power.pwrseq);
>  	}
>  
>  	clear_bit(QCA_BT_OFF, &qca->flags);

[Severity: Medium]
Does QCA_QCA2066 ever reach the default branch of qca_power_on()?

Commit a57a255ce204 ("Bluetooth: hci_qca: Reopen the UART after enabling
QCA2066") already added QCA_QCA2066 to the switch cases in qca_power_on()
(calling qca_regulator_init()) and qca_serdev_probe(), and the earlier patch
in this series, commit "Bluetooth: hci_qca: Add M.2 Bluetooth device support
using pwrseq", already factored out qca_serdev_get_m2_pwrseq(). As a result,
this branch is only reached by QCA_ROME devices, where calling
pwrseq_enable() directly bypasses the UART close/reopen performed by
qca_regulator_init().

[Severity: Medium]
Can qca_power_off() leave qcadev->bt_en asserted when a default-branch SoC
has both bt_en and pwrseq?

The default branch of qca_serdev_probe() still acquires qcadev->bt_en even
when qcadev->bt_power.pwrseq is populated, and qca_power_on() asserts
qcadev->bt_en before calling pwrseq_enable(). However, qca_power_off()
returns early after disabling pwrseq without driving qcadev->bt_en low:

drivers/bluetooth/hci_qca.c:qca_power_off() {
    ...
	if (power->pwrseq) {
		pwrseq_disable(power->pwrseq);
		set_bit(QCA_BT_OFF, &qca->flags);
		return;
        }
    ...
	default:
		gpiod_set_value_cansleep(qcadev->bt_en, 0);
	}
}

[ ... ]

> @@ -2501,6 +2507,10 @@ static int qca_serdev_probe(struct serdev_device *serdev)
>  	else
>  		qcadev->btsoc_type = QCA_ROME;
>  
> +	err = qca_serdev_get_m2_pwrseq(qcadev);
> +	if (err)
> +		return err;
> +
>  	switch (qcadev->btsoc_type) {
>  	case QCA_WCN3950:
>  	case QCA_WCN3988:
> @@ -2511,13 +2521,9 @@ static int qca_serdev_probe(struct serdev_device *serdev)
>  	case QCA_QCA2066:
>  	case QCA_WCN6855:
>  	case QCA_WCN7850:
> -		if (qca_serdev_is_m2(serdev)) {
> -			err = qca_serdev_get_m2_pwrseq(qcadev);
> -			if (err)
> -				return err;
> -
> +		/* M.2 connector modules are powered by the pwrseq acquired above. */
> +		if (qcadev->bt_power.pwrseq)
>  			break;
> -		}
>  
>  		if (!device_property_present(&serdev->dev, "enable-gpios")) {
>  			/*

[Severity: High]
Does hoisting qca_serdev_get_m2_pwrseq() before the switch break M.2 probe
for QCA_QCA6390 and fail to skip legacy resource acquisition in the default
case?

Only the QCA_WCN3950..QCA_WCN7850 switch arm checks qcadev->bt_power.pwrseq
and breaks out:

drivers/bluetooth/hci_qca.c:qca_serdev_probe() {
    ...
	case QCA_QCA6390:
		if (dev_of_node(&serdev->dev)) {
			qcadev->bt_power.pwrseq = devm_pwrseq_get(&serdev->dev,
								  "bluetooth");
			if (IS_ERR(qcadev->bt_power.pwrseq))
				return PTR_ERR(qcadev->bt_power.pwrseq);
			break;
		}
		fallthrough;

	default:
		qcadev->bt_en = devm_gpiod_get_optional(&serdev->dev, "enable",
					       GPIOD_OUT_LOW);
    ...
}

For QCA_QCA6390 on an M.2 connector with an OF node, case QCA_QCA6390
overwrites the M.2 "uart" pwrseq handle acquired from &serdev->ctrl->dev
with devm_pwrseq_get(&serdev->dev, "bluetooth") and aborts probe when the
child node has no "bluetooth" target. For QCA_ROME (default), probe still
acquires the legacy enable GPIO and susclk instead of breaking out when
qcadev->bt_power.pwrseq is already set.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261123-monza-wireless-v8-0-a8b38604be6c@oss.qualcomm.com?part=5

  reply	other threads:[~2026-11-23 10:37 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-23 10:25 [PATCH v8 0/8] arm64: dts: monaco-arduino-monza: Add support for LGA WiFi/BT module Loic Poulain
2026-11-23 10:25 ` [PATCH v8 1/8] Bluetooth: hci_qca: Add M.2 Bluetooth device support using pwrseq Loic Poulain
2026-11-23 11:33   ` arm64: dts: monaco-arduino-monza: Add support for LGA WiFi/BT module bluez.test.bot
2026-11-23 10:25 ` [PATCH v8 2/8] Bluetooth: hci_qca: Rename 'power_ctrl_enabled' to 'bt_en_available' Loic Poulain
2026-11-23 10:25 ` [PATCH v8 3/8] Bluetooth: hci_qca: Set 'bt_en_available' from pwrseq controllability Loic Poulain
2026-11-23 10:25 ` [PATCH v8 4/8] Bluetooth: hci_qca: Embed bt_power in struct qca_serdev Loic Poulain
2026-11-23 10:25 ` [PATCH v8 5/8] Bluetooth: hci_qca: Support QCA2066 on M.2 connector via pwrseq Loic Poulain
2026-11-23 10:37   ` sashiko-bot [this message]
2026-11-23 10:25 ` [PATCH v8 6/8] Bluetooth: hci_qca: Flatten struct qca_power into struct qca_serdev Loic Poulain
2026-11-23 10:25 ` [PATCH v8 7/8] dt-bindings: connector: pcie-m2-e: Add vendor LGA connector compatible Loic Poulain
2026-11-23 10:25 ` [PATCH v8 8/8] arm64: dts: qcom: monaco-arduino-monza: Add QCA2066 M.2 WiFi/BT support Loic Poulain
2026-11-23 10:37 ` [PATCH v8 0/8] arm64: dts: monaco-arduino-monza: Add support for LGA WiFi/BT module sashiko-bot

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=sashiko-outbox-229057@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=loic.poulain@oss.qualcomm.com \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.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.