[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210817005507.1507580-10-dmitry.baryshkov@linaro.org>
Date: Tue, 17 Aug 2021 03:55:01 +0300
From: Dmitry Baryshkov <dmitry.baryshkov@...aro.org>
To: Andy Gross <agross@...nel.org>,
Bjorn Andersson <bjorn.andersson@...aro.org>,
Ulf Hansson <ulf.hansson@...aro.org>,
Marcel Holtmann <marcel@...tmann.org>,
Johan Hedberg <johan.hedberg@...il.com>,
Luiz Augusto von Dentz <luiz.dentz@...il.com>,
Kalle Valo <kvalo@...eaurora.org>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Stanimir Varbanov <svarbanov@...sol.com>
Cc: linux-arm-msm@...r.kernel.org, linux-mmc@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-bluetooth@...r.kernel.org,
ath10k@...ts.infradead.org, linux-wireless@...r.kernel.org,
netdev@...r.kernel.org
Subject: [RFC PATCH 09/15] Bluetooth: hci_qca: add support for pwrseq
Support using pwrseq for powering up and down the QCA BT chips.
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@...aro.org>
---
drivers/bluetooth/hci_qca.c | 22 +++++++++++++++++++---
1 file changed, 19 insertions(+), 3 deletions(-)
diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
index 2d23e8a3ca14..a908a952c0ef 100644
--- a/drivers/bluetooth/hci_qca.c
+++ b/drivers/bluetooth/hci_qca.c
@@ -31,6 +31,7 @@
#include <linux/regulator/consumer.h>
#include <linux/serdev.h>
#include <linux/mutex.h>
+#include <linux/pwrseq/consumer.h>
#include <asm/unaligned.h>
#include <net/bluetooth/bluetooth.h>
@@ -211,6 +212,7 @@ struct qca_serdev {
struct gpio_desc *sw_ctrl;
struct clk *susclk;
enum qca_btsoc_type btsoc_type;
+ struct pwrseq *pwrseq;
struct regulator_bulk_data *vreg_bulk;
int num_vregs;
bool vregs_on;
@@ -1602,7 +1604,10 @@ static int qca_power_on(struct hci_dev *hdev)
*/
qcadev = serdev_device_get_drvdata(hu->serdev);
serdev_device_close(hu->serdev);
- ret = qca_regulator_enable(qcadev);
+ if (qcadev->pwrseq)
+ ret = pwrseq_full_power_on(qcadev->pwrseq);
+ else
+ ret = qca_regulator_enable(qcadev);
if (ret)
return ret;
@@ -1863,7 +1868,10 @@ static void qca_power_shutdown(struct hci_uart *hu)
host_set_baudrate(hu, 2400);
qca_send_power_pulse(hu, false);
}
- qca_regulator_disable(qcadev);
+ if (qcadev->pwrseq)
+ pwrseq_power_off(qcadev->pwrseq);
+ else
+ qca_regulator_disable(qcadev);
set_bit(QCA_BT_OFF, &qca->flags);
}
@@ -2015,7 +2023,15 @@ static int qca_serdev_probe(struct serdev_device *serdev)
else
qcadev->btsoc_type = QCA_ROME;
- if (data && data->num_vregs) {
+ qcadev->pwrseq = devm_pwrseq_get_optional(&serdev->dev, "bt");
+ if (IS_ERR(qcadev->pwrseq)) {
+ err = PTR_ERR(qcadev->pwrseq);
+ BT_ERR("Failed to init regulators:%d", err);
+ return err;
+
+ }
+
+ if (!qcadev->pwrseq && data && data->num_vregs) {
err = qca_init_regulators(qcadev, &serdev->dev, data->vregs,
data->num_vregs);
if (err) {
--
2.30.2
Powered by blists - more mailing lists