* [PATCH v2 1/6] dt-bindings: bluetooth: qualcomm: describe the inputs from PMU for wcn7850
2024-07-08 9:39 [PATCH v2 0/6] Bluetooth: hci_qca: use the power sequencer for wcn7850 Bartosz Golaszewski
@ 2024-07-08 9:39 ` Bartosz Golaszewski
2024-07-08 9:39 ` [PATCH v2 2/6] Bluetooth: hci_qca: schedule a devm action for disabling the clock Bartosz Golaszewski
` (4 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: Bartosz Golaszewski @ 2024-07-08 9:39 UTC (permalink / raw)
To: Marcel Holtmann, Luiz Augusto von Dentz, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Balakrishna Godavarthi,
Rocky Liao, Bjorn Andersson, Konrad Dybcio
Cc: linux-bluetooth, netdev, devicetree, linux-kernel, linux-arm-msm,
Bartosz Golaszewski
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Drop the inputs from the host and instead expect the Bluetooth node to
consume the outputs of the internal PMU. This model is closer to reality
than how we represent it now.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
.../bindings/net/bluetooth/qualcomm-bluetooth.yaml | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git a/Documentation/devicetree/bindings/net/bluetooth/qualcomm-bluetooth.yaml b/Documentation/devicetree/bindings/net/bluetooth/qualcomm-bluetooth.yaml
index 48ac9f10ef05..68c5ed111417 100644
--- a/Documentation/devicetree/bindings/net/bluetooth/qualcomm-bluetooth.yaml
+++ b/Documentation/devicetree/bindings/net/bluetooth/qualcomm-bluetooth.yaml
@@ -77,6 +77,9 @@ properties:
vddrfa1p7-supply:
description: VDD_RFA_1P7 supply regulator handle
+ vddrfa1p8-supply:
+ description: VDD_RFA_1P8 supply regulator handle
+
vddrfa1p2-supply:
description: VDD_RFA_1P2 supply regulator handle
@@ -89,6 +92,12 @@ properties:
vddasd-supply:
description: VDD_ASD supply regulator handle
+ vddwlcx-supply:
+ description: VDD_WLCX supply regulator handle
+
+ vddwlmx-supply:
+ description: VDD_WLMX supply regulator handle
+
max-speed:
description: see Documentation/devicetree/bindings/serial/serial.yaml
@@ -179,14 +188,13 @@ allOf:
- qcom,wcn7850-bt
then:
required:
- - enable-gpios
- - swctrl-gpios
- - vddio-supply
+ - vddrfacmn-supply
- vddaon-supply
- - vdddig-supply
+ - vddwlcx-supply
+ - vddwlmx-supply
- vddrfa0p8-supply
- vddrfa1p2-supply
- - vddrfa1p9-supply
+ - vddrfa1p8-supply
- if:
properties:
compatible:
--
2.43.0
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH v2 2/6] Bluetooth: hci_qca: schedule a devm action for disabling the clock
2024-07-08 9:39 [PATCH v2 0/6] Bluetooth: hci_qca: use the power sequencer for wcn7850 Bartosz Golaszewski
2024-07-08 9:39 ` [PATCH v2 1/6] dt-bindings: bluetooth: qualcomm: describe the inputs from PMU " Bartosz Golaszewski
@ 2024-07-08 9:39 ` Bartosz Golaszewski
2024-07-09 10:33 ` kernel test robot
2024-07-08 9:39 ` [PATCH v2 3/6] Bluetooth: hci_qca: unduplicate calls to hci_uart_register_device() Bartosz Golaszewski
` (3 subsequent siblings)
5 siblings, 1 reply; 9+ messages in thread
From: Bartosz Golaszewski @ 2024-07-08 9:39 UTC (permalink / raw)
To: Marcel Holtmann, Luiz Augusto von Dentz, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Balakrishna Godavarthi,
Rocky Liao, Bjorn Andersson, Konrad Dybcio
Cc: linux-bluetooth, netdev, devicetree, linux-kernel, linux-arm-msm,
Bartosz Golaszewski
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
In preparation for unduplicating the hci_uart registration code,
schedule a devres action for disabling the SUSCLK rather than doing it
manually.
We cannot really use devm_clk_get_enabled() as we also set the rate
before enabling the clock. While this should in theory work, I don't
want to risk breaking existing users. One solution for the future is to
add devm_clk_get_enabled_with_rate() to the clock framework.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
drivers/bluetooth/hci_qca.c | 22 ++++++++++++++--------
1 file changed, 14 insertions(+), 8 deletions(-)
diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
index bc6a49ba26f9..a34c663e337c 100644
--- a/drivers/bluetooth/hci_qca.c
+++ b/drivers/bluetooth/hci_qca.c
@@ -2295,6 +2295,13 @@ static int qca_init_regulators(struct qca_power *qca,
return 0;
}
+static void qca_clk_disable_unprepare(void *data)
+{
+ struct clk *clk = data;
+
+ clk_disable_unprepare(clk);
+}
+
static int qca_serdev_probe(struct serdev_device *serdev)
{
struct qca_serdev *qcadev;
@@ -2434,10 +2441,15 @@ static int qca_serdev_probe(struct serdev_device *serdev)
if (err)
return err;
+ err = devm_add_action_or_reset(&serdev->dev,
+ qca_clk_disable_unprepare,
+ qcadev->susclk);
+ if (err)
+ return err;
+
err = hci_uart_register_device(&qcadev->serdev_hu, &qca_proto);
if (err) {
BT_ERR("Rome serdev registration failed");
- clk_disable_unprepare(qcadev->susclk);
return err;
}
}
@@ -2477,15 +2489,9 @@ static void qca_serdev_remove(struct serdev_device *serdev)
case QCA_WCN6750:
case QCA_WCN6855:
case QCA_WCN7850:
- if (power->vregs_on) {
+ if (power->vregs_on)
qca_power_shutdown(&qcadev->serdev_hu);
- break;
- }
- fallthrough;
-
default:
- if (qcadev->susclk)
- clk_disable_unprepare(qcadev->susclk);
}
hci_uart_unregister_device(&qcadev->serdev_hu);
--
2.43.0
^ permalink raw reply related [flat|nested] 9+ messages in thread* Re: [PATCH v2 2/6] Bluetooth: hci_qca: schedule a devm action for disabling the clock
2024-07-08 9:39 ` [PATCH v2 2/6] Bluetooth: hci_qca: schedule a devm action for disabling the clock Bartosz Golaszewski
@ 2024-07-09 10:33 ` kernel test robot
2024-07-09 11:23 ` Bartosz Golaszewski
0 siblings, 1 reply; 9+ messages in thread
From: kernel test robot @ 2024-07-09 10:33 UTC (permalink / raw)
To: Bartosz Golaszewski, Marcel Holtmann, Luiz Augusto von Dentz,
David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Balakrishna Godavarthi, Rocky Liao, Bjorn Andersson,
Konrad Dybcio
Cc: llvm, oe-kbuild-all, netdev, linux-bluetooth, devicetree,
linux-kernel, linux-arm-msm, Bartosz Golaszewski
Hi Bartosz,
kernel test robot noticed the following build warnings:
[auto build test WARNING on 0b58e108042b0ed28a71cd7edf5175999955b233]
url: https://github.com/intel-lab-lkp/linux/commits/Bartosz-Golaszewski/dt-bindings-bluetooth-qualcomm-describe-the-inputs-from-PMU-for-wcn7850/20240708-175040
base: 0b58e108042b0ed28a71cd7edf5175999955b233
patch link: https://lore.kernel.org/r/20240708-hci_qca_refactor-v2-2-b6e83b3d1ca5%40linaro.org
patch subject: [PATCH v2 2/6] Bluetooth: hci_qca: schedule a devm action for disabling the clock
config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20240709/202407091813.9IlBCkUP-lkp@intel.com/config)
compiler: clang version 18.1.5 (https://github.com/llvm/llvm-project 617a15a9eac96088ae5e9134248d8236e34b91b1)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240709/202407091813.9IlBCkUP-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202407091813.9IlBCkUP-lkp@intel.com/
All warnings (new ones prefixed by >>):
drivers/bluetooth/hci_qca.c:2495:2: warning: label at end of compound statement is a C23 extension [-Wc23-extensions]
2495 | }
| ^
>> drivers/bluetooth/hci_qca.c:2494:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
2494 | default:
| ^
drivers/bluetooth/hci_qca.c:2494:2: note: insert '__attribute__((fallthrough));' to silence this warning
2494 | default:
| ^
| __attribute__((fallthrough));
drivers/bluetooth/hci_qca.c:2494:2: note: insert 'break;' to avoid fall-through
2494 | default:
| ^
| break;
2 warnings generated.
vim +2494 drivers/bluetooth/hci_qca.c
05ba533c5c1155 Thierry Escande 2018-03-29 2478
05ba533c5c1155 Thierry Escande 2018-03-29 2479 static void qca_serdev_remove(struct serdev_device *serdev)
05ba533c5c1155 Thierry Escande 2018-03-29 2480 {
05ba533c5c1155 Thierry Escande 2018-03-29 2481 struct qca_serdev *qcadev = serdev_device_get_drvdata(serdev);
054ec5e94a46b0 Venkata Lakshmi Narayana Gubba 2020-09-10 2482 struct qca_power *power = qcadev->bt_power;
05ba533c5c1155 Thierry Escande 2018-03-29 2483
691d54d0f7cb14 Neil Armstrong 2023-08-16 2484 switch (qcadev->btsoc_type) {
691d54d0f7cb14 Neil Armstrong 2023-08-16 2485 case QCA_WCN3988:
691d54d0f7cb14 Neil Armstrong 2023-08-16 2486 case QCA_WCN3990:
691d54d0f7cb14 Neil Armstrong 2023-08-16 2487 case QCA_WCN3991:
691d54d0f7cb14 Neil Armstrong 2023-08-16 2488 case QCA_WCN3998:
691d54d0f7cb14 Neil Armstrong 2023-08-16 2489 case QCA_WCN6750:
691d54d0f7cb14 Neil Armstrong 2023-08-16 2490 case QCA_WCN6855:
e0c1278ac89b03 Neil Armstrong 2023-08-16 2491 case QCA_WCN7850:
d12f113a15e826 Bartosz Golaszewski 2024-07-08 2492 if (power->vregs_on)
c2d7827338618a Balakrishna Godavarthi 2018-08-22 2493 qca_power_shutdown(&qcadev->serdev_hu);
691d54d0f7cb14 Neil Armstrong 2023-08-16 @2494 default:
691d54d0f7cb14 Neil Armstrong 2023-08-16 @2495 }
fa9ad876b8e0eb Balakrishna Godavarthi 2018-08-03 2496
fa9ad876b8e0eb Balakrishna Godavarthi 2018-08-03 2497 hci_uart_unregister_device(&qcadev->serdev_hu);
05ba533c5c1155 Thierry Escande 2018-03-29 2498 }
05ba533c5c1155 Thierry Escande 2018-03-29 2499
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [PATCH v2 2/6] Bluetooth: hci_qca: schedule a devm action for disabling the clock
2024-07-09 10:33 ` kernel test robot
@ 2024-07-09 11:23 ` Bartosz Golaszewski
0 siblings, 0 replies; 9+ messages in thread
From: Bartosz Golaszewski @ 2024-07-09 11:23 UTC (permalink / raw)
To: kernel test robot
Cc: Marcel Holtmann, Luiz Augusto von Dentz, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Balakrishna Godavarthi,
Rocky Liao, Bjorn Andersson, Konrad Dybcio, llvm, oe-kbuild-all,
netdev, linux-bluetooth, devicetree, linux-kernel, linux-arm-msm,
Bartosz Golaszewski
On Tue, Jul 9, 2024 at 12:34 PM kernel test robot <lkp@intel.com> wrote:
>
> Hi Bartosz,
>
> kernel test robot noticed the following build warnings:
>
> [auto build test WARNING on 0b58e108042b0ed28a71cd7edf5175999955b233]
>
> url: https://github.com/intel-lab-lkp/linux/commits/Bartosz-Golaszewski/dt-bindings-bluetooth-qualcomm-describe-the-inputs-from-PMU-for-wcn7850/20240708-175040
> base: 0b58e108042b0ed28a71cd7edf5175999955b233
> patch link: https://lore.kernel.org/r/20240708-hci_qca_refactor-v2-2-b6e83b3d1ca5%40linaro.org
> patch subject: [PATCH v2 2/6] Bluetooth: hci_qca: schedule a devm action for disabling the clock
> config: x86_64-allyesconfig (https://download.01.org/0day-ci/archive/20240709/202407091813.9IlBCkUP-lkp@intel.com/config)
> compiler: clang version 18.1.5 (https://github.com/llvm/llvm-project 617a15a9eac96088ae5e9134248d8236e34b91b1)
> reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240709/202407091813.9IlBCkUP-lkp@intel.com/reproduce)
>
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@intel.com>
> | Closes: https://lore.kernel.org/oe-kbuild-all/202407091813.9IlBCkUP-lkp@intel.com/
>
> All warnings (new ones prefixed by >>):
>
> drivers/bluetooth/hci_qca.c:2495:2: warning: label at end of compound statement is a C23 extension [-Wc23-extensions]
> 2495 | }
> | ^
> >> drivers/bluetooth/hci_qca.c:2494:2: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
> 2494 | default:
> | ^
> drivers/bluetooth/hci_qca.c:2494:2: note: insert '__attribute__((fallthrough));' to silence this warning
> 2494 | default:
> | ^
> | __attribute__((fallthrough));
> drivers/bluetooth/hci_qca.c:2494:2: note: insert 'break;' to avoid fall-through
> 2494 | default:
> | ^
> | break;
> 2 warnings generated.
>
>
> vim +2494 drivers/bluetooth/hci_qca.c
>
> 05ba533c5c1155 Thierry Escande 2018-03-29 2478
> 05ba533c5c1155 Thierry Escande 2018-03-29 2479 static void qca_serdev_remove(struct serdev_device *serdev)
> 05ba533c5c1155 Thierry Escande 2018-03-29 2480 {
> 05ba533c5c1155 Thierry Escande 2018-03-29 2481 struct qca_serdev *qcadev = serdev_device_get_drvdata(serdev);
> 054ec5e94a46b0 Venkata Lakshmi Narayana Gubba 2020-09-10 2482 struct qca_power *power = qcadev->bt_power;
> 05ba533c5c1155 Thierry Escande 2018-03-29 2483
> 691d54d0f7cb14 Neil Armstrong 2023-08-16 2484 switch (qcadev->btsoc_type) {
> 691d54d0f7cb14 Neil Armstrong 2023-08-16 2485 case QCA_WCN3988:
> 691d54d0f7cb14 Neil Armstrong 2023-08-16 2486 case QCA_WCN3990:
> 691d54d0f7cb14 Neil Armstrong 2023-08-16 2487 case QCA_WCN3991:
> 691d54d0f7cb14 Neil Armstrong 2023-08-16 2488 case QCA_WCN3998:
> 691d54d0f7cb14 Neil Armstrong 2023-08-16 2489 case QCA_WCN6750:
> 691d54d0f7cb14 Neil Armstrong 2023-08-16 2490 case QCA_WCN6855:
> e0c1278ac89b03 Neil Armstrong 2023-08-16 2491 case QCA_WCN7850:
> d12f113a15e826 Bartosz Golaszewski 2024-07-08 2492 if (power->vregs_on)
> c2d7827338618a Balakrishna Godavarthi 2018-08-22 2493 qca_power_shutdown(&qcadev->serdev_hu);
> 691d54d0f7cb14 Neil Armstrong 2023-08-16 @2494 default:
> 691d54d0f7cb14 Neil Armstrong 2023-08-16 @2495 }
> fa9ad876b8e0eb Balakrishna Godavarthi 2018-08-03 2496
> fa9ad876b8e0eb Balakrishna Godavarthi 2018-08-03 2497 hci_uart_unregister_device(&qcadev->serdev_hu);
> 05ba533c5c1155 Thierry Escande 2018-03-29 2498 }
> 05ba533c5c1155 Thierry Escande 2018-03-29 2499
>
> --
> 0-DAY CI Kernel Test Service
> https://github.com/intel/lkp-tests/wiki
Ah, cr*p.
Third time's the charm, I guess...
Bart
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v2 3/6] Bluetooth: hci_qca: unduplicate calls to hci_uart_register_device()
2024-07-08 9:39 [PATCH v2 0/6] Bluetooth: hci_qca: use the power sequencer for wcn7850 Bartosz Golaszewski
2024-07-08 9:39 ` [PATCH v2 1/6] dt-bindings: bluetooth: qualcomm: describe the inputs from PMU " Bartosz Golaszewski
2024-07-08 9:39 ` [PATCH v2 2/6] Bluetooth: hci_qca: schedule a devm action for disabling the clock Bartosz Golaszewski
@ 2024-07-08 9:39 ` Bartosz Golaszewski
2024-07-08 9:39 ` [PATCH v2 4/6] Bluetooth: hci_qca: make pwrseq calls the default if available Bartosz Golaszewski
` (2 subsequent siblings)
5 siblings, 0 replies; 9+ messages in thread
From: Bartosz Golaszewski @ 2024-07-08 9:39 UTC (permalink / raw)
To: Marcel Holtmann, Luiz Augusto von Dentz, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Balakrishna Godavarthi,
Rocky Liao, Bjorn Andersson, Konrad Dybcio
Cc: linux-bluetooth, netdev, devicetree, linux-kernel, linux-arm-msm,
Bartosz Golaszewski
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Now that all three branches of the switch end up doing the same thing,
we can move the call to hci_uart_register_device() past it and unify the
error message.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
drivers/bluetooth/hci_qca.c | 23 ++++++-----------------
1 file changed, 6 insertions(+), 17 deletions(-)
diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
index a34c663e337c..48e1b67577be 100644
--- a/drivers/bluetooth/hci_qca.c
+++ b/drivers/bluetooth/hci_qca.c
@@ -2396,12 +2396,6 @@ static int qca_serdev_probe(struct serdev_device *serdev)
dev_err(&serdev->dev, "failed to acquire clk\n");
return PTR_ERR(qcadev->susclk);
}
-
- err = hci_uart_register_device(&qcadev->serdev_hu, &qca_proto);
- if (err) {
- BT_ERR("wcn3990 serdev registration failed");
- return err;
- }
break;
case QCA_QCA6390:
@@ -2409,12 +2403,6 @@ static int qca_serdev_probe(struct serdev_device *serdev)
"bluetooth");
if (IS_ERR(qcadev->bt_power->pwrseq))
return PTR_ERR(qcadev->bt_power->pwrseq);
-
- err = hci_uart_register_device(&qcadev->serdev_hu, &qca_proto);
- if (err) {
- BT_ERR("qca6390 serdev registration failed");
- return err;
- }
break;
default:
@@ -2447,11 +2435,12 @@ static int qca_serdev_probe(struct serdev_device *serdev)
if (err)
return err;
- err = hci_uart_register_device(&qcadev->serdev_hu, &qca_proto);
- if (err) {
- BT_ERR("Rome serdev registration failed");
- return err;
- }
+ }
+
+ err = hci_uart_register_device(&qcadev->serdev_hu, &qca_proto);
+ if (err) {
+ BT_ERR("serdev registration failed");
+ return err;
}
hdev = qcadev->serdev_hu.hdev;
--
2.43.0
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH v2 4/6] Bluetooth: hci_qca: make pwrseq calls the default if available
2024-07-08 9:39 [PATCH v2 0/6] Bluetooth: hci_qca: use the power sequencer for wcn7850 Bartosz Golaszewski
` (2 preceding siblings ...)
2024-07-08 9:39 ` [PATCH v2 3/6] Bluetooth: hci_qca: unduplicate calls to hci_uart_register_device() Bartosz Golaszewski
@ 2024-07-08 9:39 ` Bartosz Golaszewski
2024-07-08 9:39 ` [PATCH v2 5/6] Bluetooth: hci_qca: use the power sequencer for wcn7850 and wcn6855 Bartosz Golaszewski
2024-07-08 9:39 ` [PATCH v2 6/6] arm64: dts: qcom: sm8650-qrd: use the PMU to power up bluetooth Bartosz Golaszewski
5 siblings, 0 replies; 9+ messages in thread
From: Bartosz Golaszewski @ 2024-07-08 9:39 UTC (permalink / raw)
To: Marcel Holtmann, Luiz Augusto von Dentz, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Balakrishna Godavarthi,
Rocky Liao, Bjorn Andersson, Konrad Dybcio
Cc: linux-bluetooth, netdev, devicetree, linux-kernel, linux-arm-msm,
Bartosz Golaszewski
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
If the device has a power sequencing handle, use it first. Otherwise
fall back to whatever code already exists.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
drivers/bluetooth/hci_qca.c | 24 +++++++++++++-----------
1 file changed, 13 insertions(+), 11 deletions(-)
diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
index 48e1b67577be..9d9553552ee1 100644
--- a/drivers/bluetooth/hci_qca.c
+++ b/drivers/bluetooth/hci_qca.c
@@ -1718,6 +1718,7 @@ static int qca_regulator_init(struct hci_uart *hu)
* off the voltage regulator.
*/
qcadev = serdev_device_get_drvdata(hu->serdev);
+
if (!qcadev->bt_power->vregs_on) {
serdev_device_close(hu->serdev);
ret = qca_regulator_enable(qcadev);
@@ -1800,18 +1801,8 @@ static int qca_power_on(struct hci_dev *hdev)
case QCA_WCN6750:
case QCA_WCN6855:
case QCA_WCN7850:
- 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;
+ ret = qca_regulator_init(hu);
break;
default:
@@ -2149,6 +2140,7 @@ static void qca_power_shutdown(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 is
* still open, stop queueing the IBS data and flush all the buffered
@@ -2166,6 +2158,13 @@ static void qca_power_shutdown(struct hci_uart *hu)
return;
qcadev = serdev_device_get_drvdata(hu->serdev);
+ power = qcadev->bt_power;
+
+ if (power->pwrseq) {
+ pwrseq_power_off(power->pwrseq);
+ set_bit(QCA_BT_OFF, &qca->flags);
+ return;
+ }
switch (soc_type) {
case QCA_WCN3988:
@@ -2227,6 +2226,9 @@ static int qca_regulator_enable(struct qca_serdev *qcadev)
struct qca_power *power = qcadev->bt_power;
int ret;
+ if (power->pwrseq)
+ return pwrseq_power_on(power->pwrseq);
+
/* Already enabled */
if (power->vregs_on)
return 0;
--
2.43.0
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH v2 5/6] Bluetooth: hci_qca: use the power sequencer for wcn7850 and wcn6855
2024-07-08 9:39 [PATCH v2 0/6] Bluetooth: hci_qca: use the power sequencer for wcn7850 Bartosz Golaszewski
` (3 preceding siblings ...)
2024-07-08 9:39 ` [PATCH v2 4/6] Bluetooth: hci_qca: make pwrseq calls the default if available Bartosz Golaszewski
@ 2024-07-08 9:39 ` Bartosz Golaszewski
2024-07-08 9:39 ` [PATCH v2 6/6] arm64: dts: qcom: sm8650-qrd: use the PMU to power up bluetooth Bartosz Golaszewski
5 siblings, 0 replies; 9+ messages in thread
From: Bartosz Golaszewski @ 2024-07-08 9:39 UTC (permalink / raw)
To: Marcel Holtmann, Luiz Augusto von Dentz, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Balakrishna Godavarthi,
Rocky Liao, Bjorn Andersson, Konrad Dybcio
Cc: linux-bluetooth, netdev, devicetree, linux-kernel, linux-arm-msm,
Bartosz Golaszewski
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
In preparation for using the power sequencing subsystem on sm8650 boards
and X13s laptop let's make pwrseq the default for wcn7850 and wcn6855.
Both these models require an enable GPIO so we can safely assume that if
the property is not there, then we should try to get the power
sequencer. Due to how the pwrseq lookup works - checking the provider at
run-time - we cannot really do it the other way around as we'd get stuck
forever on -EPROBE_DEFER.
If the relevant OF node does have the 'enable-gpios' property, we
fallback to the existing code for backward compatibility with older DTs.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
drivers/bluetooth/hci_qca.c | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
index 9d9553552ee1..22d37e8944d0 100644
--- a/drivers/bluetooth/hci_qca.c
+++ b/drivers/bluetooth/hci_qca.c
@@ -2354,13 +2354,28 @@ static int qca_serdev_probe(struct serdev_device *serdev)
}
switch (qcadev->btsoc_type) {
+ case QCA_WCN6855:
+ case QCA_WCN7850:
+ if (!device_property_present(&serdev->dev, "enable-gpios")) {
+ /*
+ * Backward compatibility with old DT sources. If the
+ * node doesn't have the 'enable-gpios' property then
+ * let's use the power sequencer. Otherwise, let's
+ * drive everything outselves.
+ */
+ 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;
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);
--
2.43.0
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH v2 6/6] arm64: dts: qcom: sm8650-qrd: use the PMU to power up bluetooth
2024-07-08 9:39 [PATCH v2 0/6] Bluetooth: hci_qca: use the power sequencer for wcn7850 Bartosz Golaszewski
` (4 preceding siblings ...)
2024-07-08 9:39 ` [PATCH v2 5/6] Bluetooth: hci_qca: use the power sequencer for wcn7850 and wcn6855 Bartosz Golaszewski
@ 2024-07-08 9:39 ` Bartosz Golaszewski
5 siblings, 0 replies; 9+ messages in thread
From: Bartosz Golaszewski @ 2024-07-08 9:39 UTC (permalink / raw)
To: Marcel Holtmann, Luiz Augusto von Dentz, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Balakrishna Godavarthi,
Rocky Liao, Bjorn Andersson, Konrad Dybcio
Cc: linux-bluetooth, netdev, devicetree, linux-kernel, linux-arm-msm,
Bartosz Golaszewski
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Change the HW model in sm8650-qrd.dts to a one closer to reality - where
the WLAN and Bluetooth modules of the WCN7850 are powered by the PMU
inside the package.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
arch/arm64/boot/dts/qcom/sm8650-qrd.dts | 28 +++++++++-------------------
1 file changed, 9 insertions(+), 19 deletions(-)
diff --git a/arch/arm64/boot/dts/qcom/sm8650-qrd.dts b/arch/arm64/boot/dts/qcom/sm8650-qrd.dts
index b0d7927b708f..8ca0d28eba9b 100644
--- a/arch/arm64/boot/dts/qcom/sm8650-qrd.dts
+++ b/arch/arm64/boot/dts/qcom/sm8650-qrd.dts
@@ -208,13 +208,10 @@ wcn7850-pmu {
compatible = "qcom,wcn7850-pmu";
pinctrl-names = "default";
- pinctrl-0 = <&wlan_en>;
+ pinctrl-0 = <&wlan_en>, <&bt_default>;
wlan-enable-gpios = <&tlmm 16 GPIO_ACTIVE_HIGH>;
- /*
- * TODO Add bt-enable-gpios once the Bluetooth driver is
- * converted to using the power sequencer.
- */
+ bt-enable-gpios = <&tlmm 17 GPIO_ACTIVE_HIGH>;
vdd-supply = <&vreg_s4i_0p85>;
vddio-supply = <&vreg_l15b_1p8>;
@@ -1255,22 +1252,15 @@ &uart14 {
bluetooth {
compatible = "qcom,wcn7850-bt";
- clocks = <&rpmhcc RPMH_RF_CLK1>;
-
- vddio-supply = <&vreg_l3c_1p2>;
- vddaon-supply = <&vreg_l15b_1p8>;
- vdddig-supply = <&vreg_s3c_0p9>;
- vddrfa0p8-supply = <&vreg_s3c_0p9>;
- vddrfa1p2-supply = <&vreg_s1c_1p2>;
- vddrfa1p9-supply = <&vreg_s6c_1p8>;
+ vddrfacmn-supply = <&vreg_pmu_rfa_cmn>;
+ vddaon-supply = <&vreg_pmu_aon_0p59>;
+ vddwlcx-supply = <&vreg_pmu_wlcx_0p8>;
+ vddwlmx-supply = <&vreg_pmu_wlmx_0p85>;
+ vddrfa0p8-supply = <&vreg_pmu_rfa_0p8>;
+ vddrfa1p2-supply = <&vreg_pmu_rfa_1p2>;
+ vddrfa1p8-supply = <&vreg_pmu_rfa_1p8>;
max-speed = <3200000>;
-
- enable-gpios = <&tlmm 17 GPIO_ACTIVE_HIGH>;
- swctrl-gpios = <&tlmm 18 GPIO_ACTIVE_HIGH>;
-
- pinctrl-0 = <&bt_default>;
- pinctrl-names = "default";
};
};
--
2.43.0
^ permalink raw reply related [flat|nested] 9+ messages in thread