Skip to contentSkip to conversation

Bluetooth: btintel_pcie: Add support for _suspend() / _resume()

PATCH Applied Kiran K 5 participants 7 messages Jul 23, 2025 – Jul 25, 2025

Subsystems (2)

v5 of 7 Applied 1/1 Latest is v7 →

lore
Share & tools
lore

Kiran K

author
#0 lore raw

PATCH v5 1/1 Bluetooth: btintel_pcie: Add support for _suspend() / _resume()

From: Chandrashekar Devegowda <[email protected]>

This patch implements _suspend() and _resume() functions for the Bluetooth controller. When the system enters a suspended state, the driver notifies the controller to perform necessary housekeeping tasks by writing to the sleep control register and waits for an alive interrupt. The firmware raises the alive interrupt when it has transitioned to the D3 state. The same flow occurs when the system resumes.

Command to test host initiated wakeup after 60 seconds sudo rtcwake -m mem -s 60

dmesg log (tested on Whale Peak2 on Panther Lake platform) On system suspend:

[  516.418316] Bluetooth: hci0: device entered into d3 state from d0 in 81 us

On system resume:

[  542.174128] Bluetooth: hci0: device entered into d0 state from d3 in 357 us

---
changes in v5:
- Address review comments

changes in v4:
- Moved document and section details from the commit message as comment in code.

changes in v3:
- Corrected the typo's
- Updated the CC list as suggested.
- Corrected the format specifiers in the logs.

changes in v2:
- Updated the commit message with test steps and logs.
- Added logs to include the timeout message.
- Fixed a potential race condition during suspend and resume.

 drivers/bluetooth/btintel_pcie.c | 102 +++++++++++++++++++++++++++++++
 drivers/bluetooth/btintel_pcie.h |   4 ++
 2 files changed, 106 insertions(+)
drivers/bluetooth/btintel_pcie.c +102 -0
index 6e7bbbd35279..a96975a55cbe 100644
@@ -540,6 +540,12 @@ static int btintel_pcie_reset_bt(struct btintel_pcie_data *data)
 	return reg == 0 ? 0 : -ENODEV;
 }
 
+static void btintel_pcie_set_persistence_mode(struct btintel_pcie_data *data)
+{
+	btintel_pcie_set_reg_bits(data, BTINTEL_PCIE_CSR_HW_BOOT_CONFIG,
+				  BTINTEL_PCIE_CSR_HW_BOOT_CONFIG_KEEP_ON);
+}
+
 static void btintel_pcie_mac_init(struct btintel_pcie_data *data)
 {
 	u32 reg;
@@ -829,6 +835,8 @@ static int btintel_pcie_enable_bt(struct btintel_pcie_data *data)
 	 */
 	data->boot_stage_cache = 0x0;
 
+	btintel_pcie_set_persistence_mode(data);
+
 	/* Set MAC_INIT bit to start primary bootloader */
 	reg = btintel_pcie_rd_reg32(data, BTINTEL_PCIE_CSR_FUNC_CTRL_REG);
 	reg &= ~(BTINTEL_PCIE_CSR_FUNC_CTRL_FUNC_INIT |
@@ -2573,11 +2581,105 @@ static void btintel_pcie_coredump(struct device *dev)
 }
 #endif
 
+#ifdef CONFIG_PM
+static int btintel_pcie_suspend_late(struct device *dev, pm_message_t mesg)
+{
+	struct pci_dev *pdev = to_pci_dev(dev);
+	struct btintel_pcie_data *data;
+	ktime_t start;
+	u32 dxstate;
+	s64 delta;
+	int err;
+
+	data = pci_get_drvdata(pdev);
+
+	if (mesg.event == PM_EVENT_SUSPEND)
+		dxstate = BTINTEL_PCIE_STATE_D3_HOT;
+	else
+		dxstate = BTINTEL_PCIE_STATE_D3_COLD;
+
+	data->gp0_received = false;
+
+	start = ktime_get();
+
+	/* Refer: 6.4.11.7 -> Platform power management */
+	btintel_pcie_wr_sleep_cntrl(data, dxstate);
+	err = wait_event_timeout(data->gp0_wait_q, data->gp0_received,
+				 msecs_to_jiffies(BTINTEL_DEFAULT_INTR_TIMEOUT_MS));
+	delta = ktime_to_ns(ktime_get() - start) / 1000;
+
+	if (err == 0) {
+		bt_dev_err(data->hdev, "Timeout (%u ms) on alive interrupt for D3 entry",
+				BTINTEL_DEFAULT_INTR_TIMEOUT_MS);
+		return -EBUSY;
+	}
+	bt_dev_info(data->hdev, "device entered into d3 state from d0 in %lld us",
+		    delta);
+	return 0;
+}
+
+static int btintel_pcie_suspend(struct device *dev)
+{
+	return btintel_pcie_suspend_late(dev, PMSG_SUSPEND);
+}
+
+static int btintel_pcie_hibernate(struct device *dev)
+{
+	return btintel_pcie_suspend_late(dev, PMSG_HIBERNATE);
+}
+
+static int btintel_pcie_freeze(struct device *dev)
+{
+	return btintel_pcie_suspend_late(dev, PMSG_FREEZE);
+}
+
+static int btintel_pcie_resume(struct device *dev)
+{
+	struct pci_dev *pdev = to_pci_dev(dev);
+	struct btintel_pcie_data *data;
+	ktime_t start;
+	int err;
+	s64 delta;
+
+	data = pci_get_drvdata(pdev);
+	data->gp0_received = false;
+
+	start = ktime_get();
+
+	/* Refer: 6.4.11.7 -> Platform power management */
+	btintel_pcie_wr_sleep_cntrl(data, BTINTEL_PCIE_STATE_D0);
+	err = wait_event_timeout(data->gp0_wait_q, data->gp0_received,
+				 msecs_to_jiffies(BTINTEL_DEFAULT_INTR_TIMEOUT_MS));
+	delta = ktime_to_ns(ktime_get() - start) / 1000;
+
+	if (err == 0) {
+		bt_dev_err(data->hdev, "Timeout (%u ms) on alive interrupt for D0 entry",
+				BTINTEL_DEFAULT_INTR_TIMEOUT_MS);
+		return -EBUSY;
+	}
+	bt_dev_info(data->hdev, "device entered into d0 state from d3 in %lld us",
+		    delta);
+	return 0;
+}
+
+const struct dev_pm_ops btintel_pcie_pm_ops = {
+	.suspend = btintel_pcie_suspend,
+	.resume = btintel_pcie_resume,
+	.freeze = btintel_pcie_freeze,
+	.thaw = btintel_pcie_resume,
+	.poweroff = btintel_pcie_hibernate,
+	.restore = btintel_pcie_resume,
+};
+#define BTINTELPCIE_PM_OPS	(&btintel_pcie_pm_ops)
+#else
+#define BTINTELPCIE_PM_OPS	NULL
+#endif
 static struct pci_driver btintel_pcie_driver = {
 	.name = KBUILD_MODNAME,
 	.id_table = btintel_pcie_table,
 	.probe = btintel_pcie_probe,
 	.remove = btintel_pcie_remove,
+	.driver.pm = BTINTELPCIE_PM_OPS,
 #ifdef CONFIG_DEV_COREDUMP
 	.driver.coredump = btintel_pcie_coredump
 #endif
drivers/bluetooth/btintel_pcie.h +4 -0
index 0fa876c5b954..5bc69004b692 100644
@@ -8,6 +8,7 @@
 
 /* Control and Status Register(BTINTEL_PCIE_CSR) */
 #define BTINTEL_PCIE_CSR_BASE			(0x000)
+#define BTINTEL_PCIE_CSR_HW_BOOT_CONFIG		(BTINTEL_PCIE_CSR_BASE + 0x000)
 #define BTINTEL_PCIE_CSR_FUNC_CTRL_REG		(BTINTEL_PCIE_CSR_BASE + 0x024)
 #define BTINTEL_PCIE_CSR_HW_REV_REG		(BTINTEL_PCIE_CSR_BASE + 0x028)
 #define BTINTEL_PCIE_CSR_RF_ID_REG		(BTINTEL_PCIE_CSR_BASE + 0x09C)
@@ -55,6 +56,9 @@
 #define BTINTEL_PCIE_CSR_BOOT_STAGE_ALIVE		(BIT(23))
 #define BTINTEL_PCIE_CSR_BOOT_STAGE_D3_STATE_READY	(BIT(24))
 
+/* CSR HW BOOT CONFIG Register */
+#define BTINTEL_PCIE_CSR_HW_BOOT_CONFIG_KEEP_ON		(BIT(31))
+
 /* Registers for MSI-X */
 #define BTINTEL_PCIE_CSR_MSIX_BASE		(0x2000)
 #define BTINTEL_PCIE_CSR_MSIX_FH_INT_CAUSES	(BTINTEL_PCIE_CSR_MSIX_BASE + 0x0800)
Signature · 1 line
2.43.0
#1 lore raw

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=985145

---Test result---

Test Summary:

CheckPatch                    PENDING   0.38 seconds
GitLint                       PENDING   0.45 seconds
SubjectPrefix                 PASS      0.12 seconds
BuildKernel                   PASS      24.92 seconds
CheckAllWarning               PASS      26.91 seconds
CheckSparse                   PASS      30.43 seconds
BuildKernel32                 PASS      24.59 seconds
TestRunnerSetup               PASS      479.88 seconds
TestRunner_l2cap-tester       PASS      25.53 seconds
TestRunner_iso-tester         PASS      40.94 seconds
TestRunner_bnep-tester        PASS      6.04 seconds
TestRunner_mgmt-tester        FAIL      134.76 seconds
TestRunner_rfcomm-tester      PASS      9.43 seconds
TestRunner_sco-tester         PASS      14.80 seconds
TestRunner_ioctl-tester       PASS      10.16 seconds
TestRunner_mesh-tester        FAIL      11.40 seconds
TestRunner_smp-tester         FAIL      10.99 seconds
TestRunner_userchan-tester    PASS      6.31 seconds
IncrementalBuild              PENDING   0.93 seconds

Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script
Output:

##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:

##############################
Test: TestRunner_mgmt-tester - FAIL
Desc: Run mgmt-tester with test-runner Output:
Total: 490, Passed: 483 (98.6%), Failed: 3, Not Run: 4

Failed Test Cases

LL Privacy - Add Device 2 (2 Devices to AL)          Failed       0.177 seconds
LL Privacy - Set Flags 1 (Add to RL)                 Failed       0.167 seconds
LL Privacy - Set Flags 3 (2 Devices to RL)           Failed       0.203 seconds

##############################
Test: TestRunner_mesh-tester - FAIL
Desc: Run mesh-tester with test-runner Output:
Total: 10, Passed: 8 (80.0%), Failed: 2, Not Run: 0

Failed Test Cases

Mesh - Send cancel - 1                               Timed out    2.067 seconds
Mesh - Send cancel - 2                               Timed out    1.998 seconds

##############################
Test: TestRunner_smp-tester - FAIL
Desc: Run smp-tester with test-runner
Output:

WARNING: CPU: 0 PID: 51 at net/bluetooth/hci_conn.c:568 hci_conn_timeout+0x14e/0x190

Total: 8, Passed: 8 (100.0%), Failed: 0, Not Run: 0
##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series Output:

---
Regards,
Linux Bluetooth

#2 lore raw
In reply to Kiran K
This patch was applied to bluetooth/bluetooth-next.git (master) by Luiz Augusto von Dentz <[email protected]>:

Hello:

This patch was applied to bluetooth/bluetooth-next.git (master) by Luiz Augusto von Dentz <[email protected]>:

Quoted 11 lines · On Wed, 23 Jul 2025 19:27:15 +0530 you wrote:

From: Chandrashekar Devegowda <[email protected]>

This patch implements _suspend() and _resume() functions for the Bluetooth controller. When the system enters a suspended state, the driver notifies the controller to perform necessary housekeeping tasks by writing to the sleep control register and waits for an alive interrupt. The firmware raises the alive interrupt when it has transitioned to the D3 state. The same flow occurs when the system resumes.

[...]

Here is the summary with links:
- [v5] Bluetooth: btintel_pcie: Add support for _suspend() / _resume()

    https://git.kernel.org/bluetooth/bluetooth-next/c/33bb9b1ce6f6

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
#3 lore raw
In reply to Kiran K
Quoted 151 lines · Kiran K

From: Chandrashekar Devegowda <[email protected]>

This patch implements _suspend() and _resume() functions for the Bluetooth controller. When the system enters a suspended state, the driver notifies the controller to perform necessary housekeeping tasks by writing to the sleep control register and waits for an alive interrupt. The firmware raises the alive interrupt when it has transitioned to the D3 state. The same flow occurs when the system resumes.

Command to test host initiated wakeup after 60 seconds sudo rtcwake -m mem -s 60

dmesg log (tested on Whale Peak2 on Panther Lake platform) On system suspend:

[  516.418316] Bluetooth: hci0: device entered into d3 state from d0 in 81 us

On system resume:

[  542.174128] Bluetooth: hci0: device entered into d0 state from d3 in 357 us

---
changes in v5:
- Address review comments

changes in v4:
- Moved document and section details from the commit message as comment in code.

changes in v3:
- Corrected the typo's
- Updated the CC list as suggested.
- Corrected the format specifiers in the logs.

changes in v2:
- Updated the commit message with test steps and logs.
- Added logs to include the timeout message.
- Fixed a potential race condition during suspend and resume.

 drivers/bluetooth/btintel_pcie.c | 102 +++++++++++++++++++++++++++++++
 drivers/bluetooth/btintel_pcie.h |   4 ++
 2 files changed, 106 insertions(+)
drivers/bluetooth/btintel_pcie.c +86 -0
index 6e7bbbd35279..a96975a55cbe 100644
@@ -540,6 +540,12 @@ static int btintel_pcie_reset_bt(struct btintel_pcie_data *data)
 	return reg == 0 ? 0 : -ENODEV;
 }
 
+static void btintel_pcie_set_persistence_mode(struct btintel_pcie_data *data)
+{
+	btintel_pcie_set_reg_bits(data, BTINTEL_PCIE_CSR_HW_BOOT_CONFIG,
+				  BTINTEL_PCIE_CSR_HW_BOOT_CONFIG_KEEP_ON);
+}
+
 static void btintel_pcie_mac_init(struct btintel_pcie_data *data)
 {
 	u32 reg;
@@ -829,6 +835,8 @@ static int btintel_pcie_enable_bt(struct btintel_pcie_data *data)
 	 */
 	data->boot_stage_cache = 0x0;
 
+	btintel_pcie_set_persistence_mode(data);
+
 	/* Set MAC_INIT bit to start primary bootloader */
 	reg = btintel_pcie_rd_reg32(data, BTINTEL_PCIE_CSR_FUNC_CTRL_REG);
 	reg &= ~(BTINTEL_PCIE_CSR_FUNC_CTRL_FUNC_INIT |
@@ -2573,11 +2581,105 @@ static void btintel_pcie_coredump(struct device *dev)
 }
 #endif
 
+#ifdef CONFIG_PM
+static int btintel_pcie_suspend_late(struct device *dev, pm_message_t mesg)
+{
+	struct pci_dev *pdev = to_pci_dev(dev);
+	struct btintel_pcie_data *data;
+	ktime_t start;
+	u32 dxstate;
+	s64 delta;
+	int err;
+
+	data = pci_get_drvdata(pdev);
+
+	if (mesg.event == PM_EVENT_SUSPEND)
+		dxstate = BTINTEL_PCIE_STATE_D3_HOT;
+	else
+		dxstate = BTINTEL_PCIE_STATE_D3_COLD;
+
+	data->gp0_received = false;
+
+	start = ktime_get();
+
+	/* Refer: 6.4.11.7 -> Platform power management */
+	btintel_pcie_wr_sleep_cntrl(data, dxstate);
+	err = wait_event_timeout(data->gp0_wait_q, data->gp0_received,
+				 msecs_to_jiffies(BTINTEL_DEFAULT_INTR_TIMEOUT_MS));
+	delta = ktime_to_ns(ktime_get() - start) / 1000;
+
+	if (err == 0) {
+		bt_dev_err(data->hdev, "Timeout (%u ms) on alive interrupt for D3 entry",
+				BTINTEL_DEFAULT_INTR_TIMEOUT_MS);
+		return -EBUSY;
+	}
+	bt_dev_info(data->hdev, "device entered into d3 state from d0 in %lld us",
+		    delta);
+	return 0;
+}
+
+static int btintel_pcie_suspend(struct device *dev)
+{
+	return btintel_pcie_suspend_late(dev, PMSG_SUSPEND);
+}
+
+static int btintel_pcie_hibernate(struct device *dev)
+{
+	return btintel_pcie_suspend_late(dev, PMSG_HIBERNATE);
+}
+
+static int btintel_pcie_freeze(struct device *dev)
+{
+	return btintel_pcie_suspend_late(dev, PMSG_FREEZE);
+}
+
+static int btintel_pcie_resume(struct device *dev)
+{
+	struct pci_dev *pdev = to_pci_dev(dev);
+	struct btintel_pcie_data *data;
+	ktime_t start;
+	int err;
+	s64 delta;
+
+	data = pci_get_drvdata(pdev);
+	data->gp0_received = false;
+
+	start = ktime_get();
+
+	/* Refer: 6.4.11.7 -> Platform power management */
+	btintel_pcie_wr_sleep_cntrl(data, BTINTEL_PCIE_STATE_D0);
+	err = wait_event_timeout(data->gp0_wait_q, data->gp0_received,
+				 msecs_to_jiffies(BTINTEL_DEFAULT_INTR_TIMEOUT_MS));
+	delta = ktime_to_ns(ktime_get() - start) / 1000;
+
+	if (err == 0) {
+		bt_dev_err(data->hdev, "Timeout (%u ms) on alive interrupt for D0 entry",
+				BTINTEL_DEFAULT_INTR_TIMEOUT_MS);
+		return -EBUSY;
+	}
+	bt_dev_info(data->hdev, "device entered into d0 state from d3 in %lld us",
+		    delta);

drivers/bluetooth/btintel_pcie.c static void btintel_pcie_coredump(struct device *dev) · line 2671

Quoted 10 lines
drivers/bluetooth/btintel_pcie.c +10 -0
+	return 0;
+}
+
+const struct dev_pm_ops btintel_pcie_pm_ops = {
+	.suspend = btintel_pcie_suspend,
+	.resume = btintel_pcie_resume,
+	.freeze = btintel_pcie_freeze,
+	.thaw = btintel_pcie_resume,
+	.poweroff = btintel_pcie_hibernate,
+	.restore = btintel_pcie_resume,

You should use pm_sleep_ptr() to avoid the ifdef clutter. It will ensure that the compiler drops the function definitions when CONFIG_PM_SLEEP is not enabled.

drivers/bluetooth/btintel_pcie.c static void btintel_pcie_coredump(struct device *dev) · line 2682

Quoted 11 lines
drivers/bluetooth/btintel_pcie.c +6 -0
+};
+#define BTINTELPCIE_PM_OPS	(&btintel_pcie_pm_ops)
+#else
+#define BTINTELPCIE_PM_OPS	NULL
+#endif
 static struct pci_driver btintel_pcie_driver = {
 	.name = KBUILD_MODNAME,
 	.id_table = btintel_pcie_table,
 	.probe = btintel_pcie_probe,
 	.remove = btintel_pcie_remove,
+	.driver.pm = BTINTELPCIE_PM_OPS,

Here, you should use pm_ptr() for the same reason.

- Mani

Signature · 1 line
மணிவண்ணன் சதாசிவம்
author
#4 lore raw

Hi Manivannan,

Thanks for the comments.

Quoted 170 lines

-----Original Message-----
From: Manivannan Sadhasivam <[email protected]>
Sent: Thursday, July 24, 2025 10:37 AM
To: K, Kiran <[email protected]>
Cc: [email protected]; Srivatsa, Ravishankar <[email protected]>; Tumkur Narayan, Chethan <[email protected]>; [email protected]; linux- [email protected]; Devegowda, Chandrashekar <[email protected]>
Subject: Re: [PATCH v5] Bluetooth: btintel_pcie: Add support for _suspend() / _resume()

Quoted 24 lines · Kiran K

From: Chandrashekar Devegowda <[email protected]>

This patch implements _suspend() and _resume() functions for the Bluetooth controller. When the system enters a suspended state, the driver notifies the controller to perform necessary housekeeping tasks by writing to the sleep control register and waits for an alive interrupt. The firmware raises the alive interrupt when it has transitioned to the D3 state. The same flow occurs when the system resumes.

Command to test host initiated wakeup after 60 seconds sudo rtcwake -m mem -s 60

dmesg log (tested on Whale Peak2 on Panther Lake platform) On system suspend:

[  516.418316] Bluetooth: hci0: device entered into d3 state from d0

in 81 us

On system resume:

[  542.174128] Bluetooth: hci0: device entered into d0 state from d3

in 357 us

Signed-off-by: Chandrashekar Devegowda
<[email protected]>

Quoted 7 lines

---
changes in v5:
- Address review comments

changes in v4:
- Moved document and section details from the commit message as

comment in code.

drivers/bluetooth/btintel_pcie.c static int btintel_pcie_reset_bt(struct

Quoted 21 lines

changes in v3:
- Corrected the typo's
- Updated the CC list as suggested.
- Corrected the format specifiers in the logs.

changes in v2:
- Updated the commit message with test steps and logs.
- Added logs to include the timeout message.
- Fixed a potential race condition during suspend and resume.

 drivers/bluetooth/btintel_pcie.c | 102 +++++++++++++++++++++++++++++++
 drivers/bluetooth/btintel_pcie.h |   4 ++
 2 files changed, 106 insertions(+)
drivers/bluetooth/btintel_pcie.c +0 -0
index 6e7bbbd35279..a96975a55cbe 100644
@@ -540,6 +540,12 @@ static int btintel_pcie_reset_bt(struct

btintel_pcie_data *data)

drivers/bluetooth/btintel_pcie.c static int btintel_pcie_reset_bt(struct btintel_pcie_data *data)

Quoted 6 lines
drivers/bluetooth/btintel_pcie.c +3 -0
 	return reg == 0 ? 0 : -ENODEV;
 }
 
+static void btintel_pcie_set_persistence_mode(struct
+btintel_pcie_data *data) {
+	btintel_pcie_set_reg_bits(data,

BTINTEL_PCIE_CSR_HW_BOOT_CONFIG,

drivers/bluetooth/btintel_pcie.c static int btintel_pcie_reset_bt(struct · line 546

Quoted 1 line
drivers/bluetooth/btintel_pcie.c +1 -0
+

BTINTEL_PCIE_CSR_HW_BOOT_CONFIG_KEEP_ON);

drivers/bluetooth/btintel_pcie.c static int btintel_pcie_enable_bt(struct

Quoted 5 lines
drivers/bluetooth/btintel_pcie.c +2 -0
+}
+
 static void btintel_pcie_mac_init(struct btintel_pcie_data *data)  {
 	u32 reg;
@@ -829,6 +835,8 @@ static int btintel_pcie_enable_bt(struct

btintel_pcie_data *data)

drivers/bluetooth/btintel_pcie.c static int btintel_pcie_enable_bt(struct btintel_pcie_data *data)

Quoted 7 lines
drivers/bluetooth/btintel_pcie.c +2 -0
 	 */
 	data->boot_stage_cache = 0x0;
 
+	btintel_pcie_set_persistence_mode(data);
+
 	/* Set MAC_INIT bit to start primary bootloader */
 	reg = btintel_pcie_rd_reg32(data,

BTINTEL_PCIE_CSR_FUNC_CTRL_REG);

Quoted 19 lines
drivers/bluetooth/btintel_pcie.c +1 -0
 	reg &= ~(BTINTEL_PCIE_CSR_FUNC_CTRL_FUNC_INIT | @@ -2573,11
+2581,105 @@ static void btintel_pcie_coredump(struct device *dev)  }

#endif

drivers/bluetooth/btintel_pcie.c +15 -0
+#ifdef CONFIG_PM
+static int btintel_pcie_suspend_late(struct device *dev, pm_message_t
+mesg) {
+	struct pci_dev *pdev = to_pci_dev(dev);
+	struct btintel_pcie_data *data;
+	ktime_t start;
+	u32 dxstate;
+	s64 delta;
+	int err;
+
+	data = pci_get_drvdata(pdev);
+
+	if (mesg.event == PM_EVENT_SUSPEND)
+		dxstate = BTINTEL_PCIE_STATE_D3_HOT;
+	else

drivers/bluetooth/btintel_pcie.c static void btintel_pcie_coredump(struct device *dev) · line 2610

Quoted 10 lines
drivers/bluetooth/btintel_pcie.c +10 -0
+		dxstate = BTINTEL_PCIE_STATE_D3_COLD;
+
+	data->gp0_received = false;
+
+	start = ktime_get();
+
+	/* Refer: 6.4.11.7 -> Platform power management */
+	btintel_pcie_wr_sleep_cntrl(data, dxstate);
+	err = wait_event_timeout(data->gp0_wait_q, data->gp0_received,
+

msecs_to_jiffies(BTINTEL_DEFAULT_INTR_TIMEOUT_MS));

drivers/bluetooth/btintel_pcie.c static void btintel_pcie_coredump(struct device *dev)

Quoted 4 lines
drivers/bluetooth/btintel_pcie.c +4 -0
+	delta = ktime_to_ns(ktime_get() - start) / 1000;
+
+	if (err == 0) {
+		bt_dev_err(data->hdev, "Timeout (%u ms) on alive interrupt

for D3 entry",

drivers/bluetooth/btintel_pcie.c static void btintel_pcie_coredump(struct device *dev)

Quoted 4 lines
drivers/bluetooth/btintel_pcie.c +4 -0
+				BTINTEL_DEFAULT_INTR_TIMEOUT_MS);
+		return -EBUSY;
+	}
+	bt_dev_info(data->hdev, "device entered into d3 state from d0 in %lld

us",

Quoted 19 lines
drivers/bluetooth/btintel_pcie.c +19 -0
+		    delta);
+	return 0;
+}
+
+static int btintel_pcie_suspend(struct device *dev) {
+	return btintel_pcie_suspend_late(dev, PMSG_SUSPEND); }
+
+static int btintel_pcie_hibernate(struct device *dev) {
+	return btintel_pcie_suspend_late(dev, PMSG_HIBERNATE); }
+
+static int btintel_pcie_freeze(struct device *dev) {
+	return btintel_pcie_suspend_late(dev, PMSG_FREEZE); }
+
+static int btintel_pcie_resume(struct device *dev) {
+	struct pci_dev *pdev = to_pci_dev(dev);
+	struct btintel_pcie_data *data;
+	ktime_t start;
+	int err;
+	s64 delta;

drivers/bluetooth/btintel_pcie.c static void btintel_pcie_coredump(struct device *dev) · line 2654

Quoted 10 lines
drivers/bluetooth/btintel_pcie.c +10 -0
+
+	data = pci_get_drvdata(pdev);
+	data->gp0_received = false;
+
+	start = ktime_get();
+
+	/* Refer: 6.4.11.7 -> Platform power management */
+	btintel_pcie_wr_sleep_cntrl(data, BTINTEL_PCIE_STATE_D0);
+	err = wait_event_timeout(data->gp0_wait_q, data->gp0_received,
+

msecs_to_jiffies(BTINTEL_DEFAULT_INTR_TIMEOUT_MS));

drivers/bluetooth/btintel_pcie.c static void btintel_pcie_coredump(struct device *dev)

Quoted 4 lines
drivers/bluetooth/btintel_pcie.c +4 -0
+	delta = ktime_to_ns(ktime_get() - start) / 1000;
+
+	if (err == 0) {
+		bt_dev_err(data->hdev, "Timeout (%u ms) on alive interrupt

for D0 entry",

drivers/bluetooth/btintel_pcie.c static void btintel_pcie_coredump(struct device *dev)

Quoted 4 lines
drivers/bluetooth/btintel_pcie.c +4 -0
+				BTINTEL_DEFAULT_INTR_TIMEOUT_MS);
+		return -EBUSY;
+	}
+	bt_dev_info(data->hdev, "device entered into d0 state from d3 in %lld

us",

Quoted 15 lines

drivers/bluetooth/btintel_pcie.c static void btintel_pcie_coredump(struct device *dev) · line 2671

Quoted 11 lines
drivers/bluetooth/btintel_pcie.c +11 -0
+		    delta);
+	return 0;
+}
+
+const struct dev_pm_ops btintel_pcie_pm_ops = {
+	.suspend = btintel_pcie_suspend,
+	.resume = btintel_pcie_resume,
+	.freeze = btintel_pcie_freeze,
+	.thaw = btintel_pcie_resume,
+	.poweroff = btintel_pcie_hibernate,
+	.restore = btintel_pcie_resume,

You should use pm_sleep_ptr() to avoid the ifdef clutter. It will ensure that the compiler drops the function definitions when CONFIG_PM_SLEEP is not enabled.

Ack.

Quoted 14 lines

drivers/bluetooth/btintel_pcie.c static void btintel_pcie_coredump(struct device *dev) · line 2682

Quoted 12 lines
drivers/bluetooth/btintel_pcie.c +6 -0
+};
+#define BTINTELPCIE_PM_OPS	(&btintel_pcie_pm_ops)
+#else
+#define BTINTELPCIE_PM_OPS	NULL
+#endif
 static struct pci_driver btintel_pcie_driver = {
 	.name = KBUILD_MODNAME,
 	.id_table = btintel_pcie_table,
 	.probe = btintel_pcie_probe,
 	.remove = btintel_pcie_remove,
+	.driver.pm = BTINTELPCIE_PM_OPS,

Here, you should use pm_ptr() for the same reason.

Ack. I will incorporate the comments.

Quoted 5 lines

- Mani

--
மணிவண்ணன் சதாசிவம்

Thanks,
Kiran

#5 lore raw
In reply to Kiran K

Dear Kiran, dear Chandrashekar,

Thank you for your patch.

Am 23.07.25 um 15:57 schrieb Kiran K:

Quoted 13 lines

From: Chandrashekar Devegowda <[email protected]>

This patch implements _suspend() and _resume() functions for the Bluetooth controller. When the system enters a suspended state, the driver notifies the controller to perform necessary housekeeping tasks by writing to the sleep control register and waits for an alive interrupt. The firmware raises the alive interrupt when it has transitioned to the D3 state. The same flow occurs when the system resumes.

Command to test host initiated wakeup after 60 seconds sudo rtcwake -m mem -s 60

Quoted 6 lines

dmesg log (tested on Whale Peak2 on Panther Lake platform) On system suspend:

[  516.418316] Bluetooth: hci0: device entered into d3 state from d0 in 81 us

On system resume:

[  542.174128] Bluetooth: hci0: device entered into d0 state from d3 in 357 us

Just to avoid confusion, is the timestamp correct, as this is only a 26 s difference and your command says 60 s. (I am only aware of inaccurate timestamps using human-readable format (dmesg -T).)

Quoted 5 lines

---
changes in v5:
- Address review comments

This should be more detailed, if code was changed.

Quoted 35 lines

changes in v4:
- Moved document and section details from the commit message as comment in code.

changes in v3:
- Corrected the typo's
- Updated the CC list as suggested.
- Corrected the format specifiers in the logs.

changes in v2:
- Updated the commit message with test steps and logs.
- Added logs to include the timeout message.
- Fixed a potential race condition during suspend and resume.

  drivers/bluetooth/btintel_pcie.c | 102 +++++++++++++++++++++++++++++++
  drivers/bluetooth/btintel_pcie.h |   4 ++
  2 files changed, 106 insertions(+)
drivers/bluetooth/btintel_pcie.c +6 -0
index 6e7bbbd35279..a96975a55cbe 100644
@@ -540,6 +540,12 @@ static int btintel_pcie_reset_bt(struct btintel_pcie_data *data)
  	return reg == 0 ? 0 : -ENODEV;
  }
 
+static void btintel_pcie_set_persistence_mode(struct btintel_pcie_data *data)
+{
+	btintel_pcie_set_reg_bits(data, BTINTEL_PCIE_CSR_HW_BOOT_CONFIG,
+				  BTINTEL_PCIE_CSR_HW_BOOT_CONFIG_KEEP_ON);
+}
+
  static void btintel_pcie_mac_init(struct btintel_pcie_data *data)
  {
  	u32 reg;

drivers/bluetooth/btintel_pcie.c static int btintel_pcie_enable_bt(struct btintel_pcie_data *data) · line 839

Quoted 5 lines
drivers/bluetooth/btintel_pcie.c +2 -0
@@ -829,6 +835,8 @@ static int btintel_pcie_enable_bt(struct btintel_pcie_data *data)
  	 */
  	data->boot_stage_cache = 0x0;
 
+	btintel_pcie_set_persistence_mode(data);
+

This hunk is not described in the commit message.

Quoted 5 lines
drivers/bluetooth/btintel_pcie.c +0 -0
  	/* Set MAC_INIT bit to start primary bootloader */
  	reg = btintel_pcie_rd_reg32(data, BTINTEL_PCIE_CSR_FUNC_CTRL_REG);
  	reg &= ~(BTINTEL_PCIE_CSR_FUNC_CTRL_FUNC_INIT |
@@ -2573,11 +2581,105 @@ static void btintel_pcie_coredump(struct device *dev)
  }

drivers/bluetooth/btintel_pcie.c static void btintel_pcie_coredump(struct device *dev) · line 2591

Quoted 10 lines
drivers/bluetooth/btintel_pcie.c +8 -0
  #endif
 
+#ifdef CONFIG_PM
+static int btintel_pcie_suspend_late(struct device *dev, pm_message_t mesg)
+{
+	struct pci_dev *pdev = to_pci_dev(dev);
+	struct btintel_pcie_data *data;
+	ktime_t start;
+	u32 dxstate;
+	s64 delta;

Append the unit to the name? delta_us?

drivers/bluetooth/btintel_pcie.c static void btintel_pcie_coredump(struct device *dev) · line 2599

Quoted 8 lines
drivers/bluetooth/btintel_pcie.c +8 -0
+	int err;
+
+	data = pci_get_drvdata(pdev);
+
+	if (mesg.event == PM_EVENT_SUSPEND)
+		dxstate = BTINTEL_PCIE_STATE_D3_HOT;
+	else
+		dxstate = BTINTEL_PCIE_STATE_D3_COLD;

I’d use the ternary operator.

drivers/bluetooth/btintel_pcie.c static void btintel_pcie_coredump(struct device *dev) · line 2609

Quoted 10 lines
drivers/bluetooth/btintel_pcie.c +10 -0
+
+	data->gp0_received = false;
+
+	start = ktime_get();
+
+	/* Refer: 6.4.11.7 -> Platform power management */
+	btintel_pcie_wr_sleep_cntrl(data, dxstate);
+	err = wait_event_timeout(data->gp0_wait_q, data->gp0_received,
+				 msecs_to_jiffies(BTINTEL_DEFAULT_INTR_TIMEOUT_MS));
+	delta = ktime_to_ns(ktime_get() - start) / 1000;

Move it below right before bt_dev_info?

Quoted 89 lines
drivers/bluetooth/btintel_pcie.c +68 -0
+
+	if (err == 0) {
+		bt_dev_err(data->hdev, "Timeout (%u ms) on alive interrupt for D3 entry",
+				BTINTEL_DEFAULT_INTR_TIMEOUT_MS);
+		return -EBUSY;
+	}
+	bt_dev_info(data->hdev, "device entered into d3 state from d0 in %lld us",
+		    delta);
+	return 0;
+}
+
+static int btintel_pcie_suspend(struct device *dev)
+{
+	return btintel_pcie_suspend_late(dev, PMSG_SUSPEND);
+}
+
+static int btintel_pcie_hibernate(struct device *dev)
+{
+	return btintel_pcie_suspend_late(dev, PMSG_HIBERNATE);
+}
+
+static int btintel_pcie_freeze(struct device *dev)
+{
+	return btintel_pcie_suspend_late(dev, PMSG_FREEZE);
+}
+
+static int btintel_pcie_resume(struct device *dev)
+{
+	struct pci_dev *pdev = to_pci_dev(dev);
+	struct btintel_pcie_data *data;
+	ktime_t start;
+	int err;
+	s64 delta;
+
+	data = pci_get_drvdata(pdev);
+	data->gp0_received = false;
+
+	start = ktime_get();
+
+	/* Refer: 6.4.11.7 -> Platform power management */
+	btintel_pcie_wr_sleep_cntrl(data, BTINTEL_PCIE_STATE_D0);
+	err = wait_event_timeout(data->gp0_wait_q, data->gp0_received,
+				 msecs_to_jiffies(BTINTEL_DEFAULT_INTR_TIMEOUT_MS));
+	delta = ktime_to_ns(ktime_get() - start) / 1000;
+
+	if (err == 0) {
+		bt_dev_err(data->hdev, "Timeout (%u ms) on alive interrupt for D0 entry",
+				BTINTEL_DEFAULT_INTR_TIMEOUT_MS);
+		return -EBUSY;
+	}
+	bt_dev_info(data->hdev, "device entered into d0 state from d3 in %lld us",
+		    delta);
+	return 0;
+}
+
+const struct dev_pm_ops btintel_pcie_pm_ops = {
+	.suspend = btintel_pcie_suspend,
+	.resume = btintel_pcie_resume,
+	.freeze = btintel_pcie_freeze,
+	.thaw = btintel_pcie_resume,
+	.poweroff = btintel_pcie_hibernate,
+	.restore = btintel_pcie_resume,
+};
+#define BTINTELPCIE_PM_OPS	(&btintel_pcie_pm_ops)
+#else
+#define BTINTELPCIE_PM_OPS	NULL
+#endif
  static struct pci_driver btintel_pcie_driver = {
  	.name = KBUILD_MODNAME,
  	.id_table = btintel_pcie_table,
  	.probe = btintel_pcie_probe,
  	.remove = btintel_pcie_remove,
+	.driver.pm = BTINTELPCIE_PM_OPS,
  #ifdef CONFIG_DEV_COREDUMP
  	.driver.coredump = btintel_pcie_coredump
  #endif
drivers/bluetooth/btintel_pcie.h +1 -0
index 0fa876c5b954..5bc69004b692 100644
@@ -8,6 +8,7 @@
 
  /* Control and Status Register(BTINTEL_PCIE_CSR) */
  #define BTINTEL_PCIE_CSR_BASE			(0x000)
+#define BTINTEL_PCIE_CSR_HW_BOOT_CONFIG		(BTINTEL_PCIE_CSR_BASE + 0x000)
  #define BTINTEL_PCIE_CSR_FUNC_CTRL_REG		(BTINTEL_PCIE_CSR_BASE + 0x024)
  #define BTINTEL_PCIE_CSR_HW_REV_REG		(BTINTEL_PCIE_CSR_BASE + 0x028)
  #define BTINTEL_PCIE_CSR_RF_ID_REG		(BTINTEL_PCIE_CSR_BASE + 0x09C)

drivers/bluetooth/btintel_pcie.h line 64

Quoted 9 lines
drivers/bluetooth/btintel_pcie.h +3 -0
@@ -55,6 +56,9 @@
  #define BTINTEL_PCIE_CSR_BOOT_STAGE_ALIVE		(BIT(23))
  #define BTINTEL_PCIE_CSR_BOOT_STAGE_D3_STATE_READY	(BIT(24))
 
+/* CSR HW BOOT CONFIG Register */
+#define BTINTEL_PCIE_CSR_HW_BOOT_CONFIG_KEEP_ON		(BIT(31))
+
  /* Registers for MSI-X */
  #define BTINTEL_PCIE_CSR_MSIX_BASE		(0x2000)
  #define BTINTEL_PCIE_CSR_MSIX_FH_INT_CAUSES	(BTINTEL_PCIE_CSR_MSIX_BASE + 0x0800)

Kind regards,

Paul

author
#6 lore raw

Hi Paul,

Appreciate your comments.

Quoted 36 lines

-----Original Message-----
From: Paul Menzel <[email protected]>
Sent: Thursday, July 24, 2025 11:48 AM
To: K, Kiran <[email protected]>; Devegowda, Chandrashekar <[email protected]>
Cc: [email protected]; Srivatsa, Ravishankar <[email protected]>; Tumkur Narayan, Chethan <[email protected]>; [email protected]; linux- [email protected]
Subject: Re: [PATCH v5] Bluetooth: btintel_pcie: Add support for _suspend() / _resume()

Dear Kiran, dear Chandrashekar,

Thank you for your patch.

Am 23.07.25 um 15:57 schrieb Kiran K:

Quoted 18 lines

From: Chandrashekar Devegowda <[email protected]>

This patch implements _suspend() and _resume() functions for the Bluetooth controller. When the system enters a suspended state, the driver notifies the controller to perform necessary housekeeping tasks by writing to the sleep control register and waits for an alive interrupt. The firmware raises the alive interrupt when it has transitioned to the D3 state. The same flow occurs when the system resumes.

Command to test host initiated wakeup after 60 seconds sudo rtcwake -m mem -s 60

dmesg log (tested on Whale Peak2 on Panther Lake platform) On system suspend:

[  516.418316] Bluetooth: hci0: device entered into d3 state from d0

in 81 us

Quoted 7 lines
Quoted 3 lines

On system resume:

[  542.174128] Bluetooth: hci0: device entered into d0 state from d3

in 357 us

Just to avoid confusion, is the timestamp correct, as this is only a 26 s difference and your command says 60 s. (I am only aware of inaccurate timestamps using human-readable format (dmesg -T).)

The system was woken up by key press before the sleep timeout. To avoid the confusion, I will update the traces to reflect the system waking up independently.

Quoted 9 lines
Quoted 7 lines

Signed-off-by: Chandrashekar Devegowda
<[email protected]>

---
changes in v5:
- Address review comments

This should be more detailed, if code was changed.

Ack.

Quoted 42 lines
Quoted 3 lines

changes in v4:
- Moved document and section details from the commit message as

comment in code.

drivers/bluetooth/btintel_pcie.c static int btintel_pcie_reset_bt(struct

Quoted 21 lines

changes in v3:
- Corrected the typo's
- Updated the CC list as suggested.
- Corrected the format specifiers in the logs.

changes in v2:
- Updated the commit message with test steps and logs.
- Added logs to include the timeout message.
- Fixed a potential race condition during suspend and resume.

  drivers/bluetooth/btintel_pcie.c | 102 +++++++++++++++++++++++++++++++
  drivers/bluetooth/btintel_pcie.h |   4 ++
  2 files changed, 106 insertions(+)
drivers/bluetooth/btintel_pcie.c +0 -0
index 6e7bbbd35279..a96975a55cbe 100644
@@ -540,6 +540,12 @@ static int btintel_pcie_reset_bt(struct

btintel_pcie_data *data)

drivers/bluetooth/btintel_pcie.c static int btintel_pcie_reset_bt(struct btintel_pcie_data *data)

Quoted 6 lines
drivers/bluetooth/btintel_pcie.c +3 -0
  	return reg == 0 ? 0 : -ENODEV;
  }
 
+static void btintel_pcie_set_persistence_mode(struct
+btintel_pcie_data *data) {
+	btintel_pcie_set_reg_bits(data,

BTINTEL_PCIE_CSR_HW_BOOT_CONFIG,

drivers/bluetooth/btintel_pcie.c static int btintel_pcie_reset_bt(struct · line 546

Quoted 1 line
drivers/bluetooth/btintel_pcie.c +1 -0
+

BTINTEL_PCIE_CSR_HW_BOOT_CONFIG_KEEP_ON);

drivers/bluetooth/btintel_pcie.c static int btintel_pcie_enable_bt(struct

Quoted 6 lines
drivers/bluetooth/btintel_pcie.c +2 -0
+}
+
  static void btintel_pcie_mac_init(struct btintel_pcie_data *data)
  {
  	u32 reg;
@@ -829,6 +835,8 @@ static int btintel_pcie_enable_bt(struct

btintel_pcie_data *data)

Quoted 7 lines

drivers/bluetooth/btintel_pcie.c static int btintel_pcie_enable_bt(struct btintel_pcie_data *data) · line 839

Quoted 5 lines
drivers/bluetooth/btintel_pcie.c +2 -0
  	 */
  	data->boot_stage_cache = 0x0;
 
+	btintel_pcie_set_persistence_mode(data);
+

This hunk is not described in the commit message.

This register write is intended to retain firmware state across a warm reboot (S5) and is not relevant to this patch. Apologies for overlooking this detail.

Quoted 9 lines

drivers/bluetooth/btintel_pcie.c static int btintel_pcie_enable_bt(struct · line 841

Quoted 3 lines
drivers/bluetooth/btintel_pcie.c +0 -0
  	/* Set MAC_INIT bit to start primary bootloader */
  	reg = btintel_pcie_rd_reg32(data,

BTINTEL_PCIE_CSR_FUNC_CTRL_REG);

Quoted 5 lines
drivers/bluetooth/btintel_pcie.c +1 -0
  	reg &= ~(BTINTEL_PCIE_CSR_FUNC_CTRL_FUNC_INIT | @@ -2573,11
+2581,105 @@ static void btintel_pcie_coredump(struct device *dev)
  }
  #endif
Quoted 10 lines

drivers/bluetooth/btintel_pcie.c static void btintel_pcie_coredump(struct device *dev) · line 2591

Quoted 8 lines
drivers/bluetooth/btintel_pcie.c +8 -0
+#ifdef CONFIG_PM
+static int btintel_pcie_suspend_late(struct device *dev, pm_message_t
+mesg) {
+	struct pci_dev *pdev = to_pci_dev(dev);
+	struct btintel_pcie_data *data;
+	ktime_t start;
+	u32 dxstate;
+	s64 delta;

Append the unit to the name? delta_us?

Ack

Quoted 11 lines

drivers/bluetooth/btintel_pcie.c static void btintel_pcie_coredump(struct device *dev) · line 2599

Quoted 9 lines
drivers/bluetooth/btintel_pcie.c +8 -0
+	int err;
+
+	data = pci_get_drvdata(pdev);
+
+	if (mesg.event == PM_EVENT_SUSPEND)
+		dxstate = BTINTEL_PCIE_STATE_D3_HOT;
+	else
+		dxstate = BTINTEL_PCIE_STATE_D3_COLD;

I’d use the ternary operator.

Ack.

Quoted 11 lines

drivers/bluetooth/btintel_pcie.c static void btintel_pcie_coredump(struct device *dev) · line 2610

Quoted 10 lines
drivers/bluetooth/btintel_pcie.c +9 -0
+
+	data->gp0_received = false;
+
+	start = ktime_get();
+
+	/* Refer: 6.4.11.7 -> Platform power management */
+	btintel_pcie_wr_sleep_cntrl(data, dxstate);
+	err = wait_event_timeout(data->gp0_wait_q, data->gp0_received,
+

msecs_to_jiffies(BTINTEL_DEFAULT_INTR_TIMEOUT_MS));

Quoted 3 lines

drivers/bluetooth/btintel_pcie.c

Quoted 1 line
drivers/bluetooth/btintel_pcie.c +1 -0
+	delta = ktime_to_ns(ktime_get() - start) / 1000;

Move it below right before bt_dev_info?

Ack.

Quoted 103 lines

drivers/bluetooth/btintel_pcie.c static void btintel_pcie_coredump(struct device *dev)

Quoted 4 lines
drivers/bluetooth/btintel_pcie.c +3 -0
+
+	if (err == 0) {
+		bt_dev_err(data->hdev, "Timeout (%u ms) on alive interrupt

for D3 entry",

drivers/bluetooth/btintel_pcie.c static void btintel_pcie_coredump(struct device *dev)

Quoted 4 lines
drivers/bluetooth/btintel_pcie.c +4 -0
+				BTINTEL_DEFAULT_INTR_TIMEOUT_MS);
+		return -EBUSY;
+	}
+	bt_dev_info(data->hdev, "device entered into d3 state from d0 in %lld

us",

Quoted 19 lines
drivers/bluetooth/btintel_pcie.c +19 -0
+		    delta);
+	return 0;
+}
+
+static int btintel_pcie_suspend(struct device *dev) {
+	return btintel_pcie_suspend_late(dev, PMSG_SUSPEND); }
+
+static int btintel_pcie_hibernate(struct device *dev) {
+	return btintel_pcie_suspend_late(dev, PMSG_HIBERNATE); }
+
+static int btintel_pcie_freeze(struct device *dev) {
+	return btintel_pcie_suspend_late(dev, PMSG_FREEZE); }
+
+static int btintel_pcie_resume(struct device *dev) {
+	struct pci_dev *pdev = to_pci_dev(dev);
+	struct btintel_pcie_data *data;
+	ktime_t start;
+	int err;
+	s64 delta;

drivers/bluetooth/btintel_pcie.c static void btintel_pcie_coredump(struct device *dev) · line 2654

Quoted 10 lines
drivers/bluetooth/btintel_pcie.c +10 -0
+
+	data = pci_get_drvdata(pdev);
+	data->gp0_received = false;
+
+	start = ktime_get();
+
+	/* Refer: 6.4.11.7 -> Platform power management */
+	btintel_pcie_wr_sleep_cntrl(data, BTINTEL_PCIE_STATE_D0);
+	err = wait_event_timeout(data->gp0_wait_q, data->gp0_received,
+

msecs_to_jiffies(BTINTEL_DEFAULT_INTR_TIMEOUT_MS));

drivers/bluetooth/btintel_pcie.c static void btintel_pcie_coredump(struct device *dev)

Quoted 4 lines
drivers/bluetooth/btintel_pcie.c +4 -0
+	delta = ktime_to_ns(ktime_get() - start) / 1000;
+
+	if (err == 0) {
+		bt_dev_err(data->hdev, "Timeout (%u ms) on alive interrupt

for D0 entry",

drivers/bluetooth/btintel_pcie.c static void btintel_pcie_coredump(struct device *dev)

Quoted 4 lines
drivers/bluetooth/btintel_pcie.c +4 -0
+				BTINTEL_DEFAULT_INTR_TIMEOUT_MS);
+		return -EBUSY;
+	}
+	bt_dev_info(data->hdev, "device entered into d0 state from d3 in %lld

us",

Quoted 31 lines
drivers/bluetooth/btintel_pcie.c +17 -0
+		    delta);
+	return 0;
+}
+
+const struct dev_pm_ops btintel_pcie_pm_ops = {
+	.suspend = btintel_pcie_suspend,
+	.resume = btintel_pcie_resume,
+	.freeze = btintel_pcie_freeze,
+	.thaw = btintel_pcie_resume,
+	.poweroff = btintel_pcie_hibernate,
+	.restore = btintel_pcie_resume,
+};
+#define BTINTELPCIE_PM_OPS	(&btintel_pcie_pm_ops)
+#else
+#define BTINTELPCIE_PM_OPS	NULL
+#endif
  static struct pci_driver btintel_pcie_driver = {
  	.name = KBUILD_MODNAME,
  	.id_table = btintel_pcie_table,
  	.probe = btintel_pcie_probe,
  	.remove = btintel_pcie_remove,
+	.driver.pm = BTINTELPCIE_PM_OPS,
  #ifdef CONFIG_DEV_COREDUMP
  	.driver.coredump = btintel_pcie_coredump
  #endif
drivers/bluetooth/btintel_pcie.h +0 -0
index 0fa876c5b954..5bc69004b692 100644

drivers/bluetooth/btintel_pcie.h line 11

Quoted 4 lines
drivers/bluetooth/btintel_pcie.h +1 -0
@@ -8,6 +8,7 @@
 
  /* Control and Status Register(BTINTEL_PCIE_CSR) */
  #define BTINTEL_PCIE_CSR_BASE			(0x000)
+#define BTINTEL_PCIE_CSR_HW_BOOT_CONFIG
	(BTINTEL_PCIE_CSR_BASE + 0x000)

drivers/bluetooth/btintel_pcie.h line 12

Quoted 1 line
drivers/bluetooth/btintel_pcie.h +0 -0
  #define BTINTEL_PCIE_CSR_FUNC_CTRL_REG
	(BTINTEL_PCIE_CSR_BASE + 0x024)

drivers/bluetooth/btintel_pcie.h line 13

Quoted 1 line
drivers/bluetooth/btintel_pcie.h +0 -0
  #define BTINTEL_PCIE_CSR_HW_REV_REG
	(BTINTEL_PCIE_CSR_BASE + 0x028)

drivers/bluetooth/btintel_pcie.h line 14

Quoted 1 line
drivers/bluetooth/btintel_pcie.h +0 -0
  #define BTINTEL_PCIE_CSR_RF_ID_REG
	(BTINTEL_PCIE_CSR_BASE + 0x09C)

drivers/bluetooth/btintel_pcie.h line 60

Quoted 6 lines
drivers/bluetooth/btintel_pcie.h +2 -0
@@ -55,6 +56,9 @@
  #define BTINTEL_PCIE_CSR_BOOT_STAGE_ALIVE		(BIT(23))
  #define BTINTEL_PCIE_CSR_BOOT_STAGE_D3_STATE_READY	(BIT(24))
 
+/* CSR HW BOOT CONFIG Register */
+#define BTINTEL_PCIE_CSR_HW_BOOT_CONFIG_KEEP_ON
	(BIT(31))

drivers/bluetooth/btintel_pcie.h

Quoted 4 lines
drivers/bluetooth/btintel_pcie.h +1 -0
+
  /* Registers for MSI-X */
  #define BTINTEL_PCIE_CSR_MSIX_BASE		(0x2000)
  #define BTINTEL_PCIE_CSR_MSIX_FH_INT_CAUSES
Quoted 6 lines
	(BTINTEL_PCIE_CSR_MSIX_BASE + 0x0800)

Kind regards,

Paul

Thanks,
Kiran