The omapdrm DSS manager enable/disable operations check the DSS manager
state to avoid double enabling/disabling. Move that code to the DSS
manager to decrease the dependency of the DRM layer to the DSS layer.

Signed-off-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
---
 drivers/gpu/drm/omapdrm/dss/dispc.c  | 1 -
 drivers/gpu/drm/omapdrm/dss/output.c | 6 ++++++
 drivers/gpu/drm/omapdrm/omap_crtc.c  | 3 ---
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/dispc.c 
b/drivers/gpu/drm/omapdrm/dss/dispc.c
index f83608b69e68..f18a6911923a 100644
--- a/drivers/gpu/drm/omapdrm/dss/dispc.c
+++ b/drivers/gpu/drm/omapdrm/dss/dispc.c
@@ -2887,7 +2887,6 @@ bool dispc_mgr_is_enabled(enum omap_channel channel)
 {
        return !!mgr_fld_read(channel, DISPC_MGR_FLD_ENABLE);
 }
-EXPORT_SYMBOL(dispc_mgr_is_enabled);

 void dispc_wb_enable(bool enable)
 {
diff --git a/drivers/gpu/drm/omapdrm/dss/output.c 
b/drivers/gpu/drm/omapdrm/dss/output.c
index 829232ad8c81..e6f67d76ec95 100644
--- a/drivers/gpu/drm/omapdrm/dss/output.c
+++ b/drivers/gpu/drm/omapdrm/dss/output.c
@@ -218,12 +218,18 @@ EXPORT_SYMBOL(dss_mgr_set_lcd_config);

 int dss_mgr_enable(enum omap_channel channel)
 {
+       if (dispc_mgr_is_enabled(channel))
+               return 0;
+
        return dss_mgr_ops->enable(channel);
 }
 EXPORT_SYMBOL(dss_mgr_enable);

 void dss_mgr_disable(enum omap_channel channel)
 {
+       if (!dispc_mgr_is_enabled(channel))
+               return;
+
        dss_mgr_ops->disable(channel);
 }
 EXPORT_SYMBOL(dss_mgr_disable);
diff --git a/drivers/gpu/drm/omapdrm/omap_crtc.c 
b/drivers/gpu/drm/omapdrm/omap_crtc.c
index 4c56d6a68390..35d59c385d38 100644
--- a/drivers/gpu/drm/omapdrm/omap_crtc.c
+++ b/drivers/gpu/drm/omapdrm/omap_crtc.c
@@ -139,9 +139,6 @@ static void omap_crtc_set_enabled(struct drm_crtc *crtc, 
bool enable)
                return;
        }

-       if (dispc_mgr_is_enabled(channel) == enable)
-               return;
-
        if (omap_crtc->channel == OMAP_DSS_CHANNEL_DIGIT) {
                /*
                 * Digit output produces some sync lost interrupts during the
-- 
2.7.3

Reply via email to