gfx: display: remove suspicious runtime PM related code
authorJani Nikula <jani.nikula@intel.com>
Mon, 5 Dec 2011 10:37:50 +0000 (12:37 +0200)
committerMarkus Lehtonen <markus.lehtonen@linux.intel.com>
Tue, 3 Jul 2012 09:28:46 +0000 (12:28 +0300)
Remove suspicious runtime PM related code sprinkled here and there in the
driver. This is in preparation of eventually properly implementing runtime
PM.

Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
drivers/staging/mrst/drv/mdfld_dsi_dbi.c
drivers/staging/mrst/drv/mdfld_dsi_dpi.c
drivers/staging/mrst/drv/mdfld_dsi_output.c
drivers/staging/mrst/drv/psb_drv.h
drivers/staging/mrst/drv/psb_intel_display.c
drivers/staging/mrst/drv/psb_intel_hdmi.c
drivers/staging/mrst/drv/psb_powermgmt.c
drivers/staging/mrst/drv/psb_powermgmt.h
drivers/staging/mrst/drv/tpo_cmd.c

index cc38331..e41f9fe 100644 (file)
@@ -248,12 +248,8 @@ void mdfld_dsi_dbi_enter_dsr (struct mdfld_dsi_dbi_output * dbi_output, int pipe
        /*update mode state to IN_DSR*/
        dbi_output->mode_flags |= MODE_SETTING_IN_DSR;
 
-       if(pipe == 2){
+       if (pipe == 2)
                enter_dsr = 1;
-#ifdef CONFIG_PM_RUNTIME
-               pm_schedule_suspend(&dev->pdev->dev, gfxrtdelay);
-#endif
-       }
 }
 
 #ifndef CONFIG_MDFLD_DSI_DPU
@@ -349,13 +345,6 @@ void mdfld_dsi_dbi_exit_dsr(struct drm_device *dev, u32 update_src)
 
        dbi_output = dsr_info->dbi_outputs;
 
-#ifdef CONFIG_PM_RUNTIME
-        if(drm_psb_ospm && !enable_gfx_rtpm) {
-//                pm_runtime_allow(&gpDrmDevice->pdev->dev);
-               schedule_delayed_work(&dev_priv->rtpm_work, 30 * 1000);
-        }
-#endif
-
        /*for each output, exit dsr*/
        for(i=0; i<dsr_info->dbi_output_num; i++) {
                /*if panel has been turned off, skip*/
@@ -456,14 +445,6 @@ void mdfld_dbi_update_panel (struct drm_device *dev, int pipe)
 #endif
                        }
                }
-       /*schedule rpm suspend after gfxrtdelay*/
-#ifdef CONFIG_PM_RUNTIME
-               if(!dev_priv->rpm_enabled
-                       || !enter_dsr
-       //              || (REG_READ(HDMIB_CONTROL) & HDMIB_PORT_EN)
-                       || pm_schedule_suspend(&dev->pdev->dev, gfxrtdelay))
-                       PSB_DEBUG_ENTRY("Runtime PM schedule suspend failed, rpm %d\n", dev_priv->rpm_enabled);
-#endif         
        }
 }
 
index b960908..4738477 100644 (file)
@@ -633,17 +633,6 @@ shutdown_out:
        /*      dev_priv->dpi_panel_on2 = false; */
        /* else if (pipe == 0) */
        /*      dev_priv->dpi_panel_on = false;  */
-
-#ifdef CONFIG_PM_RUNTIME
-       if (drm_psb_ospm && !enable_gfx_rtpm) {
-//             pm_runtime_allow(&gpDrmDevice->pdev->dev);
-               schedule_delayed_work(&dev_priv->rtpm_work, 30 * 1000);
-       }
-
-       if (enable_gfx_rtpm)
-               pm_schedule_suspend(&dev->pdev->dev, gfxrtdelay);
-#endif
-       return;
 }
 
 static void mdfld_dsi_dpi_set_power(struct drm_encoder * encoder, bool on)
@@ -735,10 +724,6 @@ void mdfld_dsi_dpi_dpms(struct drm_encoder *encoder, int mode)
        } else {
                mdfld_dsi_dpi_set_power(encoder, false);
                gbdispstatus = false;
-#ifdef CONFIG_PM_RUNTIME
-               if (enable_gfx_rtpm)
-                       pm_schedule_suspend(&gpDrmDevice->pdev->dev, gfxrtdelay);
-#endif
        }
 
        return;
index 015fe21..b36e463 100644 (file)
@@ -631,52 +631,12 @@ static int mdfld_dsi_connector_mode_valid(struct drm_connector * connector, stru
 
 static void mdfld_dsi_connector_dpms(struct drm_connector *connector, int mode)
 {
-#ifdef CONFIG_PM_RUNTIME
-       struct drm_device * dev = connector->dev;
-       struct drm_psb_private * dev_priv = dev->dev_private;
-       bool panel_on, panel_on2;
-#endif
-
        if (mode == connector->dpms)
                return;
 
        /*first, execute dpms*/
                
        drm_helper_connector_dpms(connector, mode);
-       
-#ifdef CONFIG_PM_RUNTIME       
-       if(is_panel_vid_or_cmd(dev)) {
-               /*DPI panel*/
-               panel_on = dev_priv->dpi_panel_on;
-               panel_on2 = dev_priv->dpi_panel_on2;
-       } else {
-               /*DBI panel*/
-               panel_on = dev_priv->dbi_panel_on;
-               panel_on2 = dev_priv->dbi_panel_on2;
-       }       
-       
-       /*then check all display panels + monitors status*/
-       /* Make sure that the Display (B) sub-system status isn't i3 when
-        * R/W the DC register, otherwise "Fabric error" issue would occur
-        * during S0i3 state. */
-       if(!panel_on && !panel_on2 && !(REG_READ(HDMIB_CONTROL) & HDMIB_PORT_EN)) {
-               /*request rpm idle*/
-               if(dev_priv->rpm_enabled) {
-                       pm_request_idle(&dev->pdev->dev);
-               }
-       } 
-       
-       /**
-        * if rpm wasn't enabled yet, try to allow it
-        * FIXME: won't enable rpm for DPI since DPI
-        * CRTC setting is a little messy now. 
-        * Enable it later!
-        */
-#if 0
-       if(!dev_priv->rpm_enabled && !is_panel_vid_or_cmd(dev))
-               ospm_runtime_pm_allow(dev);
-#endif
-#endif
 }
 
 static struct drm_encoder * mdfld_dsi_connector_best_encoder(struct drm_connector * connector) 
index 4b9e580..a067334 100644 (file)
@@ -682,12 +682,6 @@ struct drm_psb_private {
        struct mdfld_dsi_dbi_output * dbi_output2;
 /* MDFLD_DSI private date end */
 
-#ifdef CONFIG_PM_RUNTIME
-       /*runtime PM state*/
-       int rpm_enabled;
-       struct delayed_work rtpm_work;
-#endif
-
        /*
         *Register state
         */
index fc4a74f..7157a69 100644 (file)
@@ -1076,21 +1076,6 @@ static void mdfld_crtc_dpms(struct drm_crtc *crtc, int mode)
 
        PSB_DEBUG_ENTRY("mode = %d, pipe = %d \n", mode, pipe);
 
-       /* Ignore if system is already in DSR and in suspended state. */
-       if ((gbgfxsuspended) && (gbdispstatus == false) && (mode == DRM_MODE_DPMS_OFF)) {
-#if CONFIG_PM_RUNTIME
-               if ((dev_priv->rpm_enabled) && (pipe == 1)){
-                       // dev_priv->is_mipi_on = false;
-                       pm_request_idle(&gpDrmDevice->pdev->dev);
-               }
-#endif
-               return;
-       } else if (mode == DRM_MODE_DPMS_ON) {
-               //do not need to set gbdispstatus=true in crtc.
-               //this will be set in encoder's DPMS callback.
-               //gbdispstatus = true;
-       }
-
 /* FIXME_JLIU7 MDFLD_PO replaced w/ the following function */
 /* mdfld_dbi_dpms (struct drm_device *dev, int pipe, bool enabled) */
 
index f7558a9..2d2160e 100644 (file)
@@ -960,45 +960,7 @@ static int mdfld_hdmi_mode_valid(struct drm_connector *connector,
 
 static void mdfld_hdmi_connector_dpms(struct drm_connector *connector, int mode)
 {
-#ifdef CONFIG_PM_RUNTIME
-       struct drm_device * dev = connector->dev;
-       struct drm_psb_private * dev_priv = dev->dev_private;
-       bool panel_on, panel_on2;
-#endif
-       /*first, execute dpms*/
-               
        drm_helper_connector_dpms(connector, mode);
-
-#ifdef CONFIG_PM_RUNTIME       
-       if(is_panel_vid_or_cmd(dev)) {
-               /*DPI panel*/
-               panel_on = dev_priv->dpi_panel_on;
-               panel_on2 = dev_priv->dpi_panel_on2;
-       } else {
-               /*DBI panel*/
-               panel_on = dev_priv->dbi_panel_on;
-               panel_on2 = dev_priv->dbi_panel_on2;
-       }       
-       
-       /*then check all display panels + monitors status*/
-       if(!panel_on && !panel_on2 && !(REG_READ(HDMIB_CONTROL) & HDMIB_PORT_EN)) {
-               /*request rpm idle*/
-               if(dev_priv->rpm_enabled) {
-                       pm_request_idle(&dev->pdev->dev);
-               }
-       } 
-       
-       /**
-        * if rpm wasn't enabled yet, try to allow it
-        * FIXME: won't enable rpm for DPI since DPI
-        * CRTC setting is a little messy now. 
-        * Enable it later!
-        */
-#if 0
-       if(!dev_priv->rpm_enabled && !is_panel_vid_or_cmd(dev)) 
-               ospm_runtime_pm_allow(dev);
-#endif
-#endif         
 }
 
 /**
index a0f850e..10ce4b9 100644 (file)
@@ -58,33 +58,8 @@ static atomic_t g_videodec_access_count;
 void ospm_power_island_up(int hw_islands);
 void ospm_power_island_down(int hw_islands);
 static bool gbSuspended = false;
-bool gbgfxsuspended = false;
 bool gbdispstatus = true;
 
-
-#ifdef CONFIG_PM_RUNTIME
-int enable_gfx_rtpm = 0;
-
-void psb_runtimepm_wq_handler(struct work_struct *work)
-{
-       struct drm_psb_private * dev_priv =  gpDrmDevice->dev_private;
-
-       if(drm_psb_ospm && !enable_gfx_rtpm) {
-               printk(KERN_ALERT "Enable GFX runtime_pm \n");
-
-               dev_priv->rpm_enabled = 1;
-
-               enable_gfx_rtpm = 1;
-
-               pm_runtime_enable(&gpDrmDevice->pdev->dev);
-               pm_runtime_set_active(&gpDrmDevice->pdev->dev);
-
-               pm_runtime_allow(&gpDrmDevice->pdev->dev);
-       }
-}
-#endif
-
-
 #if 1
 static int ospm_runtime_check_msvdx_hw_busy(struct drm_device *dev)
 {
@@ -403,12 +378,6 @@ void ospm_power_init(struct drm_device *dev)
 #endif
 
        spin_lock_init(&dev_priv->ospm_lock);
-
-#ifdef CONFIG_PM_RUNTIME
-       INIT_DELAYED_WORK(&dev_priv->rtpm_work, psb_runtimepm_wq_handler);
-#endif
-
-       return;
 }
 
 /*
@@ -1207,7 +1176,6 @@ static void ospm_suspend_pci(struct pci_dev *pdev)
        pci_set_power_state(pdev, PCI_D3hot);
 
        gbSuspended = true;
-       gbgfxsuspended = true;
 }
 
 /*
@@ -1758,52 +1726,6 @@ void ospm_power_using_hw_end(int hw_island)
        WARN_ON(atomic_read(&g_display_access_count) < 0);
 }
 
-int ospm_runtime_pm_allow(struct drm_device * dev)
-{
-       struct drm_psb_private * dev_priv = dev->dev_private;
-       bool panel_on, panel_on2;
-
-       PSB_DEBUG_ENTRY("%s\n", __FUNCTION__);
-
-#ifdef OSPM_GFX_DPK
-       printk(KERN_ALERT "OSPM_GFX_DPK: %s  \n", __func__);
-#endif
-       if (dev_priv->rpm_enabled)
-               return 0;
-
-       if (is_panel_vid_or_cmd(dev)) {
-               /*DPI panel*/
-               panel_on = dev_priv->dpi_panel_on;
-               panel_on2 = dev_priv->dpi_panel_on2;
-       } else {
-               /*DBI panel*/
-               panel_on = dev_priv->dbi_panel_on;
-               panel_on2 = dev_priv->dbi_panel_on2;
-       }
-
-       if (panel_on && panel_on2) {
-               pm_runtime_allow(&dev->pdev->dev);
-               dev_priv->rpm_enabled = 1;
-               DRM_INFO("Runtime PM enabled\n");
-       }
-
-       return 0;
-}
-
-void ospm_runtime_pm_forbid(struct drm_device * dev)
-{
-       struct drm_psb_private * dev_priv = dev->dev_private;
-
-       DRM_INFO("%s\n", __FUNCTION__);
-
-#ifdef OSPM_GFX_DPK
-       printk(KERN_ALERT "OSPM_GFX_DPK: %s  \n", __func__);
-#endif
-
-       pm_runtime_forbid(&dev->pdev->dev);
-       dev_priv->rpm_enabled = 0;
-}
-
 int psb_runtime_suspend(struct device *dev)
 {
        int ret = 0;
index b4de796..bc02d99 100644 (file)
@@ -96,18 +96,8 @@ void ospm_power_island_up(int hw_islands);
 int psb_runtime_suspend(struct device *dev);
 int psb_runtime_resume(struct device *dev);
 int psb_runtime_idle(struct device *dev);
-int ospm_runtime_pm_allow(struct drm_device * dev);
-void ospm_runtime_pm_forbid(struct drm_device * dev);
-
-#ifdef CONFIG_PM_RUNTIME
-void psb_runtimepm_wq_handler(struct work_struct *work);
-#endif
 
 extern struct drm_device *gpDrmDevice;
-extern bool gbgfxsuspended;
 extern bool gbdispstatus;
-#ifdef CONFIG_PM_RUNTIME
-extern int enable_gfx_rtpm;
-#endif
 
 #endif /*_PSB_POWERMGMT_H_*/
index bb1dcd2..bb01e59 100644 (file)
@@ -388,19 +388,6 @@ static void mdfld_dsi_dbi_dpms(struct drm_encoder *encoder, int mode)
        PSB_DEBUG_ENTRY("%s \n",  (mode == DRM_MODE_DPMS_ON ? "on":"off"));
 
        if (mode == DRM_MODE_DPMS_ON){
-               /**
-                * FIXME: in case I am wrong!
-                * we don't need to exit dsr here to wake up plane/pipe/pll
-                * if everything goes right, hw_begin will resume them all
-                * during set_power.
-                */
-                if(gbgfxsuspended && bdispoff){
-                        bdispoff = false;
-                        gbdispstatus = true;
-                        gbgfxsuspended = false;
-                        mdfld_dsi_dbi_exit_dsr (dev, MDFLD_DSR_2D_3D);
-                }
-
                mdfld_dsi_dbi_set_power(encoder, true);
        } else {
                /**