diff options
author | Neeraj Sanjay Kale <neeraj.sanjaykale@nxp.com> | 2024-07-05 12:28:26 +0530 |
---|---|---|
committer | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2024-07-15 10:12:04 -0400 |
commit | 658c56d5b3b3a41e52ea4236f5dd023cbb139ece (patch) | |
tree | 59cb18496e5690c41fbdfb0d24f4a811b2cba546 /drivers/bluetooth/btnxpuart.c | |
parent | d4f6acfcb0b0962e2a59165108e212a976d1f078 (diff) | |
download | lwn-658c56d5b3b3a41e52ea4236f5dd023cbb139ece.tar.gz lwn-658c56d5b3b3a41e52ea4236f5dd023cbb139ece.zip |
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 <neeraj.sanjaykale@nxp.com>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Diffstat (limited to 'drivers/bluetooth/btnxpuart.c')
-rw-r--r-- | drivers/bluetooth/btnxpuart.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/drivers/bluetooth/btnxpuart.c b/drivers/bluetooth/btnxpuart.c index e9c2f2f7acc6..f75b24bd3045 100644 --- a/drivers/bluetooth/btnxpuart.c +++ b/drivers/bluetooth/btnxpuart.c @@ -1522,6 +1522,24 @@ static void nxp_serdev_remove(struct serdev_device *serdev) hci_free_dev(hdev); } +static int nxp_serdev_suspend(struct device *dev) +{ + struct btnxpuart_dev *nxpdev = dev_get_drvdata(dev); + struct ps_data *psdata = &nxpdev->psdata; + + ps_control(psdata->hdev, PS_STATE_SLEEP); + return 0; +} + +static int nxp_serdev_resume(struct device *dev) +{ + struct btnxpuart_dev *nxpdev = dev_get_drvdata(dev); + struct ps_data *psdata = &nxpdev->psdata; + + ps_control(psdata->hdev, PS_STATE_AWAKE); + return 0; +} + static struct btnxpuart_data w8987_data __maybe_unused = { .helper_fw_name = NULL, .fw_name = FIRMWARE_W8987, @@ -1541,12 +1559,17 @@ static const struct of_device_id nxpuart_of_match_table[] __maybe_unused = { }; MODULE_DEVICE_TABLE(of, nxpuart_of_match_table); +static const struct dev_pm_ops nxp_pm_ops = { + SET_SYSTEM_SLEEP_PM_OPS(nxp_serdev_suspend, nxp_serdev_resume) +}; + static struct serdev_device_driver nxp_serdev_driver = { .probe = nxp_serdev_probe, .remove = nxp_serdev_remove, .driver = { .name = "btnxpuart", .of_match_table = of_match_ptr(nxpuart_of_match_table), + .pm = &nxp_pm_ops, }, }; |