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

Commit 8c1200ed authored by Rama Krishna Phani A's avatar Rama Krishna Phani A
Browse files

serial: msm_geni_serial: Add support for s2d feature



Add changes to support hibernation feature for the
serial UART driver.

Change-Id: I0dc19826e2fa1e90177ac7f5edd25e6967ddc465
Signed-off-by: default avatarRama Krishna Phani A <rphani@codeaurora.org>
parent 2c002bab
Loading
Loading
Loading
Loading
+29 −0
Original line number Diff line number Diff line
@@ -2687,6 +2687,28 @@ static int msm_geni_serial_sys_resume_noirq(struct device *dev)
	}
	return 0;
}

static int msm_geni_serial_sys_hib_resume_noirq(struct device *dev)
{
	struct platform_device *pdev = to_platform_device(dev);
	struct msm_geni_serial_port *port = platform_get_drvdata(pdev);
	struct uart_port *uport = &port->uport;
	unsigned long cfg0, cfg1;

	if (uart_console(uport) &&
	    console_suspend_enabled && uport->suspended) {
		uart_resume_port((struct uart_driver *)uport->private_data,
									uport);
		dev_dbg(dev, "%s\n", __func__);
		se_get_packing_config(8, 1, false, &cfg0, &cfg1);
		geni_write_reg_nolog(cfg0, uport->membase,
					SE_GENI_TX_PACKING_CFG0);
		geni_write_reg_nolog(cfg1, uport->membase,
					SE_GENI_TX_PACKING_CFG1);
		disable_irq(uport->irq);
	}
	return 0;
}
#else
static int msm_geni_serial_runtime_suspend(struct device *dev)
{
@@ -2707,6 +2729,11 @@ static int msm_geni_serial_sys_resume_noirq(struct device *dev)
{
	return 0;
}

static int msm_geni_serial_sys_hib_resume_noirq(struct device *dev)
{
	return 0;
}
#endif

static const struct dev_pm_ops msm_geni_serial_pm_ops = {
@@ -2714,6 +2741,8 @@ static const struct dev_pm_ops msm_geni_serial_pm_ops = {
	.runtime_resume = msm_geni_serial_runtime_resume,
	.suspend_noirq = msm_geni_serial_sys_suspend_noirq,
	.resume_noirq = msm_geni_serial_sys_resume_noirq,
	.freeze = msm_geni_serial_sys_suspend_noirq,
	.restore = msm_geni_serial_sys_hib_resume_noirq,
};

static struct platform_driver msm_geni_serial_platform_driver = {