soc/tegra: fuse: Enable fuse clock on suspend for Tegra124
authorDmitry Osipenko <digetx@gmail.com>
Mon, 2 Aug 2021 22:13:35 +0000 (01:13 +0300)
committerThierry Reding <treding@nvidia.com>
Wed, 11 Aug 2021 09:55:56 +0000 (11:55 +0200)
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>
Signed-off-by: Thierry Reding <treding@nvidia.com>
drivers/soc/tegra/fuse/fuse-tegra.c
drivers/soc/tegra/fuse/fuse-tegra20.c
drivers/soc/tegra/fuse/fuse-tegra30.c
drivers/soc/tegra/fuse/fuse.h

index 7472378..f215181 100644 (file)
@@ -275,9 +275,38 @@ static int __maybe_unused tegra_fuse_runtime_suspend(struct device *dev)
        return 0;
 }
 
+static int __maybe_unused tegra_fuse_suspend(struct device *dev)
+{
+       int ret;
+
+       /*
+        * 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)
+               ret = pm_runtime_resume_and_get(dev);
+       else
+               ret = pm_runtime_force_suspend(dev);
+
+       return ret;
+}
+
+static int __maybe_unused tegra_fuse_resume(struct device *dev)
+{
+       int ret = 0;
+
+       if (fuse->soc->clk_suspend_on)
+               pm_runtime_put(dev);
+       else
+               ret = pm_runtime_force_resume(dev);
+
+       return ret;
+}
+
 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 = {
index cd6a273..8ec9fc5 100644 (file)
@@ -167,4 +167,5 @@ const struct tegra_fuse_soc tegra20_fuse_soc = {
        .probe = tegra20_fuse_probe,
        .info = &tegra20_fuse_info,
        .soc_attr_group = &tegra_soc_attr_group,
+       .clk_suspend_on = false,
 };
index dd03565..b071d43 100644 (file)
@@ -112,6 +112,7 @@ const struct tegra_fuse_soc tegra30_fuse_soc = {
        .speedo_init = tegra30_init_speedo_data,
        .info = &tegra30_fuse_info,
        .soc_attr_group = &tegra_soc_attr_group,
+       .clk_suspend_on = false,
 };
 #endif
 
@@ -127,6 +128,7 @@ const struct tegra_fuse_soc tegra114_fuse_soc = {
        .speedo_init = tegra114_init_speedo_data,
        .info = &tegra114_fuse_info,
        .soc_attr_group = &tegra_soc_attr_group,
+       .clk_suspend_on = false,
 };
 #endif
 
@@ -208,6 +210,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
 
@@ -294,6 +297,7 @@ const struct tegra_fuse_soc tegra210_fuse_soc = {
        .lookups = tegra210_fuse_lookups,
        .num_lookups = ARRAY_SIZE(tegra210_fuse_lookups),
        .soc_attr_group = &tegra_soc_attr_group,
+       .clk_suspend_on = false,
 };
 #endif
 
@@ -324,6 +328,7 @@ const struct tegra_fuse_soc tegra186_fuse_soc = {
        .lookups = tegra186_fuse_lookups,
        .num_lookups = ARRAY_SIZE(tegra186_fuse_lookups),
        .soc_attr_group = &tegra_soc_attr_group,
+       .clk_suspend_on = false,
 };
 #endif
 
@@ -354,6 +359,7 @@ const struct tegra_fuse_soc tegra194_fuse_soc = {
        .lookups = tegra194_fuse_lookups,
        .num_lookups = ARRAY_SIZE(tegra194_fuse_lookups),
        .soc_attr_group = &tegra194_soc_attr_group,
+       .clk_suspend_on = false,
 };
 #endif
 
@@ -384,5 +390,6 @@ const struct tegra_fuse_soc tegra234_fuse_soc = {
        .lookups = tegra234_fuse_lookups,
        .num_lookups = ARRAY_SIZE(tegra234_fuse_lookups),
        .soc_attr_group = &tegra194_soc_attr_group,
+       .clk_suspend_on = false,
 };
 #endif
index e057a58..de58feb 100644 (file)
@@ -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 {