drm/exynos: add PM functions for hdmi and mixer
authorJoonyoung Shim <jy0922.shim@samsung.com>
Mon, 23 Apr 2012 10:35:51 +0000 (19:35 +0900)
committerInki Dae <inki.dae@samsung.com>
Tue, 8 May 2012 09:46:33 +0000 (18:46 +0900)
This patch supports the PM for hdmi and mixer. Turn off hdmi and mixer
when suspended, and when resume, will turn on them by hdmi hotplug
detection if hdmi is attached.

Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
drivers/gpu/drm/exynos/exynos_hdmi.c
drivers/gpu/drm/exynos/exynos_mixer.c

index 9212d7d53f3a1e4385609f6708524620fe6680a8..ad53c4808bdbabaedbb56218672c1ff3d444ce65 100644 (file)
@@ -2367,11 +2367,43 @@ static int __devexit hdmi_remove(struct platform_device *pdev)
        return 0;
 }
 
+#ifdef CONFIG_PM_SLEEP
+static int hdmi_suspend(struct device *dev)
+{
+       struct exynos_drm_hdmi_context *ctx = get_hdmi_context(dev);
+       struct hdmi_context *hdata = ctx->ctx;
+
+       disable_irq(hdata->internal_irq);
+       disable_irq(hdata->external_irq);
+
+       hdata->hpd = false;
+       if (ctx->drm_dev)
+               drm_helper_hpd_irq_event(ctx->drm_dev);
+
+       hdmi_poweroff(hdata);
+
+       return 0;
+}
+
+static int hdmi_resume(struct device *dev)
+{
+       struct exynos_drm_hdmi_context *ctx = get_hdmi_context(dev);
+       struct hdmi_context *hdata = ctx->ctx;
+
+       enable_irq(hdata->external_irq);
+       enable_irq(hdata->internal_irq);
+       return 0;
+}
+#endif
+
+static SIMPLE_DEV_PM_OPS(hdmi_pm_ops, hdmi_suspend, hdmi_resume);
+
 struct platform_driver hdmi_driver = {
        .probe          = hdmi_probe,
        .remove         = __devexit_p(hdmi_remove),
        .driver         = {
                .name   = "exynos4-hdmi",
                .owner  = THIS_MODULE,
+               .pm     = &hdmi_pm_ops,
        },
 };
index a29a9a8b23124064376fe6e3bd41b447eed4e062..2f6727a4e7680f0f83d9033e950d4b48370a3220 100644 (file)
@@ -1104,10 +1104,25 @@ static int mixer_remove(struct platform_device *pdev)
        return 0;
 }
 
+#ifdef CONFIG_PM_SLEEP
+static int mixer_suspend(struct device *dev)
+{
+       struct exynos_drm_hdmi_context *drm_hdmi_ctx = get_mixer_context(dev);
+       struct mixer_context *ctx = drm_hdmi_ctx->ctx;
+
+       mixer_poweroff(ctx);
+
+       return 0;
+}
+#endif
+
+static SIMPLE_DEV_PM_OPS(mixer_pm_ops, mixer_suspend, NULL);
+
 struct platform_driver mixer_driver = {
        .driver = {
                .name = "s5p-mixer",
                .owner = THIS_MODULE,
+               .pm = &mixer_pm_ops,
        },
        .probe = mixer_probe,
        .remove = __devexit_p(mixer_remove),