Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2dea53bf authored by Jingchang Lu's avatar Jingchang Lu Committed by Greg Kroah-Hartman
Browse files

serial: of-serial: add PM suspend/resume support



This adds PM suspend/resume support for the of-serial driver
to provide power management support on devices attatched to it.

Signed-off-by: default avatarJingchang Lu <jingchang.lu@freescale.com>
Acked-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 2c8faf3d
Loading
Loading
Loading
Loading
+27 −0
Original line number Original line Diff line number Diff line
@@ -240,6 +240,32 @@ static int of_platform_serial_remove(struct platform_device *ofdev)
	return 0;
	return 0;
}
}


#ifdef CONFIG_PM_SLEEP
static int of_serial_suspend(struct device *dev)
{
	struct of_serial_info *info = dev_get_drvdata(dev);

	serial8250_suspend_port(info->line);
	if (info->clk)
		clk_disable_unprepare(info->clk);

	return 0;
}

static int of_serial_resume(struct device *dev)
{
	struct of_serial_info *info = dev_get_drvdata(dev);

	if (info->clk)
		clk_prepare_enable(info->clk);

	serial8250_resume_port(info->line);

	return 0;
}
#endif
static SIMPLE_DEV_PM_OPS(of_serial_pm_ops, of_serial_suspend, of_serial_resume);

/*
/*
 * A few common types, add more as needed.
 * A few common types, add more as needed.
 */
 */
@@ -271,6 +297,7 @@ static struct platform_driver of_platform_serial_driver = {
		.name = "of_serial",
		.name = "of_serial",
		.owner = THIS_MODULE,
		.owner = THIS_MODULE,
		.of_match_table = of_platform_serial_table,
		.of_match_table = of_platform_serial_table,
		.pm = &of_serial_pm_ops,
	},
	},
	.probe = of_platform_serial_probe,
	.probe = of_platform_serial_probe,
	.remove = of_platform_serial_remove,
	.remove = of_platform_serial_remove,