Bluetooth: qca: use the power sequencing subsystem in hci_qca
Subsystems (5)
v9 cover Bluetooth: qca: use the power sequencing subsystem in hci_qca
From: Bartosz Golaszewski <[email protected]>
Here are the dt-bindings and the hci_qca patches split out of the larger power sequencing series. They target the Bluetooth subsystem but depend on the following immutable tag:
https://lore.kernel.org/lkml/[email protected]/
Please consider picking them up into your tree, they were reviewed and thoroughly tested.
Changelog:
Since v8:
- split out the Bluetooth patches into their own series
- Link to v8: https://lore.kernel.org/r/[email protected]
Since v7:
- added DTS changes for sm8650-hdk
- added circular dependency detection for pwrseq units
- fixed a KASAN reported use-after-free error in remove path
- improve Kconfig descriptions
- fix typos in bindings and Kconfig
- fixed issues reported by smatch
- fix the unbind path in PCI pwrctl
- lots of minor improvements to the pwrseq core
Since v6:
- kernel doc fixes
- drop myself from the DT bindings maintainers list for ath12k
- wait until the PCI bridge device is fully added before creating the PCI pwrctl platform devices for its sub-nodes, otherwise we may see sysfs and procfs attribute failures (due to duplication, we're basically trying to probe the same device twice at the same time)
- I kept the regulators for QCA6390's ath11k as required as they only apply to this specific Qualcomm package
Since v5:
- unify the approach to modelling the WCN WLAN/BT chips by always exposing the PMU node on the device tree and making the WLAN and BT nodes become consumers of its power outputs; this includes a major rework of the DT sources, bindings and driver code; there's no more a separate PCI pwrctl driver for WCN7850, instead its power-up sequence was moved into the pwrseq driver common for all WCN chips
- don't set load_uA from new regulator consumers
- fix reported kerneldoc issues
- drop voltage ranges for PMU outputs from DT
- many minor tweaks and reworks
v1: Original RFC:
https://lore.kernel.org/lkml/[email protected]/T/
v2: First real patch series (should have been PATCH v2) adding what I
referred to back then as PCI power sequencing:
https://lore.kernel.org/linux-arm-kernel/2024021413-grumbling-unlivable-c145@gregkh/T/
v3: RFC for the DT representation of the PMU supplying the WLAN and BT
modules inside the QCA6391 package (was largely separate from the series but probably should have been called PATCH or RFC v3):
https://lore.kernel.org/all/CAMRc=Mc+GNoi57eTQg71DXkQKjdaoAmCpB=h2ndEpGnmdhVV-Q@mail.gmail.com/T/
v4: Second attempt at the full series with changed scope (introduction of
the pwrseq subsystem, should have been RFC v4)
https://lore.kernel.org/lkml/[email protected]/T/
v5: Two different ways of handling QCA6390 and WCN7850:
https://lore.kernel.org/lkml/[email protected]/
Bartosz Golaszewski (2):
dt-bindings: net: bluetooth: qualcomm: describe regulators for QCA6390
Bluetooth: qca: use the power sequencer for QCA6390
.../net/bluetooth/qualcomm-bluetooth.yaml | 17 +++++ drivers/bluetooth/hci_qca.c | 74 +++++++++++++++---- 2 files changed, 76 insertions(+), 15 deletions(-)
Signature · 1 line
2.40.1
PATCH v9 1/2 dt-bindings: net: bluetooth: qualcomm: describe regulators for QCA6390
From: Bartosz Golaszewski <[email protected]>
QCA6390 has a compatible listed in the bindings but is missing the regulators description. Add the missing supply property and list the required ones in the allOf section.
--- .../net/bluetooth/qualcomm-bluetooth.yaml | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
Documentation/devicetree/bindings/net/bluetooth/qualcomm-bluetooth.yaml +17 -0
@@ -62,6 +62,9 @@ properties: vdddig-supply: description: VDD_DIG supply regulator handle + vddbtcmx-supply: + description: VDD_BT_CMX supply regulator handle + vddbtcxmx-supply: description: VDD_BT_CXMX supply regulator handle
@@ -184,6 +187,20 @@ allOf: - vddrfa0p8-supply - vddrfa1p2-supply - vddrfa1p9-supply + - if: + properties: + compatible: + contains: + enum: + - qcom,qca6390-bt + then: + required: + - vddrfacmn-supply + - vddaon-supply + - vddbtcmx-supply + - vddrfa0p8-supply + - vddrfa1p2-supply + - vddrfa1p7-supply examples: - |
Signature · 1 line
2.40.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/project/bluetooth/list/?series=861073
---Test result---
Test Summary:
CheckPatch PASS 1.57 seconds GitLint FAIL 0.87 seconds SubjectPrefix FAIL 0.90 seconds BuildKernel FAIL 24.38 seconds CheckAllWarning FAIL 26.72 seconds CheckSparse FAIL 30.68 seconds CheckSmatch FAIL 81.52 seconds BuildKernel32 FAIL 23.75 seconds TestRunnerSetup PASS 534.54 seconds TestRunner_l2cap-tester PASS 21.96 seconds TestRunner_iso-tester FAIL 32.86 seconds TestRunner_bnep-tester PASS 5.48 seconds TestRunner_mgmt-tester PASS 122.50 seconds TestRunner_rfcomm-tester PASS 7.45 seconds TestRunner_sco-tester PASS 15.05 seconds TestRunner_ioctl-tester PASS 8.78 seconds TestRunner_mesh-tester PASS 5.96 seconds TestRunner_smp-tester PASS 7.07 seconds TestRunner_userchan-tester PASS 5.03 seconds IncrementalBuild FAIL 32.58 seconds
Details
##############################
Test: GitLint - FAIL
Desc: Run gitlint
Output:
[v9,2/2] Bluetooth: qca: use the power sequencer for QCA6390
WARNING: I3 - ignore-body-lines: gitlint will be switching from using Python regex 'match' (match beginning) to 'search' (match anywhere) semantics. Please review your ignore-body-lines.regex option accordingly. To remove this warning, set general.regex-style-search=True. More details: https://jorisroovers.github.io/gitlint/configuration/#regex-style-search
9: B1 Line exceeds max length (94>80): "Tested-by: Neil Armstrong <[email protected]> # on SM8550-QRD, SM8650-QRD & SM8650-HDK"
##############################
Test: SubjectPrefix - FAIL
Desc: Check subject contains "Bluetooth" prefix
Output:
"Bluetooth: " prefix is not specified in the subject
##############################
Test: BuildKernel - FAIL
Desc: Build Kernel for Bluetooth
Output:
drivers/bluetooth/hci_qca.c:31:10: fatal error: linux/pwrseq/consumer.h: No such file or directory
31 | #include <linux/pwrseq/consumer.h>
| ^~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[4]: *** [scripts/Makefile.build:244: drivers/bluetooth/hci_qca.o] Error 1 make[3]: *** [scripts/Makefile.build:485: drivers/bluetooth] Error 2 make[2]: *** [scripts/Makefile.build:485: drivers] Error 2 make[2]: *** Waiting for unfinished jobs....
make[1]: *** [/github/workspace/src/src/Makefile:1934: .] Error 2
make: *** [Makefile:240: __sub-make] Error 2
##############################
Test: CheckAllWarning - FAIL
Desc: Run linux kernel with all warning enabled
Output:
drivers/bluetooth/hci_qca.c:31:10: fatal error: linux/pwrseq/consumer.h: No such file or directory
31 | #include <linux/pwrseq/consumer.h>
| ^~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[4]: *** [scripts/Makefile.build:244: drivers/bluetooth/hci_qca.o] Error 1 make[3]: *** [scripts/Makefile.build:485: drivers/bluetooth] Error 2 make[2]: *** [scripts/Makefile.build:485: drivers] Error 2 make[2]: *** Waiting for unfinished jobs....
make[1]: *** [/github/workspace/src/src/Makefile:1934: .] Error 2
make: *** [Makefile:240: __sub-make] Error 2
##############################
Test: CheckSparse - FAIL
Desc: Run sparse tool with linux kernel
Output:
net/bluetooth/af_bluetooth.c:223:25: warning: context imbalance in 'bt_accept_enqueue' - different lock contexts for basic block drivers/bluetooth/hci_qca.c:31:10: fatal error: linux/pwrseq/consumer.h: No such file or directory
31 | #include <linux/pwrseq/consumer.h>
| ^~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[4]: *** [scripts/Makefile.build:244: drivers/bluetooth/hci_qca.o] Error 1 make[3]: *** [scripts/Makefile.build:485: drivers/bluetooth] Error 2
make[2]: *** [scripts/Makefile.build:485: drivers] Error 2
make[2]: *** Waiting for unfinished jobs....net/bluetooth/hci_event.c: note: in included file (through include/net/bluetooth/hci_core.h):./include/net/bluetooth/hci.h:2596:47: warning: array of flexible structures ./include/net/bluetooth/hci.h:2682:43: warning: array of flexible structures net/bluetooth/hci_codec.c: note: in included file:./include/net/bluetooth/hci_core.h:149:35: warning: array of flexible structures net/bluetooth/sco.c: note: in included file:./include/net/bluetooth/hci_core.h:149:35: warning: array of flexible structures make[1]: *** [/github/workspace/src/src/Makefile:1934: .] Error 2
make: *** [Makefile:240: __sub-make] Error 2
##############################
Test: CheckSmatch - FAIL
Desc: Run smatch tool with source
Output:
drivers/bluetooth/hci_qca.c:31:10: fatal error: linux/pwrseq/consumer.h: No such file or directory
31 | #include <linux/pwrseq/consumer.h>
| ^~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[4]: *** [scripts/Makefile.build:244: drivers/bluetooth/hci_qca.o] Error 1 make[3]: *** [scripts/Makefile.build:485: drivers/bluetooth] Error 2
make[2]: *** [scripts/Makefile.build:485: drivers] Error 2
make[2]: *** Waiting for unfinished jobs....net/bluetooth/hci_event.c: note: in included file (through include/net/bluetooth/hci_core.h):./include/net/bluetooth/hci.h:2596:47: warning: array of flexible structures ./include/net/bluetooth/hci.h:2682:43: warning: array of flexible structures net/bluetooth/hci_codec.c: note: in included file:./include/net/bluetooth/hci_core.h:149:35: warning: array of flexible structures net/bluetooth/sco.c: note: in included file:./include/net/bluetooth/hci_core.h:149:35: warning: array of flexible structures make[1]: *** [/github/workspace/src/src/Makefile:1934: .] Error 2
make: *** [Makefile:240: __sub-make] Error 2
##############################
Test: BuildKernel32 - FAIL
Desc: Build 32bit Kernel for Bluetooth
Output:
drivers/bluetooth/hci_qca.c:31:10: fatal error: linux/pwrseq/consumer.h: No such file or directory
31 | #include <linux/pwrseq/consumer.h>
| ^~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[4]: *** [scripts/Makefile.build:244: drivers/bluetooth/hci_qca.o] Error 1 make[3]: *** [scripts/Makefile.build:485: drivers/bluetooth] Error 2 make[2]: *** [scripts/Makefile.build:485: drivers] Error 2 make[2]: *** Waiting for unfinished jobs....
make[1]: *** [/github/workspace/src/src/Makefile:1934: .] Error 2
make: *** [Makefile:240: __sub-make] Error 2
##############################
Test: TestRunner_iso-tester - FAIL
Desc: Run iso-tester with test-runner
Output:
Total: 122, Passed: 117 (95.9%), Failed: 1, Not Run: 4
Failed Test Cases
ISO Connect Suspend - Success Failed 4.180 seconds
##############################
Test: IncrementalBuild - FAIL
Desc: Incremental build with the patches in the series Output:
[v9,2/2] Bluetooth: qca: use the power sequencer for QCA6390
drivers/bluetooth/hci_qca.c:31:10: fatal error: linux/pwrseq/consumer.h: No such file or directory
31 | #include <linux/pwrseq/consumer.h>
| ^~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[4]: *** [scripts/Makefile.build:244: drivers/bluetooth/hci_qca.o] Error 1 make[3]: *** [scripts/Makefile.build:485: drivers/bluetooth] Error 2 make[2]: *** [scripts/Makefile.build:485: drivers] Error 2 make[1]: *** [/github/workspace/src/src/Makefile:1934: .] Error 2
make: *** [Makefile:240: __sub-make] Error 2
---
Regards,
Linux Bluetooth
PATCH v9 2/2 Bluetooth: qca: use the power sequencer for QCA6390
In reply to Bartosz GolaszewskiFrom: Bartosz Golaszewski <[email protected]>
Use the pwrseq subsystem's consumer API to run the power-up sequence for the Bluetooth module of the QCA6390 package.
--- drivers/bluetooth/hci_qca.c | 74 +++++++++++++++++++++++++++++-------- 1 file changed, 59 insertions(+), 15 deletions(-)
drivers/bluetooth/hci_qca.c +59 -15
@@ -28,6 +28,7 @@#include <linux/of.h> #include <linux/acpi.h> #include <linux/platform_device.h> +#include <linux/pwrseq/consumer.h> #include <linux/regulator/consumer.h> #include <linux/serdev.h> #include <linux/mutex.h>
@@ -214,6 +215,7 @@ struct qca_power {struct regulator_bulk_data *vreg_bulk;int num_vregs;bool vregs_on; +struct pwrseq_desc *pwrseq; };struct qca_serdev {
@@ -1684,6 +1686,27 @@ static bool qca_wakeup(struct hci_dev *hdev)return wakeup; } +static int qca_port_reopen (struct hci_uart *hu) +{ +int ret; + +/* Now the device is in ready state to communicate with host. +* To sync host with device we need to reopen port. +* Without this, we will have RTS and CTS synchronization +* issues. +*/ +serdev_device_close (hu->serdev); + ret =serdev_device_open (hu->serdev); +if (ret) { +bt_dev_err (hu->hdev,"failed to open port" ); +return ret; + } + +hci_uart_set_flow_control (hu, false); + +return 0 ; +} +static int qca_regulator_init (struct hci_uart *hu) {enum qca_btsoc_type soc_type =qca_soc_type (hu);
@@ -1752,21 +1775,7 @@ static int qca_regulator_init(struct hci_uart *hu)break ; } -/* Now the device is in ready state to communicate with host. -* To sync host with device we need to reopen port. -* Without this, we will have RTS and CTS synchronization -* issues. -*/ -serdev_device_close (hu->serdev); - ret =serdev_device_open (hu->serdev); -if (ret) { -bt_dev_err (hu->hdev,"failed to open port" ); -return ret; - } - -hci_uart_set_flow_control (hu, false); - -return 0 ; +return qca_port_reopen (hu); }static int qca_power_on (struct hci_dev *hdev)
@@ -1794,6 +1803,17 @@ static int qca_power_on(struct hci_dev *hdev) ret =qca_regulator_init (hu);break ; +case QCA_QCA6390 : + qcadev =serdev_device_get_drvdata (hu->serdev); + ret =pwrseq_power_on (qcadev->bt_power->pwrseq); +if (ret) +return ret; + + ret =qca_port_reopen (hu); +if (ret) +return ret; +break ; +default : qcadev =serdev_device_get_drvdata (hu->serdev);if (qcadev->bt_en) {
@@ -2168,6 +2188,10 @@ static void qca_power_shutdown(struct hci_uart *hu) }break ; +case QCA_QCA6390 : +pwrseq_power_off (qcadev->bt_power->pwrseq); +break ; +default :gpiod_set_value_cansleep (qcadev->bt_en,0 ); }
@@ -2309,12 +2333,25 @@ static int qca_serdev_probe(struct serdev_device *serdev)case QCA_WCN6750 :case QCA_WCN6855 :case QCA_WCN7850 : +case QCA_QCA6390 : 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_WCN3988 : +case QCA_WCN3990 : +case QCA_WCN3991 : +case QCA_WCN3998 : +case QCA_WCN6750 : +case QCA_WCN6855 : +case QCA_WCN7850 : qcadev->bt_power->dev = &serdev->dev; err =qca_init_regulators (qcadev->bt_power, data->vregs, data->num_vregs);
@@ -2360,6 +2397,13 @@ static int qca_serdev_probe(struct serdev_device *serdev) }break ; +case QCA_QCA6390 : + qcadev->bt_power->pwrseq =devm_pwrseq_get (&serdev->dev, +"bluetooth" ); +if (IS_ERR (qcadev->bt_power->pwrseq)) +return PTR_ERR (qcadev->bt_power->pwrseq); + fallthrough; +default : qcadev->bt_en =devm_gpiod_get_optional (&serdev->dev,"enable" ,GPIOD_OUT_LOW );
Signature · 1 line
2.40.1
This series was applied to bluetooth/bluetooth-next.git (master) by Luiz Augusto von Dentz <[email protected]>:
Hello:
This series was applied to bluetooth/bluetooth-next.git (master) by Luiz Augusto von Dentz <[email protected]>:
Quoted 9 lines · On Wed, 12 Jun 2024 10:01:48 +0200 you wrote:
From: Bartosz Golaszewski <[email protected]>
Here are the dt-bindings and the
hci_qcapatches split out of the larger power sequencing series. They target the Bluetooth subsystem but depend on the following immutable tag:https://lore.kernel.org/lkml/[email protected]/[...]
Here is the summary with links:
- [v9,1/2] dt-bindings: net: bluetooth: qualcomm: describe regulators for QCA6390
https://git.kernel.org/bluetooth/bluetooth-next/c/251180e6dba5 - [v9,2/2] Bluetooth: qca: use the power sequencer for QCA6390 https://git.kernel.org/bluetooth/bluetooth-next/c/4029dba6b6f1
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html