mirror of
git://git.yoctoproject.org/linux-yocto.git
synced 2025-07-06 13:55:22 +02:00
tty: serial: qcom-geni-serial: Add support for Hibernation feature
Added changes to support the hibernation feature for serial UART. Added support for freeze, restore and thaw callbacks to put the device into hibernation. Signed-off-by: Aniket Randive <quic_arandive@quicinc.com> Link: https://lore.kernel.org/r/1665123780-20557-1-git-send-email-quic_arandive@quicinc.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
d11cc8c3c4
commit
35781d8356
|
@ -924,6 +924,7 @@ static int qcom_geni_serial_port_setup(struct uart_port *uport)
|
||||||
false, true, true);
|
false, true, true);
|
||||||
geni_se_init(&port->se, UART_RX_WM, port->rx_fifo_depth - 2);
|
geni_se_init(&port->se, UART_RX_WM, port->rx_fifo_depth - 2);
|
||||||
geni_se_select_mode(&port->se, GENI_SE_FIFO);
|
geni_se_select_mode(&port->se, GENI_SE_FIFO);
|
||||||
|
qcom_geni_serial_start_rx(uport);
|
||||||
port->setup = true;
|
port->setup = true;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1547,9 +1548,43 @@ static int __maybe_unused qcom_geni_serial_sys_resume(struct device *dev)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int qcom_geni_serial_sys_hib_resume(struct device *dev)
|
||||||
|
{
|
||||||
|
int ret = 0;
|
||||||
|
struct uart_port *uport;
|
||||||
|
struct qcom_geni_private_data *private_data;
|
||||||
|
struct qcom_geni_serial_port *port = dev_get_drvdata(dev);
|
||||||
|
|
||||||
|
uport = &port->uport;
|
||||||
|
private_data = uport->private_data;
|
||||||
|
|
||||||
|
if (uart_console(uport)) {
|
||||||
|
geni_icc_set_tag(&port->se, 0x7);
|
||||||
|
geni_icc_set_bw(&port->se);
|
||||||
|
ret = uart_resume_port(private_data->drv, uport);
|
||||||
|
/*
|
||||||
|
* For hibernation usecase clients for
|
||||||
|
* console UART won't call port setup during restore,
|
||||||
|
* hence call port setup for console uart.
|
||||||
|
*/
|
||||||
|
qcom_geni_serial_port_setup(uport);
|
||||||
|
} else {
|
||||||
|
/*
|
||||||
|
* Peripheral register settings are lost during hibernation.
|
||||||
|
* Update setup flag such that port setup happens again
|
||||||
|
* during next session. Clients of HS-UART will close and
|
||||||
|
* open the port during hibernation.
|
||||||
|
*/
|
||||||
|
port->setup = false;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
static const struct dev_pm_ops qcom_geni_serial_pm_ops = {
|
static const struct dev_pm_ops qcom_geni_serial_pm_ops = {
|
||||||
SET_SYSTEM_SLEEP_PM_OPS(qcom_geni_serial_sys_suspend,
|
SET_SYSTEM_SLEEP_PM_OPS(qcom_geni_serial_sys_suspend,
|
||||||
qcom_geni_serial_sys_resume)
|
qcom_geni_serial_sys_resume)
|
||||||
|
.restore = qcom_geni_serial_sys_hib_resume,
|
||||||
|
.thaw = qcom_geni_serial_sys_hib_resume,
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct of_device_id qcom_geni_serial_match_table[] = {
|
static const struct of_device_id qcom_geni_serial_match_table[] = {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user