Skip to contentSkip to conversation

pwrseq: introduce the subsystem and first driver

PATCH Applied Bartosz Golaszewski 7 participants 20 messages Jun 5, 2024 – Jun 24, 2024

Subsystems (6)
lore
Share & tools
lore
#0 lore raw

v9 cover pwrseq: introduce the subsystem and first driver

From: Bartosz Golaszewski <[email protected]>

Hi!

These are the power sequencing patches sent separately after some improvements suggested by Bjorn Helgaas. I intend to pick them up into a new branch and maintain the subsystem from now on. I then plan to provide an immutable tag to the Bluetooth and PCI subsystems so that the rest of the C changes can be applied. This new branch will then be directly sent to Linus Torvalds for the next merge window.

Changelog:

Since v8:
- split the pwrseq patches out into their own series
- rename incref/decref functions to get/put for consistency
- fix typos
- make it very explicit in docs that arrays of targets and units must be NULL-terminated
- 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):
power: sequencing: implement the pwrseq core
power: pwrseq: add a driver for the PMU module on the QCom WCN
chipsets

 MAINTAINERS                                |    8 +
 drivers/power/Kconfig                      |    1 +
 drivers/power/Makefile                     |    1 +
 drivers/power/sequencing/Kconfig           |   29 +
 drivers/power/sequencing/Makefile          |    6 +
 drivers/power/sequencing/core.c            | 1105 ++++++++++++++++++++
 drivers/power/sequencing/pwrseq-qcom-wcn.c |  336 ++++++
 include/linux/pwrseq/consumer.h            |   56 +
 include/linux/pwrseq/provider.h            |   75 ++
 9 files changed, 1617 insertions(+)
 create mode 100644 drivers/power/sequencing/Kconfig
 create mode 100644 drivers/power/sequencing/Makefile
 create mode 100644 drivers/power/sequencing/core.c
 create mode 100644 drivers/power/sequencing/pwrseq-qcom-wcn.c
 create mode 100644 include/linux/pwrseq/consumer.h
 create mode 100644 include/linux/pwrseq/provider.h
Signature · 1 line
2.40.1
#1 lore raw

PATCH v9 1/2 power: sequencing: implement the pwrseq core

From: Bartosz Golaszewski <[email protected]>

Implement the power sequencing subsystem allowing devices to share complex powering-up and down procedures. It's split into the consumer and provider parts but does not implement any new DT bindings so that the actual power sequencing is never revealed in the DT representation.

---
 MAINTAINERS                       |    8 +
 drivers/power/Kconfig             |    1 +
 drivers/power/Makefile            |    1 +
 drivers/power/sequencing/Kconfig  |   12 +
 drivers/power/sequencing/Makefile |    4 +
 drivers/power/sequencing/core.c   | 1105 +++++++++++++++++++++++++++++
 include/linux/pwrseq/consumer.h   |   56 ++
 include/linux/pwrseq/provider.h   |   75 ++
 8 files changed, 1262 insertions(+)
 create mode 100644 drivers/power/sequencing/Kconfig
 create mode 100644 drivers/power/sequencing/Makefile
 create mode 100644 drivers/power/sequencing/core.c
 create mode 100644 include/linux/pwrseq/consumer.h
 create mode 100644 include/linux/pwrseq/provider.h
MAINTAINERS +8 -0
index 242fc612fbc5..79d118779121 100644
@@ -17931,6 +17931,14 @@ F:	include/linux/pm_*
 F:	include/linux/powercap.h
 F:	kernel/configs/nopm.config
 
+POWER SEQUENCING
+M:	Bartosz Golaszewski <[email protected]>
+L:	[email protected]
+S:	Maintained
+T:	git git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux.git
+F:	drivers/power/sequencing/
+F:	include/linux/pwrseq/
+
 POWER STATE COORDINATION INTERFACE (PSCI)
 M:	Mark Rutland <[email protected]>
 M:	Lorenzo Pieralisi <[email protected]>
drivers/power/Kconfig +1 -0
index 696bf77a7042..9a8e44ca9ae4 100644
@@ -1,3 +1,4 @@
 # SPDX-License-Identifier: GPL-2.0-only
 source "drivers/power/reset/Kconfig"
+source "drivers/power/sequencing/Kconfig"
 source "drivers/power/supply/Kconfig"
drivers/power/Makefile +1 -0
index effbf0377f32..962a2cd30a51 100644
@@ -1,3 +1,4 @@
 # SPDX-License-Identifier: GPL-2.0-only
 obj-$(CONFIG_POWER_RESET)	+= reset/
+obj-$(CONFIG_POWER_SEQUENCING)	+= sequencing/
 obj-$(CONFIG_POWER_SUPPLY)	+= supply/
drivers/power/sequencing/Kconfig new file +12 -0
new file mode 100644
index 000000000000..ba5732b1dbf8
@@ -0,0 +1,12 @@
+# SPDX-License-Identifier: GPL-2.0-only
+
+menuconfig POWER_SEQUENCING
+	tristate "Power Sequencing support"
+	help
+	  Say Y here to enable the Power Sequencing subsystem.
+
+	  This subsystem is designed to control power to devices that share
+	  complex resources and/or require specific power sequences to be run
+	  during power-up.
+
+	  If unsure, say no.
drivers/power/sequencing/Makefile new file +4 -0
new file mode 100644
index 000000000000..dcdf8c0c159e
@@ -0,0 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0
+
+obj-$(CONFIG_POWER_SEQUENCING)		+= pwrseq-core.o
+pwrseq-core-y				:= core.o
drivers/power/sequencing/core.c new file +1105 -0

1,105 lines not on this page · raw message

include/linux/pwrseq/consumer.h new file +56 -0

56 lines not on this page · raw message

include/linux/pwrseq/provider.h new file +75 -0

75 lines not on this page · raw message

Signature · 1 line
2.40.1
#2 lore raw

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=859074

---Test result---

Test Summary:

CheckPatch                    FAIL      5.03 seconds
GitLint                       FAIL      0.82 seconds
SubjectPrefix                 FAIL      0.48 seconds
BuildKernel                   PASS      30.02 seconds
CheckAllWarning               PASS      32.76 seconds
CheckSparse                   PASS      38.99 seconds
CheckSmatch                   FAIL      35.25 seconds
BuildKernel32                 PASS      29.18 seconds
TestRunnerSetup               PASS      530.88 seconds
TestRunner_l2cap-tester       PASS      18.53 seconds
TestRunner_iso-tester         PASS      32.68 seconds
TestRunner_bnep-tester        PASS      4.91 seconds
TestRunner_mgmt-tester        FAIL      116.67 seconds
TestRunner_rfcomm-tester      PASS      7.49 seconds
TestRunner_sco-tester         PASS      17.12 seconds
TestRunner_ioctl-tester       PASS      8.42 seconds
TestRunner_mesh-tester        PASS      6.08 seconds
TestRunner_smp-tester         PASS      7.05 seconds
TestRunner_userchan-tester    PASS      5.10 seconds
IncrementalBuild              PASS      33.20 seconds

Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script
Output:
[v9,1/2] power: sequencing: implement the pwrseq core
WARNING: ENOSYS means 'invalid syscall nr' and nothing else #1374: FILE: include/linux/pwrseq/consumer.h:31:
+ return ERR_PTR(-ENOSYS);

WARNING: ENOSYS means 'invalid syscall nr' and nothing else #1384: FILE: include/linux/pwrseq/consumer.h:41:
+ return ERR_PTR(-ENOSYS);

WARNING: ENOSYS means 'invalid syscall nr' and nothing else #1389: FILE: include/linux/pwrseq/consumer.h:46:
+ return -ENOSYS;

WARNING: ENOSYS means 'invalid syscall nr' and nothing else #1394: FILE: include/linux/pwrseq/consumer.h:51:
+ return -ENOSYS;

total: 0 errors, 4 warnings, 1274 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or --fix-inplace.

/github/workspace/src/src/13686797.patch has style problems, please review.

NOTE: Ignored message types: UNKNOWN_COMMIT_ID

NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.

[v9,2/2] power: pwrseq: add a driver for the PMU module on the QCom WCN chipsets
WARNING: added, moved or deleted file(s), does MAINTAINERS need updating? #192:
new file mode 100644

WARNING: DT compatible string "qcom,qca6390-pmu" appears un-documented -- check ./Documentation/devicetree/bindings/ #510: FILE: drivers/power/sequencing/pwrseq-qcom-wcn.c:314:
+ .compatible = "qcom,qca6390-pmu",

WARNING: DT compatible string "qcom,wcn7850-pmu" appears un-documented -- check ./Documentation/devicetree/bindings/ #514: FILE: drivers/power/sequencing/pwrseq-qcom-wcn.c:318:
+ .compatible = "qcom,wcn7850-pmu",

total: 0 errors, 3 warnings, 361 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or --fix-inplace.

/github/workspace/src/src/13686796.patch has style problems, please review.

NOTE: Ignored message types: UNKNOWN_COMMIT_ID

NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.

##############################
Test: GitLint - FAIL
Desc: Run gitlint
Output:
[v9,1/2] power: sequencing: implement the pwrseq core

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
11: B1 Line exceeds max length (94>80): "Tested-by: Neil Armstrong <[email protected]> # on SM8550-QRD, SM8650-QRD & SM8650-HDK"
[v9,2/2] power: pwrseq: add a driver for the PMU module on the QCom WCN chipsets

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
13: 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
"Bluetooth: " prefix is not specified in the subject
##############################
Test: CheckSmatch - FAIL
Desc: Run smatch tool with source
Output:

Segmentation fault (core dumped)
make[4]: *** [scripts/Makefile.build:244: net/bluetooth/hci_core.o] Error 139 make[4]: *** Deleting file 'net/bluetooth/hci_core.o'
make[3]: *** [scripts/Makefile.build:485: net/bluetooth] Error 2 make[2]: *** [scripts/Makefile.build:485: net] Error 2
make[2]: *** Waiting for unfinished jobs....
Segmentation fault (core dumped)
make[4]: *** [scripts/Makefile.build:244: drivers/bluetooth/bcm203x.o] Error 139 make[4]: *** Deleting file 'drivers/bluetooth/bcm203x.o'
make[4]: *** Waiting for unfinished jobs....
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:1919: .] Error 2
make: *** [Makefile:240: __sub-make] Error 2
##############################
Test: TestRunner_mgmt-tester - FAIL
Desc: Run mgmt-tester with test-runner
Output:
Total: 492, Passed: 488 (99.2%), Failed: 2, Not Run: 2

Failed Test Cases

LL Privacy - Add Device 5 (2 Devices to RL)          Failed       0.165 seconds
LL Privacy - Remove Device 4 (Disable Adv)           Timed out    2.353 seconds

---
Regards,
Linux Bluetooth

Acked-by on v9 1/2
#3 lore raw

Re: [PATCH v9 1/2] power: sequencing: implement the pwrseq core

In reply to Bartosz Golaszewski
Quoted 11 lines · Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

Implement the power sequencing subsystem allowing devices to share complex powering-up and down procedures. It's split into the consumer and provider parts but does not implement any new DT bindings so that the actual power sequencing is never revealed in the DT representation.

Looks fine to me, including the concept and solving real problems.

Best regards,
Krzysztof

#4 lore raw

PATCH v9 2/2 power: pwrseq: add a driver for the PMU module on the QCom WCN chipsets

In reply to Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

This adds the power sequencing driver for the PMU modules present on the Qualcomm WCN Bluetooth and Wifi chipsets. It uses the pwrseq subsystem and knows how to match the sequencer to the consumer device by verifying the relevant properties and DT layout. Using this driver will allow the BT and WLAN drivers to respect the required delays between enabling the two modules.

---
 drivers/power/sequencing/Kconfig           |  17 ++
 drivers/power/sequencing/Makefile          |   2 +
 drivers/power/sequencing/pwrseq-qcom-wcn.c | 336 +++++++++++++++++++++
 3 files changed, 355 insertions(+)
 create mode 100644 drivers/power/sequencing/pwrseq-qcom-wcn.c
drivers/power/sequencing/Kconfig +17 -0
index ba5732b1dbf8..c9f1cdb66524 100644
@@ -10,3 +10,20 @@ menuconfig POWER_SEQUENCING
 	  during power-up.
 
 	  If unsure, say no.
+
+if POWER_SEQUENCING
+
+config POWER_SEQUENCING_QCOM_WCN
+	tristate "Qualcomm WCN family PMU driver"
+	default m if ARCH_QCOM
+	help
+	  Say Y here to enable the power sequencing driver for Qualcomm
+	  WCN Bluetooth/WLAN chipsets.
+
+	  Typically, a package from the Qualcomm WCN family contains the BT
+	  and WLAN modules whose power is controlled by the PMU module. As the
+	  former two share the power-up sequence which is executed by the PMU,
+	  this driver is needed for correct power control or else we'd risk not
+	  respecting the required delays between enabling Bluetooth and WLAN.
+
+endif
drivers/power/sequencing/Makefile +2 -0
index dcdf8c0c159e..2eec2df7912d 100644
@@ -2,3 +2,5 @@
 
 obj-$(CONFIG_POWER_SEQUENCING)		+= pwrseq-core.o
 pwrseq-core-y				:= core.o
+
+obj-$(CONFIG_POWER_SEQUENCING_QCOM_WCN)	+= pwrseq-qcom-wcn.o
drivers/power/sequencing/pwrseq-qcom-wcn.c new file +336 -0

336 lines not on this page · raw message

Signature · 1 line
2.40.1
#5 lore raw

Re: [PATCH v9 2/2] power: pwrseq: add a driver for the PMU module on the QCom WCN chipsets

Quoted 8 lines · Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

This adds the power sequencing driver for the PMU modules present on the Qualcomm WCN Bluetooth and Wifi chipsets. It uses the pwrseq subsystem and knows how to match the sequencer to the consumer device by verifying the relevant properties and DT layout. Using this driver will allow the BT and WLAN drivers to respect the required delays between enabling the two modules.

...

drivers/power/sequencing/pwrseq-qcom-wcn.c line 315

Quoted 5 lines
drivers/power/sequencing/pwrseq-qcom-wcn.c new file +5 -0
+
+static const struct of_device_id pwrseq_qcom_wcn_of_match[] = {
+	{
+		.compatible = "qcom,qca6390-pmu",
+		.data = &pwrseq_qca6390_of_data,

Bindings *must* be part of this patchset. I missed the moment this was split into such chunks.

Best regards,
Krzysztof

#6 lore raw

Re: [PATCH v9 2/2] power: pwrseq: add a driver for the PMU module on the QCom WCN chipsets

Quoted 22 lines · Krzysztof Kozlowski
Quoted 8 lines · Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

This adds the power sequencing driver for the PMU modules present on the Qualcomm WCN Bluetooth and Wifi chipsets. It uses the pwrseq subsystem and knows how to match the sequencer to the consumer device by verifying the relevant properties and DT layout. Using this driver will allow the BT and WLAN drivers to respect the required delays between enabling the two modules.

...

drivers/power/sequencing/pwrseq-qcom-wcn.c line 315

Quoted 5 lines
drivers/power/sequencing/pwrseq-qcom-wcn.c new file +5 -0
+
+static const struct of_device_id pwrseq_qcom_wcn_of_match[] = {
+     {
+             .compatible = "qcom,qca6390-pmu",
+             .data = &pwrseq_qca6390_of_data,

Bindings *must* be part of this patchset. I missed the moment this was split into such chunks.

Quoted 3 lines

Best regards,
Krzysztof

The bindings are already in next via Mark Brown's tree.

Bart

#7 lore raw

Re: [PATCH v9 2/2] power: pwrseq: add a driver for the PMU module on the QCom WCN chipsets

Quoted 24 lines · Bartosz Golaszewski
Quoted 22 lines · Krzysztof Kozlowski
Quoted 8 lines · Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

This adds the power sequencing driver for the PMU modules present on the Qualcomm WCN Bluetooth and Wifi chipsets. It uses the pwrseq subsystem and knows how to match the sequencer to the consumer device by verifying the relevant properties and DT layout. Using this driver will allow the BT and WLAN drivers to respect the required delays between enabling the two modules.

...

drivers/power/sequencing/pwrseq-qcom-wcn.c line 315

Quoted 5 lines
drivers/power/sequencing/pwrseq-qcom-wcn.c new file +5 -0
+
+static const struct of_device_id pwrseq_qcom_wcn_of_match[] = {
+     {
+             .compatible = "qcom,qca6390-pmu",
+             .data = &pwrseq_qca6390_of_data,

Bindings *must* be part of this patchset. I missed the moment this was split into such chunks.

Quoted 5 lines
Quoted 3 lines

Best regards,
Krzysztof

The bindings are already in next via Mark Brown's tree.

OK, I checked linux-next from a day before Mark merged it. Cover letter should mention it, because it is a bit unusual (and would save you reviewer's question).

Best regards,
Krzysztof

#8 lore raw

Re: [PATCH v9 2/2] power: pwrseq: add a driver for the PMU module on the QCom WCN chipsets

In reply to Bartosz Golaszewski
Quoted 9 lines · Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

This adds the power sequencing driver for the PMU modules present on the Qualcomm WCN Bluetooth and Wifi chipsets. It uses the pwrseq subsystem and knows how to match the sequencer to the consumer device by verifying the relevant properties and DT layout. Using this driver will allow the BT and WLAN drivers to respect the required delays between enabling the two modules.

...

drivers/power/sequencing/pwrseq-qcom-wcn.c line 291

Quoted 13 lines
drivers/power/sequencing/pwrseq-qcom-wcn.c new file +13 -0
+
+	ctx->bt_gpio = devm_gpiod_get_optional(dev, "bt-enable", GPIOD_OUT_LOW);
+	if (IS_ERR(ctx->bt_gpio))
+		return dev_err_probe(dev, PTR_ERR(ctx->bt_gpio),
+				     "Failed to get the Bluetooth enable GPIO\n");
+
+	ctx->wlan_gpio = devm_gpiod_get_optional(dev, "wlan-enable",
+						 GPIOD_OUT_LOW);
+	if (IS_ERR(ctx->wlan_gpio))
+		return dev_err_probe(dev, PTR_ERR(ctx->wlan_gpio),
+				     "Failed to get the WLAN enable GPIO\n");
+
+	ctx->clk = devm_clk_get_optional(dev, NULL);

Your binding does not allow the clock. Do you need it for non-DT platforms?

Best regards,
Krzysztof

#9 lore raw

Re: [PATCH v9 2/2] power: pwrseq: add a driver for the PMU module on the QCom WCN chipsets

Quoted 14 lines · Krzysztof Kozlowski
Quoted 9 lines · Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

This adds the power sequencing driver for the PMU modules present on the Qualcomm WCN Bluetooth and Wifi chipsets. It uses the pwrseq subsystem and knows how to match the sequencer to the consumer device by verifying the relevant properties and DT layout. Using this driver will allow the BT and WLAN drivers to respect the required delays between enabling the two modules.

...

Quoted 15 lines

drivers/power/sequencing/pwrseq-qcom-wcn.c line 291

Quoted 13 lines
drivers/power/sequencing/pwrseq-qcom-wcn.c new file +13 -0
+
+	ctx->bt_gpio = devm_gpiod_get_optional(dev, "bt-enable", GPIOD_OUT_LOW);
+	if (IS_ERR(ctx->bt_gpio))
+		return dev_err_probe(dev, PTR_ERR(ctx->bt_gpio),
+				     "Failed to get the Bluetooth enable GPIO\n");
+
+	ctx->wlan_gpio = devm_gpiod_get_optional(dev, "wlan-enable",
+						 GPIOD_OUT_LOW);
+	if (IS_ERR(ctx->wlan_gpio))
+		return dev_err_probe(dev, PTR_ERR(ctx->wlan_gpio),
+				     "Failed to get the WLAN enable GPIO\n");
+
+	ctx->clk = devm_clk_get_optional(dev, NULL);

Your binding does not allow the clock. Do you need it for non-DT platforms?

Bah, damn covid, now I see second commit with clocks.

Best regards,
Krzysztof

#10 lore raw
In reply to Bartosz Golaszewski
Quoted 100 lines · Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

Hi!

These are the power sequencing patches sent separately after some improvements suggested by Bjorn Helgaas. I intend to pick them up into a new branch and maintain the subsystem from now on. I then plan to provide an immutable tag to the Bluetooth and PCI subsystems so that the rest of the C changes can be applied. This new branch will then be directly sent to Linus Torvalds for the next merge window.

Changelog:

Since v8:
- split the pwrseq patches out into their own series
- rename incref/decref functions to get/put for consistency
- fix typos
- make it very explicit in docs that arrays of targets and units must be NULL-terminated
- 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):
power: sequencing: implement the pwrseq core
power: pwrseq: add a driver for the PMU module on the QCom WCN
chipsets

 MAINTAINERS                                |    8 +
 drivers/power/Kconfig                      |    1 +
 drivers/power/Makefile                     |    1 +
 drivers/power/sequencing/Kconfig           |   29 +
 drivers/power/sequencing/Makefile          |    6 +
 drivers/power/sequencing/core.c            | 1105 ++++++++++++++++++++
 drivers/power/sequencing/pwrseq-qcom-wcn.c |  336 ++++++
 include/linux/pwrseq/consumer.h            |   56 +
 include/linux/pwrseq/provider.h            |   75 ++
 9 files changed, 1617 insertions(+)
 create mode 100644 drivers/power/sequencing/Kconfig
 create mode 100644 drivers/power/sequencing/Makefile
 create mode 100644 drivers/power/sequencing/core.c
 create mode 100644 drivers/power/sequencing/pwrseq-qcom-wcn.c
 create mode 100644 include/linux/pwrseq/consumer.h
 create mode 100644 include/linux/pwrseq/provider.h
Quoted 3 lines

--
2.40.1

With no objections, I plan to pick it up into its own pwrseq branch on Wednesday.

Review and Ack tags are welcome.

Bartosz

author Applied
#11 lore raw
In reply to Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

Quoted 4 lines · Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

Hi!

Quoted 8 lines

These are the power sequencing patches sent separately after some improvements suggested by Bjorn Helgaas. I intend to pick them up into a new branch and maintain the subsystem from now on. I then plan to provide an immutable tag to the Bluetooth and PCI subsystems so that the rest of the C changes can be applied. This new branch will then be directly sent to Linus Torvalds for the next merge window.

[...]

Applied, thanks!

[1/2] power: sequencing: implement the pwrseq core

      commit: 249ebf3f65f8530beb2cbfb91bff1d83ba88d23c
[2/2] power: pwrseq: add a driver for the PMU module on the QCom WCN chipsets
      commit: 2f1630f437dff20d02e4b3f07e836f42869128dd

Best regards,

Signature · 1 line
Bartosz Golaszewski <[email protected]>
#12 lore raw
In reply to Bartosz Golaszewski
This series was applied to bluetooth/bluetooth-next.git (master) by Bartosz Golaszewski <[email protected]>:

Hello:

This series was applied to bluetooth/bluetooth-next.git (master) by Bartosz Golaszewski <[email protected]>:

Quoted 4 lines · On Wed, 5 Jun 2024 14:38:48 +0200 you wrote:

From: Bartosz Golaszewski <[email protected]>

Hi!

Quoted 8 lines

These are the power sequencing patches sent separately after some improvements suggested by Bjorn Helgaas. I intend to pick them up into a new branch and maintain the subsystem from now on. I then plan to provide an immutable tag to the Bluetooth and PCI subsystems so that the rest of the C changes can be applied. This new branch will then be directly sent to Linus Torvalds for the next merge window.

[...]

Here is the summary with links:
- [v9,1/2] power: sequencing: implement the pwrseq core

    https://git.kernel.org/bluetooth/bluetooth-next/c/249ebf3f65f8
  - [v9,2/2] power: pwrseq: add a driver for the PMU module on the QCom WCN chipsets
    https://git.kernel.org/bluetooth/bluetooth-next/c/2f1630f437df

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
Acked-by Krzysztof Kozlowski
#13 lore raw
Quoted 5 lines · On 2024/6/20 22:30, [email protected] wrote:

Hello:

This series was applied to bluetooth/bluetooth-next.git (master) by Bartosz Golaszewski <[email protected]>:

Hi luiz,

i am curious why Bartosz is able to merge his changes into bluetooth development tree bluetooth-next directly.

1)
his changes should belong to *POWER* scope instead of *Bluetooth* obviously, however, there are *NOT* any SOB tag from either power and bluetooth maintainer. these changes currently only have below Acked-by and Signed-off-by tags:

2)
his changes have not merged into linus mainline tree yet.

3)
perhaps, it is safer to pull his changes from linus mainline tree when merged than to merge into bluetooth-next firstly.

Quoted 21 lines · On Wed, 5 Jun 2024 14:38:48 +0200 you wrote:
Quoted 4 lines

From: Bartosz Golaszewski <[email protected]>

Hi!

Quoted 8 lines

These are the power sequencing patches sent separately after some improvements suggested by Bjorn Helgaas. I intend to pick them up into a new branch and maintain the subsystem from now on. I then plan to provide an immutable tag to the Bluetooth and PCI subsystems so that the rest of the C changes can be applied. This new branch will then be directly sent to Linus Torvalds for the next merge window.

[...]

Here is the summary with links:
- [v9,1/2] power: sequencing: implement the pwrseq core

    https://git.kernel.org/bluetooth/bluetooth-next/c/249ebf3f65f8
  - [v9,2/2] power: pwrseq: add a driver for the PMU module on the QCom WCN chipsets
    https://git.kernel.org/bluetooth/bluetooth-next/c/2f1630f437df

You are awesome, thank you!

#14 lore raw
Quoted 6 lines · Lk Sii
Quoted 2 lines · On 2024/6/20 22:30, [email protected] wrote:

Hello:

Quoted 8 lines
Quoted 3 lines

This series was applied to bluetooth/bluetooth-next.git (master) by Bartosz Golaszewski <[email protected]>:

Hi luiz,

i am curious why Bartosz is able to merge his changes into bluetooth development tree bluetooth-next directly.

This conversation is getting progressively worse...

Quoted 9 lines

1)
his changes should belong to *POWER* scope instead of *Bluetooth* obviously, however, there are *NOT* any SOB tag from either power and bluetooth maintainer. these changes currently only have below Acked-by and Signed-off-by tags:

It's a new subsystem that has been discussed and reviewed for months and thoroughly tested. Please refer to the cover letter under v8 linked in this thread. It's not related to power-management or power-supply, it's its own thing but IMO the best place to put it is under drivers/power/. And I will maintain it.

Quoted 3 lines

2)
his changes have not merged into linus mainline tree yet.

This is why they are in next! They are scheduled to go in during the upcoming merge window. But since changes belong in multiple trees, we need a cross-tree merge.

Quoted 4 lines

3)
perhaps, it is safer to pull his changes from linus mainline tree when merged than to merge into bluetooth-next firstly.

It's not safer at all, why would spending less time in next be safer?

Quoted 14 lines
Quoted 14 lines · On Wed, 5 Jun 2024 14:38:48 +0200 you wrote:
Quoted 12 lines

From: Bartosz Golaszewski <[email protected]>

Hi!

These are the power sequencing patches sent separately after some improvements suggested by Bjorn Helgaas. I intend to pick them up into a new branch and maintain the subsystem from now on. I then plan to provide an immutable tag to the Bluetooth and PCI subsystems so that the rest of the C changes can be applied. This new branch will then be directly sent to Linus Torvalds for the next merge window.

[...]

Quoted 8 lines
Quoted 7 lines

Here is the summary with links:
- [v9,1/2] power: sequencing: implement the pwrseq core

    https://git.kernel.org/bluetooth/bluetooth-next/c/249ebf3f65f8
  - [v9,2/2] power: pwrseq: add a driver for the PMU module on the QCom WCN chipsets
    https://git.kernel.org/bluetooth/bluetooth-next/c/2f1630f437df

You are awesome, thank you!

Why are you top-posting anyway?

Bart

#15 lore raw
Quoted 42 lines · Bartosz Golaszewski
Quoted 6 lines · Lk Sii
Quoted 2 lines · On 2024/6/20 22:30, [email protected] wrote:

Hello:

Quoted 8 lines
Quoted 3 lines

This series was applied to bluetooth/bluetooth-next.git (master) by Bartosz Golaszewski <[email protected]>:

Hi luiz,

i am curious why Bartosz is able to merge his changes into bluetooth development tree bluetooth-next directly.

This conversation is getting progressively worse...

Quoted 9 lines

1)
his changes should belong to *POWER* scope instead of *Bluetooth* obviously, however, there are *NOT* any SOB tag from either power and bluetooth maintainer. these changes currently only have below Acked-by and Signed-off-by tags:

It's a new subsystem that has been discussed and reviewed for months and thoroughly tested. Please refer to the cover letter under v8 linked in this thread. It's not related to power-management or power-supply, it's its own thing but IMO the best place to put it is under drivers/power/. And I will maintain it.

Quoted 3 lines

2)
his changes have not merged into linus mainline tree yet.

This is why they are in next! They are scheduled to go in during the upcoming merge window. But since changes belong in multiple trees, we need a cross-tree merge.

Quoted 7 lines
Quoted 4 lines

3)
perhaps, it is safer to pull his changes from linus mainline tree when merged than to merge into bluetooth-next firstly.

It's not safer at all, why would spending less time in next be safer?

it seems this patch serial(new subsystem) does not depend on bluetooth and also does not belong to bluetooth subsystem, but have been contained by tip of bluetooth tree.

why not follow below merging produce?
1) you send this patch serials to Linus to merge within linus mainline tree
2) luiz then pull your changes from linus mainline tree.

Quoted 20 lines
Quoted 20 lines
Quoted 20 lines · On Wed, 5 Jun 2024 14:38:48 +0200 you wrote:
Quoted 4 lines

From: Bartosz Golaszewski <[email protected]>

Hi!

Quoted 8 lines

These are the power sequencing patches sent separately after some improvements suggested by Bjorn Helgaas. I intend to pick them up into a new branch and maintain the subsystem from now on. I then plan to provide an immutable tag to the Bluetooth and PCI subsystems so that the rest of the C changes can be applied. This new branch will then be directly sent to Linus Torvalds for the next merge window.

[...]

Here is the summary with links:
- [v9,1/2] power: sequencing: implement the pwrseq core

    https://git.kernel.org/bluetooth/bluetooth-next/c/249ebf3f65f8
  - [v9,2/2] power: pwrseq: add a driver for the PMU module on the QCom WCN chipsets
    https://git.kernel.org/bluetooth/bluetooth-next/c/2f1630f437df
Quoted 5 lines
Quoted 2 lines
Quoted 1 line

You are awesome, thank you!

Why are you top-posting anyway?

it is caused by my bad mail client settings. thanks for reminder.

Quoted 1 line

Bart

#16 lore raw
Quoted 49 lines · Lk Sii
Quoted 47 lines · Bartosz Golaszewski
Quoted 6 lines · Lk Sii
Quoted 2 lines · On 2024/6/20 22:30, [email protected] wrote:

Hello:

Quoted 8 lines
Quoted 3 lines

This series was applied to bluetooth/bluetooth-next.git (master) by Bartosz Golaszewski <[email protected]>:

Hi luiz,

i am curious why Bartosz is able to merge his changes into bluetooth development tree bluetooth-next directly.

This conversation is getting progressively worse...

Quoted 9 lines

1)
his changes should belong to *POWER* scope instead of *Bluetooth* obviously, however, there are *NOT* any SOB tag from either power and bluetooth maintainer. these changes currently only have below Acked-by and Signed-off-by tags:

It's a new subsystem that has been discussed and reviewed for months and thoroughly tested. Please refer to the cover letter under v8 linked in this thread. It's not related to power-management or power-supply, it's its own thing but IMO the best place to put it is under drivers/power/. And I will maintain it.

Quoted 3 lines

2)
his changes have not merged into linus mainline tree yet.

This is why they are in next! They are scheduled to go in during the upcoming merge window. But since changes belong in multiple trees, we need a cross-tree merge.

Quoted 4 lines

3)
perhaps, it is safer to pull his changes from linus mainline tree when merged than to merge into bluetooth-next firstly.

Quoted 6 lines
Quoted 2 lines

It's not safer at all, why would spending less time in next be safer?

it seems this patch serial(new subsystem) does not depend on bluetooth and also does not belong to bluetooth subsystem, but have been contained by tip of bluetooth tree.

It's the other way around: bluetooth changes (namely the hci_qca driver) depend on the power sequencing changes.

Quoted 4 lines

why not follow below merging produce?
1) you send this patch serials to Linus to merge within linus mainline tree
2) luiz then pull your changes from linus mainline tree.

I explained this in my previous email. Why would you want these changes to needlessly wait for another release cycle? It makes no sense. It's just a regular cross-tree merge like hundreds that are performed every release.

Quoted 20 lines
Quoted 20 lines
Quoted 20 lines
Quoted 20 lines · On Wed, 5 Jun 2024 14:38:48 +0200 you wrote:
Quoted 4 lines

From: Bartosz Golaszewski <[email protected]>

Hi!

Quoted 8 lines

These are the power sequencing patches sent separately after some improvements suggested by Bjorn Helgaas. I intend to pick them up into a new branch and maintain the subsystem from now on. I then plan to provide an immutable tag to the Bluetooth and PCI subsystems so that the rest of the C changes can be applied. This new branch will then be directly sent to Linus Torvalds for the next merge window.

[...]

Here is the summary with links:
- [v9,1/2] power: sequencing: implement the pwrseq core

    https://git.kernel.org/bluetooth/bluetooth-next/c/249ebf3f65f8
  - [v9,2/2] power: pwrseq: add a driver for the PMU module on the QCom WCN chipsets
    https://git.kernel.org/bluetooth/bluetooth-next/c/2f1630f437df
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Quoted 1 line

You are awesome, thank you!

Why are you top-posting anyway?

it is caused by my bad mail client settings. thanks for reminder.

Quoted 1 line

Bart

Luiz, Marcel: Am I wasting my time with this person? Is this another Markus Elfring and I unknowingly got pulled into a nonsensical argument?

Bart

#17 lore raw
In reply to Lk Sii
Quoted 50 lines · Lk Sii
Quoted 42 lines · Bartosz Golaszewski
Quoted 6 lines · Lk Sii
Quoted 2 lines · On 2024/6/20 22:30, [email protected] wrote:

Hello:

Quoted 8 lines
Quoted 3 lines

This series was applied to bluetooth/bluetooth-next.git (master) by Bartosz Golaszewski <[email protected]>:

Hi luiz,

i am curious why Bartosz is able to merge his changes into bluetooth development tree bluetooth-next directly.

This conversation is getting progressively worse...

Quoted 9 lines

1)
his changes should belong to *POWER* scope instead of *Bluetooth* obviously, however, there are *NOT* any SOB tag from either power and bluetooth maintainer. these changes currently only have below Acked-by and Signed-off-by tags:

It's a new subsystem that has been discussed and reviewed for months and thoroughly tested. Please refer to the cover letter under v8 linked in this thread. It's not related to power-management or power-supply, it's its own thing but IMO the best place to put it is under drivers/power/. And I will maintain it.

Quoted 3 lines

2)
his changes have not merged into linus mainline tree yet.

This is why they are in next! They are scheduled to go in during the upcoming merge window. But since changes belong in multiple trees, we need a cross-tree merge.

Quoted 7 lines
Quoted 4 lines

3)
perhaps, it is safer to pull his changes from linus mainline tree when merged than to merge into bluetooth-next firstly.

It's not safer at all, why would spending less time in next be safer?

Quoted 7 lines

it seems this patch serial(new subsystem) does not depend on bluetooth and also does not belong to bluetooth subsystem, but have been contained by tip of bluetooth tree.

why not follow below merging produce?
1) you send this patch serials to Linus to merge within linus mainline tree
2) luiz then pull your changes from linus mainline tree.

This is not how Linux kernel development works. Read process documents before interfering with people's work.

Best regards,
Krzysztof

#18 lore raw
In reply to Lk Sii

Hi,

Quoted 51 lines · Lk Sii
Quoted 42 lines · Bartosz Golaszewski
Quoted 6 lines · Lk Sii
Quoted 2 lines · On 2024/6/20 22:30, [email protected] wrote:

Hello:

Quoted 8 lines
Quoted 3 lines

This series was applied to bluetooth/bluetooth-next.git (master) by Bartosz Golaszewski <[email protected]>:

Hi luiz,

i am curious why Bartosz is able to merge his changes into bluetooth development tree bluetooth-next directly.

This conversation is getting progressively worse...

Quoted 9 lines

1)
his changes should belong to *POWER* scope instead of *Bluetooth* obviously, however, there are *NOT* any SOB tag from either power and bluetooth maintainer. these changes currently only have below Acked-by and Signed-off-by tags:

It's a new subsystem that has been discussed and reviewed for months and thoroughly tested. Please refer to the cover letter under v8 linked in this thread. It's not related to power-management or power-supply, it's its own thing but IMO the best place to put it is under drivers/power/. And I will maintain it.

Quoted 3 lines

2)
his changes have not merged into linus mainline tree yet.

This is why they are in next! They are scheduled to go in during the upcoming merge window. But since changes belong in multiple trees, we need a cross-tree merge.

Quoted 7 lines
Quoted 4 lines

3)
perhaps, it is safer to pull his changes from linus mainline tree when merged than to merge into bluetooth-next firstly.

It's not safer at all, why would spending less time in next be safer?

Quoted 7 lines

it seems this patch serial(new subsystem) does not depend on bluetooth and also does not belong to bluetooth subsystem, but have been contained by tip of bluetooth tree.

why not follow below merging produce?
1) you send this patch serials to Linus to merge within linus mainline tree
2) luiz then pull your changes from linus mainline tree.

This was discussed already, but in case you didn't follow if we need to incorporate changes earlier we can't really wait the merge window for the changes to be merged first into the Linus tree. Anyway Bartosz is the maintainer of Power Sequence subsystem, and several others drivers, so I think it is safe to trust his judgment here.

#19 lore raw
In reply to Lk Sii
Quoted 10 lines · Lk Sii
Quoted 5 lines · On 2024/6/20 22:30, [email protected] wrote:

Hello:

This series was applied to bluetooth/bluetooth-next.git (master) by Bartosz Golaszewski <[email protected]>:

Hi luiz,

Quoted 8 lines

i am curious why Bartosz is able to merge his changes into bluetooth development tree bluetooth-next directly.

1)
his changes should belong to *POWER* scope instead of *Bluetooth* obviously, however, there are *NOT* any SOB tag from either power and bluetooth maintainer. these changes currently only have below Acked-by and Signed-off-by tags:

You are trolling us or what?

That's a cross tree pull request.

Quoted 6 lines

2)
his changes have not merged into linus mainline tree yet.

Do you understand the concept of merge windows?

Quoted 4 lines

3)
perhaps, it is safer to pull his changes from linus mainline tree when merged than to merge into bluetooth-next firstly.

You are joking, right?

Best regards,
Krzysztof