Thread (41 messages) 41 messages, 5 authors, 2019-11-08

Re: [PATCH v9 11/22] clk: tegra: clk-dfll: Add suspend and resume support

From: Stephen Boyd <sboyd@kernel.org>
Date: 2019-11-08 21:20:17
Also in: linux-clk, linux-gpio, linux-pm, linux-tegra, lkml

Quoting Sowjanya Komatineni (2019-08-16 12:41:56)
quoted hunk ↗ jump to hunk
diff --git a/drivers/clk/tegra/clk-dfll.c b/drivers/clk/tegra/clk-dfll.c
index f8688c2ddf1a..c051d92c2bbf 100644
--- a/drivers/clk/tegra/clk-dfll.c
+++ b/drivers/clk/tegra/clk-dfll.c
@@ -1487,6 +1487,7 @@ static int dfll_init(struct tegra_dfll *td)
        td->last_unrounded_rate = 0;
 
        pm_runtime_enable(td->dev);
+       pm_runtime_irq_safe(td->dev);
Why irq_safe? It would be good to mention it in the commit text or
something.
quoted hunk ↗ jump to hunk
        pm_runtime_get_sync(td->dev);
 
        dfll_set_mode(td, DFLL_DISABLED);
@@ -1513,6 +1514,61 @@ static int dfll_init(struct tegra_dfll *td)
        return ret;
 }
 
+/**
+ * tegra_dfll_suspend - check DFLL is disabled
+ * @dev: DFLL device *
+ *
+ * DFLL clock should be disabled by the CPUFreq driver. So, make
+ * sure it is disabled and disable all clocks needed by the DFLL.
+ */
+int tegra_dfll_suspend(struct device *dev)
+{
+       struct tegra_dfll *td = dev_get_drvdata(dev);
+
+       if (dfll_is_running(td)) {
+               dev_err(td->dev, "DFLL still enabled while suspending\n");
+               return -EBUSY;
+       }
+
+       reset_control_assert(td->dvco_rst);
+
+       return 0;
+}
+EXPORT_SYMBOL(tegra_dfll_suspend);
+
+/**
+ * tegra_dfll_resume - reinitialize DFLL on resume
+ * @dev: DFLL instance
I prefer this description for tegra_dfll_suspend's 'dev' argument.
+ *
+ * DFLL is disabled and reset during suspend and resume.
+ * So, reinitialize the DFLL IP block back for use.
+ * DFLL clock is enabled later in closed loop mode by CPUFreq
+ * driver before switching its clock source to DFLL output.
+ */
+int tegra_dfll_resume(struct device *dev)
+{
+       struct tegra_dfll *td = dev_get_drvdata(dev);
+
+       reset_control_deassert(td->dvco_rst);
+
+       pm_runtime_get_sync(td->dev);
+
+       dfll_set_mode(td, DFLL_DISABLED);
+       dfll_set_default_params(td);
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help