int psb_dpst_bl(struct drm_device *dev, void *data) { struct drm_psb_private *dev_priv = psb_priv(dev); uint32_t * arg = data; struct backlight_device *bd; bd = psb_get_backlight_device(); if(!dev_priv) return 0; if(dev_priv->early_suspended) return 0; dpst_print("adjust percentage: %d.%d\n", *arg / 100, *arg % 100); dev_priv->blc_adj2 = (*arg * 255 / 100) * 255 / 100; #ifdef CONFIG_BACKLIGHT_CLASS_DEVICE mutex_lock(&bd->ops_lock); bd->props.brightness = psb_get_brightness(bd); if ( 0 == bd->props.brightness) { mutex_unlock(&bd->ops_lock); return 0; } psb_set_brightness(bd); mutex_unlock(&bd->ops_lock); #endif /* */ return 0; }
int psb_dpst_bl(struct drm_device *dev, void *data) { struct drm_psb_private *dev_priv = psb_priv(dev); uint32_t *arg = data; struct backlight_device bd; dev_priv->blc_adj2 = *arg; #ifdef CONFIG_BACKLIGHT_CLASS_DEVICE bd.props.brightness = psb_get_brightness(&bd); psb_set_brightness(&bd); #endif return 0; }
static void mdfld_dsi_dpi_dpms(struct drm_encoder *encoder, int mode) { struct mdfld_dsi_encoder *dsi_encoder; struct mdfld_dsi_config *dsi_config; struct drm_device *dev; struct drm_psb_private *dev_priv; struct mdfld_dsi_dpi_output *dpi_output; struct panel_funcs *p_funcs; dsi_encoder = MDFLD_DSI_ENCODER(encoder); dsi_config = mdfld_dsi_encoder_get_config(dsi_encoder); if (!dsi_config) { DRM_ERROR("dsi_config is NULL\n"); return; } dev = dsi_config->dev; dev_priv = dev->dev_private; dpi_output = MDFLD_DSI_DPI_OUTPUT(dsi_encoder); p_funcs = dpi_output->p_funcs; PSB_DEBUG_ENTRY("%s\n", (mode == DRM_MODE_DPMS_ON ? "on" : DRM_MODE_DPMS_STANDBY == mode ? "standby" : "off")); mutex_lock(&dev_priv->dpms_mutex); DCLockMutex(); if (mode == DRM_MODE_DPMS_ON) { mdfld_dsi_dpi_set_power(encoder, true); DCAttachPipe(dsi_config->pipe); DC_MRFLD_onPowerOn(dsi_config->pipe); #ifdef CONFIG_BACKLIGHT_CLASS_DEVICE { struct mdfld_dsi_hw_context *ctx = &dsi_config->dsi_hw_context; struct backlight_device bd; bd.props.brightness = ctx->lastbrightnesslevel; psb_set_brightness(&bd); } #endif } else if (mode == DRM_MODE_DPMS_STANDBY) { #ifdef CONFIG_BACKLIGHT_CLASS_DEVICE struct mdfld_dsi_hw_context *ctx = &dsi_config->dsi_hw_context; struct backlight_device bd; ctx->lastbrightnesslevel = psb_get_brightness(&bd); bd.props.brightness = 0; psb_set_brightness(&bd); #endif /* Make the pending flip request as completed. */ DCUnAttachPipe(dsi_config->pipe); msleep(50); DC_MRFLD_onPowerOff(dsi_config->pipe); msleep(50); } else { mdfld_dsi_dpi_set_power(encoder, false); drm_handle_vblank(dev, dsi_config->pipe); /* Turn off TE interrupt. */ drm_vblank_off(dev, dsi_config->pipe); /* Make the pending flip request as completed. */ DCUnAttachPipe(dsi_config->pipe); DC_MRFLD_onPowerOff(dsi_config->pipe); } DCUnLockMutex(); mutex_unlock(&dev_priv->dpms_mutex); }