]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
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 747237865aff6fff175b05f335e800ad56f38ad5..f2151815db585b3f22bd968f0f1e984069b3b3fb 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 cd6a273707fe0891fe721b7d8f451830ae23b764..8ec9fc5e5e4b5875016675773465d4b55a7a1c9b 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 dd03565a39a4c9b4531853d0741cfc3604727b8a..b071d433d74f84669860c473f3b7ff7bf8b9707a 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 e057a58e20603250878c68db46fab7e23fcb25be..de58feba0435015fecd06f20acdcbd911f52f464 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 {