Thread (21 messages) 21 messages, 4 authors, 2023-08-09

Re: [PATCH V6 4/4] firmware: ti_sci: Introduce system suspend resume support

From: Andrew Davis <hidden>
Date: 2023-08-03 16:01:06
Also in: linux-pm, lkml

On 8/3/23 10:55 AM, Dhruva Gole wrote:
On Aug 03, 2023 at 10:26:32 -0500, Andrew Davis wrote:
quoted
On 8/3/23 1:42 AM, Dhruva Gole wrote:
quoted
Introduce system suspend resume calls that will allow the ti_sci
driver to support deep sleep low power mode when the user space issues a
suspend to mem.

Also, write a ti_sci_prepare_system_suspend call to be used in the driver
suspend handler to allow the system to identify the low power mode being
entered and if necessary, send TISCI_MSG_PREPARE_SLEEP with information
about the mode is being entered and the address for allocated memory for
storing the context during Deep Sleep.

We're using "pm_suspend_target_state" to map the kernel's target suspend
state to SysFW low power mode. Make sure this is available only when
CONFIG_SUSPEND is enabled.

Co-developed-by: Dave Gerlach <redacted>
Signed-off-by: Dave Gerlach <redacted>
Signed-off-by: Vibhore Vardhan <redacted>
Signed-off-by: Georgi Vlaev <redacted>
Signed-off-by: Dhruva Gole <redacted>
---
   drivers/firmware/ti_sci.c | 63 +++++++++++++++++++++++++++++++++++++++
   1 file changed, 63 insertions(+)
[..snip..]
quoted
quoted
+static int ti_sci_suspend(struct device *dev)
+{
+	struct ti_sci_info *info = dev_get_drvdata(dev);
+	int ret;
+
+	ret = ti_sci_cmd_set_io_isolation(&info->handle, TISCI_MSG_VALUE_IO_ENABLE);
After this the will the IOs be in isolation? Or does the firmware wait
until power down begins later?
 From what I understand,
IOs will be in isolation immediately
That is what I understand too, so then any device that may need to do some
external communication for its suspend will not function, this must be the
last driver _suspend() the system calls, how do you enforce that?

Andrew
quoted
Andrew
quoted
+	if (ret)
+		return ret;
+	dev_dbg(dev, "%s: set I/O isolation: %d\n", __func__, ret);
+
+	ret = ti_sci_prepare_system_suspend(info);
+	if (ret)
+		return ret;
+
+	return 0;
+}
+
+static int ti_sci_resume(struct device *dev)
+{
+	struct ti_sci_info *info = dev_get_drvdata(dev);
+	int ret;
+
+	ret = ti_sci_cmd_set_io_isolation(&info->handle, TISCI_MSG_VALUE_IO_DISABLE);
+	if (ret)
+		return ret;
+	dev_dbg(dev, "%s: disable I/O isolation: %d\n", __func__, ret);
+
+	return 0;
+}
+
+static DEFINE_SIMPLE_DEV_PM_OPS(ti_sci_pm_ops, ti_sci_suspend, ti_sci_resume);
+
   static int ti_sci_init_suspend(struct platform_device *pdev,
   			       struct ti_sci_info *info)
   {
@@ -3759,6 +3821,7 @@ static struct platform_driver ti_sci_driver = {
   	.driver = {
   		   .name = "ti-sci",
   		   .of_match_table = of_match_ptr(ti_sci_of_match),
+		   .pm = &ti_sci_pm_ops,
   	},
   };
   module_platform_driver(ti_sci_driver);
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help