Exemplo n.º 1
0
long k3fb_every_disp_time(void __user *p)
{
	int i = 0;
	long time = 0;
	long referencetime;
        
    if( 2 > g_frame_num )
    {
        k3fb_loge("k3fb_every_disp_time,TAG_Followability,%d frame!\n",g_frame_num);
        return  -EFAULT;
    }
	
    if (copy_from_user(&referencetime, p, sizeof(referencetime))) {
            k3fb_loge("k3fb_every_disp_time,TAG_Followability,copy from user failed!\n");
            return -EFAULT;
        }
    k3fb_logi("k3fb_every_disp_time,TAG_Followability, referencetime %lu \n",referencetime);
    
	for (i = 0; i < g_frame_num -1; i++)
	{   
	    /*get every frame dispay used time*/
		time = g_pframeinfo[i+1] - g_pframeinfo[i];

        k3fb_logi("k3fb_every_disp_time,TAG_Followability, %d frame use %ld time!\n",i+1,time);
		if (time > referencetime)
		{
            k3fb_loge("k3fb_every_disp_time,TAG_Followability, %d frame use %ld time failed!\n",i+1,time);
			return -EFAULT;
		}			
	}
	return 0;
}
Exemplo n.º 2
0
long k3fb_first_disp_time( void __user *p)
{
	long firstdispTime = 0;
	
	if(0 == g_frame_num)
	{
        k3fb_loge("TAG_Followability,frame num is zero!\n");
        return -EFAULT;
	}
	
    if (copy_from_user(&firstdispTime, p, sizeof(firstdispTime))) {
            k3fb_loge("TAG_Followability,copy from user failed!\n");
            return -EFAULT;
        }

    /*get the first disp time*/    
	firstdispTime = g_pframeinfo[0];
    
	if (copy_to_user(p, &firstdispTime, sizeof(firstdispTime))) {
		k3fb_loge("TAG_Followability,copy2user failed!\n");
		return -EFAULT;
    }
    
	return 0;
}
Exemplo n.º 3
0
int resource_cmds_tx(struct platform_device *pdev,
	struct resource_desc *cmds, int cnt)
{
	struct resource *res = NULL;
	struct resource_desc *cm = NULL;
	int i = 0;

	BUG_ON(pdev == NULL);
	cm = cmds;

	for (i = 0; i < cnt; i++) {
		if (cm == NULL) {
			k3fb_loge("cm(%d) is null!\n", i);
			continue;
		}

		BUG_ON(cm->name == NULL);

		res = platform_get_resource_byname(pdev, cm->flag, cm->name);
		if (!res) {
			k3fb_loge("failed to get %s resource!\n",
				(cm->name == NULL) ? "NULL" : cm->name);
		} else {
			*(cm->value) = res->start;
			cm++;
		}
	}

	return cnt;
}
void PWM_GPIO_REQUEST(struct k3_panel_info *pinfo)
{
	BUG_ON(pinfo == NULL);

	if (gpio_request(pinfo->gpio_pwm0, GPIO_LCD_PWM0_NAME) != 0) {
		k3fb_loge("failed to request gpio pwm0!\n");
	}
	
	if (gpio_request(pinfo->gpio_pwm1, GPIO_LCD_PWM1_NAME) != 0) {
		k3fb_loge("failed to request gpio pwm1!\n");
	}
}
Exemplo n.º 5
0
void k3fb_listInsert(long currenttime)
{
    long *pframeinfo;
    int i;
    int maxnum;

    if( g_max_num == MAX_NUM)
    {
        if(g_max_num > g_frame_num )
        {       
            g_frame_time_array[g_frame_num] = currenttime;
            g_frame_num ++;
        }
        else
        {
    	    pframeinfo =(long *)kmalloc(sizeof(long)*MAX_NUM*4 ,GFP_KERNEL);
    	    if(NULL == pframeinfo)
    	    {
                k3fb_loge("TAG_Followability,k3fb_listInsert kmalloc fail!\n");
    	        return;
    	    }
    	    
    	    memset(pframeinfo,0x0,sizeof(long)*MAX_NUM*4);
    	    
    	    for(i = 0; i < MAX_NUM; i++ )
    	    {
    	        pframeinfo[i] = g_frame_time_array[i];
    	    }
    	    pframeinfo[g_frame_num] = currenttime;
    	    g_frame_num ++;  	    
    	    g_pframeinfo = pframeinfo;
    	    g_max_num    = MAX_NUM*4;
        }
    }
    else 
    {
        if(g_max_num > g_frame_num )
        {
            g_pframeinfo[g_frame_num] = currenttime;
            g_frame_num ++;
        }
        else
        {
            k3fb_loge("TAG_Followability,no space to record,current frame %d\n",g_frame_num);
            return;
        } 
    }
}
Exemplo n.º 6
0
int iomux_cmds_tx(struct iomux_desc *cmds, int cnt)
{
	struct iomux_desc *cm = NULL;
	int i = 0;

	cm = cmds;

	for (i = 0; i < cnt; i++) {
		if (cm == NULL) {
			k3fb_loge("cm(%d) is null!\n", i);
			continue;
		}

		BUG_ON(cm->name == NULL);

		if (cm->dtype == DTYPE_IOMUX_GET) {
			if (cm->name == NULL) {
				k3fb_loge("Block name is NULL!\n");
			}
			*(cm->block) = iomux_get_block(cm->name);
			if (*(cm->block) == NULL) {
				k3fb_loge("failed to iomux_get_block, name=%s!\n",
					(cm->name == NULL) ? "NULL" : cm->name);

				continue;
			}

			*(cm->block_config) = iomux_get_blockconfig(cm->name);
			if (*(cm->block_config) == NULL) {
				k3fb_loge("failed to iomux_get_blockconfig, name=%s!\n",
					(cm->name == NULL) ? "NULL" : cm->name);

				continue;
			}
		} else if (cm->dtype == DTYPE_IOMUX_SET) {
			if (blockmux_set(*(cm->block), *(cm->block_config), cm->mode) != 0) {
				k3fb_loge("failed to blockmux_set, name=%s!\n",
					(cm->name == NULL) ? "NULL" : cm->name);

				continue;
			}
		}

		cm++;
	}

	return cnt;
}
int PWM_CLK_GET(struct k3_panel_info *pinfo)
{
	BUG_ON(pinfo == NULL);

	pinfo->pwm_clk = clk_get(NULL, CLK_PWM0_NAME);
	if (IS_ERR(pinfo->pwm_clk)) {
		k3fb_loge("failed to get pwm0 clk!\n");
		return PTR_ERR(pinfo->pwm_clk);
	}
	
	if (clk_set_rate(pinfo->pwm_clk, DEFAULT_PWM_CLK_RATE) != 0) {
		k3fb_loge("failed to set pwm clk rate!\n");
	}

	return 0;
}
Exemplo n.º 8
0
/*
 * mipi dsi short write with 0, 1 2 parameters
 * Write to GEN_HDR 24 bit register the value:
 * 1. 00h, MCS_command[15:8] ,VC[7:6],13h
 * 2. Data1[23:16], MCS_command[15:8] ,VC[7:6],23h
 */
int mipi_dsi_swrite(struct dsi_cmd_desc *cm)
{
    u32 hdr = 0;
    int len = 0;

    if (cm->dlen && cm->payload == 0) {
        k3fb_loge("NO payload error!\n");
        return 0;
    }

    len = (cm->dlen > 2) ? 2 : cm->dlen;

    hdr |= DSI_HDR_DTYPE(cm->dtype);
    hdr |= DSI_HDR_VC(cm->vc);
    if (len == 1) {
        hdr |= DSI_HDR_DATA1(cm->payload[0]);
        hdr |= DSI_HDR_DATA2(0);
    } else if (len == 2) {
        hdr |= DSI_HDR_DATA1(cm->payload[0]);
        hdr |= DSI_HDR_DATA2(cm->payload[1]);
    } else {
        hdr |= DSI_HDR_DATA1(0);
        hdr |= DSI_HDR_DATA2(0);
    }

    set_MIPIDSI_GEN_HDR(hdr);

    return len;  /* 4 bytes */
}
static int mipi_cmi_panel_on(struct platform_device *pdev)
{
	struct k3_fb_data_type *k3fd = NULL;
	struct k3_panel_info *pinfo = NULL;

	BUG_ON(pdev == NULL);

	k3fd = (struct k3_fb_data_type *)platform_get_drvdata(pdev);
	BUG_ON(k3fd == NULL);

	pinfo = &(k3fd->panel_info);
	if (pinfo->lcd_init_step == LCD_INIT_POWER_ON) {
		/* lcd vcc enable */
		vcc_cmds_tx(NULL, cmi_lcd_vcc_enable_cmds, \
			ARRAY_SIZE(cmi_lcd_vcc_enable_cmds));

		pinfo->lcd_init_step = 	LCD_INIT_MIPI_LP_SEND_SEQUENCE;
	} else if (pinfo->lcd_init_step == LCD_INIT_MIPI_LP_SEND_SEQUENCE) {
		if (!g_display_on) {
			/* lcd display on */
			cmi_disp_on(k3fd);
		}
		pinfo->lcd_init_step = LCD_INIT_MIPI_HS_SEND_SEQUENCE;
	} else if (pinfo->lcd_init_step == LCD_INIT_MIPI_HS_SEND_SEQUENCE) {

		g_display_on = true;
	} else {
		k3fb_loge("failed to init lcd!\n");
	}

	return 0;
}
Exemplo n.º 10
0
static int ldi_on(struct platform_device *pdev)
{
	int ret = 0;
	struct k3_fb_data_type *k3fd = NULL;

	BUG_ON(pdev == NULL);

	k3fd = (struct k3_fb_data_type *)platform_get_drvdata(pdev);
	BUG_ON(k3fd == NULL);

	/* ldi clock enable */
	ret = clk_enable(k3fd->ldi_clk);
	if (ret != 0) {
		k3fb_loge("failed to enable ldi_clk, error=%d!\n", ret);
		return ret;
	}

	/* ldi init */
	ldi_init(k3fd);

	if (k3fd->panel_info.type == PANEL_LDI) {
		/* set LCD init step before LCD on*/
		k3fd->panel_info.lcd_init_step = LCD_INIT_POWER_ON;
		ret = panel_next_on(pdev);
	}

	ret = panel_next_on(pdev);

	set_LDI_CTRL_ldi_en(k3fd->edc_base, K3_ENABLE);

	return ret;
}
void PWM_IOMUX_SET(struct k3_panel_info *pinfo, int mode)
{
	BUG_ON(pinfo == NULL);

	if (blockmux_set(pinfo->pwm_block, pinfo->pwm_block_config, (mode)) != 0) {
		k3fb_loge("failed to set iomux pwm normal mode!\n");
	}
}
int LCD_RESOURCE(struct platform_device *pdev, struct k3_panel_info *pinfo, 
	struct resource *res)
{
	BUG_ON(pdev == NULL);
	BUG_ON(pinfo == NULL);

	res = platform_get_resource_byname(pdev, IORESOURCE_IO, GPIO_LCD_RESET_NAME);
	if (!res) {
		k3fb_loge("failed to get gpio reset resource!\n");
		return -ENXIO;
	}
	
	pinfo->gpio_reset = res->start;
	if (!gpio_is_valid(pinfo->gpio_reset)) {
		k3fb_loge("failed to get gpio reset resource!\n");
		return -ENXIO;
	}
	
	res = platform_get_resource_byname(pdev, IORESOURCE_IO, GPIO_LCD_POWER_NAME);
	if (!res) {
		k3fb_loge("failed to get gpio power resource!\n");
		return -ENXIO;
	}
	
	pinfo->gpio_power = res->start;
	if (!gpio_is_valid(pinfo->gpio_power)) {
		k3fb_loge("failed to get gpio power resource!\n");
		return -ENXIO;
	}

	res = platform_get_resource_byname(pdev, IORESOURCE_IO, GPIO_LCD_ID0_NAME);
	if (!res) {
		k3fb_loge("failed to get gpio_lcd_id0 resource!\n");
		return -ENXIO;
	}
	
	pinfo->gpio_lcd_id0 = res->start;
	if (!(gpio_is_valid(pinfo->gpio_lcd_id0))) {
		k3fb_loge("gpio_lcd_id0 is invalid!\n");
		return -ENXIO;
	}
	
	res = platform_get_resource_byname(pdev, IORESOURCE_IO, GPIO_LCD_ID1_NAME);
	if (!res) {
		k3fb_loge("failed to get gpio_lcd_id1 resource.\n");
		return -ENXIO;
	}
	
	pinfo->gpio_lcd_id1 = res->start;
	if (!(gpio_is_valid(pinfo->gpio_lcd_id1))) {
		k3fb_loge("gpio_lcd_id1 is invalid!\n");
		return -ENXIO;
	}

	return 0;
}
void LCDIO_SET_VOLTAGE(struct k3_panel_info *pinfo, u32 min_uV, u32 max_uV)
{
	BUG_ON(pinfo == NULL);

	if (regulator_set_voltage(pinfo->lcdio_vcc, min_uV, max_uV) != 0) {
		k3fb_loge("failed to set lcdio vcc!\n");
	}
}
void LCD_IOMUX_SET(struct k3_panel_info *pinfo, int mode)
{
	BUG_ON(pinfo == NULL);

	if (blockmux_set(pinfo->lcd_block, pinfo->lcd_block_config, mode) != 0) {
		k3fb_loge("failed to set iomux_lcd normal mode!\n");
	}
}
void LCD_VCC_DISABLE(struct k3_panel_info *pinfo)
{
	BUG_ON(pinfo == NULL);

#if !defined(CONFIG_LCD_PANASONIC_VVX10F002A00) && !defined(CONFIG_LCD_QIMEI_HJ101IA_01F_10)
	if (!IS_ERR(pinfo->lcdanalog_vcc)) {
		if (regulator_disable(pinfo->lcdanalog_vcc) != 0) {
			k3fb_loge("failed to disable lcdanalog-vcc regulator!\n");
		}
	}
#endif
	
	if (!IS_ERR(pinfo->lcdio_vcc)) {
		if (regulator_disable(pinfo->lcdio_vcc) != 0) {
			k3fb_loge("failed to disable lcdio-vcc regulator!\n");
		}
	}
}
int PWM_IOMUX_GET(struct k3_panel_info *pinfo)
{
	BUG_ON(pinfo == NULL);

	pinfo->pwm_block = iomux_get_block(IOMUX_PWM_NAME);
	if (!pinfo->pwm_block) {
		k3fb_loge("failed to get iomux_pwm!\n");
		return PTR_ERR(pinfo->pwm_block);
	}
	
	pinfo->pwm_block_config = iomux_get_blockconfig(IOMUX_PWM_NAME);
	if (!pinfo->pwm_block_config) {
		k3fb_loge("failed to get iomux_pwm config!\n");
		return PTR_ERR(pinfo->pwm_block_config);
	}

	return 0;
}
struct platform_device *k3_fb_device_alloc(struct k3_fb_panel_data *pdata,
	u32 type, u32 index, u32 *graphic_ch)
{
	struct platform_device *this_dev = NULL;
	char dev_name[16] = {0};

	BUG_ON(pdata == NULL);

	switch (type) {
	case PANEL_HDMI:
		snprintf(dev_name, sizeof(dev_name), DEV_NAME_LDI);
		*graphic_ch = OVERLAY_PIPE_EDC1_CH1;
		break;
	case PANEL_DP:
		snprintf(dev_name, sizeof(dev_name), DEV_NAME_DP);
		*graphic_ch = OVERLAY_PIPE_EDC1_CH1;
		break;
	case PANEL_LDI:
		snprintf(dev_name, sizeof(dev_name), DEV_NAME_LDI);
		*graphic_ch = OVERLAY_PIPE_EDC0_CH2;
		break;
	case PANEL_MIPI_VIDEO:
	case PANEL_MIPI_CMD:
		snprintf(dev_name, sizeof(dev_name), DEV_NAME_MIPIDSI);
		*graphic_ch = OVERLAY_PIPE_EDC0_CH2;
		break;
	default:
		k3fb_loge("invalid panel type = %d!\n", type);
		return NULL;
	}

	pdata->next = NULL;

	this_dev = platform_device_alloc(dev_name, index + 1);
	if (this_dev) {
		if (platform_device_add_data(this_dev, pdata, sizeof(struct k3_fb_panel_data))) {
			k3fb_loge("failed to platform_device_add_data!\n");
			platform_device_put(this_dev);
			return NULL;
		}
	}

	return this_dev;
}
int LCD_VCC_GET(struct platform_device *pdev, struct k3_panel_info *pinfo)
{
	BUG_ON(pdev == NULL);
	BUG_ON(pinfo == NULL);

	pinfo->lcdio_vcc = regulator_get(&pdev->dev, VCC_LCDIO_NAME);
	if (IS_ERR(pinfo->lcdio_vcc)) {
		k3fb_loge("failed to get lcdio-vcc regulator!\n");
		return PTR_ERR((pinfo)->lcdio_vcc);
	}
	
#if !defined(CONFIG_LCD_PANASONIC_VVX10F002A00) && !defined(CONFIG_LCD_QIMEI_HJ101IA_01F_10)
	pinfo->lcdanalog_vcc = regulator_get(&pdev->dev, VCC_LCDANALOG_NAME);
	if (IS_ERR(pinfo->lcdanalog_vcc)) {
		k3fb_loge("failed to get lcdanalog-vcc regulator!\n");
		return PTR_ERR(pinfo->lcdanalog_vcc);
	}
#endif
	return 0;
}
void LCD_GPIO_REQUEST(struct k3_panel_info *pinfo)
{
	BUG_ON(pinfo == NULL);

	if (gpio_request(pinfo->gpio_led_en, GPIO_LED_EN_NAME) != 0) {
		k3fb_loge("failed to request gpio led enable!\n");
	}

	if (gpio_request(pinfo->gpio_avdd, GPIO_LCD_AVDD_NAME) != 0) {
		k3fb_loge("failed to request gpio lcd avdd!\n");
	}

	if (gpio_request(pinfo->gpio_lcd_id0, GPIO_LCD_ID0_NAME) != 0) {
		k3fb_loge("failed to request gpio_lcd_id0!\n");
	}

	if (gpio_request(pinfo->gpio_lcd_id1, GPIO_LCD_ID1_NAME) != 0) {
		k3fb_loge("failed to request gpio_lcd_id1!\n");
	}
}
void LCD_GPIO_REQUEST(struct k3_panel_info *pinfo)
{
	BUG_ON(pinfo == NULL);

	if (gpio_request(pinfo->gpio_power, GPIO_LCD_POWER_NAME) != 0) {
		k3fb_loge("failed to request gpio power!\n");
	}

	if (gpio_request(pinfo->gpio_reset, GPIO_LCD_RESET_NAME) != 0) {
		k3fb_loge("failed to request gpio reset!\n");
	}

	if (gpio_request(pinfo->gpio_lcd_id0, GPIO_LCD_ID0_NAME) != 0) {
		k3fb_loge("failed to request gpio_lcd_id0!\n");
	}

	if (gpio_request(pinfo->gpio_lcd_id1, GPIO_LCD_ID1_NAME) != 0) {
		k3fb_loge("failed to request gpio_lcd_id1!\n");
	}
}
Exemplo n.º 21
0
static int __init ldi_driver_init(void)
{
	int ret = 0;

	ret = platform_driver_register(&this_driver);
	if (ret) {
		k3fb_loge("not able to register the driver, error=%d!\n", ret);
		return ret;
	}

	return ret;
}
Exemplo n.º 22
0
static int __init mipi_jdi_panel_init(void)
{
	int ret = 0;

	ret = platform_driver_register(&this_driver);
	if (ret) {
		k3fb_loge("not able to register the driver\n");
		return ret;
	}

	return ret;
}
Exemplo n.º 23
0
static int jdi_sysfs_init(struct platform_device *pdev)
{
	int ret = 0;

	ret = sysfs_create_group(&pdev->dev.kobj, &jdi_attr_group);
	if (ret) {
		k3fb_loge("create sysfs file failed!\n");
		return ret;
	}

	return 0;
}
int PWM_RESOUTCE(struct platform_device *pdev, struct k3_panel_info *pinfo, 
	struct resource *res)
{
	BUG_ON(pdev == NULL);
	BUG_ON(pinfo == NULL);

	res = platform_get_resource_byname(pdev, IORESOURCE_MEM,  REG_BASE_PWM0_NAME);
	if (!res) {
		k3fb_loge("failed to get pwm0 resource!\n");
		return -ENXIO;
	}
	
	pinfo->pwm_base = res->start;
	res = platform_get_resource_byname(pdev, IORESOURCE_IO, GPIO_LCD_PWM0_NAME);
	if (!res) {
		k3fb_loge("failed to get gpio pwm0 resource!\n");
		return -ENXIO;
	}
	
	pinfo->gpio_pwm0 = res->start;
	if (!(gpio_is_valid(pinfo->gpio_pwm0))) {
		k3fb_loge("gpio pwm0 is invalid!\n");
		return -ENXIO;
	}
	
	res = platform_get_resource_byname(pdev, IORESOURCE_IO, GPIO_LCD_PWM1_NAME);
	if (!res) {
		k3fb_loge("failed to get gpio pwm1 resource!\n");
		return -ENXIO;
	}
	
	pinfo->gpio_pwm1 = res->start;
	if (!(gpio_is_valid(pinfo->gpio_pwm1))) {
		k3fb_loge("gpio pwm1 is invalid!\n");
		return -ENXIO;
	}

	return 0;
}
Exemplo n.º 25
0
long k3fb_average_frame_rate(void __user *p)
{
	long averageframerate = 0;
	long startelem;
	long endlem;
	
	if(0 == g_frame_num)
	{
        k3fb_loge("TAG_Followability,frame num is zero!\n");
        return -EFAULT;
	}
	
    if (copy_from_user(&averageframerate, p, sizeof(averageframerate))) {
            k3fb_loge("k3fb_average_frame_rate,TAG_Followability copy from user failed!\n");
            return -EFAULT;
        }

    startelem = g_pframeinfo[0];
    
    endlem = g_pframeinfo[g_frame_num - 1];
    
    if( 0 == endlem - startelem )
    {
        k3fb_loge("k3fb_average_frame_rate,TAG_Followability no update data!\n");
        return -EFAULT;
    }
	averageframerate = (1000 * (g_frame_num - 1) ) /( endlem - startelem) ;

    k3fb_logi("k3fb_average_frame_rate,TAG_Followability averageframerate is %ld \n",averageframerate);

	if (copy_to_user(p, &averageframerate, sizeof(averageframerate))) {
		k3fb_loge("k3fb_average_frame_rate,TAG_Followability copy2user failed!\n");
		return -EFAULT;
    }
	return 0;
}
Exemplo n.º 26
0
int gpio_cmds_tx(struct gpio_desc *cmds, int cnt)
{
	struct gpio_desc *cm = NULL;
	int i = 0;

	cm = cmds;

	for (i = 0; i < cnt; i++) {
		if (cm == NULL) {
			k3fb_loge("cm(%d) is null!\n", i);
			continue;
		}
		if (!gpio_is_valid(cm->gpio)) {
			k3fb_loge("gpio invalid, dtype=%d, lable=%s, gpio=%d!\n",
				cm->dtype, (cm->label == NULL) ? "NULL" : cm->label, cm->gpio);

			continue;
		}

		if (cm->dtype == DTYPE_GPIO_INPUT) {
			if (gpio_direction_input(cm->gpio) != 0) {
				k3fb_loge("failed to gpio_direction_input, lable=%s, gpio=%d!\n",
					(cm->label == NULL) ? "NULL" : cm->label, cm->gpio);
			}
		} else if (cm->dtype == DTYPE_GPIO_OUTPUT) {
			if (gpio_direction_output(cm->gpio, cm->value) != 0) {
				k3fb_loge("failed to gpio_direction_output, label%s, gpio=%d!\n",
					(cm->label == NULL) ? "NULL" : cm->label, cm->gpio);
			}
		} else if (cm->dtype == DTYPE_GPIO_REQUEST) {
			if (gpio_request(cm->gpio, cm->label) != 0) {
				k3fb_loge("failed to gpio_request, lable=%s, gpio=%d!\n",
					(cm->label == NULL) ? "NULL" : cm->label, cm->gpio);
			}
		} else if (cm->dtype == DTYPE_GPIO_FREE) {
			gpio_free(cm->gpio);
		} else {
			k3fb_loge("dtype=%x NOT supported\n", cm->dtype);
		}

		if (cm->wait) {
			if (cm->waittype == WAIT_TYPE_US)
				udelay(cm->wait);
			else if (cm->waittype == WAIT_TYPE_MS)
				mdelay(cm->wait);
			else
				mdelay(cm->wait * 1000);
		}
		cm++;
	}

	return cnt;
}
Exemplo n.º 27
0
int vcc_cmds_tx(struct platform_device *pdev, struct vcc_desc *cmds, int cnt)
{
	struct vcc_desc *cm = NULL;
	int i = 0;

	cm = cmds;

	for (i = 0; i < cnt; i++) {
		if (cm == NULL) {
			k3fb_loge("cm(%d) is null!\n", i);
			continue;
		}
		if (cm->dtype == DTYPE_VCC_GET) {
			BUG_ON(pdev == NULL);

			*(cm->regulator) = regulator_get(&pdev->dev, cm->id);
			if (IS_ERR(*(cm->regulator))) {
				k3fb_loge("failed to get %s regulator!\n", cm->id);
			}
		} else if (cm->dtype == DTYPE_VCC_PUT) {
			if (!IS_ERR(*(cm->regulator))) {
				regulator_put(*(cm->regulator));
			}
		} else if (cm->dtype == DTYPE_VCC_ENABLE) {
			if (!IS_ERR(*(cm->regulator))) {
				if (regulator_enable(*(cm->regulator)) != 0) {
					k3fb_loge("failed to enable %s regulator!\n",
						(cm->id == NULL) ? "NULL" : cm->id);
				}
			}
		} else if (cm->dtype == DTYPE_VCC_DISABLE) {
			if (!IS_ERR(*(cm->regulator))) {
				if (regulator_disable(*(cm->regulator)) != 0) {
					k3fb_loge("failed to disable %s regulator!\n",
						(cm->id == NULL) ? "NULL" : cm->id);
				}
			}
		} else if (cm->dtype == DTYPE_VCC_SET_VOLTAGE) {
			if (!IS_ERR(*(cm->regulator))) {
				if (regulator_set_voltage(*(cm->regulator), cm->min_uV, cm->max_uV) != 0) {
					k3fb_loge("failed to set %s regulator voltage!\n",
						(cm->id == NULL) ? "NULL" : cm->id);
				}
			}
		} else {
			k3fb_loge("dtype=%x NOT supported\n", cm->dtype);
		}

		cm++;
	}

	return cnt;
}
Exemplo n.º 28
0
static int mipi_jdi_panel_on(struct platform_device *pdev)
{
	struct k3_fb_data_type *k3fd = NULL;
	struct k3_panel_info *pinfo = NULL;

	BUG_ON(pdev == NULL);
	
	k3fd = (struct k3_fb_data_type *)platform_get_drvdata(pdev);
	BUG_ON(k3fd == NULL);

	pinfo = &(k3fd->panel_info);
	if (pinfo->lcd_init_step == LCD_INIT_POWER_ON) {
		/* tp vcc enable */
		vcc_cmds_tx(NULL, jdi_tp_vcc_enable_cmds, \
			ARRAY_SIZE(jdi_tp_vcc_enable_cmds));

		/* tk vcc enable */
		if (g_touchkey_enable == true) {
			vcc_cmds_tx(pdev, jdi_tk_vcc_enable_cmds, \
				ARRAY_SIZE(jdi_tk_vcc_enable_cmds));
		}
		/* lcd vcc enable */
		vcc_cmds_tx(NULL, jdi_lcd_vcc_enable_cmds, \
			ARRAY_SIZE(jdi_lcd_vcc_enable_cmds));

		pinfo->lcd_init_step = LCD_INIT_MIPI_LP_SEND_SEQUENCE;
	} else if (pinfo->lcd_init_step == LCD_INIT_MIPI_LP_SEND_SEQUENCE) {
		if (!g_display_on) {
			/* lcd display on */
			jdi_disp_on(k3fd);
			skip_esd_once = true;
		}
		pinfo->lcd_init_step = LCD_INIT_MIPI_HS_SEND_SEQUENCE;
	} else if (pinfo->lcd_init_step == LCD_INIT_MIPI_HS_SEND_SEQUENCE) {

        g_display_on = true;
        backlight_log_once = true;
	} else {
		k3fb_loge("failed to init lcd!\n");
	}

	return 0;
}
Exemplo n.º 29
0
void k3fb_follow_stop(void __user *p)
{
    int i = 0;
	long time = 0;
    long perframetime = 0;
    
	g_follow_flag = G_FOLLOW_FLAG_STOP;
	
    
    if (copy_from_user(&perframetime, p, sizeof(perframetime))) {
        k3fb_loge("TAG_Followability,copy from user failed!\n");
        return ;
    }
    
    k3fb_logi("TAG_Followability,receive %d frame! \n",g_frame_num);
    k3fb_logi("TAG_Followability,stop and receive refrence time = %d\n",perframetime);

    if( 2 > g_frame_num )
    {
        return;
    }
    
    for (i = g_frame_num - 1; i >= 1; i--)
    {        
        time = g_pframeinfo[i] - g_pframeinfo[i - 1];

        /* avoid some frame too long ,delete the node */
        if(time > perframetime){
            k3fb_logi("TAG_Followability,%d frame use %ld ms,remove it! \n",i,time);
            
            g_pframeinfo[i] = 0;
            g_frame_num--;
            continue;
         }
         else{
             break;
         }
     }
}
Exemplo n.º 30
0
static int ldi_set_timing(struct platform_device *pdev)
{
	int ret = 0;
	struct k3_fb_data_type *k3fd = NULL;
	struct k3_panel_info *pinfo = NULL;
	u32 edc_base = 0;

	BUG_ON(pdev == NULL);

	k3fd = (struct k3_fb_data_type *)platform_get_drvdata(pdev);
	BUG_ON(k3fd == NULL);

	pinfo = &(k3fd->panel_info);
	edc_base = k3fd->edc_base;

	set_LDI_HRZ_CTRL0_hfp(edc_base, pinfo->ldi.h_front_porch);
	set_LDI_HRZ_CTRL0_hbp(edc_base, pinfo->ldi.h_back_porch);
	set_LDI_HRZ_CTRL1_hsw(edc_base, pinfo->ldi.h_pulse_width);
	set_LDI_VRT_CTRL0_vfp(edc_base, pinfo->ldi.v_front_porch);
	set_LDI_VRT_CTRL0_vbp(edc_base, pinfo->ldi.v_back_porch);
	if (pinfo->ldi.v_pulse_width > 15)
		pinfo->ldi.v_pulse_width = 15;
	set_LDI_VRT_CTRL1_vsw(edc_base, pinfo->ldi.v_pulse_width);

	set_LDI_DSP_SIZE_hsize(edc_base, pinfo->xres);
	set_LDI_DSP_SIZE_vsize(edc_base, pinfo->yres);

	set_LDI_PLR_CTRL_hsync(edc_base, pinfo->ldi.hsync_plr);
	set_LDI_PLR_CTRL_vsync(edc_base, pinfo->ldi.vsync_plr);

	if (clk_set_rate(k3fd->ldi_clk, pinfo->clk_rate) != 0) {
		k3fb_loge("failed to set ldi clk rate(%d).\n", pinfo->clk_rate);
	}

	ret = panel_next_set_timing(pdev);

	return ret;
}