Example #1
0
static void k2_set_backlight(struct msm_fb_data_type *mfd)
{
	struct mipi_panel_info *mipi;
	led_pwm1[1] = k2_shrink_pwm((unsigned char)(mfd->bl_level));

	if (mipi_k2_pdata && (mipi_k2_pdata->enable_wled_bl_ctrl)
	    && (wled_trigger_initialized)) {
		led_trigger_event(bkl_led_trigger, led_pwm1[1]);
		return;
	}
	mipi  = &mfd->panel_info.mipi;


	
	if (atomic_read(&lcd_power_state) == 0) {
		PR_DISP_DEBUG("%s: LCD is off. Skip backlight setting\n", __func__);
		return;
	}

	if (mdp4_overlay_dsi_state_get() <= ST_DSI_SUSPEND) {
		return;
	}

#ifdef NOVATEK_CABC
        
        if (led_pwm1[1] == 0) {
                atomic_set(&lcd_backlight_off, 1);
				cmdreq.cmds = novatek_dim_off_cmds;
				cmdreq.cmds_cnt = ARRAY_SIZE(novatek_dim_off_cmds);
				cmdreq.flags = CMD_REQ_COMMIT;
				cmdreq.rlen = 0;
				cmdreq.cb = NULL;

				mipi_dsi_cmdlist_put(&cmdreq);
        } else
                atomic_set(&lcd_backlight_off, 0);
#endif
	cmdreq.cmds = novatek_cmd_backlight_cmds;
	cmdreq.cmds_cnt = ARRAY_SIZE(novatek_cmd_backlight_cmds);
	cmdreq.flags = CMD_REQ_COMMIT;
	cmdreq.rlen = 0;
	cmdreq.cb = NULL;

	mipi_dsi_cmdlist_put(&cmdreq);

#ifdef CONFIG_BACKLIGHT_WLED_CABC
	
	if (wled_trigger_initialized) {
		led_trigger_event(bkl_led_trigger, mfd->bl_level);
	}
#endif
	return;
}
Example #2
0
static void mipi_himax_set_backlight(struct msm_fb_data_type *mfd)
{
	struct mipi_panel_info *mipi;

	
	if (bl_off) {
		mfd->bl_level = 0;
		bl_off = 0;
	}
	
	if (mipi_himax_pdata && mipi_himax_pdata->shrink_pwm)
		led_pwm1[1] = mipi_himax_pdata->shrink_pwm(mfd->bl_level);
	else
		led_pwm1[1] = (unsigned char)(mfd->bl_level);

	if (mipi_himax_pdata && (mipi_himax_pdata->enable_wled_bl_ctrl)
	    && (wled_trigger_initialized)) {
		led_trigger_event(bkl_led_trigger, led_pwm1[1]);
		return;
	}
	mipi  = &mfd->panel_info.mipi;
	pr_debug("%s+:bl=%d \n", __func__, mfd->bl_level);

	
	if (atomic_read(&lcd_power_state) == 0) {
		PR_DISP_DEBUG("%s: LCD is off. Skip backlight setting\n", __func__);
		return;
	}

	if (mipi->mode == DSI_VIDEO_MODE && mdp4_overlay_dsi_state_get() <= ST_DSI_SUSPEND) {
		return;
	}
	

	if (mipi->mode == DSI_CMD_MODE) {
		mipi_dsi_op_mode_config(DSI_CMD_MODE);
	}

	cmdreq_himax.cmds = himax_cmd_backlight_cmds;
	cmdreq_himax.cmds_cnt = ARRAY_SIZE(himax_cmd_backlight_cmds);
	cmdreq_himax.flags = CMD_REQ_COMMIT;
	cmdreq_himax.rlen = 0;
	cmdreq_himax.cb = NULL;
	mipi_dsi_cmdlist_put(&cmdreq_himax);

#ifdef CONFIG_BACKLIGHT_WLED_CABC
	
	if (wled_trigger_initialized) {
		led_trigger_event(bkl_led_trigger, mfd->bl_level);
	}
#endif
	return;
}
static void deluxe_u_set_backlight(struct msm_fb_data_type *mfd)
{
	int rc;

	if (mdp4_overlay_dsi_state_get() <= ST_DSI_SUSPEND) {
		return;
	}

	write_display_brightness[2] = deluxe_u_shrink_pwm((unsigned char)(mfd->bl_level));

	if (resume_blk || board_mfg_mode() == 5) {
		resume_blk = 0;

		gpio_tlmm_config(GPIO_CFG(BL_HW_EN, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), GPIO_CFG_ENABLE);
		gpio_set_value(BL_HW_EN, 1);

		rc = i2c_smbus_write_byte_data(blk_pwm_client, 0x10, 0xC5);
		if (rc)
			pr_err("i2c write fail\n");
		rc = i2c_smbus_write_byte_data(blk_pwm_client, 0x19, 0x13);
		if (rc)
			pr_err("i2c write fail\n");
		rc = i2c_smbus_write_byte_data(blk_pwm_client, 0x14, 0xC2);
		if (rc)
			pr_err("i2c write fail\n");
		rc = i2c_smbus_write_byte_data(blk_pwm_client, 0x79, 0xFF);
		if (rc)
			pr_err("i2c write fail\n");
		rc = i2c_smbus_write_byte_data(blk_pwm_client, 0x1D, 0xFA);
		if (rc)
			pr_err("i2c write fail\n");
	}

	cmdreq.cmds = (struct dsi_cmd_desc*)&renesas_cmd_backlight_cmds;
	cmdreq.cmds_cnt = 1;
	cmdreq.flags = CMD_REQ_COMMIT;
	cmdreq.rlen = 0;
	cmdreq.cb = NULL;

	mipi_dsi_cmdlist_put(&cmdreq);

	if ((mfd->bl_level) == 0) {
		gpio_tlmm_config(GPIO_CFG(BL_HW_EN, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), GPIO_CFG_ENABLE);
		gpio_set_value(BL_HW_EN, 0);
		resume_blk = 1;
	}

	return;
}
Example #4
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);

}
static void cp5_wl_set_backlight(struct msm_fb_data_type *mfd)
{
	int rc;

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

	/* Check LCD power state */
	if (atomic_read(&lcd_power_state) == 0) {
		PR_DISP_DEBUG("%s: LCD is off. Skip backlight setting\n", __func__);
		return;
	}

	if (mdp4_overlay_dsi_state_get() <= ST_DSI_SUSPEND) {
		return;
	}

	/* Do not enable backlight for first boot */
	if (enable_blk) {
		/* Set HWEN pin of LM3532 to control LED */
		gpio_tlmm_config(GPIO_CFG(MSM_BL_HW_EN, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL, GPIO_CFG_2MA), GPIO_CFG_ENABLE);
		gpio_set_value(MSM_BL_HW_EN, 1);

		/* Output Configuration: assign LED1 to Bank B */
		rc = i2c_smbus_write_byte_data(blk_pwm_client, 0x10, 0xC1);
		if (rc) pr_err("i2c write fail\n");

		/* Control B Full-Scale Current */
		rc = i2c_smbus_write_byte_data(blk_pwm_client, 0x19, 0x13);
		if (rc) pr_err("i2c write fail\n");

		/* Control B PWM */
		rc = i2c_smbus_write_byte_data(blk_pwm_client, 0x14, 0xC2);
		if (rc) pr_err("i2c write fail\n");

		/* Control B Zone Target 4 */
		rc = i2c_smbus_write_byte_data(blk_pwm_client, 0x79, 0xFF);
		if (rc) pr_err("i2c write fail\n");

		/* Control Enable */
		rc = i2c_smbus_write_byte_data(blk_pwm_client, 0x1D, 0xFA);
		if (rc) pr_err("i2c write fail\n");

		enable_blk = 0;
	}

	if (led_pwm[1] == 0) {
		/* Turn off dimming before suspend */
		cmdreq.cmds = novatek_dim_off_cmds;
		cmdreq.cmds_cnt = ARRAY_SIZE(novatek_dim_off_cmds);
		cmdreq.flags = CMD_REQ_COMMIT;
		cmdreq.rlen = 0;
		cmdreq.cb = NULL;
		mipi_dsi_cmdlist_put(&cmdreq);
	}

	cmdreq.cmds = novatek_backlight_cmds;
	cmdreq.cmds_cnt = ARRAY_SIZE(novatek_backlight_cmds);
	cmdreq.flags = CMD_REQ_COMMIT;
	cmdreq.rlen = 0;
	cmdreq.cb = NULL;
	mipi_dsi_cmdlist_put(&cmdreq);

	return;
}
static int mipi_dsi_off(struct platform_device *pdev)
{
	int ret = 0;
	struct msm_fb_data_type *mfd;
	struct msm_panel_info *pinfo;

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

	/* DSI is in the suspend state, don't need to do anything */
	if (mdp4_overlay_dsi_state_get() == ST_DSI_SUSPEND)
		goto end;

	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_del_timer();
			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);
		}
	} else {
		/* video mode, wait until fifo cleaned */
		mipi_dsi_controller_cfg(0);
	}

	/*
	 * 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_MSM_BUS_SCALING
	mdp_bus_scale_update_request(0);
#endif

	spin_lock_bh(&dsi_clk_lock);
	mipi_dsi_clk_disable();

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

	mipi_dsi_phy_ctrl(0);

	mipi_dsi_ahb_ctrl(0);
	spin_unlock_bh(&dsi_clk_lock);

	if (mipi_dsi_pdata && mipi_dsi_pdata->panel_power_save)
		mipi_dsi_pdata->panel_power_save(0);

	if (mipi_dsi_pdata && mipi_dsi_pdata->dsi_power_save)
		mipi_dsi_pdata->dsi_power_save(0);
end:
	if (mdp_rev >= MDP_REV_41)
		mutex_unlock(&mfd->dma->ov_mutex);
	else
		up(&mfd->dma->mutex);

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

	return ret;
}