summaryrefslogtreecommitdiffstats
path: root/drivers/bluetooth
diff options
context:
space:
mode:
authorBartosz Golaszewski <bartosz.golaszewski@linaro.org>2024-07-09 14:18:33 +0200
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2024-07-15 16:12:10 +0200
commitb80f4e3b8cb8a4a41cc038807cd0a1e889154902 (patch)
treeac31dabd2752553adcaa4a2eb344f0b1d6125d21 /drivers/bluetooth
parentdt-bindings: bluetooth: qualcomm: describe the inputs from PMU for wcn7850 (diff)
downloadlinux-b80f4e3b8cb8a4a41cc038807cd0a1e889154902.tar.xz
linux-b80f4e3b8cb8a4a41cc038807cd0a1e889154902.zip
Bluetooth: hci_qca: schedule a devm action for disabling the clock
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> Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Diffstat (limited to 'drivers/bluetooth')
-rw-r--r--drivers/bluetooth/hci_qca.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
index bc6a49ba26f9..ace920261aa4 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,10 @@ 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;
-
+ break;
default:
- if (qcadev->susclk)
- clk_disable_unprepare(qcadev->susclk);
}
hci_uart_unregister_device(&qcadev->serdev_hu);