int dsim_panel_set_brightness_for_hmt(struct dsim_device *dsim, int force) { int ret = 0; #ifndef CONFIG_PANEL_AID_DIMMING dsim_info("%s:this panel does not support dimming \n", __func__); #else struct dim_data *dimming; struct panel_private *panel = &dsim->priv; int p_br = panel->hmt_brightness; int acutal_br = 0; int prev_index = panel->hmt_br_index; dimming = (struct dim_data *)panel->hmt_dim_data; if ((dimming == NULL) || (panel->hmt_br_tbl == NULL)) { dsim_info("%s : this panel does not support dimming\n", __func__); return ret; } acutal_br = panel->hmt_br_tbl[p_br]; panel->acl_enable = ACL_IS_ON(acutal_br); panel->hmt_br_index = get_acutal_br_index_for_hmt(dsim, acutal_br); if(panel->siop_enable) // check auto acl panel->acl_enable = 1; if (panel->state != PANEL_STATE_RESUMED) { dsim_info("%s : panel is not active state..\n", __func__); goto set_br_exit; } if (!force && panel->hmt_br_index == prev_index) goto set_br_exit; dsim_info("%s : req : %d : nit : %d index : %d\n", __func__, p_br, acutal_br, panel->hmt_br_index); if (acutal_br == 0) goto set_br_exit; mutex_lock(&panel->lock); ret = low_level_set_brightness_for_hmt(dsim, force); if (ret) { dsim_err("%s failed to hmt set brightness : %d\n", __func__, acutal_br); } mutex_unlock(&panel->lock); set_br_exit: #endif return ret; }
int dsim_panel_set_brightness(struct dsim_device *dsim, int force) { int ret = 0; #ifndef CONFIG_PANEL_AID_DIMMING dsim_info("%s:this panel does not support dimming \n", __func__); #else struct dim_data *dimming; struct panel_private *panel = &dsim->priv; int p_br = panel->bd->props.brightness; int acutal_br = 0; int real_br = 0; int prev_index = panel->br_index; #ifdef CONFIG_LCD_HMT if(panel->hmt_on == HMT_ON) { pr_info("%s hmt is enabled, plz set hmt brightness \n", __func__); goto set_br_exit; } #endif dimming = (struct dim_data *)panel->dim_data; if ((dimming == NULL) || (panel->br_tbl == NULL)) { dsim_info("%s : this panel does not support dimming\n", __func__); return ret; } if (panel->weakness_hbm_comp) acutal_br = panel->hbm_inter_br_tbl[p_br]; else acutal_br = panel->br_tbl[p_br]; panel->br_index = get_acutal_br_index(dsim, acutal_br); real_br = get_actual_br_value(dsim, panel->br_index); panel->acl_enable = ACL_IS_ON(real_br); panel->caps_enable = CAPS_IS_ON(real_br); if (LEVEL_IS_HBM(panel->auto_brightness) && (p_br == panel->bd->props.max_brightness)) { panel->br_index = panel->hbm_index; panel->acl_enable = 1; // hbm is acl on panel->caps_enable = 1; // hbm is caps on } if(panel->siop_enable) // check auto acl panel->acl_enable = 1; if (acutal_br > MAX_BRIGHTNESS) { panel->interpolation = 1; panel->acl_enable = 0; } else { panel->interpolation = 0; } if (panel->state != PANEL_STATE_RESUMED) { dsim_info("%s : panel is not active state..\n", __func__); goto set_br_exit; } dsim_info("%s : platform : %d, : mapping : %d, real : %d, index : %d, interpolation : %d\n", __func__, p_br, acutal_br, real_br, panel->br_index, panel->interpolation); if (!force && panel->br_index == prev_index) goto set_br_exit; if ((acutal_br == 0) || (real_br == 0)) goto set_br_exit; mutex_lock(&panel->lock); ret = low_level_set_brightness(dsim, force); if (ret) { dsim_err("%s failed to set brightness : %d\n", __func__, acutal_br); } mutex_unlock(&panel->lock); set_br_exit: #endif return ret; }
int dsim_panel_set_brightness(struct dsim_device *dsim, int force) { int ret = 0; #ifndef CONFIG_PANEL_AID_DIMMING dsim_info("%s:this panel does not support dimming \n", __func__); #else struct dim_data *dimming; struct panel_private *panel = &dsim->priv; int p_br = panel->bd->props.brightness; int acutal_br = 0; int real_br = 0; int prev_index = panel->br_index; int m_force = force; bool bIsHbm = (LEVEL_IS_HBM(panel->auto_brightness) && (p_br == panel->bd->props.max_brightness)); bool is_weak_mode; bool is_gallery; bool is_max_br; #ifdef CONFIG_LCD_HMT if(panel->hmt_on == HMT_ON) { pr_info("%s hmt is enabled, plz set hmt brightness \n", __func__); goto set_br_exit; } #endif if (panel->is_br_override && p_br!=panel->override_br_value) { pr_info( "%s : brightness %d canceled by override(%d)\n", __func__, p_br, panel->override_br_value ); goto set_br_exit; } is_weak_mode = (panel->weakness_hbm_comp == 1); is_gallery = (panel->weakness_hbm_comp == 2); dimming = (struct dim_data *)panel->dim_data; if ((dimming == NULL) || (panel->br_tbl == NULL)) { dsim_info("%s : this panel does not support dimming\n", __func__); return ret; } if (is_weak_mode) // color weak mode acutal_br = panel->hbm_inter_br_tbl[p_br]; else if(is_gallery) // gallery acutal_br = panel->gallery_br_tbl[p_br]; else acutal_br = panel->br_tbl[p_br]; panel->br_index = get_acutal_br_index(dsim, acutal_br); real_br = get_actual_br_value(dsim, panel->br_index); panel->caps_enable = CAPS_IS_ON(real_br); if(panel->acl_enable != ACL_IS_ON(p_br)) { m_force = 1; } if( ACL_IS_ON(p_br) ) panel->acl_enable = ACL_OPR_15P; else panel->acl_enable = ACL_OPR_OFF; if(bIsHbm) { panel->br_index = panel->hbm_index; panel->acl_enable = ACL_OPR_8P; // hbm is acl on panel->caps_enable = 1; // hbm is caps on } if(panel->siop_enable) // check auto acl panel->acl_enable = ACL_OPR_15P; if (real_br > MAX_BRIGHTNESS) { panel->interpolation = 1; } else { panel->interpolation = 0; } is_max_br =((!bIsHbm) && (p_br == 255)); if (is_weak_mode) { panel->acl_enable = ACL_OPR_15P; } else if (is_gallery) { panel->acl_enable = ACL_OPR_15P; if(is_max_br) panel->acl_enable = ACL_OPR_OFF; } else if(is_max_br) { panel->acl_enable = ACL_OPR_8P; } if (panel->state != PANEL_STATE_RESUMED) { dsim_info("%s : panel is not active state..\n", __func__); goto set_br_exit; } dsim_info("%s : platform : %d, : mapping : %d, real : %d, index : %d, interpolation : %d\n", __func__, p_br, acutal_br, real_br, panel->br_index, panel->interpolation); if (!m_force && panel->br_index == prev_index) goto set_br_exit; if ((acutal_br == 0) || (real_br == 0)) goto set_br_exit; mutex_lock(&panel->lock); ret = low_level_set_brightness(dsim, m_force); if (ret) { dsim_err("%s failed to set brightness : %d\n", __func__, acutal_br); } mutex_unlock(&panel->lock); set_br_exit: #endif return ret; }