All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 1/2] Bluetooth: hci_qca: Add qcomm devcoredump sysfs support
@ 2023-04-28  7:16 Sai Teja Aluvala
  2023-04-28  7:56 ` [v1,1/2] " bluez.test.bot
  2023-04-28 19:36 ` [PATCH v1 1/2] " kernel test robot
  0 siblings, 2 replies; 4+ messages in thread
From: Sai Teja Aluvala @ 2023-04-28  7:16 UTC (permalink / raw)
  To: marcel, johan.hedberg
  Cc: linux-kernel, linux-bluetooth, quic_hemantg, quic_bgodavar,
	quic_rameshn, jiangzp, mmandlik, Sai Teja Aluvala

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>

---
 drivers/bluetooth/hci_qca.c | 27 +++++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
index 1b06450..e21180d 100644
--- a/drivers/bluetooth/hci_qca.c
+++ b/drivers/bluetooth/hci_qca.c
@@ -1702,6 +1702,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;
@@ -1780,6 +1789,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) {
@@ -2380,6 +2392,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,
@@ -2390,6 +2414,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
 	},
 };
 
-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc.


^ permalink raw reply related	[flat|nested] 4+ messages in thread
* [PATCH v1 1/2] Bluetooth: hci_qca: Add qcomm devcoredump sysfs support
@ 2023-05-01 12:00 Sai Teja Aluvala
  2023-05-01 12:39 ` [v1,1/2] " bluez.test.bot
  0 siblings, 1 reply; 4+ messages in thread
From: Sai Teja Aluvala @ 2023-05-01 12:00 UTC (permalink / raw)
  To: marcel, johan.hedberg, luiz.dentz
  Cc: linux-kernel, linux-bluetooth, quic_hemantg, quic_bgodavar,
	jiangzp, mmandlik, Sai Teja Aluvala

This patch implements the hci_qca driver side .coredump() callback to
trigger a devcoredump via sysfs

Signed-off-by: Sai Teja Aluvala <quic_saluvala@quicinc.com>
Reviewed-by: Manish Mandlik <mmandlik@google.com>
v1:Initial Patch
---
 drivers/bluetooth/hci_qca.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
index 1b06450..ca98f6d 100644
--- a/drivers/bluetooth/hci_qca.c
+++ b/drivers/bluetooth/hci_qca.c
@@ -2380,6 +2380,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 (hdev->dump.coredump)
+		hdev->dump.coredump(hdev);
+}
+#endif
 
 static struct serdev_device_driver qca_serdev_driver = {
 	.probe = qca_serdev_probe,
@@ -2390,6 +2402,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
 	},
 };
 
-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc.


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-05-01 12:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-28  7:16 [PATCH v1 1/2] Bluetooth: hci_qca: Add qcomm devcoredump sysfs support Sai Teja Aluvala
2023-04-28  7:56 ` [v1,1/2] " bluez.test.bot
2023-04-28 19:36 ` [PATCH v1 1/2] " kernel test robot
  -- strict thread matches above, loose matches on Subject: below --
2023-05-01 12:00 Sai Teja Aluvala
2023-05-01 12:39 ` [v1,1/2] " bluez.test.bot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.