From: <shubhrajyoti.datta@gmail.com>
To: linux-serial@vger.kernel.org
Cc: devicetree@vger.kernel.org, shubhrajyoti.datta@gmail.com,
robh+dt@kernel.org,
Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
Subject: [PATCHv5 3/4] tty: serial: uartlite: Add support for suspend and resume
Date: Sat, 21 Jul 2018 17:19:06 +0530 [thread overview]
Message-ID: <1532173747-19115-4-git-send-email-shubhrajyoti.datta@gmail.com> (raw)
In-Reply-To: <1532173747-19115-1-git-send-email-shubhrajyoti.datta@gmail.com>
From: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
Add suspend and resume handlers for uartlite
Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
---
v2:
patch added
v3- v5:
No change
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
next prev parent reply other threads:[~2018-07-21 12:42 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-21 11:49 [PATCHv5 0/4] tty: serial: uartlite: Driver updates shubhrajyoti.datta
2018-07-21 11:49 ` [PATCHv5 1/4] tty: serial: uartlite: Add structure for private data shubhrajyoti.datta
2018-07-21 11:49 ` [PATCHv5 2/4] tty: serial: uartlite: Add clock adaptation shubhrajyoti.datta
2018-07-21 11:49 ` shubhrajyoti.datta [this message]
2018-07-21 11:49 ` [PATCHv5 4/4] dt-bindings: serial: Add binding for uartlite shubhrajyoti.datta
2018-07-24 23:23 ` Rob Herring
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1532173747-19115-4-git-send-email-shubhrajyoti.datta@gmail.com \
--to=shubhrajyoti.datta@gmail.com \
--cc=devicetree@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=robh+dt@kernel.org \
--cc=shubhrajyoti.datta@xilinx.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox