From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-co1nam03on0079.outbound.protection.outlook.com ([104.47.40.79]:29874 "EHLO NAM03-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727307AbeGMKtR (ORCPT ); Fri, 13 Jul 2018 06:49:17 -0400 From: Subject: [PATCHv2 4/5] tty: serial: uartlite: Add support for suspend and resume Date: Fri, 13 Jul 2018 16:00:09 +0530 Message-ID: <1531477810-23346-4-git-send-email-shubhrajyoti.datta@gmail.com> In-Reply-To: <1531477810-23346-1-git-send-email-shubhrajyoti.datta@gmail.com> References: <1531477810-23346-1-git-send-email-shubhrajyoti.datta@gmail.com> MIME-Version: 1.0 Content-Type: text/plain Sender: devicetree-owner@vger.kernel.org To: linux-serial@vger.kernel.org, devicetree@vger.kernel.org Cc: gregkh@linuxfoundation.org, robh+dt@kernel.org, jacmet@sunsite.dk, Shubhrajyoti Datta List-ID: From: Shubhrajyoti Datta Add suspend and resume handlers for uartlite Signed-off-by: Shubhrajyoti Datta --- drivers/tty/serial/uartlite.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/drivers/tty/serial/uartlite.c b/drivers/tty/serial/uartlite.c index b3a12be..98d3ead 100644 --- a/drivers/tty/serial/uartlite.c +++ b/drivers/tty/serial/uartlite.c @@ -690,9 +690,44 @@ static int ulite_release(struct device *dev) return rc; } +/** + * ulite_suspend - Stop the device. + * + * @dev: handle to the device structure. + * Return: 0 always. + */ +static int __maybe_unused ulite_suspend(struct device *dev) +{ + struct uart_port *port = dev_get_drvdata(dev); + + if (port) + uart_suspend_port(&ulite_uart_driver, port); + + return 0; +} + +/** + * ulite_resume - Resume the device. + * + * @dev: handle to the device structure. + * Return: 0 on success, errno otherwise. + */ +static int __maybe_unused ulite_resume(struct device *dev) +{ + struct uart_port *port = dev_get_drvdata(dev); + + if (port) + uart_resume_port(&ulite_uart_driver, port); + + return 0; +} + /* --------------------------------------------------------------------- * Platform bus binding */ + +static SIMPLE_DEV_PM_OPS(ulite_pm_ops, ulite_suspend, ulite_resume); + #if defined(CONFIG_OF) /* Match table for of_platform binding */ static const struct of_device_id ulite_of_match[] = { @@ -768,6 +803,7 @@ static struct platform_driver ulite_platform_driver = { .driver = { .name = "uartlite", .of_match_table = of_match_ptr(ulite_of_match), + .pm = &ulite_pm_ops, }, }; -- 2.7.4