diff mbox

tty: serial: msm_serial: Add support for suspend/resume

Message ID 20180411115045.15864-1-pascal.huerst@gmail.com (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Pascal Huerst April 11, 2018, 11:50 a.m. UTC
Without this, tx stops working after resume. By adding
these calls, everything seems to work fine.

Signed-off-by: Pascal Huerst <pascal.huerst@gmail.com>
---
 drivers/tty/serial/msm_serial.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

Comments

Bjorn Andersson April 25, 2018, 6:41 a.m. UTC | #1
On Wed 11 Apr 04:50 PDT 2018, Pascal Huerst wrote:

> Without this, tx stops working after resume. By adding
> these calls, everything seems to work fine.
> 
> Signed-off-by: Pascal Huerst <pascal.huerst@gmail.com>
> ---
>  drivers/tty/serial/msm_serial.c | 25 +++++++++++++++++++++++++
>  1 file changed, 25 insertions(+)
> 
> diff --git a/drivers/tty/serial/msm_serial.c b/drivers/tty/serial/msm_serial.c
> index ee96cf0d0057..33cd6e59ea69 100644
> --- a/drivers/tty/serial/msm_serial.c
> +++ b/drivers/tty/serial/msm_serial.c
> @@ -1812,11 +1812,36 @@ static const struct of_device_id msm_match_table[] = {
>  };
>  MODULE_DEVICE_TABLE(of, msm_match_table);
>  
> +#ifdef CONFIG_PM_SLEEP

Rather than wrapping these two functions in a check for CONFIG_PM_SLEEP
use __maybe_unused, as in:

static int __maybe_unused msm_serial_suspend(struct device *dev)

Regards,
Bjorn

> +static int msm_serial_suspend(struct device *dev)
> +{
> +	struct msm_port *port = dev_get_drvdata(dev);
> +
> +	uart_suspend_port(&msm_uart_driver, &port->uart);
> +
> +	return 0;
> +}
> +
> +static int msm_serial_resume(struct device *dev)
> +{
> +	struct msm_port *port = dev_get_drvdata(dev);
> +
> +	uart_resume_port(&msm_uart_driver, &port->uart);
> +
> +	return 0;
> +}
> +#endif /* CONFIG_PM_SLEEP */
> +
> +static const struct dev_pm_ops msm_serial_dev_pm_ops = {
> +	SET_SYSTEM_SLEEP_PM_OPS(msm_serial_suspend, msm_serial_resume)
> +};
> +
>  static struct platform_driver msm_platform_driver = {
>  	.remove = msm_serial_remove,
>  	.probe = msm_serial_probe,
>  	.driver = {
>  		.name = "msm_serial",
> +		.pm = &msm_serial_dev_pm_ops,
>  		.of_match_table = msm_match_table,
>  	},
>  };
> -- 
> 2.14.3
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/tty/serial/msm_serial.c b/drivers/tty/serial/msm_serial.c
index ee96cf0d0057..33cd6e59ea69 100644
--- a/drivers/tty/serial/msm_serial.c
+++ b/drivers/tty/serial/msm_serial.c
@@ -1812,11 +1812,36 @@  static const struct of_device_id msm_match_table[] = {
 };
 MODULE_DEVICE_TABLE(of, msm_match_table);
 
+#ifdef CONFIG_PM_SLEEP
+static int msm_serial_suspend(struct device *dev)
+{
+	struct msm_port *port = dev_get_drvdata(dev);
+
+	uart_suspend_port(&msm_uart_driver, &port->uart);
+
+	return 0;
+}
+
+static int msm_serial_resume(struct device *dev)
+{
+	struct msm_port *port = dev_get_drvdata(dev);
+
+	uart_resume_port(&msm_uart_driver, &port->uart);
+
+	return 0;
+}
+#endif /* CONFIG_PM_SLEEP */
+
+static const struct dev_pm_ops msm_serial_dev_pm_ops = {
+	SET_SYSTEM_SLEEP_PM_OPS(msm_serial_suspend, msm_serial_resume)
+};
+
 static struct platform_driver msm_platform_driver = {
 	.remove = msm_serial_remove,
 	.probe = msm_serial_probe,
 	.driver = {
 		.name = "msm_serial",
+		.pm = &msm_serial_dev_pm_ops,
 		.of_match_table = msm_match_table,
 	},
 };