diff mbox series

[v7,24/37] soc/tegra: fuse: Enable fuse clock on suspend

Message ID 20210701232728.23591-25-digetx@gmail.com
State New
Headers show
Series NVIDIA Tegra power management patches for 5.15 | expand

Commit Message

Dmitry Osipenko July 1, 2021, 11:27 p.m. UTC
The FUSE clock should be enabled during suspend on Tegra124. Currently
clk driver enables it on all SoCs, but FUSE may require a higher core
voltage on Tegra30 while enabled. Move the quirk into the FUSE driver
and make it specific to Tegra124.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
---
 drivers/soc/tegra/fuse/fuse-tegra.c   | 31 +++++++++++++++++++++++++++
 drivers/soc/tegra/fuse/fuse-tegra30.c |  1 +
 drivers/soc/tegra/fuse/fuse.h         |  2 ++
 3 files changed, 34 insertions(+)

Comments

Dmitry Osipenko July 21, 2021, 4 p.m. UTC | #1
02.07.2021 02:27, Dmitry Osipenko пишет:
> +static int __maybe_unused tegra_fuse_resume(struct device *dev)

> +{

> +	int err;

> +

> +	/*

> +	 * Critical for RAM re-repair operation, which must occur on resume

> +	 * from LP1 system suspend and as part of CCPLEX cluster switching.

> +	 */

> +	if (fuse->soc->clk_suspend_on) {

> +		err = pm_runtime_force_resume(dev);

> +		if (err)

> +			return err;

> +	}

> +

> +	return 0;

> +}

> +

> +static int __maybe_unused tegra_fuse_suspend(struct device *dev)

> +{

> +	int err;

> +

> +	if (fuse->soc->clk_suspend_on) {

> +		err = pm_runtime_force_suspend(dev);

> +		if (err)

> +			return err;

> +	}


I just noticed that something gone wrong with this patch, the condition
should have been inverted. I'll fix it in the next version.

I may also try to factor out these fuse and some other patches which
could become a 5.15 material.
diff mbox series

Patch

diff --git a/drivers/soc/tegra/fuse/fuse-tegra.c b/drivers/soc/tegra/fuse/fuse-tegra.c
index 747237865aff..f660a3557478 100644
--- a/drivers/soc/tegra/fuse/fuse-tegra.c
+++ b/drivers/soc/tegra/fuse/fuse-tegra.c
@@ -275,9 +275,40 @@  static int __maybe_unused tegra_fuse_runtime_suspend(struct device *dev)
 	return 0;
 }
 
+static int __maybe_unused tegra_fuse_resume(struct device *dev)
+{
+	int err;
+
+	/*
+	 * Critical for RAM re-repair operation, which must occur on resume
+	 * from LP1 system suspend and as part of CCPLEX cluster switching.
+	 */
+	if (fuse->soc->clk_suspend_on) {
+		err = pm_runtime_force_resume(dev);
+		if (err)
+			return err;
+	}
+
+	return 0;
+}
+
+static int __maybe_unused tegra_fuse_suspend(struct device *dev)
+{
+	int err;
+
+	if (fuse->soc->clk_suspend_on) {
+		err = pm_runtime_force_suspend(dev);
+		if (err)
+			return err;
+	}
+
+	return 0;
+}
+
 static const struct dev_pm_ops tegra_fuse_pm = {
 	SET_RUNTIME_PM_OPS(tegra_fuse_runtime_suspend, tegra_fuse_runtime_resume,
 			   NULL)
+	SET_SYSTEM_SLEEP_PM_OPS(tegra_fuse_suspend, tegra_fuse_resume)
 };
 
 static struct platform_driver tegra_fuse_driver = {
diff --git a/drivers/soc/tegra/fuse/fuse-tegra30.c b/drivers/soc/tegra/fuse/fuse-tegra30.c
index dd03565a39a4..e1f1db3b0526 100644
--- a/drivers/soc/tegra/fuse/fuse-tegra30.c
+++ b/drivers/soc/tegra/fuse/fuse-tegra30.c
@@ -208,6 +208,7 @@  const struct tegra_fuse_soc tegra124_fuse_soc = {
 	.lookups = tegra124_fuse_lookups,
 	.num_lookups = ARRAY_SIZE(tegra124_fuse_lookups),
 	.soc_attr_group = &tegra_soc_attr_group,
+	.clk_suspend_on = true,
 };
 #endif
 
diff --git a/drivers/soc/tegra/fuse/fuse.h b/drivers/soc/tegra/fuse/fuse.h
index e057a58e2060..de58feba0435 100644
--- a/drivers/soc/tegra/fuse/fuse.h
+++ b/drivers/soc/tegra/fuse/fuse.h
@@ -34,6 +34,8 @@  struct tegra_fuse_soc {
 	unsigned int num_lookups;
 
 	const struct attribute_group *soc_attr_group;
+
+	bool clk_suspend_on;
 };
 
 struct tegra_fuse {