Skip to content

Commit

Permalink
Bluetooth: hci_qca: Add qcomm devcoredump sysfs support
Browse files Browse the repository at this point in the history
This patch implements the hci_qca driver side .coredump() callback to
trigger a devcoredump via sysfs and .enable_coredump() callback to
check if the devcoredump functionality is enabled for a device.

Signed-off-by: Sai Teja Aluvala <quic_saluvala@quicinc.com>
Reviewed-by: Manish Mandlik <mmandlik@google.com>
  • Loading branch information
Sai Teja Aluvala authored and intel-lab-lkp committed Apr 28, 2023
1 parent a2a9339 commit 14f9928
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions drivers/bluetooth/hci_qca.c
Original file line number Diff line number Diff line change
Expand Up @@ -1697,6 +1697,15 @@ static int qca_power_on(struct hci_dev *hdev)
return ret;
}

#ifdef CONFIG_DEV_COREDUMP
static bool hciqca_coredump_enabled(struct hci_dev *hdev)
{
struct hci_uart *hu = hci_get_drvdata(hdev);

return !hu->serdev->dev.coredump_disabled;
}
#endif

static int qca_setup(struct hci_uart *hu)
{
struct hci_dev *hdev = hu->hdev;
Expand Down Expand Up @@ -1772,6 +1781,9 @@ static int qca_setup(struct hci_uart *hu)
qca_debugfs_init(hdev);
hu->hdev->hw_error = qca_hw_error;
hu->hdev->cmd_timeout = qca_cmd_timeout;
#ifdef CONFIG_DEV_COREDUMP
hu->hdev->dump.enabled = hciqca_coredump_enabled;
#endif
if (device_can_wakeup(hu->serdev->ctrl->dev.parent))
hu->hdev->wakeup = qca_wakeup;
} else if (ret == -ENOENT) {
Expand Down Expand Up @@ -2351,6 +2363,18 @@ static const struct acpi_device_id qca_bluetooth_acpi_match[] = {
MODULE_DEVICE_TABLE(acpi, qca_bluetooth_acpi_match);
#endif

#ifdef CONFIG_DEV_COREDUMP
static void hciqca_coredump(struct device *dev)
{
struct serdev_device *serdev = to_serdev_device(dev);
struct qca_serdev *qcadev = serdev_device_get_drvdata(serdev);
struct hci_uart *hu = &qcadev->serdev_hu;
struct hci_dev *hdev = hu->hdev;

if (!dev->coredump_disabled && hdev->dump.coredump)
hdev->dump.coredump(hdev);
}
#endif

static struct serdev_device_driver qca_serdev_driver = {
.probe = qca_serdev_probe,
Expand All @@ -2361,6 +2385,9 @@ static struct serdev_device_driver qca_serdev_driver = {
.acpi_match_table = ACPI_PTR(qca_bluetooth_acpi_match),
.shutdown = qca_serdev_shutdown,
.pm = &qca_pm_ops,
#ifdef CONFIG_DEV_COREDUMP
.coredump = hciqca_coredump,
#endif
},
};

Expand Down

0 comments on commit 14f9928

Please sign in to comment.