]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
firmware: ti_sci: Add support for restoring clock context during resume
authorThomas Richard (TI) <thomas.richard@bootlin.com>
Tue, 19 May 2026 15:06:59 +0000 (17:06 +0200)
committerNishanth Menon <nm@ti.com>
Tue, 26 May 2026 11:44:42 +0000 (06:44 -0500)
Some DM-Firmware are not able to restore the clock rates and the
clock parents after a suspend-resume. The CLK_CONTEXT_LOST firmware
capability has been introduced to identify this characteristic.
In this case the responsibility is therefore delegated to the
ti_sci driver, which uses clk_restore_context() to trigger the
context_restore() operation for all registered clocks, including
those managed by the sci-clk. The sci-clk driver implements the
context_restore() operation to ensure rates and clock parents are
correctly restored.

Reviewed-by: Dhruva Gole <d-gole@ti.com>
Reviewed-by: Kendall Willis <k-willis@ti.com>
Signed-off-by: Thomas Richard (TI) <thomas.richard@bootlin.com>
Link: https://patch.msgid.link/20260519-ti-sci-jacinto-s2r-restore-irq-v9-4-c550a8ae0f31@bootlin.com
Signed-off-by: Nishanth Menon <nm@ti.com>
drivers/firmware/ti_sci.c
drivers/firmware/ti_sci.h

index f6bffeae30f54e6e9594e6f4fac6e2e0945ca865..590a464403c50d162369e610d9f16068e682bdf0 100644 (file)
@@ -9,6 +9,7 @@
 #define pr_fmt(fmt) "%s: " fmt, __func__
 
 #include <linux/bitmap.h>
+#include <linux/clk.h>
 #include <linux/cpu.h>
 #include <linux/debugfs.h>
 #include <linux/export.h>
@@ -4010,6 +4011,9 @@ static int ti_sci_resume_noirq(struct device *dev)
                                }
                        }
                }
+
+               if (info->fw_caps & MSG_FLAG_CAPS_LPM_CLK_CONTEXT_LOST)
+                       clk_restore_context();
                break;
        default:
                break;
@@ -4170,14 +4174,15 @@ static int ti_sci_probe(struct platform_device *pdev)
        }
 
        ti_sci_msg_cmd_query_fw_caps(&info->handle, &info->fw_caps);
-       dev_dbg(dev, "Detected firmware capabilities: %s%s%s%s%s%s%s\n",
+       dev_dbg(dev, "Detected firmware capabilities: %s%s%s%s%s%s%s%s\n",
                info->fw_caps & MSG_FLAG_CAPS_GENERIC ? "Generic" : "",
                info->fw_caps & MSG_FLAG_CAPS_LPM_PARTIAL_IO ? " Partial-IO" : "",
                info->fw_caps & MSG_FLAG_CAPS_LPM_DM_MANAGED ? " DM-Managed" : "",
                info->fw_caps & MSG_FLAG_CAPS_LPM_ABORT ? " LPM-Abort" : "",
                info->fw_caps & MSG_FLAG_CAPS_IO_ISOLATION ? " IO-Isolation" : "",
                info->fw_caps & MSG_FLAG_CAPS_LPM_BOARDCFG_MANAGED ? " BoardConfig-Managed" : "",
-               info->fw_caps & MSG_FLAG_CAPS_LPM_IRQ_CONTEXT_LOST ? " IRQ-Context-Lost" : ""
+               info->fw_caps & MSG_FLAG_CAPS_LPM_IRQ_CONTEXT_LOST ? " IRQ-Context-Lost" : "",
+               info->fw_caps & MSG_FLAG_CAPS_LPM_CLK_CONTEXT_LOST ? " Clk-Context-Lost" : ""
        );
 
        ti_sci_setup_ops(info);
index ad69c765d6146159db9a0eaa1280a440283270b8..8fccbcd1c9a2c85709fa4d3f63fe403103dd9072 100644 (file)
@@ -154,6 +154,8 @@ struct ti_sci_msg_req_reboot {
  *                     for the DM via boardcfg
  *             MSG_FLAG_CAPS_LPM_IRQ_CONTEXT_LOST: DM is not able to restore IRQ
  *                     context
+ *             MSG_FLAG_CAPS_LPM_CLK_CONTEXT_LOST: DM is not able to restore
+ *                     Clock context
  *
  * Response to a generic message with message type TI_SCI_MSG_QUERY_FW_CAPS
  * providing currently available SOC/firmware capabilities. SoC that don't
@@ -168,6 +170,7 @@ struct ti_sci_msg_resp_query_fw_caps {
 #define MSG_FLAG_CAPS_IO_ISOLATION     TI_SCI_MSG_FLAG(7)
 #define MSG_FLAG_CAPS_LPM_BOARDCFG_MANAGED     TI_SCI_MSG_FLAG(12)
 #define MSG_FLAG_CAPS_LPM_IRQ_CONTEXT_LOST     TI_SCI_MSG_FLAG(14)
+#define MSG_FLAG_CAPS_LPM_CLK_CONTEXT_LOST     TI_SCI_MSG_FLAG(15)
 #define MSG_MASK_CAPS_LPM              GENMASK_ULL(4, 1)
        u64 fw_caps;
 } __packed;