Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 24 additions & 4 deletions drivers/bluetooth/hci_qca.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include <linux/mod_devicetable.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_graph.h>
#include <linux/acpi.h>
#include <linux/platform_device.h>
#include <linux/pwrseq/consumer.h>
Expand Down Expand Up @@ -2389,7 +2390,7 @@ static int qca_serdev_probe(struct serdev_device *serdev)
struct hci_dev *hdev;
const struct qca_device_data *data;
int err;
bool power_ctrl_enabled = true;
bool bt_en_available = true;

qcadev = devm_kzalloc(&serdev->dev, sizeof(*qcadev), GFP_KERNEL);
if (!qcadev)
Expand Down Expand Up @@ -2442,6 +2443,25 @@ static int qca_serdev_probe(struct serdev_device *serdev)
case QCA_WCN6750:
case QCA_WCN6855:
case QCA_WCN7850:
/*
* OF graph link is only present for BT devices attached through
* the M.2 Key E connector.
*/
if (of_graph_is_present(dev_of_node(&serdev->ctrl->dev))) {
struct device *dev;

qcadev->bt_power->pwrseq = devm_pwrseq_get(&serdev->ctrl->dev,
"uart");
if (IS_ERR(qcadev->bt_power->pwrseq))
return PTR_ERR(qcadev->bt_power->pwrseq);

dev = pwrseq_to_device(qcadev->bt_power->pwrseq);
if (!device_property_present(dev, "w-disable2-gpios"))
bt_en_available = false;

break;
}

if (!device_property_present(&serdev->dev, "enable-gpios")) {
/*
* Backward compatibility with old DT sources. If the
Expand Down Expand Up @@ -2485,7 +2505,7 @@ static int qca_serdev_probe(struct serdev_device *serdev)
(data->soc_type == QCA_WCN6750 ||
data->soc_type == QCA_WCN6855 ||
data->soc_type == QCA_WCN7850))
power_ctrl_enabled = false;
bt_en_available = false;

qcadev->sw_ctrl = devm_gpiod_get_optional(&serdev->dev, "swctrl",
GPIOD_IN);
Expand Down Expand Up @@ -2523,7 +2543,7 @@ static int qca_serdev_probe(struct serdev_device *serdev)
}

if (!qcadev->bt_en)
power_ctrl_enabled = false;
bt_en_available = false;

qcadev->susclk = devm_clk_get_optional_enabled_with_rate(
&serdev->dev, NULL, SUSCLK_RATE_32KHZ);
Expand All @@ -2541,7 +2561,7 @@ static int qca_serdev_probe(struct serdev_device *serdev)

hdev = qcadev->serdev_hu.hdev;

if (power_ctrl_enabled) {
if (bt_en_available) {
hci_set_quirk(hdev, HCI_QUIRK_NON_PERSISTENT_SETUP);
hdev->shutdown = qca_hci_shutdown;
}
Expand Down