Example #1
0
void disp_ext_refresh_seq( struct msm_fb_data_type *mfd, unsigned int cmd )
{
	struct msm_fb_data_type *mipi_novatek_wxga_mfd;

    DISP_LOCAL_LOG_EMERG("DISP disp_ext_refresh_seq S\n");

#ifndef CONFIG_FB_MSM_MIPI_DSI_RENESAS_CM
	mipi_novatek_wxga_mfd = mipi_novatek_wxga_get_mfd();
#else
	mipi_novatek_wxga_mfd = mipi_renesas_cm_get_mfd();
#endif
	if( mipi_novatek_wxga_mfd == NULL ) {
		pr_debug("%s:bot found device\n", __func__);
		return;
	}
	if( disp_ext_reflesh_get_start() != 1 ) {
		DISP_LOCAL_LOG_EMERG("%s:refresh not start\n", __func__);
		return;
	}

#ifndef CONFIG_FB_MSM_MIPI_DSI_RENESAS_CM
	mdp4_dsi_cmd_dma_busy_wait(mipi_novatek_wxga_mfd);
	mdp4_dsi_blt_dmap_busy_wait(mipi_novatek_wxga_mfd);
	mipi_dsi_mdp_busy_wait(mipi_novatek_wxga_mfd);
#else
	mdp4_dsi_cmd_busy();
	mipi_dsi_mdp_busy_wait();
#endif

	if( cmd == MIPI_REFREH_SEQ_ALL ) {
		mdp4_dsi_clock_mod();
        disp_ext_refresh_te_monitor_timer_release();
        disp_ext_reflesh_set_start(0);
#ifndef CONFIG_FB_MSM_MIPI_DSI_RENESAS_CM
		mipi_set_tx_power_mode(1);
		mipi_novatek_wxga_initial_sequence( mipi_novatek_wxga_mfd );
		mipi_set_tx_power_mode(0);
		mipi_novatek_wxga_display_direction_sequence( mipi_novatek_wxga_mfd );
        mdp4_dsi_refresh_screen_at_once( mfd );
		mipi_novatek_wxga_display_on_sequence( mipi_novatek_wxga_mfd );
#else
		mipi_renesas_cm_refresh_exec( mipi_novatek_wxga_mfd );
#endif		
		disp_ext_reflesh_set_sw(0);
        disp_ext_reflesh_set_start(1);
        disp_ext_reflesh_before_te_run_count_init();
        disp_ext_refresh_te_monitor_timer_set();
	}

    DISP_LOCAL_LOG_EMERG("DISP disp_ext_refresh_seq E\n");
}
static void sending_tune_cmd(char *src, int len)
{
	struct msm_fb_data_type *mfd = NULL;

	int data_pos;
	int cmd_step;
	int cmd_pos;

	cmd_step = 0;
	cmd_pos = 0;

	for (data_pos = 0; data_pos < len;) {
		if (*(src + data_pos) == '0') {
			if (*(src + data_pos + 1) == 'x') {
				if (!cmd_step) {
					mdni_tuning1[cmd_pos] =
					char_to_dec(*(src + data_pos + 2),
							*(src + data_pos + 3));
				} else {
					mdni_tuning2[cmd_pos] =
					char_to_dec(*(src + data_pos + 2),
							*(src + data_pos + 3));
				}

				data_pos += 3;
				cmd_pos++;

				if (cmd_pos == TUNE_FIRST_SIZE && !cmd_step) {
					cmd_pos = 0;
					cmd_step = 1;
				}
			} else
				data_pos++;
		} else {
			data_pos++;
		}
	}

/*
	printk(KERN_INFO "\n");
	for (data_pos = 0; data_pos < TUNE_FIRST_SIZE ; data_pos++)
		printk(KERN_INFO "0x%x ", mdni_tuning1[data_pos]);
	printk(KERN_INFO "\n");
	for (data_pos = 0; data_pos < TUNE_SECOND_SIZE ; data_pos++)
		printk(KERN_INFO"0x%x ", mdni_tuning2[data_pos]);
	printk(KERN_INFO "\n");
*/
	mfd = platform_get_drvdata(msd.msm_pdev);
	if (unlikely(!mfd))
		return;
	if (unlikely(mfd->key != MFD_KEY))
		return;

	mutex_lock(&dsi_tx_mutex);

	mipi_dsi_mdp_busy_wait();
	mipi_dsi_cmds_tx(&msd.samsung_tx_buf, mdni_tune_cmd,
						ARRAY_SIZE(mdni_tune_cmd));
	mutex_unlock(&dsi_tx_mutex);
}
Example #3
0
static void set_pmic_backlight(struct msm_fb_data_type *mfd)
{

	char led_pwm2[2] = {0x51, 0x1E}; /* DTYPE_DCS_WRITE1 */
	struct dsi_cmd_desc novatek_cmd_backlight_cmds2[] = {
		{DTYPE_DCS_LWRITE, 1, 0, 0, 1, sizeof(led_pwm2), led_pwm2},
	};
	led_pwm2[1] = (unsigned char)(mfd->bl_level);
	printk("%s bl_level = %d\n", __func__, mfd->bl_level);

	mutex_lock(&mfd->dma->ov_mutex);
	
	/* mdp4_dsi_cmd_busy_wait: will turn on dsi clock also */
	mdp4_dsi_cmd_dma_busy_wait(mfd);
	
	mdp4_dsi_blt_dmap_busy_wait(mfd);

	mipi_dsi_mdp_busy_wait(mfd);
	
	printk("@@@@@@@@@@@@@@@@@@@@led_pwm2[1] =%x\n",led_pwm2[1] );
	mipi_dsi_cmds_tx(&nt35516_tx_buf, novatek_cmd_backlight_cmds2,
			ARRAY_SIZE(novatek_cmd_backlight_cmds2));
	mutex_unlock(&mfd->dma->ov_mutex);
	return;

}
Example #4
0
static void clk_ctrl_work(struct work_struct *work)
{
    unsigned long flags;
    struct vsycn_ctrl *vctrl =
        container_of(work, typeof(*vctrl), clk_work);

#if defined(PANTECH_LCD_WFD_CONNECTION_FAIL_ON_CMDMODE)
    //shkwak 20130114, when using wfd, make clk_ctrl_work() does not control clk, for temporary
    if(get_wfd_info())
        return;
#endif

    mutex_lock(&vctrl->update_lock);
    spin_lock_irqsave(&vctrl->spin_lock, flags);
    if (vctrl->clk_control && vctrl->clk_enabled) {
        vsync_irq_disable(INTR_PRIMARY_RDPTR, MDP_PRIM_RDPTR_TERM);
        vctrl->clk_enabled = 0;
        vctrl->clk_control = 0;
        spin_unlock_irqrestore(&vctrl->spin_lock, flags);
        /* make sure dsi link is idle */
        mipi_dsi_mdp_busy_wait();
        mipi_dsi_clk_cfg(0);
        mdp_clk_ctrl(0);
        pr_debug("%s: SET_CLK_OFF, pid=%d\n", __func__, current->pid);
    } else {
        spin_unlock_irqrestore(&vctrl->spin_lock, flags);
    }
    mutex_unlock(&vctrl->update_lock);
}
Example #5
0
void acl_contol(struct msm_fb_data_type *mfd, int state)
{
	mutex_lock(&mfd->dma->ov_mutex);	

	mdp4_dsi_cmd_dma_busy_wait(mfd);
	mdp4_dsi_blt_dmap_busy_wait(mfd);
	mipi_dsi_mdp_busy_wait(mfd);

	mipi_set_tx_power_mode(0);

	if(state == true){
		mipi_dsi_cmds_tx(mfd, &oscar_tx_buf, oscar_acl_on,
							ARRAY_SIZE(oscar_acl_on));
		oscar_state.acl_flag = true;
	}
	else{ 
		mipi_dsi_cmds_tx(mfd, &oscar_tx_buf, oscar_acl_off,
							ARRAY_SIZE(oscar_acl_off));
		oscar_state.acl_flag = false;
	}

	mipi_set_tx_power_mode(1);	
	mutex_unlock(&mfd->dma->ov_mutex);
	printk(KERN_WARNING"mipi_oscar_lcd_ACL = %d\n",state);
}
Example #6
0
static void ville_display_on(struct msm_fb_data_type *mfd)
{
	printk(KERN_INFO "%s ++\n", __func__);
	mutex_lock(&mfd->dma->ov_mutex);



	if (mfd->panel_info.type == MIPI_CMD_PANEL) {
		mdp4_dsi_cmd_dma_busy_wait(mfd);
		mdp4_dsi_blt_dmap_busy_wait(mfd);
		mipi_dsi_mdp_busy_wait(mfd);
	}

	if (panel_type == PANEL_ID_VILLE_SAMSUNG_SG || panel_type == PANEL_ID_VILLE_SAMSUNG_SG_C2)
		mipi_dsi_cmds_tx(mfd, &ville_panel_tx_buf, samsung_display_on_cmds,
			ARRAY_SIZE(samsung_display_on_cmds));
	else if (panel_type == PANEL_ID_VILLE_AUO)
		mipi_dsi_cmds_tx(mfd, &ville_panel_tx_buf, samsung_display_on_cmds,
			ARRAY_SIZE(auo_display_on_cmds));

	cur_bl_level = 0;

	if (acl_enable) {
		mipi_dsi_cmds_tx(mfd, &ville_panel_tx_buf, samsung_acl_on_cmd,
			ARRAY_SIZE(samsung_acl_on_cmd));
		acl_enable = 1;
		PR_DISP_INFO("%s acl enable", __func__);
	}
	mutex_unlock(&mfd->dma->ov_mutex);
	printk(KERN_INFO "%s --\n", __func__);
}
void mdp4_dsi_cmd_overlay_kickoff(struct msm_fb_data_type *mfd,
				struct mdp4_overlay_pipe *pipe)
{
	unsigned long flag;


	/* change mdp clk */
	mdp4_set_perf_level();

	mipi_dsi_mdp_busy_wait(mfd);

	if (dsi_pipe->blt_addr == 0)
		mipi_dsi_cmd_mdp_start();

	mdp4_overlay_dsi_state_set(ST_DSI_PLAYING);

	spin_lock_irqsave(&mdp_spin_lock, flag);
	mdp_enable_irq(MDP_OVERLAY0_TERM);
	mfd->dma->busy = TRUE;
	if (dsi_pipe->blt_addr)
		mfd->dma->dmap_busy = TRUE;
	/* start OVERLAY pipe */
	spin_unlock_irqrestore(&mdp_spin_lock, flag);
	mdp_pipe_kickoff(MDP_OVERLAY0_TERM, mfd);
	mdp4_stat.kickoff_ov0++;
}
Example #8
0
void acl_data(struct msm_fb_data_type *mfd, int data)
{
	mutex_lock(&mfd->dma->ov_mutex);	

	mdp4_dsi_cmd_dma_busy_wait(mfd);
	mdp4_dsi_blt_dmap_busy_wait(mfd);
	mipi_dsi_mdp_busy_wait(mfd);

	mipi_set_tx_power_mode(0);

	switch(data){
		case 10 : mipi_dsi_cmds_tx(mfd, &oscar_tx_buf, oscar_acl_control10,
							ARRAY_SIZE(oscar_acl_control10));
			oscar_state.acl_data=data;
			break;
		case 30 : mipi_dsi_cmds_tx(mfd, &oscar_tx_buf, oscar_acl_control30,
							ARRAY_SIZE(oscar_acl_control30));
			oscar_state.acl_data=data;
			break;
	

		case 50 :mipi_dsi_cmds_tx(mfd, &oscar_tx_buf, oscar_acl_control50,
							ARRAY_SIZE(oscar_acl_control50));
			oscar_state.acl_data=data;
			break;
	}

	mipi_set_tx_power_mode(1);	
	mutex_unlock(&mfd->dma->ov_mutex);
	printk(KERN_WARNING"mipi_oscar_lcd_acl_data = %d\n",data);
}
Example #9
0
static inline void mipi_dsi_set_backlight(struct msm_fb_data_type *mfd)
{
	struct mipi_panel_info *mipi;

	mipi  = &mfd->panel_info.mipi;

	if (panel_type == PANEL_ID_VILLE_SAMSUNG_SG_C2)
		ville_shrink_pwm_c2(mfd->bl_level);
	else if (panel_type == PANEL_ID_VILLE_SAMSUNG_SG)
		ville_shrink_pwm(mfd->bl_level);

	mutex_lock(&mfd->dma->ov_mutex);

/* Remove the check first for impact MFG test. Command by adb to set backlight not work */
#if 0
	if (mdp4_overlay_dsi_state_get() <= ST_DSI_SUSPEND) {
		mutex_unlock(&mfd->dma->ov_mutex);
		return;
	}
#endif

	if (mfd->panel_info.type == MIPI_CMD_PANEL) {
		mdp4_dsi_cmd_dma_busy_wait(mfd);
		mdp4_dsi_blt_dmap_busy_wait(mfd);
		mipi_dsi_mdp_busy_wait(mfd);
	}

	if (panel_type == PANEL_ID_VILLE_SAMSUNG_SG || panel_type == PANEL_ID_VILLE_SAMSUNG_SG_C2)
		mipi_dsi_cmds_tx(mfd, &ville_panel_tx_buf, samsung_cmd_backlight_cmds,
				ARRAY_SIZE(samsung_cmd_backlight_cmds));
	PR_DISP_DEBUG("%s+ bl_level=%d\n", __func__, mfd->bl_level);
	mutex_unlock(&mfd->dma->ov_mutex);

	return;
}
Example #10
0
static void clk_ctrl_work(struct work_struct *work)
{
	unsigned long flags;
	struct vsycn_ctrl *vctrl =
		container_of(work, typeof(*vctrl), clk_work);

	mutex_lock(&vctrl->update_lock);
	spin_lock_irqsave(&vctrl->spin_lock, flags);
	if (vctrl->clk_control && vctrl->clk_enabled) {
		vsync_irq_disable(INTR_PRIMARY_RDPTR, MDP_PRIM_RDPTR_TERM);
		vctrl->clk_enabled = 0;
		vctrl->clk_control = 0;

#if 1 //Scott
		complete_all(&vctrl->vsync_comp);
#endif
		spin_unlock_irqrestore(&vctrl->spin_lock, flags);
		/* make sure dsi link is idle */
		mipi_dsi_mdp_busy_wait();
		mipi_dsi_clk_cfg(0);
		mdp_clk_ctrl(0);
		pr_debug("%s: SET_CLK_OFF, pid=%d\n", __func__, current->pid);
	} else
		spin_unlock_irqrestore(&vctrl->spin_lock, flags);
	mutex_unlock(&vctrl->update_lock);
}
static void villec2_display_on(struct msm_fb_data_type *mfd)
{
	mutex_lock(&mfd->dma->ov_mutex);

	if (mfd->panel_info.type == MIPI_CMD_PANEL) {
		mdp4_dsi_cmd_dma_busy_wait(mfd);
		mdp4_dsi_blt_dmap_busy_wait(mfd);
		mipi_dsi_mdp_busy_wait(mfd);
	}

	if (panel_type == PANEL_ID_VILLE_SAMSUNG_SG_C2)
		mipi_dsi_cmds_tx(mfd, &panel_tx_buf, samsung_display_on_cmds,
			ARRAY_SIZE(samsung_display_on_cmds));

	cur_bl_level = 0;

#if defined (CONFIG_MSM_AUTOBL_ENABLE)
	if (acl_enable) {
		mipi_dsi_cmds_tx(mfd, &panel_tx_buf, samsung_acl_on_cmd,
			ARRAY_SIZE(samsung_acl_on_cmd));
		acl_enable = 1;
		PR_DISP_INFO("%s acl enable", __func__);
	}
#endif
	mutex_unlock(&mfd->dma->ov_mutex);
}
void mdp4_dsi_cmd_overlay_restore(void)
{
    /* mutex holded by caller */
    if (dsi_mfd && dsi_pipe) {
        mdp4_dsi_cmd_dma_busy_wait(dsi_mfd);
        mipi_dsi_mdp_busy_wait(dsi_mfd);
        mdp4_overlay_update_dsi_cmd(dsi_mfd);
        mdp4_dsi_cmd_overlay_kickoff(dsi_mfd, dsi_pipe);
    }
}
Example #13
0
int mipi_sharp_api_cabc_outdoor_move(int lut_level)
{
    struct msm_fb_data_type *mfd;
    struct mipi_panel_info *mipi;
    struct fb_info *info = NULL;
    struct msm_fb_panel_data *pdata = NULL;
    int ret = 0;
    
    if (!num_registered_fb){
        pr_err("%s: num_registered_fb == NULL, -ENODEV\n", __func__);
        return -ENODEV;
    }
    
    info = registered_fb[0];
    if (!info){
        pr_err("%s: registered_fb[0] == NULL, -ENODEV\n", __func__);
        return -ENODEV;
    }
    
    mfd = (struct msm_fb_data_type *)info->par;
    if (!mfd) {
        pr_err("%s: mfd == NULL, -ENODEV\n", __func__);
        return -ENODEV;
    }
    
    if (!mfd->panel_power_on) {
        pr_err("%s: power off, -ENODEV\n", __func__);
        return -ENODEV;
    }
    
    mipi = &mfd->panel_info.mipi;
    if (mipi->mode != DSI_CMD_MODE) {
        pr_err("%s: Not command mode, -ENODEV\n", __func__);
        return -ENODEV;
    }
    
    pdata = (struct msm_fb_panel_data *)mfd->pdev->dev.platform_data;
    if (!pdata) {
        pr_err("%s: pdata == NULL, -ENODEV\n", __func__);
        return -ENODEV;
    }
    
    SHLCDC_BUSYLOG_REC(FB,LCD,FBMEM_KERL,EEVENTID_FB_CABC_OUTDOOR_MODE,0);
    mutex_lock(&mfd->dma->ov_mutex);
    
    mipi_dsi_mdp_busy_wait();
    mdp4_dsi_cmd_busy_wait();
    
    ret = pdata->cabc_outdoor_move(mfd, mipi, lut_level);
    
    mutex_unlock(&mfd->dma->ov_mutex);
    SHLCDC_BUSYLOG_REC(FB,LCD,FBMEM_KERL,EEVENTID_FB_CABC_OUTDOOR_MODE_RET,ret);
    
    return ret;
}
int mipi_mot_panel_off(struct msm_fb_data_type *mfd)
{
	struct dsi_buf *tp = mot_panel->mot_tx_buf;

	mdp4_dsi_cmd_dma_busy_wait(mfd);
	mipi_dsi_mdp_busy_wait(mfd);

	mipi_dsi_buf_init(tp);
	mipi_dsi_cmds_tx(mfd, tp, &mot_display_off_cmd, 1);

	return 0;
}
static void mipi_mot_mipi_busy_wait(struct msm_fb_data_type *mfd)
{
	/* Todo: consider to remove mdp4_dsi_cmd_dma_busy_wait
	 * mipi_dsi_cmds_tx/rx wait for dma completion already.
	 */
	if (mfd->panel_info.type == MIPI_CMD_PANEL) {
		mdp4_dsi_cmd_dma_busy_wait(mfd);
		mipi_dsi_mdp_busy_wait(mfd);
		mdp4_dsi_blt_dmap_busy_wait(mfd);
	} else if (mfd->panel_info.type == MIPI_VIDEO_PANEL) {
		mdp4_overlay_dsi_video_wait4event(mfd, INTR_PRIMARY_VSYNC);
	}

}
void mdp4_dsi_cmd_overlay_kickoff(struct msm_fb_data_type *mfd,
                                  struct mdp4_overlay_pipe *pipe)
{
    unsigned long flag;

    mdp4_iommu_attach();
    /* change mdp clk */
    mdp4_set_perf_level();

    mipi_dsi_mdp_busy_wait(mfd);

    mipi_dsi_cmd_mdp_start();

    mdp4_overlay_dsi_state_set(ST_DSI_PLAYING);

    /* MDP cmd block enable */
    mdp_pipe_ctrl(MDP_CMD_BLOCK, MDP_BLOCK_POWER_ON, FALSE);

    spin_lock_irqsave(&mdp_spin_lock, flag);
    outp32(MDP_INTR_CLEAR, INTR_DMA_P_DONE);
    outp32(MDP_INTR_CLEAR, INTR_OVERLAY0_DONE);
    mdp_intr_mask |= INTR_DMA_P_DONE;
    if (dsi_pipe && dsi_pipe->ov_blt_addr) {
        mdp_intr_mask |= INTR_OVERLAY0_DONE;
        mfd->dma->busy = TRUE;
    } else
        mdp_intr_mask &= ~INTR_OVERLAY0_DONE;
    mfd->dma->dmap_busy = TRUE;
    outp32(MDP_INTR_ENABLE, mdp_intr_mask);
    mdp_enable_irq(MDP_DMA2_TERM);
    wmb();
    spin_unlock_irqrestore(&mdp_spin_lock, flag);

    /* MDP cmd block disable */
    mdp_pipe_ctrl(MDP_CMD_BLOCK, MDP_BLOCK_POWER_OFF, FALSE);

    mdp_pipe_kickoff(MDP_OVERLAY0_TERM, mfd);
    wmb();
    mdp4_stat.kickoff_ov0++;
    dsi_pipe->ov_cnt++;
    if (dsi_pipe && dsi_pipe->ov_blt_addr) {
        wmb();
        outpdw(MDP_BASE + 0x000c, 0x0);
        mdp4_stat.kickoff_dmap++;
        wmb();
        dsi_pipe->dmap_cnt++;
        dsi_pipe->blt_cnt++;
    }
}
static void JDI_command_backlight(int level)
{
	pr_debug("%s: back light level %d\n", __func__, level);
	bl_value[1] = (char) level;

	/* mdp4_dsi_cmd_busy_wait: will turn on dsi clock also */
	mipi_dsi_mdp_busy_wait();

	cmdreq_JDI.cmds = backlight_cmd;
	cmdreq_JDI.cmds_cnt = ARRAY_SIZE(backlight_cmd);
	cmdreq_JDI.flags = CMD_REQ_COMMIT | CMD_CLK_CTRL;
	cmdreq_JDI.rlen = 0;
	cmdreq_JDI.cb = NULL;
	mipi_dsi_cmdlist_put(&cmdreq_JDI);
}
Example #18
0
void mdp4_dsi_cmd_overlay_restore(void)
{
#ifdef FACTORY_TEST
	if (!is_lcd_connected)
		return;
#endif
	/* mutex holded by caller */
	if (dsi_mfd && dsi_pipe) {
		mdp4_dsi_cmd_dma_busy_wait(dsi_mfd);
		mipi_dsi_mdp_busy_wait(dsi_mfd);
		mdp4_overlay_update_dsi_cmd(dsi_mfd);

		if (dsi_pipe->blt_addr)
			mdp4_dsi_blt_dmap_busy_wait(dsi_mfd);
		mdp4_dsi_cmd_overlay_kickoff(dsi_mfd, dsi_pipe);
	}
}
static void mipi_samsung_disp_backlight(struct msm_fb_data_type *mfd)
{
	struct mipi_panel_info *mipi;
#ifndef CONFIG_BACKLIGHT_IC_KTD253
	struct dcs_cmd_req cmdreq;
#endif	
	static int bl_level_old;

	pr_info("%s Back light level:%d\n", __func__, mfd->bl_level);

	mipi  = &mfd->panel_info.mipi;
	if (bl_level_old == mfd->bl_level)
		goto end;
	if (!msd.mpd->set_brightness_level ||  !mfd->panel_power_on)
		goto end;

#if defined(CONFIG_BACKLIGHT_IC_KTD253)

	ktd253_set_brightness(msd.mpd->set_brightness_level(mfd->bl_level));
	bl_level_old = mfd->bl_level;

#else /*for himax ldi HX8394-A*/
	mutex_lock(&dsi_tx_mutex);
	/* mdp4_dsi_cmd_busy_wait: will turn on dsi clock also */
	mipi_dsi_mdp_busy_wait();

	WRDISBV[1] = (unsigned char)
		(msd.mpd->set_brightness_level(mfd->bl_level));

	cmdreq.cmds = himax_video_backlight_cmds;
	cmdreq.cmds_cnt = ARRAY_SIZE(himax_video_backlight_cmds);
	cmdreq.flags = CMD_REQ_COMMIT;
	cmdreq.rlen = 0;
	cmdreq.cb = NULL;

	mipi_dsi_cmdlist_put(&cmdreq);

	bl_level_old = mfd->bl_level;
	mutex_unlock(&dsi_tx_mutex);
#endif

end:
	return;
	
}
static void read_error_register(struct msm_fb_data_type *mfd)
{
	struct dsi_buf *rp, *tp;
#if defined(CONFIG_FB_MSM_MIPI_SAMSUNG_OLED_VIDEO_WVGA_PT)
	char *cmd_lp;
#else
	struct dsi_cmd_desc *cmd;
#endif

	wake_lock(&idle_wake_lock);

#if CONFIG_FB_MSM_MIPI_SAMSUNG_OLED_VIDEO_WVGA_PT
	mutex_lock(&mipi_lp_mutex);
#endif
	mutex_lock(&mfd->dma->ov_mutex);

	mipi_dsi_mdp_busy_wait();

	tp = &msd.samsung_tx_buf;
	rp = &msd.samsung_rx_buf;

	mipi_dsi_buf_init(rp);
	mipi_dsi_buf_init(tp);

#if defined(CONFIG_FB_MSM_MIPI_SAMSUNG_OLED_VIDEO_WVGA_PT)
	cmd_lp = &error_id2_cmd;
	mipi_dsi_cmds_rx_lp(mfd, tp, rp, cmd_lp, 1);
	error_buf[0] = *rp->data;
	mipi_dsi_cmds_rx_lp(mfd, tp, rp, cmd_lp, 1);

	pr_debug("############ error buf E5 = %x\n", error_buf[0]);
#else
	cmd = &error_id2_cmd;
	mipi_dsi_cmds_rx(mfd, tp, rp, cmd, 1);
	error_buf[0] = *rp->data;
	pr_debug("############ error buf E5 %x\n", error_buf[0]);
#endif

	mutex_unlock(&mfd->dma->ov_mutex);
#if CONFIG_FB_MSM_MIPI_SAMSUNG_OLED_VIDEO_WVGA_PT
	mutex_unlock(&mipi_lp_mutex);
#endif
	wake_unlock(&idle_wake_lock);
}
Example #21
0
void mdp4_dsi_cmd_overlay_kickoff(struct msm_fb_data_type *mfd,
				struct mdp4_overlay_pipe *pipe)
{
	unsigned long flag, rflag;

#ifdef FACTORY_TEST
	if (!is_lcd_connected)
		return;
#endif
/*
*QCT_PATCH-sbyun to avoid confilt
*between on going video image and new overlay image,
*add some delay when mdp of dma is in busy status
*/
	/* change mdp clk */
	mdp4_set_perf_level();

	mipi_dsi_mdp_busy_wait(mfd);
#ifdef MDP_UNDERFLOW_RESET_CTRL_CMD
	spin_lock_irqsave(&mixer_reset_lock, rflag);
#endif
	if (dsi_pipe->blt_addr == 0)
		mipi_dsi_cmd_mdp_start();

	mdp4_overlay_dsi_state_set(ST_DSI_PLAYING);

	spin_lock_irqsave(&mdp_spin_lock, flag);

	mdp_enable_irq(MDP_OVERLAY0_TERM);
	mfd->dma->busy = TRUE;

	if (dsi_pipe->blt_addr)
		mfd->dma->dmap_busy = TRUE;

	/* start OVERLAY pipe */
	spin_unlock_irqrestore(&mdp_spin_lock, flag);
	mdp_pipe_kickoff(MDP_OVERLAY0_TERM, mfd);
	mdp4_stat.kickoff_ov0++;
#ifdef MDP_UNDERFLOW_RESET_CTRL_CMD
	spin_unlock_irqrestore(&mixer_reset_lock, rflag);
#endif
}
Example #22
0
/*add qcom patch to solve esd issue*/
void cmd_wait4dmap(struct msm_fb_data_type *mfd)
{
	int need_dmap_wait = 0;
	int need_ov_wait = 0;
	struct vsycn_ctrl *vctrl;
	struct mdp4_overlay_pipe *pipe;
	unsigned long flags;
		vctrl = &vsync_ctrl_db[0];
	pipe = vctrl->base_pipe;
		mutex_lock(&vctrl->update_lock);
	spin_lock_irqsave(&vctrl->spin_lock, flags);
	if (pipe->ov_blt_addr) {
		/* Blt */
		if (vctrl->blt_wait)
			need_dmap_wait = 1;
		if (vctrl->ov_koff != vctrl->ov_done) {
		INIT_COMPLETION(vctrl->ov_comp);
		need_ov_wait = 1;		}
	} else {
		/* direct out */
		if (vctrl->dmap_koff != vctrl->dmap_done) {
			INIT_COMPLETION(vctrl->dmap_comp);
			pr_debug("%s: wait, ok=%d od=%d dk=%d dd=%d cpu=%d\n",
			__func__, vctrl->ov_koff, vctrl->ov_done,
			vctrl->dmap_koff, vctrl->dmap_done, smp_processor_id());
			need_dmap_wait = 1;
		}
	}
	spin_unlock_irqrestore(&vctrl->spin_lock, flags);
	
	if (need_dmap_wait) {
		pr_debug("%s: wait4dmap\n", __func__);
		mdp4_dsi_cmd_wait4dmap(0);
	}
	if (need_ov_wait) {
		pr_debug("%s: wait4ov\n", __func__);
		mdp4_dsi_cmd_wait4ov(0);
	}
	mutex_unlock(&vctrl->update_lock);
		mipi_dsi_mdp_busy_wait();
}
Example #23
0
static int ville_samsung_acl_enable(int on, struct msm_fb_data_type *mfd)
{
	static int first_time = 1;
	static unsigned long last_autobkl_stat = 0, cur_autobkl_stat = 0;

	/* if backlight is over 245, then disable acl */
	if(cur_bl_level > 245)
		cur_autobkl_stat = 8;
	else
		cur_autobkl_stat = on;

	if(cur_autobkl_stat == last_autobkl_stat)
		return 0;

	last_autobkl_stat = cur_autobkl_stat;
	mutex_lock(&mfd->dma->ov_mutex);
	if (mfd->panel_info.type == MIPI_CMD_PANEL) {
		mdp4_dsi_cmd_dma_busy_wait(mfd);
		mdp4_dsi_blt_dmap_busy_wait(mfd);
		mipi_dsi_mdp_busy_wait(mfd);
	}

	if (cur_autobkl_stat == 8 && !first_time) {
		if (panel_type == PANEL_ID_VILLE_SAMSUNG_SG || panel_type == PANEL_ID_VILLE_SAMSUNG_SG_C2) {
			mipi_dsi_cmds_tx(mfd, &ville_panel_tx_buf, samsung_acl_off_cmd,
				ARRAY_SIZE(samsung_acl_off_cmd));
			acl_enable = 0;
			PR_DISP_INFO("%s acl disable", __func__);
		}
	} else if (cur_autobkl_stat == 12) {
		if (panel_type == PANEL_ID_VILLE_SAMSUNG_SG || panel_type == PANEL_ID_VILLE_SAMSUNG_SG_C2) {
			mipi_dsi_cmds_tx(mfd, &ville_panel_tx_buf, samsung_acl_on_cmd,
				ARRAY_SIZE(samsung_acl_on_cmd));
			acl_enable = 1;
			PR_DISP_INFO("%s acl enable", __func__);
		}
	}
	first_time = 0;
	mutex_unlock(&mfd->dma->ov_mutex);
	return 0;
}
Example #24
0
static void mipi_novatek_disp_set_backlight(struct msm_fb_data_type *mfd)
{
	struct mipi_panel_info *mipi;
	static int bl_level_old;

	pr_info("%s : level (%d)\n", __func__, mfd->bl_level);

#if defined(CONFIG_MIPI_SAMSUNG_ESD_REFRESH)
	if (msd.esd_refresh == true) {
		pr_debug("ESD Refresh on going cannot set backlight\n");
		goto end;
	}
#endif
	mipi  = &mfd->panel_info.mipi;
	if (bl_level_old == mfd->bl_level)
		goto end;
	if (!mfd->panel_power_on)
		goto end;

#ifdef CONFIG_SAMSUNG_CMC624
	cmc624_pwm_control_cabc(mfd->bl_level);
#else
	mutex_lock(&mfd->dma->ov_mutex);
	/* mdp4_dsi_cmd_busy_wait: will turn on dsi clock also */
	mipi_dsi_mdp_busy_wait();

	WRDISBV[1] = (unsigned char)mfd->bl_level;

	mipi_dsi_cmds_tx(&msd.novatek_tx_buf, novatek_video_backlight_cmds,
		ARRAY_SIZE(novatek_video_backlight_cmds));
	mutex_unlock(&mfd->dma->ov_mutex);
#endif
	bl_level_old = mfd->bl_level;
#if defined(CONFIG_TOUCHSCREEN_SYNAPTICS_I2C_RMI)
	synaptics_inform_callbacks(RMI4_CALLBACK_LCD, is_lcd_on);
#endif
end:
	return;
}
static void mipi_novatek_set_backlight(struct msm_fb_data_type *mfd)
{
	struct mipi_panel_info *mipi;
	static int bl_level_old;

	mipi  = &mfd->panel_info.mipi;
	if (bl_level_old == mfd->bl_level)
		return;

	mutex_lock(&mfd->dma->ov_mutex);
	/* mdp4_dsi_cmd_busy_wait: will turn on dsi clock also */
	mdp4_dsi_cmd_dma_busy_wait(mfd);
	mdp4_dsi_blt_dmap_busy_wait(mfd);
	mipi_dsi_mdp_busy_wait(mfd);

	led_pwm1[1] = (unsigned char)(mfd->bl_level);
	mipi_dsi_cmds_tx(mfd, &novatek_tx_buf, novatek_cmd_backlight_cmds,
			ARRAY_SIZE(novatek_cmd_backlight_cmds));
	bl_level_old = mfd->bl_level;
	mutex_unlock(&mfd->dma->ov_mutex);
	return;
}
void mdp4_dsi_cmd_overlay_kickoff(struct msm_fb_data_type *mfd,
				struct mdp4_overlay_pipe *pipe)
{
	unsigned long flag;


	/* change mdp clk */
	mdp4_set_perf_level();

#ifndef MDP4_DSI_SW_TRIGGER
	mipi_dsi_mdp_busy_wait(mfd);
	if (dsi_pipe->blt_addr == 0)
		mipi_dsi_cmd_mdp_start();
#endif

	mdp4_overlay_dsi_state_set(ST_DSI_PLAYING);

	spin_lock_irqsave(&mdp_spin_lock, flag);
	mdp_enable_irq(MDP_OVERLAY0_TERM);
	mfd->dma->busy = TRUE;
	if (dsi_pipe->blt_addr)
		mfd->dma->dmap_busy = TRUE;
	/* start OVERLAY pipe */
	wmb();
	spin_unlock_irqrestore(&mdp_spin_lock, flag);
	mdp_pipe_kickoff(MDP_OVERLAY0_TERM, mfd);
	wmb();

	mdp4_stat.kickoff_ov0++;
#ifdef MDP4_DSI_SW_TRIGGER
	if (dsi_pipe->blt_addr == 0) {
		/* trigger dsi cmd engine */
		mipi_dsi_cmd_mdp_sw_trigger(mfd);
	}
#endif
}
static int mipi_dsi_off(struct platform_device *pdev)
{
	int ret = 0;
	struct msm_fb_data_type *mfd;
	struct msm_panel_info *pinfo;
#ifdef CONFIG_HUAWEI_KERNEL
	struct mipi_panel_info *mipi;
	unsigned int datamask = 0;
#endif

	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);

	mdp4_overlay_dsi_state_set(ST_DSI_SUSPEND);

	/*
	 * Description: dsi clock is need to perform shutdown.
	 * mdp4_dsi_cmd_dma_busy_wait() will enable dsi clock if disabled.
	 * also, wait until dma (overlay and dmap) finish.
	 */
	if (mfd->panel_info.type == MIPI_CMD_PANEL) {
		if (mdp_rev >= MDP_REV_41) {
			mdp4_dsi_cmd_dma_busy_wait(mfd);
			mdp4_dsi_blt_dmap_busy_wait(mfd);
			mipi_dsi_mdp_busy_wait(mfd);
		} else {
			mdp3_dsi_cmd_dma_busy_wait(mfd);
		}
	}

	/*
	 * 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);
#ifdef CONFIG_HUAWEI_KERNEL
	
	mipi  = &mfd->panel_info.mipi;
	if (mipi->data_lane3)
		datamask |= 1<<3;
	if (mipi->data_lane2)
		datamask |= 1<<2;
	if (mipi->data_lane1)
		datamask |= 1<<1;
	if (mipi->data_lane0)
		datamask |= 1<<0;
		
	MIPI_OUTP(MIPI_DSI_BASE + 0xA8, datamask );
	mdelay(1);
	MIPI_OUTP(MIPI_DSI_BASE + 0xA8, datamask|(1<<4));
	mdelay(1);
#endif
#ifdef CONFIG_MSM_BUS_SCALING
	mdp_bus_scale_update_request(0);
#endif

	local_bh_disable();
	mipi_dsi_clk_disable();
	local_bh_enable();

	/* disbale dsi engine */
	MIPI_OUTP(MIPI_DSI_BASE + 0x0000, 0);

	mipi_dsi_phy_ctrl(0);


	local_bh_disable();
	mipi_dsi_ahb_ctrl(0);
	local_bh_enable();

	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);

	pr_debug("%s-:\n", __func__);

	return ret;
}
Example #28
0
static int mipi_novatek_disp_send_cmd(struct msm_fb_data_type *mfd,
				       enum mipi_novatek_cmd_list cmd,
				       unsigned char lock)
{
	struct dsi_cmd_desc *cmd_desc;
	int cmd_size = 0;

	if (lock)
		mutex_lock(&mfd->dma->ov_mutex);

	pr_info("%s : %s\n", __func__, msd.mpd->panel_name);
	pr_info("%s cmd = 0x%x\n", __func__, cmd);

	switch (cmd) {
	case PANEL_READY_TO_ON:
		cmd_desc = msd.mpd->ready_to_on.cmd;
		cmd_size = msd.mpd->ready_to_on.size;
		break;
	case PANEL_READY_TO_OFF:
		cmd_desc = msd.mpd->ready_to_off.cmd;
		cmd_size = msd.mpd->ready_to_off.size;
		break;
	case PANEL_ON:
		cmd_desc = msd.mpd->on.cmd;
		cmd_size = msd.mpd->on.size;
		break;
	case PANEL_OFF:
		cmd_desc = msd.mpd->off.cmd;
		cmd_size = msd.mpd->off.size;
		break;
	case PANEL_LATE_ON:
		cmd_desc = msd.mpd->late_on.cmd;
		cmd_size = msd.mpd->late_on.size;
		break;
	case PANEL_EARLY_OFF:
		cmd_desc = msd.mpd->early_off.cmd;
		cmd_size = msd.mpd->early_off.size;
		break;
	case MTP_READ_ENABLE:
		cmd_desc = msd.mpd->mtp_read_enable.cmd;
		cmd_size = msd.mpd->mtp_read_enable.size;
		break;

	default:
		goto unknown_command;
		;
	}
	
	pr_info("%s cmd size = %d\n", __func__, cmd_size);

	if (!cmd_size)
		goto unknown_command;

	if (lock) {
		mipi_dsi_mdp_busy_wait();
		mipi_dsi_cmds_tx(&msd.novatek_tx_buf, cmd_desc, cmd_size);

		mutex_unlock(&mfd->dma->ov_mutex);
	} else {
		mipi_dsi_mdp_busy_wait();
		mipi_dsi_cmds_tx(&msd.novatek_tx_buf, cmd_desc, cmd_size);
	}

/*	wake_unlock(&idle_wake_lock);*//*temp*/

	pr_info("%s end\n", __func__);

	return 0;

unknown_command:
	if (lock)
		mutex_unlock(&mfd->dma->ov_mutex);

/*	wake_unlock(&idle_wake_lock);*//*temp*/

	return 0;
}
Example #29
0
static void mipi_oscar_set_backlight(struct msm_fb_data_type *mfd)
{

	if(!mfd)
		return;
	if(mfd->key != MFD_KEY)
		return;
	if(mfd->panel_power_on == FALSE)
		return;

	mutex_lock(&mfd->dma->ov_mutex);	
	if (mdp4_overlay_dsi_state_get() <= ST_DSI_SUSPEND) {
			mipi_dsi_turn_on_clks();
			mdp4_overlay_dsi_state_set(ST_DSI_PLAYING);
	}


	mdp4_dsi_cmd_dma_busy_wait(mfd);
	mdp4_dsi_blt_dmap_busy_wait(mfd);
	mipi_dsi_mdp_busy_wait(mfd);
	
	if(backlight_cnt == true)
	{
			mipi_set_tx_power_mode(0);
			mipi_dsi_cmds_tx(mfd, &oscar_tx_buf, oscar_sleep_out,
				ARRAY_SIZE(oscar_sleep_out));
			mipi_set_tx_power_mode(1);
			
			backlight_cnt = false;	
	}
	
	mipi_set_tx_power_mode(0);	

	switch(mfd->bl_level){
		case 13 :
					#ifdef CONFIG_F_SKYDISP_SMART_DIMMING
					if(chnnel_mtp)
						mipi_dsi_cmds_tx(mfd, &oscar_tx_buf, Smart_oscar_backlight_190_cmds,ARRAY_SIZE(Smart_oscar_backlight_190_cmds));
					else
					#endif
						mipi_dsi_cmds_tx(mfd, &oscar_tx_buf, oscar_backlight_190_cmds,ARRAY_SIZE(oscar_backlight_190_cmds));
				  break;
	
		case 12 :	
					#ifdef CONFIG_F_SKYDISP_SMART_DIMMING
					if(chnnel_mtp)
						mipi_dsi_cmds_tx(mfd, &oscar_tx_buf, Smart_oscar_backlight_180_cmds,ARRAY_SIZE(Smart_oscar_backlight_180_cmds));
					else
					#endif
						mipi_dsi_cmds_tx(mfd, &oscar_tx_buf, oscar_backlight_180_cmds,ARRAY_SIZE(oscar_backlight_180_cmds));
				
				  break;
		case 11 :	
					#ifdef CONFIG_F_SKYDISP_SMART_DIMMING
					if(chnnel_mtp)
						mipi_dsi_cmds_tx(mfd, &oscar_tx_buf, Smart_oscar_backlight_170_cmds,ARRAY_SIZE(Smart_oscar_backlight_170_cmds));
					else
					#endif
						mipi_dsi_cmds_tx(mfd, &oscar_tx_buf, oscar_backlight_170_cmds,ARRAY_SIZE(oscar_backlight_170_cmds));
				
				  break;
		case 10 :	
					#ifdef CONFIG_F_SKYDISP_SMART_DIMMING
					if(chnnel_mtp)
						mipi_dsi_cmds_tx(mfd, &oscar_tx_buf, Smart_oscar_backlight_160_cmds,ARRAY_SIZE(Smart_oscar_backlight_160_cmds));
					else
					#endif
						mipi_dsi_cmds_tx(mfd, &oscar_tx_buf, oscar_backlight_160_cmds,ARRAY_SIZE(oscar_backlight_160_cmds));
				
				  break;
		case 9 :	
					#ifdef CONFIG_F_SKYDISP_SMART_DIMMING
					if(chnnel_mtp)
						mipi_dsi_cmds_tx(mfd, &oscar_tx_buf, Smart_oscar_backlight_150_cmds,ARRAY_SIZE(Smart_oscar_backlight_150_cmds));
					else
					#endif
						mipi_dsi_cmds_tx(mfd, &oscar_tx_buf, oscar_backlight_150_cmds,ARRAY_SIZE(oscar_backlight_150_cmds));
			
				  break;
		case 8 :	
					#ifdef CONFIG_F_SKYDISP_SMART_DIMMING
					if(chnnel_mtp)
						mipi_dsi_cmds_tx(mfd, &oscar_tx_buf, Smart_oscar_backlight_140_cmds,ARRAY_SIZE(Smart_oscar_backlight_140_cmds));
					else
					#endif
						mipi_dsi_cmds_tx(mfd, &oscar_tx_buf, oscar_backlight_140_cmds,ARRAY_SIZE(oscar_backlight_140_cmds));
			
				  break;
		case 7 :	
					#ifdef CONFIG_F_SKYDISP_SMART_DIMMING
					if(chnnel_mtp)
						mipi_dsi_cmds_tx(mfd, &oscar_tx_buf, Smart_oscar_backlight_130_cmds,ARRAY_SIZE(Smart_oscar_backlight_130_cmds));
					else
					#endif
						mipi_dsi_cmds_tx(mfd, &oscar_tx_buf, oscar_backlight_130_cmds,ARRAY_SIZE(oscar_backlight_130_cmds));
		
				  break;
		case 6 :	
					#ifdef CONFIG_F_SKYDISP_SMART_DIMMING
					if(chnnel_mtp)
						mipi_dsi_cmds_tx(mfd, &oscar_tx_buf, Smart_oscar_backlight_120_cmds,ARRAY_SIZE(Smart_oscar_backlight_120_cmds));
					else
					#endif
						mipi_dsi_cmds_tx(mfd, &oscar_tx_buf, oscar_backlight_120_cmds,ARRAY_SIZE(oscar_backlight_120_cmds));
			
				  break;
		case 5 : 	
					#ifdef CONFIG_F_SKYDISP_SMART_DIMMING
					if(chnnel_mtp)
						mipi_dsi_cmds_tx(mfd, &oscar_tx_buf, Smart_oscar_backlight_110_cmds,ARRAY_SIZE(Smart_oscar_backlight_110_cmds));
					else
					#endif
						mipi_dsi_cmds_tx(mfd, &oscar_tx_buf, oscar_backlight_110_cmds,ARRAY_SIZE(oscar_backlight_110_cmds));
				  break;
		case 4 : 	
					#ifdef CONFIG_F_SKYDISP_SMART_DIMMING
					if(chnnel_mtp)
						mipi_dsi_cmds_tx(mfd, &oscar_tx_buf, Smart_oscar_backlight_100_cmds,ARRAY_SIZE(Smart_oscar_backlight_100_cmds));
					else
					#endif
						mipi_dsi_cmds_tx(mfd, &oscar_tx_buf, oscar_backlight_100_cmds,ARRAY_SIZE(oscar_backlight_100_cmds));

				  break;
		case 3 :	
					#ifdef CONFIG_F_SKYDISP_SMART_DIMMING
					if(chnnel_mtp)
						mipi_dsi_cmds_tx(mfd, &oscar_tx_buf, Smart_oscar_backlight_90_cmds,ARRAY_SIZE(Smart_oscar_backlight_90_cmds));
					else
					#endif
						mipi_dsi_cmds_tx(mfd, &oscar_tx_buf, oscar_backlight_90_cmds,ARRAY_SIZE(oscar_backlight_90_cmds));
				  break;
		case 2 : 	
					#ifdef CONFIG_F_SKYDISP_SMART_DIMMING
					if(chnnel_mtp)
						mipi_dsi_cmds_tx(mfd, &oscar_tx_buf, Smart_oscar_backlight_80_cmds,ARRAY_SIZE(Smart_oscar_backlight_80_cmds));
					else
					#endif
						mipi_dsi_cmds_tx(mfd, &oscar_tx_buf, oscar_backlight_80_cmds,ARRAY_SIZE(oscar_backlight_80_cmds));
				  break;
				  
		case 1 : 	
					#ifdef CONFIG_F_SKYDISP_SMART_DIMMING
					if(chnnel_mtp)
						mipi_dsi_cmds_tx(mfd, &oscar_tx_buf, Smart_oscar_backlight_70_cmds,ARRAY_SIZE(Smart_oscar_backlight_70_cmds));
						
					else
					#endif
						mipi_dsi_cmds_tx(mfd, &oscar_tx_buf, oscar_backlight_70_cmds,ARRAY_SIZE(oscar_backlight_70_cmds));
	
				  break;
		case 0 :	
					#ifdef CONFIG_F_SKYDISP_SMART_DIMMING
					if(chnnel_mtp)
						mipi_dsi_cmds_tx(mfd, &oscar_tx_buf, Smart_oscar_backlight_70_cmds,ARRAY_SIZE(Smart_oscar_backlight_70_cmds));
					else
					#endif
						mipi_dsi_cmds_tx(mfd, &oscar_tx_buf, oscar_backlight_70_cmds,ARRAY_SIZE(oscar_backlight_70_cmds));
					if(backlight_control == true)
						backlight_cnt = true;
				  break;
		}

	mipi_set_tx_power_mode(1);

	
	mutex_unlock(&mfd->dma->ov_mutex);
	
	if(mfd->bl_level > 0)
		oscar_state.backlightoff = true;
	else
		oscar_state.backlightoff = false;

	printk(KERN_WARNING"[%s] = %d, backlight_cnt = %d\n",__func__,mfd->bl_level,backlight_cnt);

}
Example #30
0
int mdp4_dsi_cmd_pipe_commit(int cndx, int wait)
{
	int  i, undx;
	int mixer = 0;
	struct vsycn_ctrl *vctrl;
	struct vsync_update *vp;
	struct mdp4_overlay_pipe *pipe;
	struct mdp4_overlay_pipe *real_pipe;
	unsigned long flags;
	int need_dmap_wait = 0;
	int need_ov_wait = 0;
	int cnt = 0;

	int clk_set_on = 0;
	vctrl = &vsync_ctrl_db[0];
#ifdef FACTORY_TEST
		if (!is_lcd_connected)
			return 0;
#endif

	mutex_lock(&vctrl->update_lock);
	undx =  vctrl->update_ndx;
	vp = &vctrl->vlist[undx];
	pipe = vctrl->base_pipe;
	if (pipe == NULL) {
		pr_err("%s: NO base pipe\n", __func__);
		mutex_unlock(&vctrl->update_lock);
		return 0;
	}

	mixer = pipe->mixer_num;

	/*
	 * allow stage_commit without pipes queued
	 * (vp->update_cnt == 0) to unstage pipes after
	 * overlay_unset
	 */

	vctrl->update_ndx++;
	vctrl->update_ndx &= 0x01;
	vp->update_cnt = 0;     /* reset */
	if (vctrl->blt_free) {
		vctrl->blt_free--;
		if (vctrl->blt_free == 0)
			mdp4_free_writeback_buf(vctrl->mfd, mixer);
	}
	mutex_unlock(&vctrl->update_lock);
	if(wait == 1) { 
		spin_lock_irqsave(&vctrl->spin_lock, flags);
		vctrl->clk_control = 0;
		vctrl->pan_display++;
		if (!vctrl->clk_enabled) {
			clk_set_on = 1;
			vctrl->clk_enabled = 1;
		}
		vctrl->expire_tick = VSYNC_EXPIRE_TICK;
		spin_unlock_irqrestore(&vctrl->spin_lock, flags);
		if (clk_set_on) {
			pr_err("%s: warning, clock off while pan display\n", __func__);
			pr_debug("%s: SET_CLK_ON\n", __func__);
			mipi_dsi_clk_cfg(1);
			mdp_clk_ctrl(1);
			vsync_irq_enable(INTR_PRIMARY_RDPTR, MDP_PRIM_RDPTR_TERM);
		 }
	}

	if (mdp4_dsi_cmd_clk_check(vctrl) < 0)
		return 0;

	/* free previous committed iommu back to pool */
	mdp4_overlay_iommu_unmap_freelist(mixer);

	spin_lock_irqsave(&vctrl->spin_lock, flags);
	if (pipe->ov_blt_addr) {
		/* Blt */
		if (vctrl->blt_wait)
			need_dmap_wait = 1;
		else if (vctrl->ov_koff != vctrl->ov_done) {
			INIT_COMPLETION(vctrl->ov_comp);
			need_ov_wait = 1;
		}
	} else {
		/* direct out */
		if (vctrl->dmap_koff != vctrl->dmap_done) {
			INIT_COMPLETION(vctrl->dmap_comp);
			pr_debug("%s: wait, ok=%d od=%d dk=%d dd=%d cpu=%d\n",
			 __func__, vctrl->ov_koff, vctrl->ov_done,
			vctrl->dmap_koff, vctrl->dmap_done, smp_processor_id());
			need_dmap_wait = 1;
		}
	}
	spin_unlock_irqrestore(&vctrl->spin_lock, flags);

	if (need_dmap_wait) {
		pr_debug("%s: wait4dmap\n", __func__);
		mdp4_dsi_cmd_wait4dmap(0);
	}
#if defined(CONFIG_FB_MSM_MIPI_NOVATEK_CMD_WVGA_PT) \
	|| defined(CONFIG_FB_MSM_MIPI_NOVATEK_BOE_CMD_WVGA_PT) \
	|| defined(CONFIG_FB_MSM_MIPI_SAMSUNG_OLED_CMD_QHD_PT)
	if(mdp_lut_push) {
		mipi_dsi_mdp_busy_wait();
		mdp_lut_enable();
	} 
#endif
	if (need_ov_wait) {
		pr_debug("#### %s: wait4ov\n", __func__);
		vsync_irq_enable(INTR_OVERLAY0_DONE, MDP_OVERLAY0_TERM);
		outpdw(MDP_BASE + 0x0004, 0);
		mb();
		mdp4_dsi_cmd_wait4ov(0);
	}

	if (pipe->ov_blt_addr) {
		if (vctrl->blt_end) {
			vctrl->blt_end = 0;
			pipe->ov_blt_addr = 0;
			pipe->dma_blt_addr =  0;
		}
	}

	if (vctrl->blt_change) {
		mdp4_overlayproc_cfg(pipe);
		mdp4_overlay_dmap_xy(pipe);
		vctrl->blt_change = 0;
	}

	pipe = vp->plist;
	for (i = 0; i < OVERLAY_PIPE_MAX; i++, pipe++) {
		if (pipe->pipe_used) {
			cnt++;
			real_pipe = mdp4_overlay_ndx2pipe(pipe->pipe_ndx);
			if (real_pipe && real_pipe->pipe_used) {
				/* pipe not unset */
				mdp4_overlay_vsync_commit(pipe);
			}
			/* free previous iommu to freelist
			* which will be freed at next
			* pipe_commit
			*/
			mdp4_overlay_iommu_pipe_free(pipe->pipe_ndx, 0);
			pipe->pipe_used = 0; /* clear */
		}
	}

	/* tx dcs command if had any */
	mipi_dsi_cmdlist_commit(1);

	mdp4_mixer_stage_commit(mixer);

	pipe = vctrl->base_pipe;
	spin_lock_irqsave(&vctrl->spin_lock, flags);
	if (pipe->ov_blt_addr) {
		mdp4_dsi_cmd_blt_ov_update(pipe);
		pipe->ov_cnt++;
		vctrl->ov_koff++;
		INIT_COMPLETION(vctrl->ov_comp);
		vsync_irq_enable(INTR_OVERLAY0_DONE, MDP_OVERLAY0_TERM);
	} else {
		INIT_COMPLETION(vctrl->dmap_comp);
		vsync_irq_enable(INTR_DMA_P_DONE, MDP_DMAP_TERM);
		vctrl->dmap_koff++;
	}
	pr_debug("%s: kickoff, pid=%d\n", __func__, current->pid);
	/* kickoff overlay engine */
	mdp4_stat.kickoff_ov0++;
	outpdw(MDP_BASE + 0x0004, 0);
	mb();
	spin_unlock_irqrestore(&vctrl->spin_lock, flags);

	mdp4_stat.overlay_commit[pipe->mixer_num]++;

	if (wait)
		mdp4_dsi_cmd_wait4vsync(0);

	return cnt;
}