/*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
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*/
#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
}
}
/* 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)
} 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;
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)
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
*/
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) */
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
}
/**
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)
{
#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;
}
/*
pci_set_power_state(pdev, PCI_D3hot);
gbSuspended = true;
- gbgfxsuspended = true;
}
/*
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;
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_*/
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 {
/**