arm64: dts: monaco-arduino-monza: Add support for LGA WiFi/BT module
Subsystems (7)
v7 cover arm64: dts: monaco-arduino-monza: Add support for LGA WiFi/BT module
This series describes support for the onboard WiFi/Bluetooth module present on the Arduino VENTUNO Q (monaco) platform.
The board provides LGA pads for a wireless module. On the VENTUNO Q these pads are populated with an NFA725B module featuring the QCA2066 WiFi/BT combo chip. While implemented as an LGA footprint, the design is functionally compatible with the M.2 Key E.
The NFA725B exposes WiFi over PCIe and Bluetooth over a UART. Both interfaces are gated through the W_DISABLE1# and W_DISABLE2# signals, as defined by the M.2 specification and handled here via the pcie-m2 power sequencer.
This series models the hardware using the existing pwrseq framework and connector bindings, allowing coordinated PCIe and UART bring-up.
---
Changes in v7:
- Rebased on linux-next (pwrseq changes dropped)
- Link to v6: https://lore.kernel.org/r/[email protected]
Changes in v6:
- Rebase onto v7.3-rc1: drop the now-upstream "power: sequencing: pcie-m2:
Add QCA2066 (QCNFA765) BT serdev ID" patch and adapt to the pwrseq_power_on()/pwrseq_power_off() -> pwrseq_enable()/pwrseq_disable()
rename that landed in this merge window.
- hci_qca: fully drop struct qca_power and move its fields directly into
struct qca_serdev, removing the bt_power indirection (Dmitry).
- Pick up Reviewed-by/Acked-by tags from Mani, Bartosz and Dmitry on the pwrseq_is_controllable() API, the pcie-m2/qcom-wcn controllability
reporting, the bt_en_available rework and the M.2 connector support
patches.
- Drop the pwrseq-m2-bt prerequisite series link, it is now merged upstream
and included in the v7.3-rc1 base.
- Link to v5: https://lore.kernel.org/r/[email protected]
Changes in v5:
- hci_qca: comment why the M.2 'uart' pwrseq lifetime is bound to the serdev consumer device instead of using devm_pwrseq_get() on the controller (Bartosz).
- hci_qca: note that dropping the always-on pwrseq handle is not a leak since
the descriptor is still released by devres (Bartosz).
- Link to v4: https://lore.kernel.org/r/[email protected]
Changes in v4:
- pwrseq: rename pwrseq_power_is_controllable() to pwrseq_is_controllable() (Bartosz).
- pwrseq: move the is_controllable() callback from the unit to the target (Bartosz).
- pwrseq: add might_sleep() and guard pwrseq_is_controllable() against
concurrent provider removal with rw_lock, matching pwrseq_power_on/off() (Bartosz).
- pwrseq: clarify the pwrseq_is_controllable() doc (Bartosz)
- hci_qca: lifetime follows the Bluetooth device rather than the UART controller (ChenYu).
- dt-bindings: also add the "qcom,pcie-m2-1620-lga-connector" compatible (Mani).
- arm64: dts: monaco-arduino-monza: rename the 'pcie_bridge_ep' endpoint to 'pcie_ep' (Mani).
- pwrseq: reword commmit message (Mani)
- Link to v3: https://lore.kernel.org/r/[email protected]
Changes in v3:
- Embed bt_power in struct qca_serdev instead of allocating it (Dmitry).
- Add generic pwrseq_is_controllable() API + per-target .is_controllable() callback; use it in hci_qca instead of peeking at the W_DISABLE2# property.
- Implement .is_controllable() in the pcie-m2 and qcom-wcn providers.
- Treat non-controllable BT power as always-on.
- Integrate the pending Bluetooth pwrseq patches from Mani.
- Link to v2: https://lore.kernel.org/r/[email protected]
Changes in v2:
- hci_qca: extract M.2 pwrseq into qca_serdev_get_m2_pwrseq() helper, called outside the SoC switch; drop duplicated of_graph logic and redundant
bt_power NULL checks (Dmitry/Mani)
- dts/bindings: use qcom,pcie-m2-1418-lga-connector (fallback
pcie-m2-e-connector) instead of the generic M.2 E-key compatible (Mani)
- Link to v1: https://lore.kernel.org/r/[email protected]
---
Loic Poulain (6):
Bluetooth: hci_qca: Set 'bt_en_available' based on pwrseq power controllability
Bluetooth: hci_qca: Embed bt_power in struct qca_serdev
Bluetooth: hci_qca: Support QCA2066 on M.2 connector via pwrseq
Bluetooth: hci_qca: Flatten struct qca_power into struct qca_serdev
dt-bindings: connector: pcie-m2-e: Add vendor LGA connector compatible
arm64: dts: qcom: monaco-arduino-monza: Add QCA2066 M.2 WiFi/BT support
Manivannan Sadhasivam (2):
Bluetooth: hci_qca: Add M.2 Bluetooth device support using pwrseq
Bluetooth: hci_qca: Rename 'power_ctrl_enabled' to 'bt_en_available'
.../bindings/connector/pcie-m2-e-connector.yaml | 8 +- arch/arm64/boot/dts/qcom/monaco-arduino-monza.dts | 64 ++++++++- drivers/bluetooth/hci_qca.c | 160 ++++++++++++--------- 3 files changed, 157 insertions(+), 75 deletions(-)
---
base-commit: f0406245cb9855e6318335a8a223551354291a46
change-id: 20260520-monza-wireless-e6ce7f013f38
Best regards,
Signature · 1 line
Loic Poulain <[email protected]>
PATCH v7 1/8 Bluetooth: hci_qca: Add M.2 Bluetooth device support using pwrseq
From: Manivannan Sadhasivam <[email protected]>
Power supply to the M.2 Bluetooth device attached to the host using M.2 connector is controlled using the 'uart' pwrseq device. So add support for getting the pwrseq device if the OF graph link is present. Once obtained, the existing pwrseq APIs can be used to control the power supplies of the M.2 card.
--- drivers/bluetooth/hci_qca.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
drivers/bluetooth/hci_qca.c +13 -0
@@ -25,6 +25,7 @@#include <linux/gpio/consumer.h> #include <linux/module.h> #include <linux/of.h> +#include <linux/of_graph.h> #include <linux/acpi.h> #include <linux/platform_device.h> #include <linux/pwrseq/consumer.h>
@@ -2454,6 +2455,18 @@ static int qca_serdev_probe(struct serdev_device *serdev)case QCA_WCN6750 :case QCA_WCN6855 :case QCA_WCN7850 : +/* +* OF graph link is only present for BT devices attached through +* the M.2 Key E connector. +*/ +if (of_graph_is_present (dev_of_node (&serdev->ctrl->dev))) { + qcadev->bt_power->pwrseq =devm_pwrseq_get (&serdev->ctrl->dev, +"uart" ); +if (IS_ERR (qcadev->bt_power->pwrseq)) +return PTR_ERR (qcadev->bt_power->pwrseq); +break ; + } +if (!device_property_present (&serdev->dev,"enable-gpios" )) {/* * Backward compatibility with old DT sources. If the
Signature · 1 line
2.34.1
[email protected]
AI reviewRe: [PATCH v7 1/8] Bluetooth: hci_qca: Add M.2 Bluetooth device support using pwrseq
Sashiko has reviewed this patch and found no issues. It looks great!
Quoted 11 lines
From: Manivannan Sadhasivam <[email protected]>
Power supply to the M.2 Bluetooth device attached to the host using M.2 connector is controlled using the 'uart' pwrseq device. So add support for getting the pwrseq device if the OF graph link is present. Once obtained, the existing pwrseq APIs can be used to control the power supplies of the M.2 card.
Reviewed-by Bartosz Golaszewski <[email protected]>Reviewed-by Dmitry Baryshkov <[email protected]>Signed-off-by Manivannan Sadhasivam <[email protected]>
Sashiko has reviewed this patch and found no issues. It looks great!
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
This is automated email and please do not reply to this email!
Dear submitter,
Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/series/1179616/
---Test result---
Test Summary:
CheckPatch PASS 5.40 seconds VerifyFixes PASS 0.09 seconds VerifySignedoff PASS 0.09 seconds GitLint FAIL 2.19 seconds SubjectPrefix FAIL 0.71 seconds BuildKernel FAIL 23.74 seconds CheckAllWarning FAIL 26.98 seconds CheckSparse FAIL 29.70 seconds BuildKernel32 FAIL 25.13 seconds CheckKernelLLVM FAIL 27.74 seconds TestRunnerSetup FAIL 758.78 seconds TestRunner_l2cap-tester FAIL 0.10 seconds TestRunner_iso-tester FAIL 0.12 seconds TestRunner_bnep-tester FAIL 0.10 seconds TestRunner_mgmt-tester FAIL 0.25 seconds TestRunner_rfcomm-tester FAIL 0.10 seconds TestRunner_sco-tester FAIL 0.10 seconds TestRunner_ioctl-tester FAIL 0.09 seconds TestRunner_mesh-tester FAIL 0.10 seconds TestRunner_smp-tester FAIL 0.10 seconds TestRunner_userchan-tester FAIL 0.10 seconds TestRunner_6lowpan-tester FAIL 0.10 seconds IncrementalBuild FAIL 31.81 seconds
Details
##############################
Test: GitLint - FAIL
Desc: Run gitlint
Output:
[v7,3/8] Bluetooth: hci_qca: Set 'bt_en_available' based on pwrseq power controllability
1: T1 Title exceeds max length (88>80): "[v7,3/8] Bluetooth: hci_qca: Set 'bt_en_available' based on pwrseq power controllability"
##############################
Test: SubjectPrefix - FAIL
Desc: Check subject contains "Bluetooth" prefix
Output:
"Bluetooth: " prefix is not specified in the subject
"Bluetooth: " prefix is not specified in the subject
##############################
Test: BuildKernel - FAIL
Desc: Build Kernel for Bluetooth
Output:
drivers/bluetooth/hci_qca.c: In function ‘qca_serdev_probe’:drivers/bluetooth/hci_qca.c:2557:35: error: implicit declaration of function ‘pwrseq_is_controllable’ [-Wimplicit-function-declaration]
2557 | bt_en_available = pwrseq_is_controllable(qcadev->pwrseq);
| ^~~~~~~~~~~~~~~~~~~~~~make[4]: *** [scripts/Makefile.build:290: drivers/bluetooth/hci_qca.o] Error 1 make[3]: *** [scripts/Makefile.build:551: drivers/bluetooth] Error 2
make[2]: *** [scripts/Makefile.build:551: drivers] Error 2
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [/home/runner/work/bluetooth-next/bluetooth-next/src/src/Makefile:2229: .] Error 2
make: *** [Makefile:248: __sub-make] Error 2
##############################
Test: CheckAllWarning - FAIL
Desc: Run linux kernel with all warning enabled
Output:
drivers/bluetooth/hci_qca.c: In function ‘qca_serdev_probe’:drivers/bluetooth/hci_qca.c:2557:35: error: implicit declaration of function ‘pwrseq_is_controllable’ [-Wimplicit-function-declaration]
2557 | bt_en_available = pwrseq_is_controllable(qcadev->pwrseq);
| ^~~~~~~~~~~~~~~~~~~~~~make[4]: *** [scripts/Makefile.build:290: drivers/bluetooth/hci_qca.o] Error 1 make[4]: *** Waiting for unfinished jobs....
make[3]: *** [scripts/Makefile.build:551: drivers/bluetooth] Error 2
make[2]: *** [scripts/Makefile.build:551: drivers] Error 2
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [/home/runner/work/bluetooth-next/bluetooth-next/src/src/Makefile:2229: .] Error 2
make: *** [Makefile:248: __sub-make] Error 2
##############################
Test: CheckSparse - FAIL
Desc: Run sparse tool with linux kernel
Output:
net/bluetooth/hci_event.c: note: in included file (through include/net/bluetooth/hci_core.h):./include/net/bluetooth/hci.h:2975:47: warning: array of flexible structures ./include/net/bluetooth/hci.h:3061:43: warning: array of flexible structuresdrivers/bluetooth/hci_qca.c: In function ‘qca_serdev_probe’:drivers/bluetooth/hci_qca.c:2557:35: error: implicit declaration of function ‘pwrseq_is_controllable’ [-Wimplicit-function-declaration]
2557 | bt_en_available = pwrseq_is_controllable(qcadev->pwrseq);
| ^~~~~~~~~~~~~~~~~~~~~~make[4]: *** [scripts/Makefile.build:290: drivers/bluetooth/hci_qca.o] Error 1 make[4]: *** Waiting for unfinished jobs....
make[3]: *** [scripts/Makefile.build:551: drivers/bluetooth] Error 2
make[2]: *** [scripts/Makefile.build:551: drivers] Error 2
make[2]: *** Waiting for unfinished jobs....net/bluetooth/hci_codec.c: note: in included file:./include/net/bluetooth/hci_core.h:151:35: warning: array of flexible structures net/bluetooth/sco.c: note: in included file:./include/net/bluetooth/hci_core.h:151:35: warning: array of flexible structures make[1]: *** [/home/runner/work/bluetooth-next/bluetooth-next/src/src/Makefile:2229: .] Error 2
make: *** [Makefile:248: __sub-make] Error 2
##############################
Test: BuildKernel32 - FAIL
Desc: Build 32bit Kernel for Bluetooth
Output:
drivers/bluetooth/hci_qca.c: In function ‘qca_serdev_probe’:drivers/bluetooth/hci_qca.c:2557:35: error: implicit declaration of function ‘pwrseq_is_controllable’ [-Wimplicit-function-declaration]
2557 | bt_en_available = pwrseq_is_controllable(qcadev->pwrseq);
| ^~~~~~~~~~~~~~~~~~~~~~make[4]: *** [scripts/Makefile.build:290: drivers/bluetooth/hci_qca.o] Error 1 make[3]: *** [scripts/Makefile.build:551: drivers/bluetooth] Error 2
make[2]: *** [scripts/Makefile.build:551: drivers] Error 2
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [/home/runner/work/bluetooth-next/bluetooth-next/src/src/Makefile:2229: .] Error 2
make: *** [Makefile:248: __sub-make] Error 2
##############################
Test: CheckKernelLLVM - FAIL
Desc: Build kernel with LLVM + context analysis
Output:
drivers/bluetooth/hci_qca.c:2557:21: error: call to undeclared function 'pwrseq_is_controllable'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
2557 | bt_en_available = pwrseq_is_controllable(qcadev->pwrseq);
| ^
1 error generated.
make[4]: *** [scripts/Makefile.build:290: drivers/bluetooth/hci_qca.o] Error 1
make[4]: *** Waiting for unfinished jobs....
make[3]: *** [scripts/Makefile.build:551: drivers/bluetooth] Error 2
make[2]: *** [scripts/Makefile.build:551: drivers] Error 2
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [/home/runner/work/bluetooth-next/bluetooth-next/src/src/Makefile:2229: .] Error 2
make: *** [Makefile:248: __sub-make] Error 2
##############################
Test: TestRunnerSetup - FAIL
Desc: Setup kernel and bluez for test-runner
Output:
Kernel:drivers/bluetooth/hci_qca.c: In function ‘qca_serdev_probe’:drivers/bluetooth/hci_qca.c:2557:35: error: implicit declaration of function ‘pwrseq_is_controllable’ [-Wimplicit-function-declaration]
2557 | bt_en_available = pwrseq_is_controllable(qcadev->pwrseq);
| ^~~~~~~~~~~~~~~~~~~~~~make[4]: *** [scripts/Makefile.build:290: drivers/bluetooth/hci_qca.o] Error 1 make[3]: *** [scripts/Makefile.build:551: drivers/bluetooth] Error 2
make[3]: *** Waiting for unfinished jobs....
make[2]: *** [scripts/Makefile.build:551: drivers] Error 2
make[1]: *** [/home/runner/work/bluetooth-next/bluetooth-next/src/src/Makefile:2229: .] Error 2
make: *** [Makefile:248: __sub-make] Error 2
##############################
Test: TestRunner_l2cap-tester - FAIL
Desc: Run l2cap-tester with test-runner
Output:
No kernel image found
##############################
Test: TestRunner_iso-tester - FAIL
Desc: Run iso-tester with test-runner
Output:
No kernel image found
##############################
Test: TestRunner_bnep-tester - FAIL
Desc: Run bnep-tester with test-runner
Output:
No kernel image found
##############################
Test: TestRunner_mgmt-tester - FAIL
Desc: Run mgmt-tester with test-runner
Output:
No kernel image found
##############################
Test: TestRunner_rfcomm-tester - FAIL
Desc: Run rfcomm-tester with test-runner
Output:
No kernel image found
##############################
Test: TestRunner_sco-tester - FAIL
Desc: Run sco-tester with test-runner
Output:
No kernel image found
##############################
Test: TestRunner_ioctl-tester - FAIL
Desc: Run ioctl-tester with test-runner
Output:
No kernel image found
##############################
Test: TestRunner_mesh-tester - FAIL
Desc: Run mesh-tester with test-runner
Output:
No kernel image found
##############################
Test: TestRunner_smp-tester - FAIL
Desc: Run smp-tester with test-runner
Output:
No kernel image found
##############################
Test: TestRunner_userchan-tester - FAIL
Desc: Run userchan-tester with test-runner
Output:
No kernel image found
##############################
Test: TestRunner_6lowpan-tester - FAIL
Desc: Run 6lowpan-tester with test-runner
Output:
No kernel image found
##############################
Test: IncrementalBuild - FAIL
Desc: Incremental build with the patches in the series Output:
drivers/bluetooth/hci_qca.c: In function ‘qca_serdev_probe’:drivers/bluetooth/hci_qca.c:2562:35: error: implicit declaration of function ‘pwrseq_is_controllable’ [-Wimplicit-function-declaration]
2562 | bt_en_available = pwrseq_is_controllable(qcadev->bt_power->pwrseq);
| ^~~~~~~~~~~~~~~~~~~~~~
drivers/bluetooth/hci_qca.c:2569:25: error: implicit declaration of function ‘pwrseq_power_on’ [-Wimplicit-function-declaration]
2569 | pwrseq_power_on(qcadev->bt_power->pwrseq);
| ^~~~~~~~~~~~~~~make[4]: *** [scripts/Makefile.build:290: drivers/bluetooth/hci_qca.o] Error 1 make[3]: *** [scripts/Makefile.build:551: drivers/bluetooth] Error 2
make[2]: *** [scripts/Makefile.build:551: drivers] Error 2
make[1]: *** [/home/runner/work/bluetooth-next/bluetooth-next/src/src/Makefile:2229: .] Error 2
make: *** [Makefile:248: __sub-make] Error 2
[v7,3/8] Bluetooth: hci_qca: Set 'bt_en_available' based on pwrseq power controllability
drivers/bluetooth/hci_qca.c: In function ‘qca_serdev_probe’:drivers/bluetooth/hci_qca.c:2562:35: error: implicit declaration of function ‘pwrseq_is_controllable’ [-Wimplicit-function-declaration]
2562 | bt_en_available = pwrseq_is_controllable(qcadev->bt_power->pwrseq);
| ^~~~~~~~~~~~~~~~~~~~~~
drivers/bluetooth/hci_qca.c:2569:25: error: implicit declaration of function ‘pwrseq_power_on’ [-Wimplicit-function-declaration]
2569 | pwrseq_power_on(qcadev->bt_power->pwrseq);
| ^~~~~~~~~~~~~~~make[4]: *** [scripts/Makefile.build:290: drivers/bluetooth/hci_qca.o] Error 1 make[3]: *** [scripts/Makefile.build:551: drivers/bluetooth] Error 2
make[2]: *** [scripts/Makefile.build:551: drivers] Error 2
make[1]: *** [/home/runner/work/bluetooth-next/bluetooth-next/src/src/Makefile:2229: .] Error 2
make: *** [Makefile:248: __sub-make] Error 2
https://github.com/bluez/bluetooth-next/pull/862
---
Regards,
Linux Bluetooth
Re: [PATCH v7 1/8] Bluetooth: hci_qca: Add M.2 Bluetooth device support using pwrseq
In reply to Loic PoulainTested on an ASUS Zenbook A16 (UX3607OA, X2 Elite), whose mainline DT connects Bluetooth through the M.2 E connector (W_DISABLE2# on GPIO 116), with the QCC2072 support from [1] on top. Without this patch hci_qca asks for a "bluetooth" pwrseq target the connector doesn't provide, W_DISABLE2# stays asserted and reading the version times out (-110). With it, W_DISABLE2# is released, setup completes and a phone connects.
[1] https://lore.kernel.org/r/20260727-rb3-industrial-bt-uart-v2-0-2d100f30e202@oss.qualcomm.com
PATCH v7 2/8 Bluetooth: hci_qca: Rename 'power_ctrl_enabled' to 'bt_en_available'
In reply to Loic PoulainFrom: Manivannan Sadhasivam <[email protected]>
'power_ctrl_enabled' flag is used to indicate the availability of the BT_EN GPIO in devicetree. But the naming causes confusion with the new pwrctrl framework.
So rename it to 'bt_en_available' to make it clear and explicit.
--- drivers/bluetooth/hci_qca.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/bluetooth/hci_qca.c +4 -4
@@ -2402,7 +2402,7 @@ static int qca_serdev_probe(struct serdev_device *serdev)struct hci_dev *hdev;const struct qca_device_data *data;int err; -bool power_ctrl_enabled = true; +bool bt_en_available = true; qcadev =devm_kzalloc (&serdev->dev,sizeof (*qcadev),GFP_KERNEL );if (!qcadev)
@@ -2510,7 +2510,7 @@ static int qca_serdev_probe(struct serdev_device *serdev) (data->soc_type ==QCA_WCN6750 || data->soc_type ==QCA_WCN6855 || data->soc_type == QCA_WCN7850)) - power_ctrl_enabled = false; + bt_en_available = false; qcadev->sw_ctrl =devm_gpiod_get_optional (&serdev->dev,"swctrl" ,GPIOD_IN );
@@ -2548,7 +2548,7 @@ static int qca_serdev_probe(struct serdev_device *serdev) }if (!qcadev->bt_en) - power_ctrl_enabled = false; + bt_en_available = false; qcadev->susclk =devm_clk_get_optional_enabled_with_rate ( &serdev->dev,NULL ,SUSCLK_RATE_32KHZ );
@@ -2566,7 +2566,7 @@ static int qca_serdev_probe(struct serdev_device *serdev) hdev = qcadev->serdev_hu.hdev; -if (power_ctrl_enabled) { +if (bt_en_available) {hci_set_quirk (hdev,HCI_QUIRK_NON_PERSISTENT_SETUP ); hdev->shutdown = qca_hci_shutdown; }
Signature · 1 line
2.34.1
[email protected]
AI reviewRe: [PATCH v7 2/8] Bluetooth: hci_qca: Rename 'power_ctrl_enabled' to 'bt_en_available'
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [Medium] bluetooth: semantic mismatch in renaming power_ctrl_enabled to bt_en_available --
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] bluetooth: semantic mismatch in renaming power_ctrl_enabled to bt_en_available --
commit a629aed3c3c3f22e42d5d786579731613da2a200
Author: Manivannan Sadhasivam <[email protected]>
Bluetooth: hci_qca: Rename 'power_ctrl_enabled' to 'bt_en_available'
The commit renames the 'power_ctrl_enabled' flag to 'bt_en_available' to avoid confusion with the new pwrctrl framework. It claims the flag is used to indicate the availability of the BT_EN GPIO in devicetree.
drivers/bluetooth/hci_qca.c static int qca_serdev_probe(struct serdev_device *serdev) · line 2405
Quoted 10 lines
drivers/bluetooth/hci_qca.c +1
-1@@ -2402,7 +2402,7 @@ static int qca_serdev_probe(struct serdev_device *serdev)struct hci_dev *hdev;const struct qca_device_data *data;int err; -bool power_ctrl_enabled = true; +bool bt_en_available = true;
[Severity: Medium]
Does initializing this to true imply that BT_EN is available by default, even when it is not?
[ ... ]
drivers/bluetooth/hci_qca.c static int qca_serdev_probe(struct serdev_device *serdev) · line 2513
Quoted 6 lines
drivers/bluetooth/hci_qca.c +1
-1@@ -2510,7 +2510,7 @@ static int qca_serdev_probe(struct serdev_device *serdev) (data->soc_type ==QCA_WCN6750 || data->soc_type ==QCA_WCN6855 || data->soc_type == QCA_WCN7850)) - power_ctrl_enabled = false; + bt_en_available = false;
[Severity: Medium]
For SoCs like QCA_WCN3990, if the BT_EN GPIO is missing but regulators exist, this variable remains true because the logic to clear it is strictly limited to WCN6750/WCN6855/WCN7850.
Does this create a semantic mismatch where the variable name suggests BT_EN is available, but it is actually tracking whether any form of power control is active?
[ ... ]
drivers/bluetooth/hci_qca.c static int qca_serdev_probe(struct serdev_device *serdev) · line 2572
Quoted 9 lines
drivers/bluetooth/hci_qca.c +1
-1@@ -2566,7 +2566,7 @@ static int qca_serdev_probe(struct serdev_device *serdev) hdev = qcadev->serdev_hu.hdev; -if (power_ctrl_enabled) { +if (bt_en_available) {hci_set_quirk (hdev,HCI_QUIRK_NON_PERSISTENT_SETUP ); hdev->shutdown = qca_hci_shutdown; }
[Severity: Medium]
The qca_hci_shutdown hook is assigned based on this flag to ensure power control teardown.
Since this flag must remain true for devices like QCA_WCN3990 to execute the shutdown hook to disable their regulators (even if they lack a BT_EN GPIO), was the original 'power_ctrl_enabled' name actually more accurate?
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
PATCH v7 3/8 Bluetooth: hci_qca: Set 'bt_en_available' based on pwrseq power controllability
In reply to Loic PoulainA Bluetooth device only needs the non-persistent setup if the host can gate its power, so that it is actually reset on the next power-on. When the power is controlled by a power sequencer, whether the host can gate it depends on the hardware wiring, e.g. the presence of the BT_EN or W_DISABLE2# line.
Query the generic pwrseq_is_controllable() helper whenever the BT power comes from a sequencer, regardless of which provider it is (M2, WCN, ...). If the power is not controllable, clear 'bt_en_available' so that HCI_QUIRK_NON_PERSISTENT_SETUP is not set.
This is based on Manivannan's original patch that keyed the decision off the W_DISABLE2# device tree property, it now uses the generic pwrseq helper and handles the always-on case.
--- drivers/bluetooth/hci_qca.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)
drivers/bluetooth/hci_qca.c +14 -1
@@ -2557,7 +2557,20 @@ static int qca_serdev_probe(struct serdev_device *serdev)return PTR_ERR (qcadev->susclk); } } - + +if (qcadev->bt_power->pwrseq) { + bt_en_available =pwrseq_is_controllable (qcadev->bt_power->pwrseq); +if (!bt_en_available) { +/* The host cannot gate the BT power individually. +* Treat it as always-on and drop the pwrseq handle. +* The descriptor itself is still released by devres, +* so dropping the handle here is not a leak. +*/ +pwrseq_power_on (qcadev->bt_power->pwrseq); + qcadev->bt_power->pwrseq =NULL ; + } + } + err =hci_uart_register_device (&qcadev->serdev_hu, &qca_proto);if (err) {BT_ERR ("serdev registration failed" );
Signature · 1 line
2.34.1
[email protected]
AI reviewRe: [PATCH v7 3/8] Bluetooth: hci_qca: Set 'bt_en_available' based on pwrseq power controllability
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [High] bluetooth: hci_qca: missing error check for pwrseq_enable() in probe --
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] bluetooth: hci_qca: missing error check for pwrseq_enable() in probe --
commit 842e42b3b693b54c6eab8132c98045df38fc5343
Author: Loic Poulain <[email protected]>
Bluetooth: hci_qca: Set 'bt_en_available' based on pwrseq power controllability
This commit updates the driver to query pwrseq_is_controllable() when Bluetooth power comes from a sequencer. If the power is not controllable, it clears bt_en_available so that the non-persistent setup quirk is not set and treats the device as always-on.
Quoted 9 lines
drivers/bluetooth/hci_qca.c +0
-1@@ -2557,7 +2557,20 @@ static int qca_serdev_probe(struct serdev_device *serdev)return PTR_ERR (qcadev->susclk); } } -
drivers/bluetooth/hci_qca.c static int qca_serdev_probe(struct serdev_device *serdev) · line 2569
Quoted 10 lines
drivers/bluetooth/hci_qca.c +10
-0+ +if (qcadev->bt_power->pwrseq) { + bt_en_available =pwrseq_is_controllable (qcadev->bt_power->pwrseq); +if (!bt_en_available) { +/* The host cannot gate the BT power individually. +* Treat it as always-on and drop the pwrseq handle. +* The descriptor itself is still released by devres, +* so dropping the handle here is not a leak. +*/ +pwrseq_power_on (qcadev->bt_power->pwrseq);
[Severity: High]
Does this code need to check the return value of pwrseq_power_on()?
If powering on the Bluetooth hardware fails, the driver incorrectly continues probing and returns success. This leads to silent hardware initialization failures and downstream communication timeouts when the host attempts to interact with the unpowered controller.
Note: The undefined function typo (pwrseq_power_on) present in this patch is fixed in a subsequent patch in this series (commit 'Bluetooth: hci_qca:
Flatten struct qca_power into struct qca_serdev'), but the missing error check for the corrected pwrseq_enable() call remains unfixed in the final state of the series.
Quoted 5 lines
drivers/bluetooth/hci_qca.c +4
-0+ qcadev->bt_power->pwrseq =NULL ; + } + } + err =hci_uart_register_device (&qcadev->serdev_hu, &qca_proto);
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=3
PATCH v7 4/8 Bluetooth: hci_qca: Embed bt_power in struct qca_serdev
In reply to Loic Poulain'bt_power' is allocated dynamically only for a subset of SOC types, using a switch on the SOC type that mirrors the one that follows it. This is about to become pointless as the power sequencer path (used by M.2 modules) is independent of the SOC type and needs 'bt_power' populated for any type.
Embed 'struct qca_power' directly in 'struct qca_serdev' instead of allocating it separately. This drops the extra allocation and its dedicated SOC-type switch, and removes the need for NULL checks on the pointer.
No functional change intended.
--- drivers/bluetooth/hci_qca.c | 72 ++++++++++++++++----------------------------- 1 file changed, 26 insertions(+), 46 deletions(-)
drivers/bluetooth/hci_qca.c +26 -46
@@ -225,7 +225,7 @@ struct qca_serdev {struct gpio_desc *sw_ctrl;struct clk *susclk;enum qca_btsoc_type btsoc_type; -struct qca_power *bt_power; +struct qca_power bt_power;u32 init_speed;u32 oper_speed;bool bdaddr_property_broken;
@@ -1779,7 +1779,7 @@ static int qca_regulator_init(struct hci_uart *hu)*/ qcadev =serdev_device_get_drvdata (hu->serdev); -if (!qcadev->bt_power->vregs_on) { +if (!qcadev->bt_power.vregs_on) {serdev_device_close (hu->serdev); ret =qca_regulator_enable (qcadev);if (ret)
@@ -2245,7 +2245,7 @@ static void qca_power_off(struct hci_uart *hu)return ; qcadev =serdev_device_get_drvdata (hu->serdev); - power = qcadev->bt_power; + power = &qcadev->bt_power;switch (soc_type) {case QCA_WCN3988 :
@@ -2265,7 +2265,7 @@ static void qca_power_off(struct hci_uart *hu)break ; } -if (power && power->pwrseq) { +if (power->pwrseq) {pwrseq_disable (power->pwrseq);set_bit (QCA_BT_OFF , &qca->flags);return ;
@@ -2322,7 +2322,7 @@ static int qca_hci_shutdown(struct hci_dev *hdev)static int qca_regulator_enable (struct qca_serdev *qcadev) { -struct qca_power *power = qcadev->bt_power; +struct qca_power *power = &qcadev->bt_power;int ret;if (power->pwrseq)
@@ -2354,7 +2354,7 @@ static void qca_regulator_disable(struct qca_serdev *qcadev)if (!qcadev)return ; - power = qcadev->bt_power; + power = &qcadev->bt_power;/* Already disabled? */ if (!power->vregs_on)
@@ -2426,26 +2426,6 @@ static int qca_serdev_probe(struct serdev_device *serdev)else qcadev->btsoc_type =QCA_ROME ; -switch (qcadev->btsoc_type) { -case QCA_QCA6390 : -case QCA_WCN3950 : -case QCA_WCN3988 : -case QCA_WCN3990 : -case QCA_WCN3991 : -case QCA_WCN3998 : -case QCA_WCN6750 : -case QCA_WCN6855 : -case QCA_WCN7850 : - qcadev->bt_power =devm_kzalloc (&serdev->dev, -sizeof (struct qca_power ), -GFP_KERNEL ); -if (!qcadev->bt_power) -return -ENOMEM ; -break ; -default : -break ; - } -switch (qcadev->btsoc_type) {case QCA_WCN3950 :case QCA_WCN3988 :
@@ -2460,10 +2440,10 @@ static int qca_serdev_probe(struct serdev_device *serdev)* the M.2 Key E connector. */ if (of_graph_is_present (dev_of_node (&serdev->ctrl->dev))) { - qcadev->bt_power->pwrseq =devm_pwrseq_get (&serdev->ctrl->dev, -"uart" ); -if (IS_ERR (qcadev->bt_power->pwrseq)) -return PTR_ERR (qcadev->bt_power->pwrseq); + qcadev->bt_power.pwrseq =devm_pwrseq_get (&serdev->ctrl->dev, +"uart" ); +if (IS_ERR (qcadev->bt_power.pwrseq)) +return PTR_ERR (qcadev->bt_power.pwrseq);break ; }
@@ -2474,8 +2454,8 @@ static int qca_serdev_probe(struct serdev_device *serdev)* let's use the power sequencer. Otherwise, let's * drive everything ourselves. */ - qcadev->bt_power->pwrseq =devm_pwrseq_get (&serdev->dev, -"bluetooth" ); + qcadev->bt_power.pwrseq =devm_pwrseq_get (&serdev->dev, +"bluetooth" );/* * Some modules have BT_EN enabled via a hardware pull-up,
@@ -2483,21 +2463,21 @@ static int qca_serdev_probe(struct serdev_device *serdev)* through the power sequence. In such cases, fall through * to follow the legacy flow. */ -if (IS_ERR (qcadev->bt_power->pwrseq)) - qcadev->bt_power->pwrseq =NULL ; +if (IS_ERR (qcadev->bt_power.pwrseq)) + qcadev->bt_power.pwrseq =NULL ;else break ; } - qcadev->bt_power->dev = &serdev->dev; - err =qca_init_regulators (qcadev->bt_power, data->vregs, + qcadev->bt_power.dev = &serdev->dev; + err =qca_init_regulators (&qcadev->bt_power, data->vregs, data->num_vregs);if (err) {BT_ERR ("Failed to init regulators:%d" , err);return err; } - qcadev->bt_power->vregs_on = false; + qcadev->bt_power.vregs_on = false; qcadev->bt_en =devm_gpiod_get_optional (&serdev->dev,"enable" ,GPIOD_OUT_LOW );
@@ -2531,10 +2511,10 @@ static int qca_serdev_probe(struct serdev_device *serdev)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); + 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;
@@ -2558,16 +2538,16 @@ static int qca_serdev_probe(struct serdev_device *serdev) } } -if (qcadev->bt_power->pwrseq) { - bt_en_available =pwrseq_is_controllable (qcadev->bt_power->pwrseq); +if (qcadev->bt_power.pwrseq) { + bt_en_available =pwrseq_is_controllable (qcadev->bt_power.pwrseq);if (!bt_en_available) {/* The host cannot gate the BT power individually. * Treat it as always-on and drop the pwrseq handle. * The descriptor itself is still released by devres, * so dropping the handle here is not a leak. */ -pwrseq_power_on (qcadev->bt_power->pwrseq); - qcadev->bt_power->pwrseq =NULL ; +pwrseq_enable (qcadev->bt_power.pwrseq); + qcadev->bt_power.pwrseq =NULL ; } }
@@ -2605,7 +2585,7 @@ static int qca_serdev_probe(struct serdev_device *serdev)static void qca_serdev_remove (struct serdev_device *serdev) {struct qca_serdev *qcadev =serdev_device_get_drvdata (serdev); -struct qca_power *power = qcadev->bt_power; +struct qca_power *power = &qcadev->bt_power;switch (qcadev->btsoc_type) {case QCA_WCN3988 :
Signature · 1 line
2.34.1
[email protected]
AI reviewRe: [PATCH v7 4/8] Bluetooth: hci_qca: Embed bt_power in struct qca_serdev
Sashiko has reviewed this patch and found no issues. It looks great!
Quoted 5 lines
'
bt_power' is allocated dynamically only for a subset of SOC types, using a switch on the SOC type that mirrors the one that follows it. This is about to become pointless as the power sequencer path (used by M.2 modules) is independent of the SOC type and needs 'bt_power' populated for any type.
Quoted 8 lines
Embed 'struct
qca_power' directly in 'structqca_serdev' instead of allocating it separately. This drops the extra allocation and its dedicated SOC-type switch, and removes the need for NULL checks on the pointer.No functional change intended.
Reviewed-by Bartosz Golaszewski <[email protected]>Signed-off-by Loic Poulain <[email protected]>
Sashiko has reviewed this patch and found no issues. It looks great!
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=4
PATCH v7 5/8 Bluetooth: hci_qca: Support QCA2066 on M.2 connector via pwrseq
In reply to Loic PoulainFor QCA2066 (and other QCA chips) on M.2 connectors, the UART enable is controlled by the W_DISABLE2# signal managed by the pcie-m2 power sequencer rather than a dedicated BT enable GPIO.
When the serdev controller has an OF graph (indicating it is connected to an M.2 connector), acquire the 'uart' pwrseq target from the connector's power sequencer and use it to control BT power instead of the bt-enable GPIO. This is factored out into qca_serdev_get_m2_pwrseq().
--- drivers/bluetooth/hci_qca.c | 47 +++++++++++++++++++++++++++++++++++---------- 1 file changed, 37 insertions(+), 10 deletions(-)
drivers/bluetooth/hci_qca.c +37 -10
@@ -1875,6 +1875,9 @@ static int qca_power_on(struct hci_dev *hdev)/* Controller needs time to bootup. */ msleep (150 ); } + +if (qcadev->bt_power.pwrseq) +pwrseq_power_on (qcadev->bt_power.pwrseq); }clear_bit (QCA_BT_OFF , &qca->flags);
@@ -2396,6 +2399,34 @@ static int qca_init_regulators(struct qca_power *qca,return 0 ; } +static void qca_serdev_put_pwrseq (void *data) +{ +pwrseq_put (data); +} + +static int qca_serdev_get_m2_pwrseq (struct qca_serdev *qcadev) +{ +struct serdev_device *serdev = qcadev->serdev_hu.serdev; +struct pwrseq_desc *pwrseq; + +if (!of_graph_is_present (dev_of_node (&serdev->ctrl->dev))) +return 0 ; + +/* The pwrseq is looked up on the serdev controller (which holds the +* OF graph to the M.2 connector), but its lifetime must follow this +* serdev consumer device, not the controller. So acquire it with the +* non-devres pwrseq_get() and release it via a devres action bound to +* &serdev->dev instead of using devm_pwrseq_get(&serdev->ctrl->dev). +*/ + pwrseq =pwrseq_get (&serdev->ctrl->dev,"uart" ); +if (IS_ERR (pwrseq)) +return PTR_ERR (pwrseq); + + qcadev->bt_power.pwrseq = pwrseq; + +return devm_add_action_or_reset (&serdev->dev, qca_serdev_put_pwrseq, pwrseq); +} +static int qca_serdev_probe (struct serdev_device *serdev) {struct qca_serdev *qcadev;
@@ -2426,6 +2457,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 :
@@ -2435,17 +2470,9 @@ static int qca_serdev_probe(struct serdev_device *serdev)case QCA_WCN6750 :case QCA_WCN6855 :case QCA_WCN7850 : -/* -* OF graph link is only present for BT devices attached through -* the M.2 Key E connector. -*/ -if (of_graph_is_present (dev_of_node (&serdev->ctrl->dev))) { - qcadev->bt_power.pwrseq =devm_pwrseq_get (&serdev->ctrl->dev, -"uart" ); -if (IS_ERR (qcadev->bt_power.pwrseq)) -return PTR_ERR (qcadev->bt_power.pwrseq); +/* 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" )) {/*
Signature · 1 line
2.34.1
[email protected]
AI reviewRe: [PATCH v7 5/8] Bluetooth: hci_qca: Support QCA2066 on M.2 connector via pwrseq
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider: - [High] hci_qca: QCA6390 probe fails on M.2 connectors due to overwritten pwrseq - [Medium] hci_qca…
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [High] hci_qca: QCA6390 probe fails on M.2 connectors due to overwritten pwrseq
- [Medium] hci_qca: missing error check for power sequencer enable in qca_power_on()
- [Medium] hci_qca: asymmetric power-off leaks bt_en GPIO assertion
--
commit d33d72433b2dc1cfeaa1bb5a87c7d716233a54a5
Author: Loic Poulain <[email protected]>
Bluetooth: hci_qca: Support QCA2066 on M.2 connector via pwrseq
This patch modifies the QCA HCI driver to support QCA2066 (and similar chips) on M.2 connectors. It updates the probe sequence to acquire a power sequencer for the M.2 UART connection instead of relying on a dedicated BT enable GPIO.
drivers/bluetooth/hci_qca.c static int qca_power_on(struct hci_dev *hdev) · line 1881
Quoted 12 lines
drivers/bluetooth/hci_qca.c +3
-0@@ -1875,6 +1875,9 @@ static int qca_power_on(struct hci_dev *hdev)/* Controller needs time to bootup. */ msleep (150 ); } + +if (qcadev->bt_power.pwrseq) +pwrseq_power_on (qcadev->bt_power.pwrseq); }
[Severity: Medium]
Does this code need to check the return value of pwrseq_power_on()?
If the power sequencer API returns an error (for example, due to a regulator error or timeout), the result is discarded and the driver will incorrectly assume power-on succeeded.
This causes the driver to attempt communication with an unpowered Bluetooth controller, leading to HCI command timeouts and driver malfunction.
[ ... ]
drivers/bluetooth/hci_qca.c static int qca_serdev_probe(struct serdev_device *serdev) · line 2463
Quoted 8 lines
drivers/bluetooth/hci_qca.c +4
-0@@ -2426,6 +2457,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; +
[Severity: High]
Does this code overwrite the M.2 power sequencer and break probe for QCA6390 chips?
Because qca_serdev_get_m2_pwrseq() is now called unconditionally for all chips before the switch statement, it correctly acquires the M.2 power sequencer when present. However, the QCA_QCA6390 branch further down in this function lacks a guard to prevent overwriting it:
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;
}If the serdev has an OF node, this overwrites the M.2 power sequencer with a request for a 'bluetooth' power sequencer. This fails with -ENOENT and aborts the probe.
[Severity: Medium]
Can this early acquisition cause an asymmetric power-off that leaks the bt_en GPIO assertion?
For legacy/default SoC types (like QCA_ROME), the default branch of the switch statement doesn't check if the power sequencer was already acquired:
default: qcadev->bt_en = devm_gpiod_get_optional(&serdev->dev, "enable", GPIOD_OUT_LOW);
If both exist, qca_power_on() asserts the bt_en GPIO and enables the power sequencer. However, qca_power_off() disables the power sequencer and immediately returns:
if (power->pwrseq) {
pwrseq_disable(power->pwrseq);
set_bit(QCA_BT_OFF, &qca->flags);
return;
}This early return bypasses the fallback logic that de-asserts bt_en, leaving the hardware partially enabled.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=5
Re: [PATCH v7 5/8] Bluetooth: hci_qca: Support QCA2066 on M.2 connector via pwrseq
In reply to Loic PoulainQuoted 37 lines · Loic Poulain
For QCA2066 (and other QCA chips) on M.2 connectors, the UART enable is controlled by the W_DISABLE2# signal managed by the pcie-m2 power sequencer rather than a dedicated BT enable GPIO.
When the serdev controller has an OF graph (indicating it is connected to an M.2 connector), acquire the 'uart' pwrseq target from the connector's power sequencer and use it to control BT power instead of the bt-enable GPIO. This is factored out into
qca_serdev_get_m2_pwrseq().Reviewed-by Manivannan Sadhasivam <[email protected]>Reviewed-by Dmitry Baryshkov <[email protected]>Reviewed-by Bartosz Golaszewski <[email protected]>Signed-off-by Loic Poulain <[email protected]>--- drivers/bluetooth/hci_qca.c | 47 +++++++++++++++++++++++++++++++++++---------- 1 file changed, 37 insertions(+), 10 deletions(-)drivers/bluetooth/hci_qca.c +5
-0@@ -1875,6 +1875,9 @@ static int qca_power_on(struct hci_dev *hdev)/* Controller needs time to bootup. */ msleep (150 ); } + +if (qcadev->bt_power.pwrseq) +pwrseq_power_on (qcadev->bt_power.pwrseq); }clear_bit (QCA_BT_OFF , &qca->flags);@@ -2396,6 +2399,34 @@ static int qca_init_regulators(struct qca_power *qca,return 0 ; } +static void qca_serdev_put_pwrseq (void *data) +{
drivers/bluetooth/hci_qca.c static int qca_init_regulators(struct qca_power *qca, · line 2413
Quoted 10 lines
drivers/bluetooth/hci_qca.c +10
-0+pwrseq_put (data); +} + +static int qca_serdev_get_m2_pwrseq (struct qca_serdev *qcadev) +{ +struct serdev_device *serdev = qcadev->serdev_hu.serdev; +struct pwrseq_desc *pwrseq; + +if (!of_graph_is_present (dev_of_node (&serdev->ctrl->dev))) +return 0 ;
Seems like of_graph_is_present does *not* return false for the existing (non-connector) setup which is currently used in all the laptop device trees..
drivers/bluetooth/hci_qca.c static int qca_init_regulators(struct qca_power *qca, · line 2423
Quoted 11 lines
drivers/bluetooth/hci_qca.c +10
-0+ +/* The pwrseq is looked up on the serdev controller (which holds the +* OF graph to the M.2 connector), but its lifetime must follow this +* serdev consumer device, not the controller. So acquire it with the +* non-devres pwrseq_get() and release it via a devres action bound to +* &serdev->dev instead of using devm_pwrseq_get(&serdev->ctrl->dev). +*/ + pwrseq =pwrseq_get (&serdev->ctrl->dev,"uart" ); +if (IS_ERR (pwrseq)) +return PTR_ERR (pwrseq);
So this returns EPROBE_DEFER and bluetooth gets deferred forever :(
~val
Re: [PATCH v7 5/8] Bluetooth: hci_qca: Support QCA2066 on M.2 connector via pwrseq
Hi Val,
Quoted 38 lines · Val Packett
Quoted 35 lines · Loic Poulain
For QCA2066 (and other QCA chips) on M.2 connectors, the UART enable is controlled by the W_DISABLE2# signal managed by the pcie-m2 power sequencer rather than a dedicated BT enable GPIO.
When the serdev controller has an OF graph (indicating it is connected to an M.2 connector), acquire the 'uart' pwrseq target from the connector's power sequencer and use it to control BT power instead of the bt-enable GPIO. This is factored out into
qca_serdev_get_m2_pwrseq().Reviewed-by Manivannan Sadhasivam <[email protected]>Reviewed-by Dmitry Baryshkov <[email protected]>Reviewed-by Bartosz Golaszewski <[email protected]>Signed-off-by Loic Poulain <[email protected]>--- drivers/bluetooth/hci_qca.c | 47 +++++++++++++++++++++++++++++++++++---------- 1 file changed, 37 insertions(+), 10 deletions(-)drivers/bluetooth/hci_qca.c +3
-0@@ -1875,6 +1875,9 @@ static int qca_power_on(struct hci_dev *hdev)/* Controller needs time to bootup. */ msleep (150 ); } + +if (qcadev->bt_power.pwrseq) +pwrseq_power_on (qcadev->bt_power.pwrseq); }clear_bit (QCA_BT_OFF , &qca->flags);@@ -2396,6 +2399,34 @@ static int qca_init_regulators(struct qca_power *qca,return 0 ; }
Quoted 15 lines
drivers/bluetooth/hci_qca.c static int qca_init_regulators(struct qca_power *qca, · line 2413
Quoted 12 lines
drivers/bluetooth/hci_qca.c +12
-0+static void qca_serdev_put_pwrseq (void *data) +{ +pwrseq_put (data); +} + +static int qca_serdev_get_m2_pwrseq (struct qca_serdev *qcadev) +{ +struct serdev_device *serdev = qcadev->serdev_hu.serdev; +struct pwrseq_desc *pwrseq; + +if (!of_graph_is_present (dev_of_node (&serdev->ctrl->dev))) +return 0 ;Seems like
of_graph_is_presentdoes *not* return false for the existing (non-connector) setup which is currently used in all the laptop device trees..
If I understand the issue correctly, this can only occur when a UART 'port' is left unconnected, in which case the failure is legitimate. The laptop device trees should be fixed accordingly, either by connecting the port to the corresponding M.2 device or by using the usual Bluetooth UART child-node approach. I don't see this issue in mainline.
Regards,
Loic
Quoted 16 lines
drivers/bluetooth/hci_qca.c static int qca_init_regulators(struct qca_power *qca, · line 2423
Quoted 11 lines
drivers/bluetooth/hci_qca.c +10
-0+ +/* The pwrseq is looked up on the serdev controller (which holds the +* OF graph to the M.2 connector), but its lifetime must follow this +* serdev consumer device, not the controller. So acquire it with the +* non-devres pwrseq_get() and release it via a devres action bound to +* &serdev->dev instead of using devm_pwrseq_get(&serdev->ctrl->dev). +*/ + pwrseq =pwrseq_get (&serdev->ctrl->dev,"uart" ); +if (IS_ERR (pwrseq)) +return PTR_ERR (pwrseq);So this returns
EPROBE_DEFERand bluetooth gets deferred forever :(~val
Re: [PATCH v7 5/8] Bluetooth: hci_qca: Support QCA2066 on M.2 connector via pwrseq
Quoted 55 lines · Loic Poulain
Hi Val,
Quoted 37 lines · Val Packett
Quoted 35 lines · Loic Poulain
For QCA2066 (and other QCA chips) on M.2 connectors, the UART enable is controlled by the W_DISABLE2# signal managed by the pcie-m2 power sequencer rather than a dedicated BT enable GPIO.
When the serdev controller has an OF graph (indicating it is connected to an M.2 connector), acquire the 'uart' pwrseq target from the connector's power sequencer and use it to control BT power instead of the bt-enable GPIO. This is factored out into
qca_serdev_get_m2_pwrseq().Reviewed-by Manivannan Sadhasivam <[email protected]>Reviewed-by Dmitry Baryshkov <[email protected]>Reviewed-by Bartosz Golaszewski <[email protected]>Signed-off-by Loic Poulain <[email protected]>--- drivers/bluetooth/hci_qca.c | 47 +++++++++++++++++++++++++++++++++++---------- 1 file changed, 37 insertions(+), 10 deletions(-)drivers/bluetooth/hci_qca.c +3
-0@@ -1875,6 +1875,9 @@ static int qca_power_on(struct hci_dev *hdev)/* Controller needs time to bootup. */ msleep (150 ); } + +if (qcadev->bt_power.pwrseq) +pwrseq_power_on (qcadev->bt_power.pwrseq); }clear_bit (QCA_BT_OFF , &qca->flags);@@ -2396,6 +2399,34 @@ static int qca_init_regulators(struct qca_power *qca,return 0 ; }Quoted 15 lines
drivers/bluetooth/hci_qca.c static int qca_init_regulators(struct qca_power *qca, · line 2413
Quoted 12 lines
drivers/bluetooth/hci_qca.c +12
-0+static void qca_serdev_put_pwrseq (void *data) +{ +pwrseq_put (data); +} + +static int qca_serdev_get_m2_pwrseq (struct qca_serdev *qcadev) +{ +struct serdev_device *serdev = qcadev->serdev_hu.serdev; +struct pwrseq_desc *pwrseq; + +if (!of_graph_is_present (dev_of_node (&serdev->ctrl->dev))) +return 0 ;Seems like
of_graph_is_presentdoes *not* return false for the existing (non-connector) setup which is currently used in all the laptop device trees..
Quoted 6 lines
If I understand the issue correctly, this can only occur when a UART 'port' is left unconnected, in which case the failure is legitimate. The laptop device trees should be fixed accordingly, either by connecting the port to the corresponding M.2 device or by using the usual Bluetooth UART child-node approach. I don't see this issue in mainline.
So it looks like this is because commit 014501d141ed ("arm64: dts: qcom: hamoa: Add graph port/endpoint anchors to pcie4_port0 and uart14") unconditionally added the uart14 endpoint to hamoa.dtsi itself in preparation for the future transition to proper M.2 descriptions.
The laptop dts'es themselves still have the older child-node description for bluetooth, with a dummy port { uart14_ep: endpoint {}; }; that's not used yet.
Could the check be extended to actually verify that there's actually something the graph endpoint is connected to? Or should that commit be reverted?
Thanks,
~val
Manivannan Sadhasivam
maintainerRe: [PATCH v7 5/8] Bluetooth: hci_qca: Support QCA2066 on M.2 connector via pwrseq
Quoted 69 lines · Val Packett
Quoted 55 lines · Loic Poulain
Hi Val,
Quoted 37 lines · Val Packett
Quoted 35 lines · Loic Poulain
For QCA2066 (and other QCA chips) on M.2 connectors, the UART enable is controlled by the W_DISABLE2# signal managed by the pcie-m2 power sequencer rather than a dedicated BT enable GPIO.
When the serdev controller has an OF graph (indicating it is connected to an M.2 connector), acquire the 'uart' pwrseq target from the connector's power sequencer and use it to control BT power instead of the bt-enable GPIO. This is factored out into
qca_serdev_get_m2_pwrseq().Reviewed-by Manivannan Sadhasivam <[email protected]>Reviewed-by Dmitry Baryshkov <[email protected]>Reviewed-by Bartosz Golaszewski <[email protected]>Signed-off-by Loic Poulain <[email protected]>--- drivers/bluetooth/hci_qca.c | 47 +++++++++++++++++++++++++++++++++++---------- 1 file changed, 37 insertions(+), 10 deletions(-)drivers/bluetooth/hci_qca.c +3
-0@@ -1875,6 +1875,9 @@ static int qca_power_on(struct hci_dev *hdev)/* Controller needs time to bootup. */ msleep (150 ); } + +if (qcadev->bt_power.pwrseq) +pwrseq_power_on (qcadev->bt_power.pwrseq); }clear_bit (QCA_BT_OFF , &qca->flags);@@ -2396,6 +2399,34 @@ static int qca_init_regulators(struct qca_power *qca,return 0 ; }Quoted 15 lines
drivers/bluetooth/hci_qca.c static int qca_init_regulators(struct qca_power *qca, · line 2413
Quoted 12 lines
drivers/bluetooth/hci_qca.c +12
-0+static void qca_serdev_put_pwrseq (void *data) +{ +pwrseq_put (data); +} + +static int qca_serdev_get_m2_pwrseq (struct qca_serdev *qcadev) +{ +struct serdev_device *serdev = qcadev->serdev_hu.serdev; +struct pwrseq_desc *pwrseq; + +if (!of_graph_is_present (dev_of_node (&serdev->ctrl->dev))) +return 0 ;Seems like
of_graph_is_presentdoes *not* return false for the existing (non-connector) setup which is currently used in all the laptop device trees..Quoted 6 lines
If I understand the issue correctly, this can only occur when a UART 'port' is left unconnected, in which case the failure is legitimate. The laptop device trees should be fixed accordingly, either by connecting the port to the corresponding M.2 device or by using the usual Bluetooth UART child-node approach. I don't see this issue in mainline.
So it looks like this is because commit
014501d141ed("arm64: dts: qcom:
hamoa: Add graph port/endpoint anchors topcie4_port0and uart14") unconditionally added the uart14 endpoint tohamoa.dtsiitself in preparation for the future transition to proper M.2 descriptions.
Quoted 8 lines
The laptop dts'es themselves still have the older child-node description for bluetooth, with a dummy port {
uart14_ep: endpoint {}; }; that's not used yet.Could the check be extended to actually verify that there's actually something the graph endpoint is connected to? Or should that commit be reverted?
Taken care now: https://lore.kernel.org/linux-arm-msm/[email protected]/
I shouldn't have given my r-b tag for the offending patch :/
- Mani
Signature · 1 line
மணிவண்ணன் சதாசிவம்
PATCH v7 6/8 Bluetooth: hci_qca: Flatten struct qca_power into struct qca_serdev
In reply to Loic Poulainstruct qca_power currently only groups a handful of fields (vreg_bulk, num_vregs, vregs_on, pwrseq) that are exclusively used from struct qca_serdev, via its embedded bt_power member. The extra indirection level does not provide any isolation or reuse benefit, and just adds qcadev->bt_power.<field> noise throughout the driver.
Drop struct qca_power and move its fields directly into struct qca_serdev, updating qca_init_regulators() to take a struct qca_serdev pointer instead. No functional change intended.
--- drivers/bluetooth/hci_qca.c | 91 +++++++++++++++++++-------------------------- 1 file changed, 39 insertions(+), 52 deletions(-)
drivers/bluetooth/hci_qca.c +39 -52
@@ -211,21 +211,16 @@ struct qca_device_data {/* * Platform data for the QCA Bluetooth power driver. */ -struct qca_power { -struct device *dev; -struct regulator_bulk_data *vreg_bulk; -int num_vregs; -bool vregs_on; -struct pwrseq_desc *pwrseq; -}; -struct qca_serdev {struct hci_uart serdev_hu;struct gpio_desc *bt_en;struct gpio_desc *sw_ctrl;struct clk *susclk;enum qca_btsoc_type btsoc_type; -struct qca_power bt_power; +struct regulator_bulk_data *vreg_bulk; +int num_vregs; +bool vregs_on; +struct pwrseq_desc *pwrseq;u32 init_speed;u32 oper_speed;bool bdaddr_property_broken;
@@ -1779,7 +1774,7 @@ static int qca_regulator_init(struct hci_uart *hu)*/ qcadev =serdev_device_get_drvdata (hu->serdev); -if (!qcadev->bt_power.vregs_on) { +if (!qcadev->vregs_on) {serdev_device_close (hu->serdev); ret =qca_regulator_enable (qcadev);if (ret)
@@ -1876,8 +1871,8 @@ static int qca_power_on(struct hci_dev *hdev)msleep (150 ); } -if (qcadev->bt_power.pwrseq) -pwrseq_power_on (qcadev->bt_power.pwrseq); +if (qcadev->pwrseq) +pwrseq_enable (qcadev->pwrseq); }clear_bit (QCA_BT_OFF , &qca->flags);
@@ -2230,7 +2225,6 @@ static void qca_power_off(struct hci_uart *hu)unsigned long flags;enum qca_btsoc_type soc_type =qca_soc_type (hu);bool sw_ctrl_state; -struct qca_power *power;/* From this point we go into power off state. But serial port may * still be open, stop queueing the IBS data and flush all the buffered
@@ -2248,7 +2242,6 @@ static void qca_power_off(struct hci_uart *hu)return ; qcadev =serdev_device_get_drvdata (hu->serdev); - power = &qcadev->bt_power;switch (soc_type) {case QCA_WCN3988 :
@@ -2268,8 +2261,8 @@ static void qca_power_off(struct hci_uart *hu)break ; } -if (power->pwrseq) { -pwrseq_disable (power->pwrseq); +if (qcadev->pwrseq) { +pwrseq_disable (qcadev->pwrseq);set_bit (QCA_BT_OFF , &qca->flags);return ; }
@@ -2325,23 +2318,22 @@ static int qca_hci_shutdown(struct hci_dev *hdev)static int qca_regulator_enable (struct qca_serdev *qcadev) { -struct qca_power *power = &qcadev->bt_power;int ret; -if (power->pwrseq) -return pwrseq_enable (power->pwrseq); +if (qcadev->pwrseq) +return pwrseq_enable (qcadev->pwrseq);/* Already enabled */ -if (power->vregs_on) +if (qcadev->vregs_on)return 0 ; -BT_DBG ("enabling %d regulators)" , power->num_vregs); +BT_DBG ("enabling %d regulators)" , qcadev->num_vregs); - ret =regulator_bulk_enable (power->num_vregs, power->vreg_bulk); + ret =regulator_bulk_enable (qcadev->num_vregs, qcadev->vreg_bulk);if (ret)return ret; - power->vregs_on = true; + qcadev->vregs_on = true; ret =clk_prepare_enable (qcadev->susclk);if (ret)
@@ -2352,38 +2344,35 @@ static int qca_regulator_enable(struct qca_serdev *qcadev)static void qca_regulator_disable (struct qca_serdev *qcadev) { -struct qca_power *power; -if (!qcadev)return ; - power = &qcadev->bt_power; -/* Already disabled? */ -if (!power->vregs_on) +if (!qcadev->vregs_on)return ; -regulator_bulk_disable (power->num_vregs, power->vreg_bulk); - power->vregs_on = false; +regulator_bulk_disable (qcadev->num_vregs, qcadev->vreg_bulk); + qcadev->vregs_on = false;clk_disable_unprepare (qcadev->susclk); } -static int qca_init_regulators (struct qca_power *qca, +static int qca_init_regulators (struct qca_serdev *qcadev,const struct qca_vreg *vregs,size_t num_vregs) { +struct device *dev = &qcadev->serdev_hu.serdev->dev;struct regulator_bulk_data *bulk;int ret;int i; - bulk =devm_kcalloc (qca->dev, num_vregs,sizeof (*bulk),GFP_KERNEL ); + bulk =devm_kcalloc (dev, num_vregs,sizeof (*bulk),GFP_KERNEL );if (!bulk)return -ENOMEM ;for (i =0 ; i < num_vregs; i++) bulk[i].supply = vregs[i].name; - ret =devm_regulator_bulk_get (qca->dev, num_vregs, bulk); + ret =devm_regulator_bulk_get (dev, num_vregs, bulk);if (ret <0 )return ret;
@@ -2393,8 +2382,8 @@ static int qca_init_regulators(struct qca_power *qca,return ret; } - qca->vreg_bulk = bulk; - qca->num_vregs = num_vregs; + qcadev->vreg_bulk = bulk; + qcadev->num_vregs = num_vregs;return 0 ; }
@@ -2422,7 +2411,7 @@ static int qca_serdev_get_m2_pwrseq(struct qca_serdev *qcadev)if (IS_ERR (pwrseq))return PTR_ERR (pwrseq); - qcadev->bt_power.pwrseq = pwrseq; + qcadev->pwrseq = pwrseq;return devm_add_action_or_reset (&serdev->dev, qca_serdev_put_pwrseq, pwrseq); }
@@ -2471,7 +2460,7 @@ static int qca_serdev_probe(struct serdev_device *serdev)case QCA_WCN6855 :case QCA_WCN7850 :/* M.2 connector modules are powered by the pwrseq acquired above. */ -if (qcadev->bt_power.pwrseq) +if (qcadev->pwrseq)break ;if (!device_property_present (&serdev->dev,"enable-gpios" )) {
@@ -2481,7 +2470,7 @@ static int qca_serdev_probe(struct serdev_device *serdev)* let's use the power sequencer. Otherwise, let's * drive everything ourselves. */ - qcadev->bt_power.pwrseq =devm_pwrseq_get (&serdev->dev, + qcadev->pwrseq =devm_pwrseq_get (&serdev->dev,"bluetooth" );/*
@@ -2490,21 +2479,20 @@ static int qca_serdev_probe(struct serdev_device *serdev)* through the power sequence. In such cases, fall through * to follow the legacy flow. */ -if (IS_ERR (qcadev->bt_power.pwrseq)) - qcadev->bt_power.pwrseq =NULL ; +if (IS_ERR (qcadev->pwrseq)) + qcadev->pwrseq =NULL ;else break ; } - qcadev->bt_power.dev = &serdev->dev; - err =qca_init_regulators (&qcadev->bt_power, data->vregs, + err =qca_init_regulators (qcadev, data->vregs, data->num_vregs);if (err) {BT_ERR ("Failed to init regulators:%d" , err);return err; } - qcadev->bt_power.vregs_on = false; + qcadev->vregs_on = false; qcadev->bt_en =devm_gpiod_get_optional (&serdev->dev,"enable" ,GPIOD_OUT_LOW );
@@ -2538,10 +2526,10 @@ static int qca_serdev_probe(struct serdev_device *serdev)case QCA_QCA6390 :if (dev_of_node (&serdev->dev)) { - qcadev->bt_power.pwrseq =devm_pwrseq_get (&serdev->dev, + qcadev->pwrseq =devm_pwrseq_get (&serdev->dev,"bluetooth" ); -if (IS_ERR (qcadev->bt_power.pwrseq)) -return PTR_ERR (qcadev->bt_power.pwrseq); +if (IS_ERR (qcadev->pwrseq)) +return PTR_ERR (qcadev->pwrseq);break ; } fallthrough;
@@ -2565,16 +2553,16 @@ static int qca_serdev_probe(struct serdev_device *serdev) } } -if (qcadev->bt_power.pwrseq) { - bt_en_available =pwrseq_is_controllable (qcadev->bt_power.pwrseq); +if (qcadev->pwrseq) { + bt_en_available =pwrseq_is_controllable (qcadev->pwrseq);if (!bt_en_available) {/* The host cannot gate the BT power individually. * Treat it as always-on and drop the pwrseq handle. * The descriptor itself is still released by devres, * so dropping the handle here is not a leak. */ -pwrseq_enable (qcadev->bt_power.pwrseq); - qcadev->bt_power.pwrseq =NULL ; +pwrseq_enable (qcadev->pwrseq); + qcadev->pwrseq =NULL ; } }
@@ -2612,7 +2600,6 @@ static int qca_serdev_probe(struct serdev_device *serdev)static void qca_serdev_remove (struct serdev_device *serdev) {struct qca_serdev *qcadev =serdev_device_get_drvdata (serdev); -struct qca_power *power = &qcadev->bt_power;switch (qcadev->btsoc_type) {case QCA_WCN3988 :
@@ -2622,7 +2609,7 @@ static void qca_serdev_remove(struct serdev_device *serdev)case QCA_WCN6750 :case QCA_WCN6855 :case QCA_WCN7850 : -if (power->vregs_on) +if (qcadev->vregs_on)qca_power_off (&qcadev->serdev_hu);break ;default :
Signature · 1 line
2.34.1
[email protected]
AI reviewRe: [PATCH v7 6/8] Bluetooth: hci_qca: Flatten struct qca_power into struct qca_serdev
Sashiko has reviewed this patch and found no issues. It looks great!
Quoted 6 lines
struct
qca_powercurrently only groups a handful of fields (vreg_bulk,num_vregs,vregs_on, pwrseq) that are exclusively used from structqca_serdev, via its embeddedbt_powermember. The extra indirection level does not provide any isolation or reuse benefit, and just adds qcadev->bt_power.<field> noise throughout the driver.
Quoted 6 lines
Drop struct
qca_powerand move its fields directly into structqca_serdev, updatingqca_init_regulators()to take a structqca_serdevpointer instead. No functional change intended.Suggested-by Dmitry Baryshkov <[email protected]>Signed-off-by Loic Poulain <[email protected]>
Sashiko has reviewed this patch and found no issues. It looks great!
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=6
PATCH v7 7/8 dt-bindings: connector: pcie-m2-e: Add vendor LGA connector compatible
In reply to Loic PoulainSome modules (e.g. the Qualcomm QCA2066/QCNFA765) expose the same M.2 Key E interface signals but are physically soldered as an LGA package rather than plugged into a real M.2 Key E connector socket. Such designs are not actual M.2 Key E connectors, so describe them with a dedicated vendor-specific compatible while keeping "pcie-m2-e-connector" as a fallback for the shared signal semantics.
Add "qcom,pcie-m2-1418-lga-connector" for the M.2 LGA 1418 found on Arduino Ventuno Q (Monaco Monza).
Add "qcom,pcie-m2-1620-lga-connector" for the M.2 LGA 1620 found on The Lenovo Thinkpad T14s.
--- .../devicetree/bindings/connector/pcie-m2-e-connector.yaml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
Documentation/devicetree/bindings/connector/pcie-m2-e-connector.yaml +7 -1
@@ -17,7 +17,13 @@ description: properties: compatible: - const: pcie-m2-e-connector + oneOf: + - const: pcie-m2-e-connector + - items: + - enum: + - qcom,pcie-m2-1418-lga-connector + - qcom,pcie-m2-1620-lga-connector + - const: pcie-m2-e-connector vpcie3v3-supply: description: A phandle to the regulator for 3.3v supply.
Signature · 1 line
2.34.1
[email protected]
AI reviewRe: [PATCH v7 7/8] dt-bindings: connector: pcie-m2-e: Add vendor LGA connector compatible
Sashiko has reviewed this patch and found no issues. It looks great!
Quoted 10 lines
Some modules (e.g. the Qualcomm QCA2066/QCNFA765) expose the same M.2 Key E interface signals but are physically soldered as an LGA package rather than plugged into a real M.2 Key E connector socket. Such designs are not actual M.2 Key E connectors, so describe them with a dedicated vendor-specific compatible while keeping "pcie-m2-e-connector" as a fallback for the shared signal semantics.
Add "qcom,pcie-m2-1418-lga-connector" for the M.2 LGA 1418 found on Arduino Ventuno Q (Monaco Monza).
Quoted 7 lines
Add "qcom,pcie-m2-1620-lga-connector" for the M.2 LGA 1620 found on The Lenovo Thinkpad T14s.
Reviewed-by Krzysztof Kozlowski <[email protected]>Reviewed-by Manivannan Sadhasivam <[email protected]>Reviewed-by Bartosz Golaszewski <[email protected]>Signed-off-by Loic Poulain <[email protected]>
Sashiko has reviewed this patch and found no issues. It looks great!
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=7
PATCH v7 8/8 arm64: dts: qcom: monaco-arduino-monza: Add QCA2066 M.2 WiFi/BT support
In reply to Loic PoulainAdd support for the QCA2066 (QCNFA765) WiFi/Bluetooth module on the Arduino VENTUNO Q board. The module is interfaced via LGA and is compatible with the M.2 Key E.
Add wireless-lga-connector node using pcie-m2-e-connector binding, connecting PCIe port 0 to the WiFi interface and UART10 port 3 to the Bluetooth interface.
Add pcie@1,0 downstream port node with pciclass,0604 compatible so the pci-pwrctrl driver can acquire the power sequencer and enable the M.2 slot before PCIe enumeration.
Add nfa725b_default_state pinctrl for the W_DISABLE1/2 GPIOs (gpio56/gpio55) used by the power sequencer.
--- arch/arm64/boot/dts/qcom/monaco-arduino-monza.dts | 64 +++++++++++++++++++++-- 1 file changed, 60 insertions(+), 4 deletions(-)
arch/arm64/boot/dts/qcom/monaco-arduino-monza.dts +60 -4
@@ -178,6 +178,40 @@ vreg_nvme: regulator-3p3-m2 { enable-active-high; startup-delay-us = <20000>; }; + + wireless-lga-connector { + compatible = "qcom,pcie-m2-1418-lga-connector", + "pcie-m2-e-connector"; + vpcie3v3-supply = <&vdc_3v3>; + vpcie1v8-supply = <&vdc_1v8>; + w-disable1-gpios = <&tlmm 56 GPIO_ACTIVE_LOW>; + w-disable2-gpios = <&tlmm 55 GPIO_ACTIVE_LOW>; + pinctrl-0 = <&nfa725b_default_state>; + pinctrl-names = "default"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + /* WiFi/PCIe */ + port@0 { + reg = <0>; + + lga_pcie_ep: endpoint { + remote-endpoint = <&pcie_ep>; + }; + }; + + /* Bluetooth/UART */ + port@3 { + reg = <3>; + + lga_uart_ep: endpoint { + remote-endpoint = <&uart10_ep>; + }; + }; + }; + }; }; &cci1 {
@@ -541,6 +575,22 @@ pcie@0,0 { ranges; reg = <0x010000 0x00 0x00 0x00 0x00>; + pcie@1,0 { + #address-cells = <3>; + #size-cells = <2>; + device_type = "pci"; + compatible = "pciclass,0604"; + bus-range = <0x00 0xff>; + ranges; + reg = <0x020800 0x00 0x00 0x00 0x00>; + + port { + pcie_ep: endpoint { + remote-endpoint = <&lga_pcie_ep>; + }; + }; + }; + pcie@2,0 { #address-cells = <3>; #size-cells = <2>;
@@ -694,6 +744,12 @@ max98091_default: max98091-default-state { bias-pull-up; }; + nfa725b_default_state: nfa725b-default-state { + pins = "gpio55", "gpio56"; + function = "gpio"; + bias-disable; + }; + pcie1_default_state: pcie1-default-state { wake-pins { pins = "gpio21";
@@ -745,10 +801,10 @@ &uart7 { &uart10 { status = "okay"; - bluetooth: bluetooth { - compatible = "qcom,qca2066-bt"; - enable-gpios = <&tlmm 55 GPIO_ACTIVE_HIGH>; - clocks = <&sleep_clk>; + port { + uart10_ep: endpoint { + remote-endpoint = <&lga_uart_ep>; + }; }; };
Signature · 1 line
2.34.1
[email protected]
AI reviewRe: [PATCH v7 8/8] arm64: dts: qcom: monaco-arduino-monza: Add QCA2066 M.2 WiFi/BT support
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider: - [Low] dts: qcom: missing clocks property in wireless-lga-connector - [Low] dts: qcom: invalid bus-range…
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Low] dts: qcom: missing clocks property in wireless-lga-connector
- [Low] dts: qcom: invalid bus-range property for downstream PCI bridge
--
commit 29a5722958bd298370461ff6846d50f2a2e13fa0
Author: Loic Poulain <[email protected]>
arm64: dts: qcom: monaco-arduino-monza: Add QCA2066 M.2 WiFi/BT support
This commit adds support for the QCA2066 WiFi/Bluetooth module on the Arduino VENTUNO Q board. It introduces a wireless-lga-connector node and a downstream pcie port to enable the M.2 slot power sequencer.
Quoted 6 lines
arch/arm64/boot/dts/qcom/monaco-arduino-monza.dts +0
-0@@ -178,6 +178,40 @@ vreg_nvme: regulator-3p3-m2 { enable-active-high;
arch/arm64/boot/dts/qcom/monaco-arduino-monza.dts vreg_nvme: regulator-3p3-m2 { · line 188
Quoted 10 lines
arch/arm64/boot/dts/qcom/monaco-arduino-monza.dts +8
-0startup-delay-us = <20000>; }; + + wireless-lga-connector { + compatible = "qcom,pcie-m2-1418-lga-connector", + "pcie-m2-e-connector"; + vpcie3v3-supply = <&vdc_3v3>; + vpcie1v8-supply = <&vdc_1v8>; + w-disable1-gpios = <&tlmm 56 GPIO_ACTIVE_LOW>; + w-disable2-gpios = <&tlmm 55 GPIO_ACTIVE_LOW>;
[Severity: Low]
Is the clocks property missing here in the wireless-lga-connector node for the M.2 SUSCLK routing?
The clocks property is defined in the pcie-m2-e-connector binding and was previously included in the legacy bluetooth node, but appears to have been dropped during the transition to the new node. Because sleep_clk is a fixed clock that is physically always running on this platform, the omission causes no functional regression, but the Device Tree hardware description seems incomplete without the SUSCLK routing.
[ ... ]
arch/arm64/boot/dts/qcom/monaco-arduino-monza.dts pcie@0,0 { · line 583
Quoted 10 lines
arch/arm64/boot/dts/qcom/monaco-arduino-monza.dts +6
-0@@ -541,6 +575,22 @@ pcie@0,0 { ranges; reg = <0x010000 0x00 0x00 0x00 0x00>; + pcie@1,0 { + #address-cells = <3>; + #size-cells = <2>; + device_type = "pci"; + compatible = "pciclass,0604"; + bus-range = <0x00 0xff>;
[Severity: Low]
Does this bus-range property in the pcie@1,0 node define an invalid secondary bus?
The bus-range property claims the downstream bridge's secondary bus is 0, which violates PCI numbering rules since its primary bus is 2 (encoded in the reg property as 0x020800).
The Linux PCI core dynamically reassigns invalid topologies for downstream bridges, preventing functional breakage. However, specifying a topologically invalid bus range in the DT seems to be an error.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=8
Hi Luiz, Bartosz,
Quoted 14 lines · Loic Poulain
This series describes support for the onboard WiFi/Bluetooth module present on the Arduino VENTUNO Q (monaco) platform.
The board provides LGA pads for a wireless module. On the VENTUNO Q these pads are populated with an NFA725B module featuring the QCA2066 WiFi/BT combo chip. While implemented as an LGA footprint, the design is functionally compatible with the M.2 Key E.
The NFA725B exposes WiFi over PCIe and Bluetooth over a UART. Both interfaces are gated through the W_DISABLE1# and W_DISABLE2# signals, as defined by the M.2 specification and handled here via the pcie-m2 power sequencer.
Quoted 4 lines
This series models the hardware using the existing pwrseq framework and connector bindings, allowing coordinated PCIe and UART bring-up.
Signed-off-by Loic Poulain <[email protected]>
Is there anything blocking this series from being picked up for Bluetooth? I've already rebased it, so I'd appreciate any feedback if anything still needs to be addressed.
Thanks,
Loic
Quoted 81 lines
---
Changes in v7:
- Rebased on linux-next (pwrseq changes dropped)
- Link to v6: https://lore.kernel.org/r/[email protected]Changes in v6:
- Rebase onto v7.3-rc1: drop the now-upstream "power: sequencing: pcie-m2:
Add QCA2066 (QCNFA765) BT serdev ID" patch and adapt to the pwrseq_power_on()/pwrseq_power_off() -> pwrseq_enable()/pwrseq_disable()
rename that landed in this merge window.
-hci_qca: fully drop structqca_powerand move its fields directly into
structqca_serdev, removing thebt_powerindirection (Dmitry).
- Pick up Reviewed-by/Acked-by tags from Mani, Bartosz and Dmitry on thepwrseq_is_controllable()API, the pcie-m2/qcom-wcn controllability
reporting, thebt_en_availablerework and the M.2 connector support
patches.
- Drop the pwrseq-m2-bt prerequisite series link, it is now merged upstream
and included in the v7.3-rc1 base.
- Link to v5: https://lore.kernel.org/r/[email protected]Changes in v5:
-hci_qca: comment why the M.2 'uart' pwrseq lifetime is bound to the serdev consumer device instead of usingdevm_pwrseq_get()on the controller (Bartosz).
-hci_qca: note that dropping the always-on pwrseq handle is not a leak since
the descriptor is still released by devres (Bartosz).
- Link to v4: https://lore.kernel.org/r/[email protected]Changes in v4:
- pwrseq: renamepwrseq_power_is_controllable()topwrseq_is_controllable()(Bartosz).
- pwrseq: move theis_controllable()callback from the unit to the target (Bartosz).
- pwrseq: addmight_sleep()and guardpwrseq_is_controllable()against
concurrent provider removal withrw_lock, matching pwrseq_power_on/off() (Bartosz).
- pwrseq: clarify thepwrseq_is_controllable()doc (Bartosz)
-hci_qca: lifetime follows the Bluetooth device rather than the UART controller (ChenYu).
- dt-bindings: also add the "qcom,pcie-m2-1620-lga-connector" compatible (Mani).
- arm64: dts: monaco-arduino-monza: rename the 'pcie_bridge_ep' endpoint to 'pcie_ep' (Mani).
- pwrseq: reword commmit message (Mani)
- Link to v3: https://lore.kernel.org/r/[email protected]Changes in v3:
- Embedbt_powerin structqca_serdevinstead of allocating it (Dmitry).
- Add genericpwrseq_is_controllable()API + per-target .is_controllable() callback; use it inhci_qcainstead of peeking at the W_DISABLE2# property.
- Implement .is_controllable() in the pcie-m2 and qcom-wcn providers.
- Treat non-controllable BT power as always-on.
- Integrate the pending Bluetooth pwrseq patches from Mani.
- Link to v2: https://lore.kernel.org/r/[email protected]Changes in v2:
-hci_qca: extract M.2 pwrseq intoqca_serdev_get_m2_pwrseq()helper, called outside the SoC switch; drop duplicatedof_graphlogic and redundant
bt_powerNULL checks (Dmitry/Mani)
- dts/bindings: use qcom,pcie-m2-1418-lga-connector (fallback
pcie-m2-e-connector) instead of the generic M.2 E-key compatible (Mani)
- Link to v1: https://lore.kernel.org/r/[email protected]---
Loic Poulain (6):
Bluetooth:hci_qca: Set 'bt_en_available' based on pwrseq power controllability
Bluetooth:hci_qca: Embedbt_powerin structqca_serdev
Bluetooth:hci_qca: Support QCA2066 on M.2 connector via pwrseq
Bluetooth:hci_qca: Flatten structqca_powerinto structqca_serdev
dt-bindings: connector: pcie-m2-e: Add vendor LGA connector compatible
arm64: dts: qcom: monaco-arduino-monza: Add QCA2066 M.2 WiFi/BT supportManivannan Sadhasivam (2):
Bluetooth:hci_qca: Add M.2 Bluetooth device support using pwrseq
Bluetooth:hci_qca: Rename 'power_ctrl_enabled' to 'bt_en_available'.../bindings/connector/pcie-m2-e-connector.yaml | 8 +- arch/arm64/boot/dts/qcom/monaco-arduino-monza.dts | 64 ++++++++- drivers/bluetooth/hci_qca.c | 160 ++++++++++++--------- 3 files changed, 157 insertions(+), 75 deletions(-)---
base-commit:f0406245cb9855e6318335a8a223551354291a46
change-id: 20260520-monza-wireless-e6ce7f013f38Best regards,
--
Loic Poulain <[email protected]>