Skip to content

Commit 658c56d

Browse files
NeerajSanjayKaleVudentz
authored andcommitted
Bluetooth: btnxpuart: Add system suspend and resume handlers
This adds handling for system suspend and resume. While the host enters suspend state, the driver will drive the chip into low power state. Similarly when system is resuming, the driver will wake up the chip. Signed-off-by: Neeraj Sanjay Kale <[email protected]> Signed-off-by: Luiz Augusto von Dentz <[email protected]>
1 parent d4f6acf commit 658c56d

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

drivers/bluetooth/btnxpuart.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1522,6 +1522,24 @@ static void nxp_serdev_remove(struct serdev_device *serdev)
15221522
hci_free_dev(hdev);
15231523
}
15241524

1525+
static int nxp_serdev_suspend(struct device *dev)
1526+
{
1527+
struct btnxpuart_dev *nxpdev = dev_get_drvdata(dev);
1528+
struct ps_data *psdata = &nxpdev->psdata;
1529+
1530+
ps_control(psdata->hdev, PS_STATE_SLEEP);
1531+
return 0;
1532+
}
1533+
1534+
static int nxp_serdev_resume(struct device *dev)
1535+
{
1536+
struct btnxpuart_dev *nxpdev = dev_get_drvdata(dev);
1537+
struct ps_data *psdata = &nxpdev->psdata;
1538+
1539+
ps_control(psdata->hdev, PS_STATE_AWAKE);
1540+
return 0;
1541+
}
1542+
15251543
static struct btnxpuart_data w8987_data __maybe_unused = {
15261544
.helper_fw_name = NULL,
15271545
.fw_name = FIRMWARE_W8987,
@@ -1541,12 +1559,17 @@ static const struct of_device_id nxpuart_of_match_table[] __maybe_unused = {
15411559
};
15421560
MODULE_DEVICE_TABLE(of, nxpuart_of_match_table);
15431561

1562+
static const struct dev_pm_ops nxp_pm_ops = {
1563+
SET_SYSTEM_SLEEP_PM_OPS(nxp_serdev_suspend, nxp_serdev_resume)
1564+
};
1565+
15441566
static struct serdev_device_driver nxp_serdev_driver = {
15451567
.probe = nxp_serdev_probe,
15461568
.remove = nxp_serdev_remove,
15471569
.driver = {
15481570
.name = "btnxpuart",
15491571
.of_match_table = of_match_ptr(nxpuart_of_match_table),
1572+
.pm = &nxp_pm_ops,
15501573
},
15511574
};
15521575

0 commit comments

Comments
 (0)