memory: tegra: Remove interconnect state syncing hack
authorDmitry Osipenko <digetx@gmail.com>
Sun, 12 Sep 2021 18:30:09 +0000 (21:30 +0300)
committerKrzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Mon, 20 Sep 2021 08:32:53 +0000 (10:32 +0200)
State syncing works properly now, previously the sync callback was never
invoked. Apparently it was fixed in drivers core, so let's remove the
hack. The state won't be synced until all consumer drivers of devices
that reference memory controller in a device-tree are probed, i.e. keeping
bandwidth at maximum until both display and devfreq drivers are probed.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Link: https://lore.kernel.org/r/20210912183009.6400-1-digetx@gmail.com
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
drivers/memory/tegra/mc.c

index 3c5aae7abf358b881ba4b6d64a0c64e1a019b3c1..6b710c204799f7d9c35e522888bef293bc1e2aa9 100644 (file)
@@ -706,15 +706,6 @@ static int tegra_mc_interconnect_setup(struct tegra_mc *mc)
                        goto remove_nodes;
        }
 
-       /*
-        * MC driver is registered too early, so early that generic driver
-        * syncing doesn't work for the MC. But it doesn't really matter
-        * since syncing works for the EMC drivers, hence we can sync the
-        * MC driver by ourselves and then EMC will complete syncing of
-        * the whole ICC state.
-        */
-       icc_sync_state(mc->dev);
-
        return 0;
 
 remove_nodes:
@@ -835,6 +826,15 @@ static int __maybe_unused tegra_mc_resume(struct device *dev)
        return 0;
 }
 
+static void tegra_mc_sync_state(struct device *dev)
+{
+       struct tegra_mc *mc = dev_get_drvdata(dev);
+
+       /* check whether ICC provider is registered */
+       if (mc->provider.dev == dev)
+               icc_sync_state(dev);
+}
+
 static const struct dev_pm_ops tegra_mc_pm_ops = {
        SET_SYSTEM_SLEEP_PM_OPS(tegra_mc_suspend, tegra_mc_resume)
 };
@@ -845,6 +845,7 @@ static struct platform_driver tegra_mc_driver = {
                .of_match_table = tegra_mc_of_match,
                .pm = &tegra_mc_pm_ops,
                .suppress_bind_attrs = true,
+               .sync_state = tegra_mc_sync_state,
        },
        .prevent_deferred_probe = true,
        .probe = tegra_mc_probe,