[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID:
<DU2PR04MB8567002942DE30A3FD1D645EEDDF2@DU2PR04MB8567.eurprd04.prod.outlook.com>
Date: Fri, 5 Jul 2024 06:36:43 +0000
From: Luke Wang <ziniu.wang_1@....com>
To: Neeraj Sanjay Kale <neeraj.sanjaykale@....com>, "marcel@...tmann.org"
<marcel@...tmann.org>, "luiz.dentz@...il.com" <luiz.dentz@...il.com>
CC: "linux-bluetooth@...r.kernel.org" <linux-bluetooth@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>, Amitkumar
Karwar <amitkumar.karwar@....com>, Rohit Fule <rohit.fule@....com>, Neeraj
Sanjay Kale <neeraj.sanjaykale@....com>, Sherry Sun <sherry.sun@....com>,
Bough Chen <haibo.chen@....com>, LnxRevLi <LnxRevLi@....com>
Subject: RE: [PATCH v1] Bluetooth: btnxpuart: Add system suspend and resume
handlers
Hi Neeraj
> -----Original Message-----
> From: Neeraj Sanjay Kale <neeraj.sanjaykale@....com>
> Sent: Thursday, July 4, 2024 8:58 PM
> To: marcel@...tmann.org; luiz.dentz@...il.com
> Cc: linux-bluetooth@...r.kernel.org; linux-kernel@...r.kernel.org;
> Amitkumar Karwar <amitkumar.karwar@....com>; Rohit Fule
> <rohit.fule@....com>; Neeraj Sanjay Kale <neeraj.sanjaykale@....com>;
> Sherry Sun <sherry.sun@....com>; Luke Wang <ziniu.wang_1@....com>;
> Bough Chen <haibo.chen@....com>; LnxRevLi <LnxRevLi@....com>
> Subject: [PATCH v1] 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@....com>
> ---
> drivers/bluetooth/btnxpuart.c | 23 +++++++++++++++++++++++
> 1 file changed, 23 insertions(+)
>
> diff --git a/drivers/bluetooth/btnxpuart.c b/drivers/bluetooth/btnxpuart.c
> index da18fd4f54f3..acd360fcc3b8 100644
> --- a/drivers/bluetooth/btnxpuart.c
> +++ b/drivers/bluetooth/btnxpuart.c
> @@ -1498,6 +1498,24 @@ static void nxp_serdev_remove(struct
> serdev_device *serdev)
> hci_free_dev(hdev);
> }
>
> +static int nxp_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_resume(struct device *dev)
> +{
> + struct btnxpuart_dev *nxpdev = dev_get_drvdata(dev);
> + struct ps_data *psdata = &nxpdev->psdata;
> +
> + ps_control(data->hdev, PS_STATE_AWAKE);
> + return 0;
> +}
> +
Is it better to use btnxpuart_suspend/resume or nxp_serdev_suspend/resume?
> static struct btnxpuart_data w8987_data __maybe_unused = {
> .helper_fw_name = NULL,
> .fw_name = FIRMWARE_W8987,
> @@ -1517,12 +1535,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_suspend, nxp_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,
> },
> };
>
> --
> 2.34.1
Powered by blists - more mailing lists