]> git.karo-electronics.de Git - linux-beck.git/commitdiff
drm/tegra: Add minimal power management
authorThierry Reding <treding@nvidia.com>
Thu, 18 Dec 2014 16:15:25 +0000 (17:15 +0100)
committerThierry Reding <treding@nvidia.com>
Tue, 27 Jan 2015 09:14:58 +0000 (10:14 +0100)
For now only disable the KMS hotplug polling helper logic upon suspend
and re-enable it on resume.

Reviewed-by: Sean Paul <seanpaul@chromium.org>
Reviewed-by: Mark Zhang <markz@nvidia.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
drivers/gpu/drm/tegra/drm.c

index 0edfb5e0b37481474d0a851440451c8c8afb399f..5bccb20889f74fb4a70c3ca0d390d4a58b9ae4d1 100644 (file)
@@ -996,6 +996,30 @@ static int host1x_drm_remove(struct host1x_device *dev)
        return 0;
 }
 
+#ifdef CONFIG_PM_SLEEP
+static int host1x_drm_suspend(struct device *dev)
+{
+       struct drm_device *drm = dev_get_drvdata(dev);
+
+       drm_kms_helper_poll_disable(drm);
+
+       return 0;
+}
+
+static int host1x_drm_resume(struct device *dev)
+{
+       struct drm_device *drm = dev_get_drvdata(dev);
+
+       drm_kms_helper_poll_enable(drm);
+
+       return 0;
+}
+#endif
+
+static const struct dev_pm_ops host1x_drm_pm_ops = {
+       SET_SYSTEM_SLEEP_PM_OPS(host1x_drm_suspend, host1x_drm_resume)
+};
+
 static const struct of_device_id host1x_drm_subdevs[] = {
        { .compatible = "nvidia,tegra20-dc", },
        { .compatible = "nvidia,tegra20-hdmi", },
@@ -1017,6 +1041,7 @@ static const struct of_device_id host1x_drm_subdevs[] = {
 static struct host1x_driver host1x_drm_driver = {
        .driver = {
                .name = "drm",
+               .pm = &host1x_drm_pm_ops,
        },
        .probe = host1x_drm_probe,
        .remove = host1x_drm_remove,