Exemplo n.º 1
0
static void gfx_panel_setup(device_t dev)
{
	struct soc_intel_baytrail_config *config = dev->chip_info;
	struct reg_script gfx_pipea_init[] = {
		/* CONTROL */
		REG_RES_WRITE32(PCI_BASE_ADDRESS_0, PIPEA_REG(PP_CONTROL),
				PP_CONTROL_UNLOCK | PP_CONTROL_EDP_FORCE_VDD),
		/* POWER ON */
		REG_RES_WRITE32(PCI_BASE_ADDRESS_0, PIPEA_REG(PP_ON_DELAYS),
				(config->gpu_pipea_port_select << 30 |
				 config->gpu_pipea_power_on_delay << 16 |
				 config->gpu_pipea_light_on_delay)),
		/* POWER OFF */
		REG_RES_WRITE32(PCI_BASE_ADDRESS_0, PIPEA_REG(PP_OFF_DELAYS),
				(config->gpu_pipea_power_off_delay << 16 |
				 config->gpu_pipea_light_off_delay)),
		/* DIVISOR */
		REG_RES_RMW32(PCI_BASE_ADDRESS_0, PIPEA_REG(PP_DIVISOR),
			      ~0x1f, config->gpu_pipea_power_cycle_delay),
		REG_SCRIPT_END
	};
	struct reg_script gfx_pipeb_init[] = {
		/* CONTROL */
		REG_RES_WRITE32(PCI_BASE_ADDRESS_0, PIPEB_REG(PP_CONTROL),
				PP_CONTROL_UNLOCK | PP_CONTROL_EDP_FORCE_VDD),
		/* POWER ON */
		REG_RES_WRITE32(PCI_BASE_ADDRESS_0, PIPEB_REG(PP_ON_DELAYS),
				(config->gpu_pipeb_port_select << 30 |
				 config->gpu_pipeb_power_on_delay << 16 |
				 config->gpu_pipeb_light_on_delay)),
		/* POWER OFF */
		REG_RES_WRITE32(PCI_BASE_ADDRESS_0, PIPEB_REG(PP_OFF_DELAYS),
				(config->gpu_pipeb_power_off_delay << 16 |
				 config->gpu_pipeb_light_off_delay)),
		/* DIVISOR */
		REG_RES_RMW32(PCI_BASE_ADDRESS_0, PIPEB_REG(PP_DIVISOR),
			      ~0x1f, config->gpu_pipeb_power_cycle_delay),
		REG_SCRIPT_END
	};

	if (config->gpu_pipea_port_select) {
		printk(BIOS_INFO, "GFX: Initialize PIPEA\n");
		reg_script_run_on_dev(dev, gfx_pipea_init);
		set_backlight_pwm(dev, PIPEA_REG(BACKLIGHT_CTL),
		                  config->gpu_pipea_pwm_freq_hz);
	}

	if (config->gpu_pipeb_port_select) {
		printk(BIOS_INFO, "GFX: Initialize PIPEB\n");
		reg_script_run_on_dev(dev, gfx_pipeb_init);
		set_backlight_pwm(dev, PIPEB_REG(BACKLIGHT_CTL),
		                  config->gpu_pipeb_pwm_freq_hz);
	}
}
Exemplo n.º 2
0
/* update and get brightness */
 int lm3630_bank_a_update_status(u32 bl_level)
{
	int ret;
	struct lm3630_chip_data *pchip = lm3630_pchip;
	pr_debug("%s: bl=%d\n", __func__,bl_level);
	
	if(!pchip){
		dev_err(pchip->dev, "lm3630_bank_a_update_status pchip is null\n");
		return -ENOMEM;
		}
	
	/* brightness 0 means disable */
	if (!bl_level) {
        ret = regmap_write(lm3630_pchip->regmap, REG_BRT_A, 0);
		ret = regmap_update_bits(pchip->regmap, REG_CTRL, 0x80, 0x80);
		if (ret < 0)
			goto out;
		return bl_level;
	}

	/* pwm control */
	//bl_level=255;
		/* i2c control */
		ret = regmap_update_bits(pchip->regmap, REG_CTRL, 0x80, 0x00);
		if (ret < 0)
			goto out;
		mdelay(1);
		ret = regmap_write(pchip->regmap,
				   REG_BRT_A, bl_level);
		if (ret < 0)
			goto out;
#ifdef VENDOR_EDIT
/* Xiaori.Yuan@Mobile Phone Software Dept.Driver, 2014/03/10  Add for flicker in low backlight */
		backlight_level =  bl_level;
		if(bl_level <= 0x14 && pwm_flag==true){
			set_backlight_pwm(0);
		}else if(bl_level > 0x14 && pwm_flag==false && cabc_mode >0){
			set_backlight_pwm(1);
		}
#endif /*VENDOR_EDIT*/
	return bl_level;
out:
	dev_err(pchip->dev, "i2c failed to access REG_CTRL\n");
	return bl_level;
}
Exemplo n.º 3
0
static void cmc623_pwm_apply_brightness(struct platform_device *pdev, int level)
{
	set_backlight_pwm(level);
	current_backlight_level = level;
}
Exemplo n.º 4
0
static int set_cabc(int level)
{
    int ret = 0;
    pr_info("%s Neal level = %d\n",__func__,level);

    set_backlight_pwm(1);

    mutex_lock(&cabc_mutex);
    /*OPPO 2013-10-11 zhzhyon Add for reason*/
    if(flag_lcd_off == true)
    {
        printk(KERN_INFO "lcd is off,don't allow to set cabc\n");
        cabc_mode = level;
        mutex_unlock(&cabc_mutex);
        return 0;
    }
    /*OPPO 2013-10-11 zhzhyon Add end*/

    mipi_dsi_clk_cfg(1);
    mipi_set_tx_power_mode(0);
    /*OPPO 2013-10-18 zhzhyon Add for reason*/
#ifdef PANEL_SRE
    if(level && (sre_level != sre_mode) && sre_level)
    {
        mipi_dsi_cmds_tx(&orise_tx_buf, sre_strong_mode_sequence,
                         ARRAY_SIZE(sre_strong_mode_sequence));
        sre_mode = SRE_HIGH_MODE;
    }
#endif
    /*OPPO 2013-10-18 zhzhyon Add end*/

    switch(level)
    {
        case 0:/*
            mipi_dsi_cmds_tx(&orise_tx_buf, cabc_off_sequence,
                             ARRAY_SIZE(cabc_off_sequence));
                             */
            set_backlight_pwm(0);
            cabc_mode = CABC_CLOSE;
            /*OPPO 2013-10-18 zhzhyon Add for reason*/
#ifdef PANEL_SRE
            sre_mode = SRE_CLOSE;
#endif
            /*OPPO 2013-10-18 zhzhyon Add end*/
            break;
        case 1:
            mipi_dsi_cmds_tx(&orise_tx_buf, cabc_user_interface_image_sequence,
                             ARRAY_SIZE(cabc_user_interface_image_sequence));
            cabc_mode = CABC_LOW_MODE;
            break;
        case 2:
            mipi_dsi_cmds_tx(&orise_tx_buf, cabc_still_image_sequence,
                             ARRAY_SIZE(cabc_still_image_sequence));
            cabc_mode = CABC_MIDDLE_MODE;
            break;
        case 3:
            mipi_dsi_cmds_tx(&orise_tx_buf, cabc_video_image_sequence,
                             ARRAY_SIZE(cabc_video_image_sequence));
            cabc_mode = CABC_HIGH_MODE;
            break;
        default:
            pr_err("%s Leavel %d is not supported!\n",__func__,level);
            ret = -1;
            break;
    }
    //mipi_set_tx_power_mode(1);
    mipi_dsi_clk_cfg(0);
    mutex_unlock(&cabc_mutex);
    return ret;

}
Exemplo n.º 5
0
static void pwm_delay_work_func( struct work_struct *work )
{
    pr_info("%s pwm on!\n",__func__);
    set_backlight_pwm(1);
    return ;
}
Exemplo n.º 6
0
/* update and get brightness */
 int lm3630_bank_a_update_status(u32 bl_level)
{
	int ret;
	struct lm3630_chip_data *pchip = lm3630_pchip;
	pr_debug("%s: bl=%d\n", __func__,bl_level);
#ifdef VENDOR_EDIT

/* Xiaori.Yuan@Mobile Phone Software Dept.Driver, 2014/04/28  Add for add log for 14001 black screen */
		if(pre_brightness == 0)
			{pr_err("%s set brightness :  %d \n",__func__,bl_level);}
		pre_brightness=bl_level;
#endif /*VENDOR_EDIT*/

	if(!pchip){
		dev_err(pchip->dev, "lm3630_bank_a_update_status pchip is null\n");
		return -ENOMEM;
		}
    if (!pchip->regmap || !lm3630_pchip->regmap) {
        pr_err("%s YXQ pchip->regmap is NULL.\n", __func__);
        return bl_level;
    }

	/* brightness 0 means disable */
	if (!bl_level) {
        ret = regmap_write(lm3630_pchip->regmap, REG_BRT_A, 0);
		ret = regmap_update_bits(pchip->regmap, REG_CTRL, 0x80, 0x80);
		if (ret < 0)
			goto out;
		return bl_level;
	}
	/* pwm control */
	//bl_level=255;
		/* i2c control */
		ret = regmap_update_bits(pchip->regmap, REG_CTRL, 0x80, 0x00);
		if (ret < 0)
			goto out;
		mdelay(1);
#ifndef VENDOR_EDIT


/* Xiaori.Yuan@Mobile Phone Software Dept.Driver, 2014/04/24  Modify for backlight flick when disable pwm */
		ret = regmap_write(pchip->regmap,
				   REG_BRT_A, bl_level);
#else /*VENDOR_EDIT*/
		if(bl_level>20)
			{
	
			ret = regmap_write(pchip->regmap,
				   REG_BRT_A, bl_level);
			}
		else if((get_pcb_version() < 20)||(get_pcb_version() >=30))/*liuyan add 30 for N3*/
			{

		
			ret = regmap_write(pchip->regmap,
				   REG_BRT_A, 2+(bl_level-1)*7/18);
			}
		else
			{
	
			ret = regmap_write(pchip->regmap,
				   REG_BRT_A, 2+(bl_level-1)*9/18);
			}
#endif /*VENDOR_EDIT*/
		if (ret < 0)
			goto out;
#ifdef VENDOR_EDIT


/* Xiaori.Yuan@Mobile Phone Software Dept.Driver, 2014/03/10  Add for flicker in low backlight */
		backlight_level =  bl_level;
		if(bl_level <= 0x14 && pwm_flag==true){
			set_backlight_pwm(0);
		}else if(bl_level > 0x14 && pwm_flag==false && cabc_mode >0){
			set_backlight_pwm(1);
		}
#endif /*VENDOR_EDIT*/

	return bl_level;
out:
	dev_err(pchip->dev, "i2c failed to access REG_CTRL\n");
	return bl_level;
}