Skip to content

Commit a3a1061

Browse files
Shubhrajyoti Dattagregkh
authored andcommitted
tty: serial: uartlite: Add support for suspend and resume
Add suspend and resume handlers for uartlite Signed-off-by: Shubhrajyoti Datta <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 14288be commit a3a1061

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

drivers/tty/serial/uartlite.c

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -690,9 +690,44 @@ static int ulite_release(struct device *dev)
690690
return rc;
691691
}
692692

693+
/**
694+
* ulite_suspend - Stop the device.
695+
*
696+
* @dev: handle to the device structure.
697+
* Return: 0 always.
698+
*/
699+
static int __maybe_unused ulite_suspend(struct device *dev)
700+
{
701+
struct uart_port *port = dev_get_drvdata(dev);
702+
703+
if (port)
704+
uart_suspend_port(&ulite_uart_driver, port);
705+
706+
return 0;
707+
}
708+
709+
/**
710+
* ulite_resume - Resume the device.
711+
*
712+
* @dev: handle to the device structure.
713+
* Return: 0 on success, errno otherwise.
714+
*/
715+
static int __maybe_unused ulite_resume(struct device *dev)
716+
{
717+
struct uart_port *port = dev_get_drvdata(dev);
718+
719+
if (port)
720+
uart_resume_port(&ulite_uart_driver, port);
721+
722+
return 0;
723+
}
724+
693725
/* ---------------------------------------------------------------------
694726
* Platform bus binding
695727
*/
728+
729+
static SIMPLE_DEV_PM_OPS(ulite_pm_ops, ulite_suspend, ulite_resume);
730+
696731
#if defined(CONFIG_OF)
697732
/* Match table for of_platform binding */
698733
static const struct of_device_id ulite_of_match[] = {
@@ -768,6 +803,7 @@ static struct platform_driver ulite_platform_driver = {
768803
.driver = {
769804
.name = "uartlite",
770805
.of_match_table = of_match_ptr(ulite_of_match),
806+
.pm = &ulite_pm_ops,
771807
},
772808
};
773809

0 commit comments

Comments
 (0)