#ifdef CONFIG_PM_GENERIC_DOMAINS
pdata->pd.name = "tegra-host1x";
err = nvhost_module_add_domain(&pdata->pd, dev);
-
#endif
nvhost_module_busy(dev);
}
#ifdef CONFIG_PM
+
+/*
+ * FIXME: Genpd disables the runtime pm while preparing for system
+ * suspend. As host1x clients may need host1x in suspend sequence
+ * for register reads/writes or syncpoint increments, we need to
+ * re-enable pm_runtime. As we *must* balance pm_runtime counter,
+ * we drop the reference in suspend complete callback, right before
+ * the genpd re-enables runtime pm.
+ *
+ * We should revisit the power code as this is hacky and
+ * caused by the way we use power domains.
+ */
+
+static int nvhost_suspend_prepare(struct device *dev)
+{
+ pm_runtime_enable(dev);
+ return 0;
+}
+
+static void nvhost_suspend_complete(struct device *dev)
+{
+ __pm_runtime_disable(dev, false);
+}
+
static int nvhost_suspend(struct device *dev)
{
struct platform_device *pdev = to_platform_device(dev);
}
static const struct dev_pm_ops host1x_pm_ops = {
- .suspend = nvhost_suspend,
- .resume = nvhost_resume,
+ .prepare = nvhost_suspend_prepare,
+ .complete = nvhost_suspend_complete,
+ .suspend_late = nvhost_suspend,
+ .resume_early = nvhost_resume,
};
#endif /* CONFIG_PM */