static int s6e3hf2_wqhd_probe(struct dsim_device *dsim) { int ret = 0; struct panel_private *priv = &dsim->priv; dsim_info("%s was called\n", __func__); dsim->lcd = lcd_device_register("panel", dsim->dev, &dsim->priv, NULL); if (IS_ERR(dsim->lcd)) { pr_err("failed to register lcd device\n"); ret = PTR_ERR(dsim->lcd); goto probe_err; } priv->bd = backlight_device_register("panel", dsim->dev, &dsim->priv, &s6e3hf2_wqhd_backlight_ops, NULL); if (IS_ERR(priv->bd)) { pr_err("failed to register backlight device\n"); ret = PTR_ERR(priv->bd); goto probe_err; } priv->bd->props.max_brightness = MAX_PLATFORM_BRIGHTNESS; priv->bd->props.brightness = DEFAULT_PLATFORM_BRIGHTNESS; /*Todo need to rearrange below value */ priv->lcdConnected = PANEL_CONNECTED; priv->state = PANEL_STATE_ACTIVE; priv->power = FB_BLANK_UNBLANK; priv->temperature = NORMAL_TEMPERATURE; priv->acl_enable= 0; priv->current_acl = 0; priv->auto_brightness = 0; priv->siop_enable = 0; priv->current_hbm = 0; mutex_init(&priv->lock); #if defined(CONFIG_EXYNOS_DECON_LCD_SYSFS) lcd_init_sysfs(dsim); #endif dsim_panel_probe(dsim); #if defined(CONFIG_EXYNOS_DECON_MDNIE_LITE) mdnie_register(&dsim->lcd->dev, dsim, (mdnie_w)s6e3hf2_send_seq, (mdnie_r)s6e3hf2_read); #endif probe_err: return ret; }
static int dsim_panel_set_vint(struct dsim_device *dsim, int force) { int ret = 0; int nit = 0; int i, level = 0; int arraySize = ARRAY_SIZE(VINT_DIM_TABLE); struct panel_private* panel = &(dsim->priv); unsigned char SEQ_VINT[VINT_LEN] = {VINT_REG, 0x8B, 0x21}; unsigned char *vint_tbl = (unsigned char *)VINT_TABLE; #if defined(CONFIG_PANEL_S6E3HF2_DYNAMIC) // edge unsigned char panelline = panel->id[0] & 0xc0; if (panel->a3_vint_updated && panelline == S6E3HF2_A3_LINE_ID) { vint_tbl = panel->a3_vint; } #endif level = arraySize - 1; if(UNDER_MINUS_20(panel->temperature)) goto set_vint; #ifdef CONFIG_LCD_HMT if(panel->hmt_on == HMT_ON) goto set_vint; #endif nit = get_actual_br_value(dsim, panel->br_index); level = arraySize - 1; for (i = 0; i < arraySize; i++) { if (nit <= VINT_DIM_TABLE[i]) { level = i; goto set_vint; } } set_vint: if(force || panel->current_vint != vint_tbl[level]) { SEQ_VINT[VINT_LEN - 1] = vint_tbl[level]; if ((ret = dsim_write_hl_data(dsim, SEQ_VINT, ARRAY_SIZE(SEQ_VINT))) < 0) { dsim_err("fail to write vint command.\n"); ret = -EPERM; } panel->current_vint = vint_tbl[level]; dsim_info("vint: %02x\n", panel->current_vint); } return ret; }
int mdnie_lite_send_seq(struct dsim_device *dsim, struct lcd_seq_info *seq, u32 num) { int ret = 0; struct panel_private *panel = &dsim->priv; if (panel->state != PANEL_STATE_RESUMED) { dsim_info("%s : panel is not active\n", __func__); return -EIO; } mutex_lock(&panel->lock); ret = mdnie_lite_write_set(dsim, seq, num); mutex_unlock(&panel->lock); return ret; }
static void dsim_panel_dynamic_aid_ctrl(struct dsim_device *dsim) { u8 aid[S6E3HF3_AID_CMD_CNT] = { 0, }; int index = 0; int current_pbr; struct panel_private *panel = &dsim->priv; struct SmtDimInfo *dimming_info = (struct SmtDimInfo *)panel->dim_info; if (dynamic_lcd_type == LCD_TYPE_S6E3HF3_WQHD) { memcpy(aid, S6E3HF3_SEQ_AOR, sizeof(S6E3HF3_SEQ_AOR)); } else { memcpy(aid, S6E3HA3_SEQ_AOR, sizeof(S6E3HA3_SEQ_AOR)); } if (dimming_info == NULL) { dsim_err("%s : dimming info is NULL\n", __func__); goto aid_ctrl_err; } current_pbr = panel->bd->props.brightness; index = dsim->priv.br_index + 1; if (index > MAX_BR_INFO) index = MAX_BR_INFO; if (panel->inter_aor_tbl == NULL) return; aid[9] = panel->inter_aor_tbl[current_pbr * 2]; aid[10] = panel->inter_aor_tbl[current_pbr * 2 + 1]; dsim_info("%s %d aid : %x : %x : %x\n", __func__, current_pbr, aid[0], aid[9], aid[10]); if (dynamic_lcd_type == LCD_TYPE_S6E3HF3_WQHD) { if (dsim_write_hl_data(dsim, aid, S6E3HF3_AID_CMD_CNT) < 0) dsim_err("%s : failed to write gamma \n", __func__); } else { if (dsim_write_hl_data(dsim, aid, S6E3HA3_AID_CMD_CNT) < 0) dsim_err("%s : failed to write gamma \n", __func__); } aid_ctrl_err: return; }
static void dsim_panel_set_elvss_for_hmt(struct dsim_device *dsim) { u8 *elvss = NULL; unsigned char SEQ_ELVSS[ELVSS_LEN_MAX] = {0, }; SEQ_ELVSS[0] = aid_dimming_dynamic.elvss_reg; elvss = get_elvss_from_index_for_hmt(dsim, dsim->priv.hmt_br_index, dsim->priv.acl_enable); if (elvss == NULL) { dsim_err("%s : failed to get elvss value\n", __func__); return; } memcpy(&SEQ_ELVSS[1], dsim->priv.elvss_set, aid_dimming_dynamic.elvss_len - 1); memcpy(SEQ_ELVSS, elvss, aid_dimming_dynamic.elvss_cmd_cnt); SEQ_ELVSS[aid_dimming_dynamic.elvss_len - 1] += dsim_panel_get_elvssoffset(dsim); dsim_info("%s elvss ha3/hf3\n", __func__); memcpy(dsim->priv.tset, &SEQ_ELVSS[1], aid_dimming_dynamic.elvss_len - 1); dsim_panel_set_tset(dsim, 1); }
static int s6d7aa0x62_probe(struct dsim_device *dsim) { int ret = 0; struct panel_private *panel = &dsim->priv; dsim_info("MDD : %s was called\n", __func__); panel->dim_data = (void *)NULL; panel->lcdConnected = PANEL_CONNECTED; panel->panel_type = 0; if (panel->lcdConnected == PANEL_DISCONNEDTED) { dsim_err("dsim : %s lcd was not connected\n", __func__); goto probe_exit; } probe_exit: return ret; }
static int dsim_panel_set_tset(struct dsim_device *dsim, int force) { int ret = 0; int tset = 0; unsigned char SEQ_TSET[TSET_LEN] = {TSET_REG, }; tset = (dsim->priv.temperature < 0) ? BIT(7) | abs(dsim->priv.temperature) : dsim->priv.temperature; if(force || dsim->priv.tset[TSET_LEN - 2] != tset) { memcpy(&SEQ_TSET[1], dsim->priv.tset, TSET_LEN - 1); dsim->priv.tset[TSET_LEN - 2] = SEQ_TSET[TSET_LEN - 1] = tset; if ((ret = dsim_write_hl_data(dsim, SEQ_TSET, ARRAY_SIZE(SEQ_TSET))) < 0) { dsim_err("fail to write tset command.\n"); ret = -EPERM; } dsim_info("%s temperature: %d, tset: %d\n", __func__, dsim->priv.temperature, SEQ_TSET[TSET_LEN - 1]); } return ret; }
static int dsim_panel_set_hbm(struct dsim_device *dsim, int force) { int ret = 0, level = LEVEL_IS_HBM(dsim->priv.auto_brightness); struct panel_private *panel = &dsim->priv; if (panel == NULL) { dsim_err("%s : panel is NULL\n", __func__); goto exit; } if(force || dsim->priv.current_hbm != panel->hbm_tbl[level][1]) { dsim->priv.current_hbm = panel->hbm_tbl[level][1]; if((ret = dsim_write_hl_data(dsim, panel->hbm_tbl[level], ARRAY_SIZE(SEQ_HBM_OFF))) < 0) { dsim_err("fail to write hbm command.\n"); ret = -EPERM; } dsim_info("hbm: %d, auto_brightness: %d\n", dsim->priv.current_hbm, dsim->priv.auto_brightness); } exit: return ret; }
static int dsim_panel_set_vint(struct dsim_device *dsim, int force) { int ret = 0; int nit = 0; int i, level = 0; int arraySize = ARRAY_SIZE(VINT_DIM_TABLE); struct panel_private* panel = &(dsim->priv); unsigned char SEQ_VINT[VINT_LEN] = {VINT_REG, 0x8B, 0x21}; unsigned char *vint_tbl = aid_dimming_dynamic.vint_dim_offset; level = arraySize - 1; SEQ_VINT[1] = aid_dimming_dynamic.vint_reg2; if(UNDER_MINUS_20(panel->temperature)) goto set_vint; #ifdef CONFIG_LCD_HMT if(panel->hmt_on == HMT_ON) goto set_vint; #endif nit = get_actual_br_value(dsim, panel->br_index); for (i = 0; i < arraySize; i++) { if (nit <= VINT_DIM_TABLE[i]) { level = i; goto set_vint; } } set_vint: if(force || panel->current_vint != vint_tbl[level]) { SEQ_VINT[VINT_LEN - 1] = vint_tbl[level]; if ((ret = dsim_write_hl_data(dsim, SEQ_VINT, ARRAY_SIZE(SEQ_VINT))) < 0) { dsim_err("fail to write vint command.\n"); ret = -EPERM; } panel->current_vint = vint_tbl[level]; dsim_info("vint: %02x\n", panel->current_vint); } return ret; }
static void dsim_panel_aid_interpolation(struct dsim_device *dsim) { int current_pbr; struct panel_private *panel = &dsim->priv; u8 aid[S6E3HF3_AID_CMD_CNT] = { 0, }; if (dynamic_lcd_type == LCD_TYPE_S6E3HF3_WQHD) { memcpy(aid, S6E3HF3_SEQ_AOR, sizeof(S6E3HF3_SEQ_AOR)); } else{ memcpy(aid, S6E3HA3_SEQ_AOR, sizeof(S6E3HA3_SEQ_AOR)); } current_pbr = panel->bd->props.brightness; if (panel->inter_aor_tbl == NULL) return; aid[9] = panel->inter_aor_tbl[current_pbr * 2]; aid[10] = panel->inter_aor_tbl[current_pbr * 2 + 1]; dsim_info("%s %d = aid : %x : %x : %x\n", __func__, current_pbr, aid[0], aid[9], aid[10]); if (dsim_write_hl_data(dsim, SEQ_TEST_KEY_ON_F0, ARRAY_SIZE(SEQ_TEST_KEY_ON_F0)) < 0) dsim_err("%s : fail to write F0 on command.\n", __func__); if (dynamic_lcd_type == LCD_TYPE_S6E3HF3_WQHD) { if (dsim_write_hl_data(dsim, aid, S6E3HF3_AID_CMD_CNT) < 0) dsim_err("%s : failed to write gamma \n", __func__); } else { if (dsim_write_hl_data(dsim, aid, S6E3HA3_AID_CMD_CNT) < 0) dsim_err("%s : failed to write gamma \n", __func__); } if (dsim_write_hl_data(dsim, SEQ_GAMMA_UPDATE, ARRAY_SIZE(SEQ_GAMMA_UPDATE)) < 0) dsim_err("%s : failed to write gamma \n", __func__); if (dsim_write_hl_data(dsim, SEQ_GAMMA_UPDATE_L, ARRAY_SIZE(SEQ_GAMMA_UPDATE_L)) < 0) dsim_err("%s : failed to write gamma \n", __func__); if (dsim_write_hl_data(dsim, SEQ_TEST_KEY_OFF_F0, ARRAY_SIZE(SEQ_TEST_KEY_OFF_F0)) < 0) dsim_err("%s : fail to write F0 on command.\n", __func__); return; }
static int dsim_panel_lvds_init(struct dsim_device *dsim) { int ret = 0; struct panel_private *panel = &dsim->priv; dsim_info("%s : lvds init, panel state (%d)\n", __func__, panel->state); if (panel->state == PANEL_STATE_SUSPENED) { panel->state = PANEL_STATE_RESUMED; if (panel->ops->lvds_init) { ret = panel->ops->lvds_init(dsim); if (ret) { dsim_err("%s : failed to lvds init\n", __func__); panel->state = PANEL_STATE_SUSPENED; goto lvds_init_err; } } } lvds_init_err: return ret; }
/* * configure and set DPHY PLL, byte clock, escape clock and hs clock * * Parameters * - hs_clk : in/out parameter. * in : requested hs clock. out : calculated hs clock * - esc_clk : in/out paramter. * in : requested escape clock. out : calculated escape clock * - byte_clk : out parameter. byte clock = hs clock / 8 */ int dsim_reg_set_clocks(struct dsim_clks *clks, u32 lane, u32 en) { unsigned int esc_div; struct dsim_pll_param pll; struct dphy_timing_value t; int ret; if (en) { /* byte clock source must be DPHY PLL */ dsim_reg_set_byte_clk_src_is_pll(); /* requested DPHY PLL frequency(HS clock) */ pll.pll_freq = clks->hs_clk; /* calculate p, m, s for setting DPHY PLL and hs clock */ ret = dsim_reg_calculate_pms(&pll); if (ret) return ret; /* store calculated hs clock */ clks->hs_clk = pll.pll_freq; /* set p, m, s to DPHY PLL */ dsim_reg_set_pll_freq(pll.p, pll.m, pll.s); /* set PLL's lock time */ dsim_reg_pll_stable_time(); /* get byte clock */ clks->byte_clk = clks->hs_clk / 8; dsim_info("byte clock is %ld\n", clks->byte_clk); /* requeseted escape clock */ dsim_info("requested escape clock %ld\n", clks->esc_clk); /* escape clock divider */ esc_div = clks->byte_clk / clks->esc_clk; /* adjust escape clock */ if ((clks->byte_clk / esc_div) > clks->esc_clk) esc_div += 1; /* adjusted escape clock */ clks->esc_clk = clks->byte_clk / esc_div; dsim_info("escape clock divider is 0x%x\n", esc_div); dsim_info("escape clock is %ld\n", clks->esc_clk); /* get DPHY timing values using hs clock and escape clock */ dsim_reg_get_dphy_timing(clks->hs_clk, clks->esc_clk, &t); dsim_reg_set_dphy_timing_values(&t); /* DPHY uses PLL output */ /* dsim_reg_pll_bypass(0); discard in Helsinki-Prime */ /* enable PLL */ dsim_reg_enable_pll(1); /* enable byte clock. */ dsim_reg_set_byte_clock(1); /* enable escape clock */ dsim_reg_set_esc_clk_prescaler(1, esc_div); /* escape clock on lane */ dsim_reg_set_esc_clk_on_lane(1, lane); } else { dsim_reg_set_esc_clk_on_lane(0, lane); dsim_reg_set_esc_clk_prescaler(0, 0); dsim_reg_set_byte_clock(0); dsim_reg_enable_pll(0); } return 0; }
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; }
/* * input parameter * - pll_freq : requested pll frequency * * output parameters * - p, m, s : calculated p, m, s values * - pll_freq : adjusted pll frequency */ static int dsim_reg_calculate_pms(struct dsim_pll_param *pll) { u32 p_div, m_div, s_div; u32 target_freq, fin_pll, voc_out, fout_cal; u32 fin = 24; /* * One clk lane consists of 2 lines. * HS clk freq = line rate X 2 * Here, we calculate the freq of ONE line(fout_cal is the freq of ONE line). * Thus, target_freq = dsim->lcd_info->hs_clk/2. */ dsim_info("requested HS clock is %ld\n", pll->pll_freq); target_freq = pll->pll_freq / 2; target_freq /= MHZ; for (p_div = 1; p_div <= 33; p_div++) { for (m_div = 25; m_div <= 125; m_div++) { for (s_div = 0; s_div <= 3; s_div++) { fin_pll = fin / p_div; voc_out = (m_div * fin) / p_div; fout_cal = (m_div * fin) / (p_div * (1 << s_div)); if ((fin_pll < 6) || (fin_pll > 12)) continue; if ((voc_out < 300) || (voc_out > 750)) continue; if (fout_cal < target_freq) continue; if ((target_freq == fout_cal) && (fout_cal <= 750)) goto calculation_success; } } } for (p_div = 1; p_div <= 33; p_div++) { for (m_div = 25; m_div <= 125; m_div++) { for (s_div = 0; s_div <= 3; s_div++) { fin_pll = fin / p_div; voc_out = (m_div * fin) / p_div; fout_cal = (m_div * fin) / (p_div * (1 << s_div)); if ((fin_pll < 6) || (fin_pll > 12)) continue; if ((voc_out < 300) || (voc_out > 750)) continue; if (fout_cal < target_freq) continue; /* target_freq < fout_cal, here is different from the above */ if ((target_freq < fout_cal) && (fout_cal <= 750)) goto calculation_success; } } } dsim_err("failed to calculate PMS values for DPHY\n"); return -EINVAL; calculation_success: pll->p = p_div; pll->m = m_div; pll->s = s_div; pll->pll_freq = fout_cal * 2 * MHZ; dsim_info("calculated HS clock is %ld. p(%u), m(%u), s(%u)\n", pll->pll_freq, pll->p, pll->m, pll->s); return 0; }
static int s6d7aa0x62_init(struct dsim_device *dsim) { int ret; dsim_info("MDD : %s was called\n", __func__); ret = dsim_write_hl_data(dsim, SEQ_TEST_KEY_ON_F0, ARRAY_SIZE(SEQ_TEST_KEY_ON_F0)); if (ret < 0) { dsim_err("%s : fail to write CMD : SEQ_TEST_KEY_ON_F0\n", __func__); goto init_exit; } ret = dsim_write_hl_data(dsim, SEQ_TEST_KEY_ON_F1, ARRAY_SIZE(SEQ_TEST_KEY_ON_F1)); if (ret < 0) { dsim_err("%s : fail to write CMD : SEQ_TEST_KEY_ON_F1\n", __func__); goto init_exit; } ret = dsim_write_hl_data(dsim, SEQ_TEST_KEY_ON_FC, ARRAY_SIZE(SEQ_TEST_KEY_ON_FC)); if (ret < 0) { dsim_err("%s : fail to write CMD : SEQ_TEST_KEY_ON_FC\n", __func__); goto init_exit; } ret = dsim_write_hl_data(dsim, SEQ_OTP_RELOAD, ARRAY_SIZE(SEQ_OTP_RELOAD)); if (ret < 0) { dsim_err(":%s fail to write CMD : SEQ_OTP_RELOAD\n", __func__); goto init_exit; } #if 0 ret = dsim_read_hl_data(dsim, S6D7AA0X62_ID_REG, S6D7AA0X62_ID_LEN, dsim->priv.id); if (ret != S6D7AA0X62_ID_LEN) { dsim_err("%s : can't find connected panel. check panel connection\n",__func__); } dsim_info("READ ID : "); for(i = 0; i < S6D7AA0X62_ID_LEN; i++) dsim_info("%02x, ", dsim->priv.id[i]); dsim_info("\n"); #else s6d7aa0x62_read_init_info(dsim); #endif ret = dsim_write_hl_data(dsim, SEQ_INIT_1, ARRAY_SIZE(SEQ_INIT_1)); if (ret < 0) { dsim_err(":%s fail to write CMD : SEQ_INIT_1\n", __func__); goto init_exit; } ret = dsim_write_hl_data(dsim, SEQ_INIT_2, ARRAY_SIZE(SEQ_INIT_2)); if (ret < 0) { dsim_err(":%s fail to write CMD : SEQ_INIT_2\n", __func__); goto init_exit; } ret = dsim_write_hl_data(dsim, SEQ_INIT_3, ARRAY_SIZE(SEQ_INIT_3)); if (ret < 0) { dsim_err(":%s fail to write CMD : SEQ_INIT_3\n", __func__); goto init_exit; } ret = dsim_write_hl_data(dsim, SEQ_INIT_4, ARRAY_SIZE(SEQ_INIT_4)); if (ret < 0) { dsim_err(":%s fail to write CMD : SEQ_INIT_4\n", __func__); goto init_exit; } ret = dsim_write_hl_data(dsim, SEQ_INIT_5, ARRAY_SIZE(SEQ_INIT_5)); if (ret < 0) { dsim_err(":%s fail to write CMD : SEQ_INIT_5\n", __func__); goto init_exit; } ret = dsim_write_hl_data(dsim, SEQ_INIT_6, ARRAY_SIZE(SEQ_INIT_6)); if (ret < 0) { dsim_err(":%s fail to write CMD : SEQ_INIT_6\n", __func__); goto init_exit; } ret = dsim_write_hl_data(dsim, SEQ_INIT_7, ARRAY_SIZE(SEQ_INIT_7)); if (ret < 0) { dsim_err(":%s fail to write CMD : SEQ_INIT_7\n", __func__); goto init_exit; } ret = dsim_write_hl_data(dsim, SEQ_INIT_8, ARRAY_SIZE(SEQ_INIT_8)); if (ret < 0) { dsim_err(":%s fail to write CMD : SEQ_INIT_8\n", __func__); goto init_exit; } ret = dsim_write_hl_data(dsim, SEQ_INIT_9, ARRAY_SIZE(SEQ_INIT_9)); if (ret < 0) { dsim_err(":%s fail to write CMD : SEQ_INIT_9\n", __func__); goto init_exit; } ret = dsim_write_hl_data(dsim, SEQ_INIT_10, ARRAY_SIZE(SEQ_INIT_10)); if (ret < 0) { dsim_err(":%s fail to write CMD : SEQ_INIT_10\n", __func__); goto init_exit; } ret = dsim_write_hl_data(dsim, SEQ_INIT_11, ARRAY_SIZE(SEQ_INIT_11)); if (ret < 0) { dsim_err(":%s fail to write CMD : SEQ_INIT_11\n", __func__); goto init_exit; } ret = dsim_write_hl_data(dsim, SEQ_INIT_12, ARRAY_SIZE(SEQ_INIT_12)); if (ret < 0) { dsim_err(":%s fail to write CMD : SEQ_INIT_12\n", __func__); goto init_exit; } ret = dsim_write_hl_data(dsim, SEQ_INIT_13, ARRAY_SIZE(SEQ_INIT_13)); if (ret < 0) { dsim_err(":%s fail to write CMD : SEQ_INIT_13\n", __func__); goto init_exit; } ret = dsim_write_hl_data(dsim, SEQ_INIT_14, ARRAY_SIZE(SEQ_INIT_14)); if (ret < 0) { dsim_err(":%s fail to write CMD : SEQ_INIT_14\n", __func__); goto init_exit; } ret = dsim_write_hl_data(dsim, SEQ_INIT_15, ARRAY_SIZE(SEQ_INIT_15)); if (ret < 0) { dsim_err(":%s fail to write CMD : SEQ_INIT_15\n", __func__); goto init_exit; } ret = dsim_write_hl_data(dsim, SEQ_INIT_16, ARRAY_SIZE(SEQ_INIT_16)); if (ret < 0) { dsim_err(":%s fail to write CMD : SEQ_INIT_16\n", __func__); goto init_exit; } ret = dsim_write_hl_data(dsim, SEQ_INIT_17, ARRAY_SIZE(SEQ_INIT_17)); if (ret < 0) { dsim_err(":%s fail to write CMD : SEQ_INIT_17\n", __func__); goto init_exit; } ret = dsim_write_hl_data(dsim, SEQ_GAMMA_1, ARRAY_SIZE(SEQ_GAMMA_1)); if (ret < 0) { dsim_err(":%s fail to write CMD : SEQ_GAMMA_1\n", __func__); goto init_exit; } ret = dsim_write_hl_data(dsim, SEQ_GAMMA_2, ARRAY_SIZE(SEQ_GAMMA_2)); if (ret < 0) { dsim_err(":%s fail to write CMD : SEQ_GAMMA_2\n", __func__); goto init_exit; } ret = dsim_write_hl_data(dsim, SEQ_SLEEP_OUT, ARRAY_SIZE(SEQ_SLEEP_OUT)); if (ret < 0) { dsim_err(":%s fail to write CMD : SEQ_SLEEP_OUT\n", __func__); goto init_exit; } msleep(120); init_exit: return ret; }
static int s6e3ha0_wqhd_init(struct dsim_device *dsim) { int ret = 0; dsim_info("MDD : %s was called\n", __func__); ret = dsim_write_hl_data(dsim, SEQ_TEST_KEY_ON_F0, ARRAY_SIZE(SEQ_TEST_KEY_ON_F0)); if (ret < 0) { dsim_err("%s : fail to write CMD : SEQ_TEST_KEY_ON_F0\n", __func__); goto init_err; } ret = dsim_write_hl_data(dsim, SEQ_SINGLE_DSI_1, ARRAY_SIZE(SEQ_SINGLE_DSI_1)); if (ret < 0) { dsim_err("%s : fail to write CMD : SEQ_SINGLE_DSI_1\n", __func__); goto init_err; } ret = dsim_write_hl_data(dsim, SEQ_SINGLE_DSI_2, ARRAY_SIZE(SEQ_SINGLE_DSI_2)); if (ret < 0) { dsim_err("%s : fail to write CMD : SEQ_SINGLE_DSI_2\n", __func__); goto init_err; } msleep(5); ret = dsim_write_hl_data(dsim, SEQ_TEST_KEY_ON_FC, ARRAY_SIZE(SEQ_TEST_KEY_ON_FC)); if (ret < 0) { dsim_err(":%s fail to write CMD : SEQ_TEST_KEY_ON_FC\n", __func__); goto init_err; } ret = dsim_write_hl_data(dsim, SEQ_SLEEP_OUT, ARRAY_SIZE(SEQ_SLEEP_OUT)); if (ret < 0) { dsim_err(":%s fail to write CMD : SEQ_TEST_KEY_ON_FC\n", __func__); goto init_err; } msleep(20); /* Common Setting */ ret = dsim_write_hl_data(dsim, SEQ_TOUCH_HSYNC, ARRAY_SIZE(SEQ_TOUCH_HSYNC)); if (ret < 0) { dsim_err(":%s fail to write CMD : SEQ_TOUCH_HSYNC\n", __func__); goto init_err; } ret = dsim_write_hl_data(dsim, SEQ_TOUCH_VSYNC, ARRAY_SIZE(SEQ_TOUCH_VSYNC)); if (ret < 0) { dsim_err(":%s fail to write CMD : SEQ_TOUCH_VSYNC\n", __func__); goto init_err; } ret = dsim_write_hl_data(dsim, SEQ_PENTILE_SETTING, ARRAY_SIZE(SEQ_PENTILE_SETTING)); if (ret < 0) { dsim_err(":%s fail to write CMD : SEQ_PENTILE_SETTING\n", __func__); goto init_err; } ret = dsim_write_hl_data(dsim, SEQ_TE_ON, ARRAY_SIZE(SEQ_TE_ON)); if (ret < 0) { dsim_err(":%s fail to write CMD : SEQ_TE_ON\n", __func__); goto init_err; } msleep(120); ret = dsim_write_hl_data(dsim, SEQ_TEST_KEY_OFF_FC, ARRAY_SIZE(SEQ_TEST_KEY_OFF_FC)); if (ret < 0) { dsim_err(":%s fail to write CMD : SEQ_TEST_KEY_OFF_FC\n", __func__); goto init_err; } #ifndef CONFIG_PANEL_AID_DIMMING /* Brightness Setting */ ret = dsim_write_hl_data(dsim, SEQ_GAMMA_CONDITION_SET, ARRAY_SIZE(SEQ_GAMMA_CONDITION_SET)); if (ret < 0) { dsim_err(":%s fail to write CMD : SEQ_GAMMA_CONDITION_SET\n", __func__); goto init_err; } ret = dsim_write_hl_data(dsim, SEQ_AOR_CONTROL, ARRAY_SIZE(SEQ_AOR_CONTROL)); if (ret < 0) { dsim_err(":%s fail to write CMD : SEQ_AOR_CONTROL\n", __func__); goto init_err; } ret = dsim_write_hl_data(dsim, SEQ_GAMMA_UPDATE, ARRAY_SIZE(SEQ_GAMMA_UPDATE)); if (ret < 0) { dsim_err(":%s fail to write CMD : SEQ_GAMMA_UPDATE\n", __func__); goto init_err; } /* elvss */ ret = dsim_write_hl_data(dsim, SEQ_TSET_GLOBAL, ARRAY_SIZE(SEQ_TSET_GLOBAL)); if (ret < 0) { dsim_err(":%s fail to write CMD : SEQ_TSET_GLOBAL\n", __func__); goto init_err; } ret = dsim_write_hl_data(dsim, SEQ_TSET, ARRAY_SIZE(SEQ_TSET)); if (ret < 0) { dsim_err(":%s fail to write CMD : SEQ_TSET\n", __func__); goto init_err; } ret = dsim_write_hl_data(dsim, SEQ_ELVSS_SET, ARRAY_SIZE(SEQ_ELVSS_SET)); if (ret < 0) { dsim_err(":%s fail to write CMD : SEQ_ELVSS_SET\n", __func__); goto init_err; } /* ACL Setting */ ret = dsim_write_hl_data(dsim, SEQ_ACL_OFF, ARRAY_SIZE(SEQ_ACL_OFF)); if (ret < 0) { dsim_err(":%s fail to write CMD : SEQ_ACL_OFF\n", __func__); goto init_err; } ret = dsim_write_hl_data(dsim, SEQ_ACL_OFF_OPR, ARRAY_SIZE(SEQ_ACL_OFF_OPR)); if (ret < 0) { dsim_err(":%s fail to write CMD : SEQ_ACL_OFF_OPR\n", __func__); goto init_err; } #endif ret = dsim_write_hl_data(dsim, SEQ_TEST_KEY_OFF_F0, ARRAY_SIZE(SEQ_TEST_KEY_OFF_F0)); if (ret < 0) { dsim_err(":%s fail to write CMD : SEQ_TEST_KEY_OFF_F0\n", __func__); goto init_err; } init_err: 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; }
static int s6e3hf2_wqhd_displayon(struct dsim_device *dsim) { dsim_info("%s was called\n", __func__); dsim_panel_on(dsim); return 1; }
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 auto_offset = 0; int prev_index = panel->br_index; bool bIsHbm = (LEVEL_IS_HBM(panel->auto_brightness) && (p_br == panel->bd->props.max_brightness)); bool bIsHbmArea = (LEVEL_IS_HBM_AREA(panel->auto_brightness) && (p_br == panel->bd->props.max_brightness)); #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; } panel->acl_enable = ACL_OPR_15P; if(bIsHbmArea) { auto_offset = 13 - panel->auto_brightness; panel->br_index = MAX_BR_INFO - auto_offset; acutal_br = real_br = get_actual_br_value(dsim, panel->br_index); panel->interpolation = 1; panel->acl_enable = ACL_OPR_8P; goto set_brightness; } else { panel->interpolation = 0; } if (panel->weakness_hbm_comp == HBM_COLORBLIND_ON) 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->caps_enable = CAPS_IS_ON(real_br); if(bIsHbm) { panel->br_index = panel->hbm_index; panel->caps_enable = 1; // hbm is caps on panel->acl_enable = ACL_OPR_8P; } if (real_br > MAX_BRIGHTNESS) { panel->interpolation = 1; } else { panel->interpolation = 0; } if((!bIsHbm) && (p_br == 255)) { if (panel->weakness_hbm_comp == HBM_GALLERY_ON) { panel->acl_enable = ACL_OPR_OFF; } else { 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; } #ifdef AID_INTERPOLATION if (!force && panel->br_index == prev_index) { if (dynamic_lcd_type == LCD_TYPE_S6E3HA2_WQHD) goto set_br_exit; #ifdef CONFIG_LCD_BURNIN_CORRECTION if((panel->ldu_correction_state == 0) && ((panel->weakness_hbm_comp != HBM_COLORBLIND_ON) || (panel->interpolation != 1))) { #else if((panel->weakness_hbm_comp != HBM_COLORBLIND_ON) || (panel->interpolation != 1)) { #endif mutex_lock(&panel->lock); dsim_panel_aid_interpolation(dsim); ret = dsim_write_hl_data(dsim, SEQ_TEST_KEY_ON_F0, ARRAY_SIZE(SEQ_TEST_KEY_ON_F0)); if (ret < 0) { dsim_err("%s : fail to write CMD : SEQ_TEST_KEY_ON_F0\n", __func__); goto set_br_exit; } dsim_panel_set_acl(dsim, 1); ret = dsim_write_hl_data(dsim, SEQ_TEST_KEY_OFF_F0, ARRAY_SIZE(SEQ_TEST_KEY_OFF_F0)); if (ret < 0) { dsim_err("%s : fail to write CMD : SEQ_TEST_KEY_ON_F0\n", __func__); goto set_br_exit; } mutex_unlock(&panel->lock); } goto set_br_exit; } #else if (!force && panel->br_index == prev_index) goto set_br_exit; #endif if ((acutal_br == 0) || (real_br == 0)) goto set_br_exit; set_brightness: dsim_info("%s : platform : %d, : mapping : %d, real : %d, index : %d, interpolation : %d\n", __func__, p_br, acutal_br, real_br, panel->br_index+1, panel->interpolation); 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; } #ifdef CONFIG_LCD_HMT #ifdef CONFIG_PANEL_AID_DIMMING static unsigned char *get_gamma_from_index_for_hmt(struct dsim_device *dsim, int index) { struct panel_private *panel = &dsim->priv; struct SmtDimInfo *dimming_info = (struct SmtDimInfo *)panel->hmt_dim_info; if (dimming_info == NULL) { dsim_err("%s : dimming info is NULL\n", __func__); goto get_gamma_err; } if (index > HMT_MAX_BR_INFO - 1) index = HMT_MAX_BR_INFO - 1; return (unsigned char *)dimming_info[index].gamma; get_gamma_err: return NULL; } static unsigned char *get_aid_from_index_for_hmt(struct dsim_device *dsim, int index) { struct panel_private *panel = &dsim->priv; struct SmtDimInfo *dimming_info = (struct SmtDimInfo *)panel->hmt_dim_info; if (dimming_info == NULL) { dsim_err("%s : dimming info is NULL\n", __func__); goto get_aid_err; } if (index > HMT_MAX_BR_INFO - 1) index = HMT_MAX_BR_INFO - 1; return (u8 *)dimming_info[index].aid; get_aid_err: return NULL; } static unsigned char *get_elvss_from_index_for_hmt(struct dsim_device *dsim, int index, int caps) { struct panel_private *panel = &dsim->priv; struct SmtDimInfo *dimming_info = (struct SmtDimInfo *)panel->hmt_dim_info; if (dimming_info == NULL) { dsim_err("%s : dimming info is NULL\n", __func__); goto get_elvess_err; } if(caps) return (unsigned char *)dimming_info[index].elvCaps; else return (unsigned char *)dimming_info[index].elv; get_elvess_err: return NULL; } static void dsim_panel_gamma_ctrl_for_hmt(struct dsim_device *dsim) { u8 *gamma = NULL; gamma = get_gamma_from_index_for_hmt(dsim, dsim->priv.hmt_br_index); if (gamma == NULL) { dsim_err("%s :faied to get gamma\n", __func__); return; } if (dsim_write_hl_data(dsim, gamma, GAMMA_CMD_CNT) < 0) dsim_err("%s : failed to write hmt gamma \n", __func__); }
static int s6e3hf2_wqhd_suspend(struct dsim_device *dsim) { dsim_info("%s was called\n", __func__); dsim_panel_suspend(dsim); return 0; }
static int s6e3hf2_wqhd_resume(struct dsim_device *dsim) { dsim_info("%s was called\n", __func__); return 0; }