int psb_set_brightness(struct backlight_device *bd) { struct drm_device *dev = (struct drm_device *)bl_get_data(psb_backlight_device); struct drm_psb_private *dev_priv = (struct drm_psb_private *)dev->dev_private; int level; if (bd != NULL) level = bd->props.brightness; else level = lastFailedBrightness; DRM_DEBUG_DRIVER("backlight level set to %d\n", level); PSB_DEBUG_ENTRY("[DISPLAY] %s: level is %d\n", __func__, level); //DIV5-MM-DISPLAY-NC-LCM_INIT-00 /* Perform value bounds checking */ if (level < BRIGHTNESS_MIN_LEVEL) level = BRIGHTNESS_MIN_LEVEL; lastFailedBrightness = -1; if (IS_FLDS(dev)) { u32 adjusted_level = 0; /* Adjust the backlight level with the percent in * dev_priv->blc_adj2; */ adjusted_level = level * dev_priv->blc_adj2; adjusted_level = adjusted_level / BLC_ADJUSTMENT_MAX / 100; dev_priv->brightness_adjusted = adjusted_level; #ifndef CONFIG_MID_DSI_DPU if (!(dev_priv->dsr_fb_update & MDFLD_DSR_MIPI_CONTROL) && (dev_priv->dbi_panel_on || dev_priv->dbi_panel_on2)) { mdfld_dsi_dbi_exit_dsr(dev, MDFLD_DSR_MIPI_CONTROL, 0, 0); PSB_DEBUG_ENTRY ("Out of DSR before set brightness to %d.\n", adjusted_level); } #endif PSB_DEBUG_BL("Adjusted Backlight value: %d\n", adjusted_level); mdfld_dsi_brightness_control(dev, 0, adjusted_level); mdfld_dsi_brightness_control(dev, 2, adjusted_level); } /* cache the brightness for later use */ psb_brightness = level; return 0; }
static void mdfld_dsi_dbi_dpms(struct drm_encoder *encoder, int mode) { struct mdfld_dsi_encoder *dsi_encoder = MDFLD_DSI_ENCODER(encoder); struct mdfld_dsi_dbi_output *dbi_output = MDFLD_DSI_DBI_OUTPUT(dsi_encoder); struct drm_device *dev = dbi_output->dev; struct drm_psb_private *dev_priv = dev->dev_private; static bool bdispoff; dev_dbg(dev->dev, "%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 (bdispoff /* FIXME && gbgfxsuspended */) { mdfld_dsi_dbi_exit_dsr(dev, MDFLD_DSR_2D_3D); bdispoff = false; dev_priv->dispstatus = true; } mdfld_dsi_dbi_set_power(encoder, true); /* FIXME if (gbgfxsuspended) gbgfxsuspended = false; */ } else { /* * I am not sure whether this is the perfect place to * turn rpm on since we still have a lot of CRTC turnning * on work to do. */ bdispoff = true; dev_priv->dispstatus = false; mdfld_dsi_dbi_set_power(encoder, false); } }
static int mfld_set_brightness(struct backlight_device *bd) { struct drm_device *dev = bl_get_data(mdfld_backlight_device); struct drm_psb_private *dev_priv = dev->dev_private; int level = bd->props.brightness; /* Percentage 1-100% being valid */ if (level < 1) level = 1; if (gma_power_begin(dev, 0)) { /* Calculate and set the brightness value */ u32 adjusted_level; /* Adjust the backlight level with the percent in * dev_priv->blc_adj2; */ adjusted_level = level * dev_priv->blc_adj2; adjusted_level = adjusted_level / 100; #if 0 #ifndef CONFIG_MDFLD_DSI_DPU if(!(dev_priv->dsr_fb_update & MDFLD_DSR_MIPI_CONTROL) && (dev_priv->dbi_panel_on || dev_priv->dbi_panel_on2)){ mdfld_dsi_dbi_exit_dsr(dev,MDFLD_DSR_MIPI_CONTROL, 0, 0); dev_dbg(dev->dev, "Out of DSR before set brightness to %d.\n",adjusted_level); } #endif mdfld_dsi_brightness_control(dev, 0, adjusted_level); if ((dev_priv->dbi_panel_on2) || (dev_priv->dpi_panel_on2)) mdfld_dsi_brightness_control(dev, 2, adjusted_level); #endif gma_power_end(dev); } mdfld_brightness = level; return 0; }
static void pyr_dsi_dbi_dpms(struct drm_encoder *encoder, int mode) { struct mdfld_dsi_encoder * dsi_encoder = MDFLD_DSI_ENCODER(encoder); struct mdfld_dsi_dbi_output * dbi_output = MDFLD_DSI_DBI_OUTPUT(dsi_encoder); struct drm_device * dev = dbi_output->dev; static bool bdispoff = false; PSB_DEBUG_ENTRY("%s \n", (mode == DRM_MODE_DPMS_ON ? "on":"off")); if (mode == DRM_MODE_DPMS_ON){ if(gbgfxsuspended && bdispoff){ bdispoff = false; gbdispstatus = true; gbgfxsuspended = false; mdfld_dsi_dbi_exit_dsr (dev, MDFLD_DSR_2D_3D, 0, 0); } pyr_dsi_dbi_set_power(encoder, true); } else { bdispoff = true; gbdispstatus = false; pyr_dsi_dbi_set_power(encoder, false); } }