static int mdss_dsi_event_handler(struct mdss_panel_data *pdata, int event, void *arg) { int rc = 0; struct mdss_dsi_ctrl_pdata *ctrl_pdata = NULL; if (pdata == NULL) { pr_err("%s: Invalid input data\n", __func__); return -EINVAL; } ctrl_pdata = container_of(pdata, struct mdss_dsi_ctrl_pdata, panel_data); pr_debug("%s+:event=%d\n", __func__, event); switch (event) { case MDSS_EVENT_UNBLANK: lcd_notifier_call_chain(LCD_EVENT_ON_START, NULL); rc = mdss_dsi_on(pdata); mdss_dsi_op_mode_config(pdata->panel_info.mipi.mode, pdata); if (ctrl_pdata->on_cmds.link_state == DSI_LP_MODE) rc = mdss_dsi_unblank(pdata); break; case MDSS_EVENT_PANEL_ON: ctrl_pdata->ctrl_state |= CTRL_STATE_MDP_ACTIVE; if (ctrl_pdata->on_cmds.link_state == DSI_HS_MODE) rc = mdss_dsi_unblank(pdata); lcd_notifier_call_chain(LCD_EVENT_ON_END, NULL); break; case MDSS_EVENT_BLANK: lcd_notifier_call_chain(LCD_EVENT_OFF_START, NULL); if (ctrl_pdata->off_cmds.link_state == DSI_HS_MODE) rc = mdss_dsi_blank(pdata); break; case MDSS_EVENT_PANEL_OFF: ctrl_pdata->ctrl_state &= ~CTRL_STATE_MDP_ACTIVE; if (ctrl_pdata->off_cmds.link_state == DSI_LP_MODE) rc = mdss_dsi_blank(pdata); rc = mdss_dsi_off(pdata); lcd_notifier_call_chain(LCD_EVENT_OFF_END, NULL); break; case MDSS_EVENT_CONT_SPLASH_FINISH: ctrl_pdata->ctrl_state &= ~CTRL_STATE_MDP_ACTIVE; if (ctrl_pdata->on_cmds.link_state == DSI_LP_MODE) { rc = mdss_dsi_cont_splash_on(pdata); } else { pr_debug("%s:event=%d, Dsi On not called: ctrl_state: %d\n", __func__, event, ctrl_pdata->on_cmds.link_state); rc = -EINVAL; } break; case MDSS_EVENT_PANEL_CLK_CTRL: mdss_dsi_clk_req(ctrl_pdata, (int)arg); break; case MDSS_EVENT_DSI_CMDLIST_KOFF: ctrl_pdata->recovery = (struct mdss_panel_recovery *)arg; mdss_dsi_cmdlist_commit(ctrl_pdata, 1); break; case MDSS_EVENT_CONT_SPLASH_BEGIN: if (ctrl_pdata->off_cmds.link_state == DSI_HS_MODE) { /* Panel is Enabled in Bootloader */ rc = mdss_dsi_blank(pdata); } break; default: pr_debug("%s: unhandled event=%d\n", __func__, event); break; } pr_debug("%s-:event=%d, rc=%d\n", __func__, event, rc); return rc; }
static int mdss_dsi_event_handler(struct mdss_panel_data *pdata, int event, void *arg) { int rc = 0; struct mdss_dsi_ctrl_pdata *ctrl_pdata = NULL; if (pdata == NULL) { pr_err("%s: Invalid input data\n", __func__); return -EINVAL; } ctrl_pdata = container_of(pdata, struct mdss_dsi_ctrl_pdata, panel_data); pr_debug("%s+:event=%d\n", __func__, event); #ifdef CONFIG_MACH_LGE if (pdata_base == NULL) { if(ctrl_pdata->shared_pdata.broadcast_enable) pdata_base = pdata->next; else pdata_base = pdata; } #endif switch (event) { case MDSS_EVENT_UNBLANK: lcd_notifier_call_chain(LCD_EVENT_ON_START); rc = mdss_dsi_on(pdata); mdss_dsi_op_mode_config(pdata->panel_info.mipi.mode, pdata); if (ctrl_pdata->on_cmds.link_state == DSI_LP_MODE) rc = mdss_dsi_unblank(pdata); break; case MDSS_EVENT_PANEL_ON: ctrl_pdata->ctrl_state |= CTRL_STATE_MDP_ACTIVE; if (ctrl_pdata->on_cmds.link_state == DSI_HS_MODE) rc = mdss_dsi_unblank(pdata); lcd_notifier_call_chain(LCD_EVENT_ON_END); break; case MDSS_EVENT_BLANK: lcd_notifier_call_chain(LCD_EVENT_OFF_START); if (ctrl_pdata->off_cmds.link_state == DSI_HS_MODE) rc = mdss_dsi_blank(pdata); break; case MDSS_EVENT_PANEL_OFF: ctrl_pdata->ctrl_state &= ~CTRL_STATE_MDP_ACTIVE; if (ctrl_pdata->off_cmds.link_state == DSI_LP_MODE) rc = mdss_dsi_blank(pdata); rc = mdss_dsi_off(pdata); lcd_notifier_call_chain(LCD_EVENT_OFF_END); break; case MDSS_EVENT_CONT_SPLASH_FINISH: ctrl_pdata->ctrl_state &= ~CTRL_STATE_MDP_ACTIVE; if (ctrl_pdata->on_cmds.link_state == DSI_LP_MODE) { rc = mdss_dsi_cont_splash_on(pdata); } else { pr_debug("%s:event=%d, Dsi On not called: ctrl_state: %d\n", __func__, event, ctrl_pdata->on_cmds.link_state); rc = -EINVAL; } break; case MDSS_EVENT_PANEL_CLK_CTRL: mdss_dsi_clk_req(ctrl_pdata, (int)arg); break; case MDSS_EVENT_DSI_CMDLIST_KOFF: ctrl_pdata->recovery = (struct mdss_panel_recovery *)arg; mdss_dsi_cmdlist_commit(ctrl_pdata, 1); break; case MDSS_EVENT_PANEL_UPDATE_FPS: if (arg != NULL) { rc = mdss_dsi_dfps_config(pdata, (int)arg); pr_debug("%s:update fps to = %d\n", __func__, (int)arg); } break; case MDSS_EVENT_CONT_SPLASH_BEGIN: if (ctrl_pdata->off_cmds.link_state == DSI_HS_MODE) { /* Panel is Enabled in Bootloader */ rc = mdss_dsi_blank(pdata); } break; case MDSS_EVENT_ENABLE_PARTIAL_UPDATE: rc = mdss_dsi_ctl_partial_update(pdata); break; #ifdef CONFIG_LGE_SHARPENING case MDSS_EVENT_SET_SHARPENING: rc = ctrl_pdata->set_sharpening(ctrl_pdata, (int) arg, NULL); break; case MDSS_EVENT_GET_SHARPENING: rc = ctrl_pdata->get_sharpening(ctrl_pdata); break; case MDSS_EVENT_QUEUE_SHARPENING: rc = ctrl_pdata->queue_sharpening(ctrl_pdata, (int) arg); break; #endif default: pr_debug("%s: unhandled event=%d\n", __func__, event); break; } pr_debug("%s-:event=%d, rc=%d\n", __func__, event, rc); return rc; }
static int mipi_dsi_off(struct platform_device *pdev) { int ret = 0; struct msm_fb_data_type *mfd; struct msm_panel_info *pinfo; uint32 dsi_ctrl; #ifdef CONFIG_FB_MSM_LCD_NOTIFY lcd_notifier_call_chain(LCD_EVENT_OFF_START, NULL); #endif pr_debug("%s+:\n", __func__); mfd = platform_get_drvdata(pdev); pinfo = &mfd->panel_info; if (mdp_rev >= MDP_REV_41) mutex_lock(&mfd->dma->ov_mutex); else down(&mfd->dma->mutex); if (mfd->panel_info.type == MIPI_CMD_PANEL) { mipi_dsi_prepare_clocks(); mipi_dsi_ahb_ctrl(1); mipi_dsi_clk_enable(); /* make sure dsi_cmd_mdp is idle */ mipi_dsi_cmd_mdp_busy(); } /* * Desctiption: change to DSI_CMD_MODE since it needed to * tx DCS dsiplay off comamnd to panel * mipi_dsi_op_mode_config(DSI_CMD_MODE); */ if (mfd->panel_info.type == MIPI_CMD_PANEL) { if (pinfo->lcd.vsync_enable) { if (pinfo->lcd.hw_vsync_mode && vsync_gpio >= 0) { if (MDP_REV_303 != mdp_rev) gpio_free(vsync_gpio); } mipi_dsi_set_tear_off(mfd); } } ret = panel_next_off(pdev); spin_lock_bh(&dsi_clk_lock); mipi_dsi_clk_disable(); /* disbale dsi engine */ dsi_ctrl = MIPI_INP(MIPI_DSI_BASE + 0x0000); dsi_ctrl &= ~0x01; MIPI_OUTP(MIPI_DSI_BASE + 0x0000, dsi_ctrl); MIPI_OUTP(MIPI_DSI_BASE + 0x010c, 0); /* DSI_INTL_CTRL */ MDP_OUTP(MDP_BASE + DSI_VIDEO_BASE, 0); mipi_dsi_phy_ctrl(0); mipi_dsi_ahb_ctrl(0); spin_unlock_bh(&dsi_clk_lock); mipi_dsi_unprepare_clocks(); usleep(5000); #if defined (CONFIG_MIPI_DSI_RESET_LP11) if (mipi_dsi_pdata && mipi_dsi_pdata->active_reset) mipi_dsi_pdata->active_reset(0); /* low */ #endif usleep(2000); /*1ms delay(minimum) required between reset low and AVDD off*/ #if defined(CONFIG_SUPPORT_SECOND_POWER) if (mipi_dsi_pdata && mipi_dsi_pdata->panel_power_save) mipi_dsi_pdata->panel_power_save(0); #endif if (mipi_dsi_pdata && mipi_dsi_pdata->dsi_power_save) mipi_dsi_pdata->dsi_power_save(0); if (mdp_rev >= MDP_REV_41) mutex_unlock(&mfd->dma->ov_mutex); else up(&mfd->dma->mutex); #ifdef CONFIG_FB_MSM_LCD_NOTIFY lcd_notifier_call_chain(LCD_EVENT_OFF_END, NULL); #endif pr_debug("%s-:\n", __func__); return ret; }
static int mipi_dsi_on(struct platform_device *pdev) { int ret = 0; u32 clk_rate; struct msm_fb_data_type *mfd; struct fb_info *fbi; struct fb_var_screeninfo *var; struct msm_panel_info *pinfo; struct mipi_panel_info *mipi; u32 hbp, hfp, vbp, vfp, hspw, vspw, width, height; u32 ystride, bpp, data; u32 dummy_xres, dummy_yres; int target_type = 0; u32 tmp; #if defined(CONFIG_FB_MSM_MIPI_RENESAS_TFT_VIDEO_FULL_HD_PT_PANEL) static int is_booting = 1; #endif #ifdef CONFIG_FB_MSM_LCD_NOTIFY lcd_notifier_call_chain(LCD_EVENT_ON_START, NULL); #endif pr_debug("%s+:\n", __func__); #if defined(CONFIG_MIPI_SAMSUNG_ESD_REFRESH) || defined(CONFIG_ESD_ERR_FG_RECOVERY) pdev_for_esd = pdev; #endif #if defined (CONFIG_FB_MSM_MIPI_SAMSUNG_OLED_VIDEO_QHD_PT) if (get_lcd_attached() == 0) return ENODEV; #endif mfd = platform_get_drvdata(pdev); fbi = mfd->fbi; var = &fbi->var; pinfo = &mfd->panel_info; esc_byte_ratio = pinfo->mipi.esc_byte_ratio; if (mipi_dsi_pdata && mipi_dsi_pdata->power_common) mipi_dsi_pdata->power_common(); #if defined(CONFIG_SUPPORT_SECOND_POWER) #if defined(CONFIG_FB_MSM_MIPI_RENESAS_TFT_VIDEO_FULL_HD_PT_PANEL) if( is_booting == 1 ) { is_booting = 0; #if defined(CONFIG_MACH_JACTIVE_ATT) || defined(CONFIG_MACH_JACTIVE_EUR) usleep(5000); if (mipi_dsi_pdata && mipi_dsi_pdata->active_reset) mipi_dsi_pdata->active_reset(0); /* low */ usleep(2000); if (mipi_dsi_pdata && mipi_dsi_pdata->panel_power_save) mipi_dsi_pdata->panel_power_save(0); msleep(10); #endif } #endif if (mipi_dsi_pdata && mipi_dsi_pdata->panel_power_save) mipi_dsi_pdata->panel_power_save(1); #endif #if !defined(CONFIG_SEC_PRODUCT_8930) && !defined(CONFIG_SEC_PRODUCT_8960) if (system_rev == 6) mdelay(500); #endif if (mipi_dsi_pdata && mipi_dsi_pdata->dsi_power_save) mipi_dsi_pdata->dsi_power_save(1); cont_splash_clk_ctrl(0); mipi_dsi_prepare_clocks(); mipi_dsi_ahb_ctrl(1); clk_rate = mfd->fbi->var.pixclock; clk_rate = min(clk_rate, mfd->panel_info.clk_max); mipi_dsi_phy_ctrl(1); if (mdp_rev == MDP_REV_42 && mipi_dsi_pdata) target_type = mipi_dsi_pdata->target_type; mipi_dsi_phy_init(0, &(mfd->panel_info), target_type); mipi_dsi_clk_enable(); #if defined(CONFIG_FB_MSM_MIPI_SAMSUNG_OLED_VIDEO_QHD_PT_PANEL) mipi_dsi_configure_dividers(60); #endif MIPI_OUTP(MIPI_DSI_BASE + 0x114, 1); MIPI_OUTP(MIPI_DSI_BASE + 0x114, 0); hbp = var->left_margin; hfp = var->right_margin; vbp = var->upper_margin; vfp = var->lower_margin; hspw = var->hsync_len; vspw = var->vsync_len; width = mfd->panel_info.xres; height = mfd->panel_info.yres; mipi = &mfd->panel_info.mipi; if (mfd->panel_info.type == MIPI_VIDEO_PANEL) { dummy_xres = mfd->panel_info.lcdc.xres_pad; dummy_yres = mfd->panel_info.lcdc.yres_pad; if (mdp_rev >= MDP_REV_41) { MIPI_OUTP(MIPI_DSI_BASE + 0x20, ((hspw + hbp + width + dummy_xres) << 16 | (hspw + hbp))); MIPI_OUTP(MIPI_DSI_BASE + 0x24, ((vspw + vbp + height + dummy_yres) << 16 | (vspw + vbp))); MIPI_OUTP(MIPI_DSI_BASE + 0x28, (vspw + vbp + height + dummy_yres + vfp - 1) << 16 | (hspw + hbp + width + dummy_xres + hfp - 1)); } else { /* DSI_LAN_SWAP_CTRL */ MIPI_OUTP(MIPI_DSI_BASE + 0x00ac, mipi->dlane_swap); MIPI_OUTP(MIPI_DSI_BASE + 0x20, ((hbp + width + dummy_xres) << 16 | (hbp))); MIPI_OUTP(MIPI_DSI_BASE + 0x24, ((vbp + height + dummy_yres) << 16 | (vbp))); MIPI_OUTP(MIPI_DSI_BASE + 0x28, (vbp + height + dummy_yres + vfp) << 16 | (hbp + width + dummy_xres + hfp)); } MIPI_OUTP(MIPI_DSI_BASE + 0x2c, (hspw << 16)); MIPI_OUTP(MIPI_DSI_BASE + 0x30, 0); MIPI_OUTP(MIPI_DSI_BASE + 0x34, (vspw << 16)); } else { /* command mode */ if (mipi->dst_format == DSI_CMD_DST_FORMAT_RGB888) bpp = 3; else if (mipi->dst_format == DSI_CMD_DST_FORMAT_RGB666) bpp = 3; else if (mipi->dst_format == DSI_CMD_DST_FORMAT_RGB565) bpp = 2; else bpp = 3; /* Default format set to RGB888 */ ystride = width * bpp + 1; /* DSI_COMMAND_MODE_MDP_STREAM_CTRL */ data = (ystride << 16) | (mipi->vc << 8) | DTYPE_DCS_LWRITE; MIPI_OUTP(MIPI_DSI_BASE + 0x5c, data); MIPI_OUTP(MIPI_DSI_BASE + 0x54, data); /* DSI_COMMAND_MODE_MDP_STREAM_TOTAL */ data = height << 16 | width; MIPI_OUTP(MIPI_DSI_BASE + 0x60, data); MIPI_OUTP(MIPI_DSI_BASE + 0x58, data); } mipi_dsi_host_init(mipi); #if defined(CONFIG_FB_MSM_MIPI_SAMSUNG_OLED_VIDEO_HD_PT_PANEL) { u32 tmp_reg0c, tmp_rega8; udelay(200); /* backup register values */ tmp_reg0c = MIPI_INP(MIPI_DSI_BASE + 0x000c); tmp_rega8 = MIPI_INP(MIPI_DSI_BASE + 0xA8); /* Clear HS mode assertion and related flags */ MIPI_OUTP(MIPI_DSI_BASE + 0x0c, 0x8000); MIPI_OUTP(MIPI_DSI_BASE + 0xA8, 0x0); wmb(); mdelay(10); if (mipi_dsi_pdata && mipi_dsi_pdata->lcd_rst_up) mipi_dsi_pdata->lcd_rst_up(); /* restore previous values */ MIPI_OUTP(MIPI_DSI_BASE + 0x0c, tmp_reg0c); MIPI_OUTP(MIPI_DSI_BASE + 0xa8, tmp_rega8); wmb(); } #else msleep(10); #if defined (CONFIG_MIPI_DSI_RESET_LP11) /* LP11 */ tmp = MIPI_INP(MIPI_DSI_BASE + 0xA8); tmp &= ~(1<<28); MIPI_OUTP(MIPI_DSI_BASE + 0xA8, tmp); wmb(); /* LP11 */ usleep(5000); if (mipi_dsi_pdata && mipi_dsi_pdata->active_reset) mipi_dsi_pdata->active_reset(1); /* high */ usleep(10000); #endif #if defined(CONFIG_MACH_LT02_SPR) || defined(CONFIG_MACH_LT02_ATT) || defined(CONFIG_MACH_LT02_TMO) if(system_rev) ret = panel_next_on(pdev); #elif defined(CONFIG_MACH_LT02_CHN_CTC) ret = panel_next_on(pdev); #endif #endif /* always high */ if (mipi->force_clk_lane_hs) { tmp = MIPI_INP(MIPI_DSI_BASE + 0xA8); tmp |= (1<<28); MIPI_OUTP(MIPI_DSI_BASE + 0xA8, tmp); wmb(); } if (mdp_rev >= MDP_REV_41) mutex_lock(&mfd->dma->ov_mutex); else down(&mfd->dma->mutex); #if !defined(CONFIG_MACH_LT02_CHN_CTC) #if defined(CONFIG_MACH_LT02_SPR) || defined(CONFIG_MACH_LT02_ATT) || defined(CONFIG_MACH_LT02_TMO) if(!system_rev) ret = panel_next_on(pdev); #else ret = panel_next_on(pdev); #endif #endif mipi_dsi_op_mode_config(mipi->mode); if (mfd->panel_info.type == MIPI_CMD_PANEL) { if (pinfo->lcd.vsync_enable) { if (pinfo->lcd.hw_vsync_mode && vsync_gpio >= 0) { if (mdp_rev >= MDP_REV_41) { if (gpio_request(vsync_gpio, "MDP_VSYNC") == 0) gpio_direction_input( vsync_gpio); else pr_err("%s: unable to \ request gpio=%d\n", __func__, vsync_gpio); } else if (mdp_rev == MDP_REV_303) { if (!tlmm_settings && gpio_request( vsync_gpio, "MDP_VSYNC") == 0) { ret = gpio_tlmm_config( GPIO_CFG( vsync_gpio, 1, GPIO_CFG_INPUT, GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), GPIO_CFG_ENABLE); if (ret) { pr_err( "%s: unable to config \ tlmm = %d\n", __func__, vsync_gpio); } tlmm_settings = TRUE; gpio_direction_input( vsync_gpio); } else { if (!tlmm_settings) { pr_err( "%s: unable to request \ gpio=%d\n", __func__, vsync_gpio); } } }
static int mdss_dsi_event_handler(struct mdss_panel_data *pdata, int event, void *arg) { int rc = 0; struct mdss_dsi_ctrl_pdata *ctrl_pdata = NULL; if (pdata == NULL) { pr_err("%s: Invalid input data\n", __func__); return -EINVAL; } ctrl_pdata = container_of(pdata, struct mdss_dsi_ctrl_pdata, panel_data); pr_debug("%s+:event=%d\n", __func__, event); switch (event) { case MDSS_EVENT_UNBLANK: lcd_notifier_call_chain(LCD_EVENT_ON_START, NULL); rc = mdss_dsi_on(pdata); if (ctrl_pdata->on_cmds.link_state == DSI_LP_MODE) rc = mdss_dsi_unblank(pdata); break; case MDSS_EVENT_PANEL_ON: ctrl_pdata->ctrl_state |= CTRL_STATE_MDP_ACTIVE; if (ctrl_pdata->on_cmds.link_state == DSI_HS_MODE) rc = mdss_dsi_unblank(pdata); lcd_notifier_call_chain(LCD_EVENT_ON_END, NULL); break; case MDSS_EVENT_BLANK: if (ctrl_pdata->off_cmds.link_state == DSI_HS_MODE) rc = mdss_dsi_blank(pdata); break; case MDSS_EVENT_PANEL_OFF: ctrl_pdata->ctrl_state &= ~CTRL_STATE_MDP_ACTIVE; if (ctrl_pdata->off_cmds.link_state == DSI_LP_MODE) rc = mdss_dsi_blank(pdata); rc = mdss_dsi_off(pdata); lcd_notifier_call_chain(LCD_EVENT_OFF_END, NULL); break; case MDSS_EVENT_CONT_SPLASH_FINISH: ctrl_pdata->ctrl_state &= ~CTRL_STATE_MDP_ACTIVE; if (ctrl_pdata->on_cmds.link_state == DSI_LP_MODE) { rc = mdss_dsi_cont_splash_on(pdata); } else { pr_debug("%s:event=%d, Dsi On not called: ctrl_state: %d\n", __func__, event, ctrl_pdata->on_cmds.link_state); rc = -EINVAL; } break; #ifdef CONFIG_OLED_SUPPORT case MDSS_EVENT_FIRST_FRAME_UPDATE: /*Event is send only if cont_splash feature is enabled */ if (ctrl_pdata->off_cmds.link_state == DSI_HS_MODE) { /* Panel is Enabled already in Bootloader */ ctrl_pdata->ctrl_state |= CTRL_STATE_PANEL_INIT; rc = mdss_dsi_blank(pdata); } break; #endif case MDSS_EVENT_PANEL_CLK_CTRL: mdss_dsi_clk_req(ctrl_pdata, (int)arg); break; case MDSS_EVENT_DSI_CMDLIST_KOFF: mdss_dsi_cmdlist_commit(ctrl_pdata, 1); break; case MDSS_EVENT_CONT_SPLASH_BEGIN: if (ctrl_pdata->off_cmds.link_state == DSI_HS_MODE) { /* Panel is Enabled in Bootloader */ rc = mdss_dsi_blank(pdata); } break; default: pr_debug("%s: unhandled event=%d\n", __func__, event); break; } pr_debug("%s-:event=%d, rc=%d\n", __func__, event, rc); return rc; }