static void mipi_r63306_backup_nvm_to_ram(struct msm_fb_data_type *mfd)
{
	struct mipi_dsi_data *dsi_data;
	struct dsi_nvm_rewrite_ctl *pnvrw_ctl;
	int n;

	dsi_data = platform_get_drvdata(mfd->panel_pdev);
	pnvrw_ctl = dsi_data->panel->pnvrw_ctl;
	mipi_dsi_cmds_tx(&dsi_data->tx_buf, pnvrw_ctl->nvm_mcap_unlock,
					pnvrw_ctl->nvm_mcap_unlock_size);

	/* Backup E7 register */
	if (pnvrw_ctl->nvm_read_e7 && pnvrw_ctl->nvm_restore_e7) {
		mipi_dsi_cmds_rx(mfd, &dsi_data->tx_buf, &dsi_data->rx_buf,
			pnvrw_ctl->nvm_read_e7, pnvrw_ctl->nvm_e7_nbr_params);
		for (n = 0; n < pnvrw_ctl->nvm_e7_nbr_params; n++) {
			pnvrw_ctl->nvm_e7[n + 1] = dsi_data->rx_buf.data[n];
		}
	}

	/* Backup DE register */
	if (pnvrw_ctl->nvm_read_de && pnvrw_ctl->nvm_restore_de) {
		mipi_dsi_cmds_rx(mfd, &dsi_data->tx_buf, &dsi_data->rx_buf,
			pnvrw_ctl->nvm_read_de, pnvrw_ctl->nvm_de_nbr_params);
		for (n = 0; n < pnvrw_ctl->nvm_de_nbr_params; n++) {
			if (pnvrw_ctl->nvm_de_valid_param_start <= n &&
					n <= pnvrw_ctl->nvm_de_valid_param_end)
				pnvrw_ctl->nvm_de[n + 1] =
						dsi_data->rx_buf.data[n];
		}
	}
	mipi_dsi_cmds_tx(&dsi_data->tx_buf, pnvrw_ctl->nvm_mcap_lock,
						pnvrw_ctl->nvm_mcap_lock_size);
}
static int mipi_r63306_nvm_erase_all(struct msm_fb_data_type *mfd)
{
	struct device *dev = &mfd->panel_pdev->dev;
	struct mipi_dsi_data *dsi_data;
	struct dsi_nvm_rewrite_ctl *pnvrw_ctl;
	int ret = 0;
	int i;

	dev_dbg(dev, "%s: start\n", __func__);

	dsi_data = platform_get_drvdata(mfd->panel_pdev);
	if (!dsi_data && !dsi_data->panel && !dsi_data->panel->pnvrw_ctl) {
		ret = -1;
		goto exit;
	}

	pnvrw_ctl = dsi_data->panel->pnvrw_ctl;
	/* Enter sleep not in spec, but we come get here when panel is on */
	mipi_dsi_cmds_tx(&dsi_data->tx_buf,
		pnvrw_ctl->nvm_enter_sleep, pnvrw_ctl->nvm_enter_sleep_size);
	mipi_dsi_cmds_tx(&dsi_data->tx_buf,
		pnvrw_ctl->nvm_mcap_unlock, pnvrw_ctl->nvm_mcap_unlock_size);

	mipi_set_tx_power_mode(0);

	for (i = 0; i < NVRW_RETRY; i++) {
		mipi_dsi_cmds_tx(&dsi_data->tx_buf, pnvrw_ctl->nvm_erase_all,
						pnvrw_ctl->nvm_erase_all_size);
		mipi_dsi_cmds_rx(mfd, &dsi_data->tx_buf, &dsi_data->rx_buf,
					pnvrw_ctl->nvm_read_e4, 1);
		if (dsi_data->rx_buf.data[0] == 0xBD) {
			dev_warn(dev, "%s: E4 failed (0x%02x), retry %d\n",
				__func__, dsi_data->rx_buf.data[0], i + 1);
			nvm_retry(dsi_data, pnvrw_ctl);
			continue;
		}
		mipi_dsi_cmds_tx(&dsi_data->tx_buf, pnvrw_ctl->nvm_erase_finish,
					pnvrw_ctl->nvm_erase_finish_size);
		mipi_dsi_cmds_rx(mfd, &dsi_data->tx_buf, &dsi_data->rx_buf,
					pnvrw_ctl->nvm_read_e1, 1);
		if (dsi_data->rx_buf.data[0] == 0x00) {
			dev_warn(dev, "%s: E1 failed (0x%02x), retry %d\n",
				__func__, dsi_data->rx_buf.data[0], i + 1);
			nvm_retry(dsi_data, pnvrw_ctl);
			continue;
		}
		break;
	}
	if (i >= NVRW_RETRY) {
		dev_err(&mfd->panel_pdev->dev, "%s: failed.\n", __func__);
		ret = -1;
	}
	end_nvm_command(dsi_data, pnvrw_ctl);
exit:
	dev_dbg(dev, "%s: end, ret = %d\n", __func__, ret);
	return ret;
}
Exemplo n.º 3
0
static uint32 mipi_samsung_manufacture_id(struct msm_fb_data_type *mfd)
{
	struct dsi_buf *rp, *tp;

	struct dsi_cmd_desc *cmd;
	uint32 id;

	mutex_lock(&dsi_tx_mutex);

	tp = &msd.samsung_tx_buf;
	rp = &msd.samsung_rx_buf;
	mipi_dsi_buf_init(rp);
	mipi_dsi_buf_init(tp);

	cmd = &samsung_manufacture_id1_cmd;
	mipi_dsi_cmds_rx(mfd, tp, rp, cmd, 1);

/*	pr_info("%s: manufacture_id1=%x\n", __func__, *rp->data); */
	id = *((uint8 *)rp->data);
	id <<= 8;

	mipi_dsi_buf_init(rp);
	mipi_dsi_buf_init(tp);

	cmd = &samsung_manufacture_id2_cmd;
	mipi_dsi_cmds_rx(mfd, tp, rp, cmd, 1);

/*	pr_info("%s: manufacture_id2=%x\n", __func__, *rp->data); */
	bypass_lcd_id = *rp->data;
	id |= *((uint8*)rp->data);
	id <<= 8;

	mipi_dsi_buf_init(rp);
	mipi_dsi_buf_init(tp);

	cmd = &samsung_manufacture_id3_cmd;
	mipi_dsi_cmds_rx(mfd, tp, rp, cmd, 1);

/*	pr_info("%s: manufacture_id3=%x\n", __func__, *rp->data); */
	elvss_value = *rp->data;
	id |= *((uint8 *)rp->data);

	pr_info("%s: manufacture_id=%x\n", __func__, id);

#ifdef FACTORY_TEST
	if (id == 0x00) {
		pr_info("Lcd is not connected\n");
		is_lcd_connected = 0;
	}
#endif
	mutex_unlock(&dsi_tx_mutex);
	return id;
}
static bool mipi_r63303_is_nvm_ok(struct msm_fb_data_type *mfd)
{
	struct mipi_dsi_data *dsi_data;
	struct dsi_nvm_rewrite_ctl *pnvrw_ctl;
	struct device *dev = &mfd->panel_pdev->dev;
	int n;
	bool verify_ok = true;

	dsi_data = platform_get_drvdata(mfd->panel_pdev);
	pnvrw_ctl = dsi_data->panel->pnvrw_ctl;
	mipi_dsi_cmds_tx(&dsi_data->tx_buf, pnvrw_ctl->nvm_mcap_unlock,
					pnvrw_ctl->nvm_mcap_unlock_size);

	/* Check E6 register data */
	if (pnvrw_ctl->nvm_read_e6) {
		mipi_dsi_cmds_rx(mfd, &dsi_data->tx_buf, &dsi_data->rx_buf,
				pnvrw_ctl->nvm_read_e6, NVRW_NUM_E6_PARAM);
		for (n = 0; n < NVRW_NUM_E6_PARAM; n++) {
			if ((n < NVRW_NUM_E6_VALID_PARAM) &&
					(dsi_data->rx_buf.data[n] !=
						pnvrw_ctl->nvm_e6[n + 1])) {
				dev_warn(dev, "%s: E6 (r 0x%02x, 0x%02x)\n",
					__func__, dsi_data->rx_buf.data[n],
					pnvrw_ctl->nvm_e6[n + 1]);
				verify_ok = false;
				goto exit;
			}
		}
	}

	/* Check BF register data */
	 if (pnvrw_ctl->nvm_read_bf) {
		mipi_dsi_cmds_rx(mfd, &dsi_data->tx_buf, &dsi_data->rx_buf,
				pnvrw_ctl->nvm_read_bf, NVRW_NUM_BF_PARAM);
		for (n = 0; n < NVRW_NUM_BF_PARAM; n++) {
			if (dsi_data->rx_buf.data[n] !=
					pnvrw_ctl->nvm_bf[n + 1]) {
				dev_warn(dev, "%s: BF (r 0x%02x, 0x%02x)\n",
					__func__, dsi_data->rx_buf.data[n],
					pnvrw_ctl->nvm_bf[n + 1]);
				verify_ok = false;
				goto exit;
			}
		}
	}
exit:
	mipi_dsi_cmds_tx(&dsi_data->tx_buf, pnvrw_ctl->nvm_mcap_lock,
						pnvrw_ctl->nvm_mcap_lock_size);
	return verify_ok;
}
static uint32 mipi_samsung_manufacture_id(struct msm_fb_data_type *mfd)
{
	struct dsi_buf *rp, *tp;
	struct dsi_cmd_desc *cmd;
	uint32 id, id1;

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

	mipi_dsi_buf_init(rp);
	mipi_dsi_buf_init(tp);
	/*read Id1 two time since fist time id read is always returning 0*/
	cmd = &samsung_manufacture_id1_cmd;
	mipi_dsi_cmds_rx(mfd, tp, rp, cmd, 1);
	id1 = *((uint8 *)rp->data);

	mipi_dsi_buf_init(rp);
	mipi_dsi_buf_init(tp);
	cmd = &samsung_manufacture_id1_cmd;
	mipi_dsi_cmds_rx(mfd, tp, rp, cmd, 1);
	id = *((uint8 *)rp->data) | id1;
	pr_info("%s: manufacture_id1=%x\n", __func__, *rp->data);
	id <<= 8;

	mipi_dsi_buf_init(rp);
	mipi_dsi_buf_init(tp);
	cmd = &samsung_manufacture_id2_cmd;
	mipi_dsi_cmds_rx(mfd, tp, rp, cmd, 1);
	pr_info("%s: manufacture_id2=%x\n", __func__, *rp->data);
	id |= *((uint8 *)rp->data);
	id <<= 8;

	mipi_dsi_buf_init(rp);
	mipi_dsi_buf_init(tp);
	cmd = &samsung_manufacture_id3_cmd;
	mipi_dsi_cmds_rx(mfd, tp, rp, cmd, 1);
	pr_info("%s: manufacture_id3=%x\n", __func__, *rp->data);
	id |= *((uint8 *)rp->data);

	pr_info("%s: manufacture_id=%x\n", __func__, id);

#ifdef FACTORY_TEST
	if (id == 0x00) {
		pr_info("Lcd is not connected\n");
		is_lcd_connected = 0;
	}
#endif
	return id;
}
static uint32 mipi_samsung_manufacture_id(struct msm_fb_data_type *mfd)
{
	struct dsi_buf *rp, *tp;
	struct dsi_cmd_desc *cmd;
	uint32 id = 0;

	tp = &msd.samsung_tx_buf;
	rp = &msd.samsung_rx_buf;
	mipi_dsi_buf_init(rp);
	mipi_dsi_buf_init(tp);

	if (system_rev == 0) {
		pr_err("[LCD] %s, temp return! for rev00\n", __func__);
		return 0;
	}

	cmd = &samsung_manufacture_id1_cmd;
	mipi_dsi_cmds_rx(mfd, tp, rp, cmd, 1);
	pr_info("%s: manufacture_id1=%x\n", __func__, *rp->data);
	id = *rp->data & 0xFF;
	id <<= 8;

	mipi_dsi_buf_init(rp);
	mipi_dsi_buf_init(tp);
	cmd = &samsung_manufacture_id2_cmd;
	mipi_dsi_cmds_rx(mfd, tp, rp, cmd, 1);
	pr_info("%s: manufacture_id2=%x\n", __func__, *rp->data);
	id |= *rp->data & 0xFF;
	id <<= 8;

	mipi_dsi_buf_init(rp);
	mipi_dsi_buf_init(tp);
	cmd = &samsung_manufacture_id3_cmd;
	mipi_dsi_cmds_rx(mfd, tp, rp, cmd, 1);
	pr_info("%s: manufacture_id3=%x\n", __func__, *rp->data);
	id |= *rp->data & 0xFF;
	id <<= 8;

	mipi_dsi_buf_init(rp);
	mipi_dsi_buf_init(tp);
	cmd = &samsung_manufacture_id4_cmd;
	mipi_dsi_cmds_rx(mfd, tp, rp, cmd, 1);
	pr_info("%s: manufacture_id4=%x\n", __func__, *rp->data);
	id |= *rp->data & 0xFF;

	pr_info("%s: manufacture_id=%x\n", __func__, id);

	return id;
}
Exemplo n.º 7
0
void mipi_samsung_oled_hd_read(struct msm_fb_data_type *mfd)
{
	struct dsi_buf *rp, *tp;
	struct dsi_cmd_desc *cmd;
	int i;
	uint8 *lp;

	tp = &oscar_tx_buf;
	rp = &oscar_rx_buf;	
		
	lp = NULL;

	cmd = &samsung_oled_hd_read_panel;
	mipi_dsi_cmds_rx(mfd, tp, rp, cmd,10);
	
	for(i=0; i<10; i++)
	{
		lp = ((uint8 *)rp->data++);
		
		mtp_buffer[i + mtp_count] = *lp;
		printk("[PANTECH_LCD]MTP = %d %d\n",*lp,mtp_buffer[i + mtp_count]); 
		msleep(1);
	}
	mtp_count += 10; 

}
static uint32 mipi_samsung_manufacture_id(struct msm_fb_data_type *mfd)
{
	struct dsi_buf *rp, *tp;
	struct dsi_cmd_desc *cmd;
	uint32 id_size;
	char id[3];

	mutex_lock(&dsi_tx_mutex);

	id_size = 3;
	tp = &msd.samsung_tx_buf;
	rp = &msd.samsung_rx_buf;
	mipi_dsi_buf_init(rp);
	mipi_dsi_buf_init(tp);

	cmd = &samsung_manufacture_id1_cmd;
	mipi_dsi_cmds_rx(mfd, tp, rp, cmd, id_size);

	id[0] = *rp->data;
	id[1] = *(rp->data + 1);
	id[2] = *(rp->data + 2);

	mutex_unlock(&dsi_tx_mutex);

	pr_info("%s id0:  0x%x, id1: 0x%x, id2: 0x%x", __func__,
		id[0], id[1], id[2]);

	return id[0] << 16 | id[1] << 8 | id[2] ;
}
Exemplo n.º 9
0
/**
 * Read a bridge register
 *
 * @param mfd
 *
 * @return register data value
 */
static u32 mipi_d2l_read_reg(struct msm_fb_data_type *mfd, u16 reg)
{
	u32 data;
	int len = 4;
	struct dsi_cmd_desc cmd_read_reg = {
		DTYPE_GEN_READ2, 1, 0, 1, 0, /* cmd 0x24 */
			sizeof(reg), (char *) &reg};

	mipi_dsi_buf_init(&d2l_tx_buf);
	mipi_dsi_buf_init(&d2l_rx_buf);

	mutex_lock(&mfd->dma->ov_mutex);
	len = mipi_dsi_cmds_rx(mfd, &d2l_tx_buf, &d2l_rx_buf,
			       &cmd_read_reg, len);
	mutex_unlock(&mfd->dma->ov_mutex);

	data = *(u32 *)d2l_rx_buf.data;

	if (len != 4)
		pr_err("%s: invalid rlen=%d, expecting 4.\n", __func__, len);

	pr_debug("%s: reg=0x%x.data=0x%08x.\n", __func__, reg, data);


	return data;
}
static uint32 mipi_himax_manufacture_id(void)
{
	struct dsi_buf *rp, *tp;
	struct dsi_cmd_desc *cmd;
	uint32 *lp;
	int i;
	char *cp;

	tp = &himax_tx_buf;
	rp = &himax_rx_buf;
	mipi_dsi_buf_init(rp);
	mipi_dsi_buf_init(tp);

	cmd = &himax_manufacture_id_cmd;
	mipi_dsi_cmds_rx(tp, rp, cmd, 3);


	cp = (char *)rp->data;
	PR_DISP_DEBUG("rx-data: ");
	for (i = 0; i < rp->len; i++, cp++)
		PR_DISP_DEBUG("%x ", *cp);
	PR_DISP_DEBUG("\n");

	lp = (uint32 *)rp->data;

	PR_DISP_DEBUG("%s: manu_id=%x", __func__, *lp);

	return *lp;
}
static uint32 mipi_samsung_oled_hd_read_id(struct msm_fb_data_type *mfd)
{
	struct dsi_buf *rp, *tp;
	struct dsi_cmd_desc *cmd;
	int i;
	uint8 *lp;

	tp = &samsung_oled_hd_tx_buf;
	rp = &samsung_oled_hd_rx_buf;	
		
	lp = NULL;

	cmd = &samsung_oled_hd_id_cmd;
	mipi_dsi_cmds_rx(mfd, tp, rp, cmd,4);
	for(i=0; i<3;i++)
	{
		lp = ((uint8 *)rp->data++);
		if(i==0)
		    printk("[PANTECH_LCD]OLED Manufacture ID(ID1) = 0x%x\n",*lp); 
		else if(i==1)
		    printk("[PANTECH_LCD]OLED Rev.(ID2) = 0x%x\n",*lp); 
		else if(i==2){
		    elvss_id3 = (*lp);
		    printk("[PANTECH_LCD]OLED ELVSS Value(ID3) = 0x%x\n",elvss_id3); 
	        }
		msleep(1);
	}
	
	return *lp;
}
Exemplo n.º 12
0
static uint32 mipi_orise_manufacture_id(void)
{
	struct dsi_buf *rp, *tp;
	struct dsi_cmd_desc *cmd;
	uint32 *lp;

	tp = &orise_tx_buf;
	rp = &orise_rx_buf;
	mipi_dsi_buf_init(rp);
	mipi_dsi_buf_init(tp);

	cmd = &orise_manufacture_id_cmd;
	mipi_dsi_cmds_rx(tp, rp, cmd, 3);

{
	int i;
	char *cp;

	cp = (char *)rp->data;
	printk("rx-data: ");
	for (i = 0; i < rp->len; i++, cp++)
		printk("%x ", *cp);
	printk("\n");
}

	lp = (uint32 *)rp->data;

	printk("%s: manu_id=%x", __func__, *lp);

	return *lp;
}
int mipi_dsi_read_compare(struct mipi_dsi_read_compare_data *data, char __iomem *dsi_base)
{
	u32 *read_value = data->read_value;
	u32 *expected_value = data->expected_value;
	u32 *read_mask = data->read_mask;
	char **reg_name = data->reg_name;
	int log_on = data->log_on;
	struct dsi_cmd_desc *cmds = data->cmds;
	int cnt = data->cnt;

	int cnt_not_match = 0;
	int read_ret = 0;
	int i;

	read_ret = mipi_dsi_cmds_rx(read_value, cmds, cnt, dsi_base);

	if(read_ret){
		HISI_FB_ERR("Read error number: %d\n", read_ret);
		return cnt;
	}
	for(i=0; i<cnt; i++) {
		if (log_on) {
			HISI_FB_INFO("Read reg %s: 0x%X, value = 0x%X\n", reg_name[i], cmds[i].payload[0], read_value[i]);
		}
		if(expected_value[i] != (read_value[i] & read_mask[i])){
			cnt_not_match++;
		}
	}

	return cnt_not_match;
}
static uint32 mipi_nt35565_manufacture_id(struct msm_fb_data_type *mfd)
{
	struct dsi_buf *rp, *tp;
	struct dsi_cmd_desc *cmd;
	uint32 *lp;

	tp = &nt35565_tx_buf;
	rp = &nt35565_rx_buf;
	cmd = &nt35565_manufacture_id_cmd;
	mipi_dsi_cmds_rx(mfd, tp, rp, cmd, 3);
	lp = (uint32 *)rp->data;
	printk("%s: manufacture_id=%x\n", __func__, *lp);

	cmd = &nt35565_addr_mode_cmd;
	mipi_dsi_cmds_rx(mfd, tp, rp, cmd, 3);
	lp = (uint32 *)rp->data;
	printk("%s: nt35565_addr_mode_cmd=%x\n", __func__, *lp);

	return *lp;
}
Exemplo n.º 15
0
int mipi_smd_oled_hd_read_dev_reg( struct msm_fb_data_type *mfd, struct msmfb_register_read *data)
{
    const int one_read_size = 4;
    const int loop_limit = 16;
    int read_pos = 0;
    int readed_size = 0;
    int data_cnt = 0;
    int i,j;


    read_target_reg[0] = (char)data->w_data[0];
    packet_size[0] = (char)data->len;


    mipi_dsi_cmds_tx(&smd_oled_hd_tx_buf, &(mipi_smd_oled_hd_packet_size_cmd), 1);

    for (j = 0; j < loop_limit; j++)
    {
        read_position[1] = read_pos;


        if ( mipi_dsi_cmds_tx(&smd_oled_hd_tx_buf, &(mipi_smd_oled_hd_read_pos_cmd), 1) < 1 )
        {
            printk(KERN_ERR "%s. mipi_dsi_cmds_tx FAILED.\n", __func__);
            return -1;
        }

        mipi_dsi_op_mode_config(DSI_CMD_MODE);
        mipi_dsi_sw_reset();

        mipi_dsi_buf_init(&smd_oled_hd_rx_buf);


        readed_size = mipi_dsi_cmds_rx(mfd, &smd_oled_hd_tx_buf, &smd_oled_hd_rx_buf, &mipi_smd_oled_hd_read_reg_cmd, one_read_size);


        for (i = 0; i < readed_size; i++, data_cnt++)
        {
            if( data_cnt < data->len )
                data->r_data[data_cnt] = smd_oled_hd_rx_buf.data[i];
        }

        mipi_dsi_sw_reset();
        mipi_dsi_op_mode_config(DSI_VIDEO_MODE);


        read_pos += readed_size;
        if( read_pos > data->len )
            break;
    }

    return 0;
}
static uint32 mipi_renesas_manufacture_id(struct msm_fb_data_type *mfd)
{
	struct dsi_buf *rp, *tp;
	struct dsi_cmd_desc *cmd;
	uint32 *lp;

	tp = &deluxe_j_panel_tx_buf;
	rp = &deluxe_j_panel_rx_buf;
	cmd = &renesas_manufacture_id_cmd;
	mipi_dsi_cmds_rx(mfd, tp, rp, cmd, 3);
	lp = (uint32 *)rp->data;
	pr_info("%s: manufacture_id=%x", __func__, *lp);
	return *lp;
}
Exemplo n.º 17
0
static int mipi_get_manufacture_icid(struct msm_fb_data_type *mfd)
{
	uint32 icid = 0;
	int i ;
	

	 struct mipi_manufacture_ic mipi_manufacture_icid[3] = {
		{hx8363_setpassword_cmd,ARRAY_SIZE(hx8363_setpassword_cmd),&hx8363_icid_rd_cmd,3,1},
		{nt3511_setpassword_cmd,ARRAY_SIZE(nt3511_setpassword_cmd),&nt3511_icid_rd_cmd,3,0},
		{hx8369_setpassword_cmd,ARRAY_SIZE(hx8369_setpassword_cmd),&hx8369_icid_rd_cmd,3,1},

	 };

	for(i = 0; i < ARRAY_SIZE(mipi_manufacture_icid) ; i++)
	{	lcd_panle_reset();	
		mipi_dsi_buf_init(&lead_tx_buf);
		mipi_dsi_buf_init(&lead_rx_buf);
		mipi_set_tx_power_mode(1);	
		
		mipi_dsi_cmds_tx(mfd, &lead_tx_buf, mipi_manufacture_icid[i].readid_tx,mipi_manufacture_icid[i].readid_len_tx);
		mipi_dsi_cmd_bta_sw_trigger(); 
		
		if(!mipi_manufacture_icid[i].mode)
			mipi_set_tx_power_mode(0);	
		
		mipi_dsi_cmds_rx(mfd,&lead_tx_buf, &lead_rx_buf, mipi_manufacture_icid[i].readid_rx,mipi_manufacture_icid[i].readid_len_rx);

		if(mipi_manufacture_icid[i].mode)
			mipi_set_tx_power_mode(0);
		
		icid = *(uint32 *)(lead_rx_buf.data);
		
		printk("debug read icid is %x\n",icid & 0xffffff);

		switch(icid & 0xffffff){
			case 0x1055:
						return NOVATEK_35510;
			case 0x6383ff:
						return HIMAX_8363;
						
			case 0x6983ff:
						return HIMAX_8369;
						
			default:
						break;			
		}

	}
	return 0;
}
Exemplo n.º 18
0
static uint32_t mipi_novatek_manufacture_id(void)
{
	char rec_buf[24];
	char *rp = rec_buf;
	uint32_t *lp, data;

	mipi_dsi_cmds_tx(&novatek_panel_manufacture_id_cmd, 1);
	mipi_dsi_cmds_rx(&rp, 3);

	lp = (uint32_t *) rp;
	data = (uint32_t) * lp;
	data = ntohl(data);
	data = data >> 8;
	return data;
}
static uint32 mipi_nt35510_read_register(struct msm_fb_data_type *mfd)
{
	struct dsi_buf *rp = NULL;
	struct dsi_buf *tp = NULL;
	struct dsi_cmd_desc *cmd = NULL;
	char *lp = NULL;

	tp = &nt35510_tx_buf;
	rp = &nt35510_rx_buf;
	cmd = &nt35510_register_id_cmd;
	mipi_dsi_cmds_rx(mfd, tp, rp, cmd, 1);
	lp = (char *)rp->data;
	/* Delete unwanted log */
	return *lp;
}
static uint32 mipi_nt35510_read_register(struct msm_fb_data_type *mfd)
{
	struct dsi_buf *rp = NULL;
	struct dsi_buf *tp = NULL;
	struct dsi_cmd_desc *cmd = NULL;
	char *lp = NULL;

	tp = &nt35510_tx_buf;
	rp = &nt35510_rx_buf;
	cmd = &nt35510_register_id_cmd;
	mipi_dsi_cmds_rx(mfd, tp, rp, cmd, 1);
	lp = (char *)rp->data;
    LCD_DEBUG("%s: register_id=%02x\n", __func__, *lp);
	return *lp;
}
Exemplo n.º 21
0
static int mipi_orise_rd(struct msm_fb_data_type *mfd, char addr)
{
    struct dsi_buf *rp, *tp;
    struct dsi_cmd_desc *cmd;
    int *lp;
    addr_buf[0] = addr;
    tp = &orise_tx_buf;
    rp = &orise_rx_buf;
    mipi_dsi_buf_init(rp);
    mipi_dsi_buf_init(tp);

    cmd = &cmd_mipi_addr_buf;
    mipi_dsi_cmds_rx(mfd, tp, rp, cmd, 4);
    lp = (uint32 *)rp->data;
    pr_info("mipi_orise_rd addr=%x, data=%x\n", addr, *lp);
    return *lp;
}
Exemplo n.º 22
0
static uint32 mipi_get_commic_panleid(struct msm_fb_data_type *mfd,struct dsi_cmd_desc *para,uint32 len,int mode)
{
	uint32 panelid = 0;
	mipi_dsi_buf_init(&lead_tx_buf);
	mipi_dsi_buf_init(&lead_rx_buf);
	mipi_dsi_cmd_bta_sw_trigger(); 
	if(mode)
		mipi_set_tx_power_mode(1);
	else 
		mipi_set_tx_power_mode(0);
	mipi_dsi_cmds_rx(mfd,&lead_tx_buf, &lead_rx_buf, para,len);
	if(mode)
		mipi_set_tx_power_mode(0);
	panelid = *(uint32 *)(lead_rx_buf.data);
	printk("debug read panelid is %x\n",panelid & 0xffffffff);
	return panelid & 0xff;
}
static int mipi_orise_manufacture_id(struct msm_fb_data_type *mfd)
{


	char retDA = 0;
	struct dsi_buf *tp = &orise_tx_buf;
	struct dsi_buf *rp = &orise_rx_buf;

	mipi_dsi_buf_init(rp);
	mipi_dsi_buf_init(tp);
	mipi_dsi_cmds_rx(mfd, tp, rp, &orise_ReadDA, 1);
	retDA = *((char *) rp->data);

	printk(KERN_ALERT "[DISPLAY] Panel ID <0x%02x>\n", retDA);
	return retDA;
	
}
static uint32 protou_manufacture_id(struct msm_fb_data_type *mfd)
{
	struct dsi_buf *rp, *tp;
	struct dsi_cmd_desc *cmd;
	uint32 *lp;

	tp = &protou_panel_tx_buf;
	rp = &protou_panel_rx_buf;
	mipi_dsi_buf_init(rp);
	mipi_dsi_buf_init(tp);

	cmd = &lg_manufacture_id_cmd;
	mipi_dsi_cmds_rx(mfd, tp, rp, cmd, 3);
	lp = (uint32 *)rp->data;
	PR_DISP_INFO("%s: manufacture_id=%x\n", __func__, *lp);

	return *lp;
}
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);
}
static int mipi_r63306_nvm_write_user_area(struct msm_fb_data_type *mfd)
{
	struct device *dev = &mfd->panel_pdev->dev;
	struct mipi_dsi_data *dsi_data;
	struct dsi_nvm_rewrite_ctl *pnvrw_ctl;
	int i;
	int ret = 0;

	dev_dbg(dev, "%s: start\n", __func__);
	dsi_data = platform_get_drvdata(mfd->panel_pdev);
	dsi_data = platform_get_drvdata(mfd->panel_pdev);
	if (!dsi_data && !dsi_data->panel && !dsi_data->panel->pnvrw_ctl) {
		ret = -1;
		goto exit;
	}

	pnvrw_ctl = dsi_data->panel->pnvrw_ctl;
	nvm_power(true, dsi_data);
	mipi_dsi_cmds_tx(&dsi_data->tx_buf, pnvrw_ctl->nvm_mcap_unlock,
					pnvrw_ctl->nvm_mcap_unlock_size);
	for (i = 0; i < NVRW_RETRY; i++) {
		mipi_dsi_cmds_tx(&dsi_data->tx_buf, pnvrw_ctl->nvm_write_user,
						pnvrw_ctl->nvm_write_user_size);
		mipi_dsi_cmds_rx(mfd, &dsi_data->tx_buf, &dsi_data->rx_buf,
					pnvrw_ctl->nvm_read_e1, 1);
		if (dsi_data->rx_buf.data[0] != 0x03) {
			dev_warn(dev, "%s: E1 failed (0x%02x), retry %d\n",
				__func__, dsi_data->rx_buf.data[0], i + 1);
			nvm_retry(dsi_data, pnvrw_ctl);
			continue;
		}
		break;
	}
	if (i >= NVRW_RETRY) {
		dev_err(&mfd->panel_pdev->dev, "%s: failed.\n", __func__);
		ret = -1;
	}

	end_nvm_command(dsi_data, pnvrw_ctl);
	nvm_power(true, dsi_data);
exit:
	dev_dbg(dev, "%s: end, ret = %d\n", __func__, ret);
	return ret;
}
Exemplo n.º 27
0
static int panel_id_reg_check(struct msm_fb_data_type *mfd, struct dsi_buf *ptx,
			      struct dsi_buf *prx, const struct panel_id* panel)
{
	int i;

	mutex_lock(&mfd->dma->ov_mutex);
	mipi_dsi_buf_init(prx);
	mipi_dsi_buf_init(ptx);
	mipi_dsi_cmds_rx(mfd, ptx, prx, panel->pctrl->read_id_cmds,
			 panel->id_num);
	mutex_unlock(&mfd->dma->ov_mutex);

	for (i = 0; i < panel->id_num; i++) {
		if ((i >= prx->len) ||
			((prx->data[i] != panel->id[i]) &&
				(panel->id[i] != 0xff)))
			return -ENODEV;
	}
	return 0;
}
Exemplo n.º 28
0
static void mipi_nt35510_init_power_state(struct platform_device *pdev)
{
	struct msm_fb_data_type *mfd;

	DPRINT("start %s\n", __func__);

	return;

	disp_powered_up = DISP_STATE_OFF;

	if (!pdev)
		return;

	mfd = platform_get_drvdata(pdev);

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

	mipi_dsi_cmds_rx(mfd, &nt35510_tx_buf, &nt35510_rx_buf,
			 nt35510_read_display_power_mode_cmds,
			 ARRAY_SIZE(nt35510_read_display_power_mode_cmds));

	if (
		(NT35510_DISPLAY_POWER_MODE_SLEEP_OUT
		 | NT35510_DISPLAY_POWER_MODE_DISPLAY_ON)
		== (nt35510_rx_buf.data[0] &
		  (NT35510_DISPLAY_POWER_MODE_SLEEP_OUT
		   | NT35510_DISPLAY_POWER_MODE_DISPLAY_ON)
	    )
	    ) {
		disp_powered_up = DISP_STATE_ON;
	}
	DPRINT("%s(length %d)[%x] = %d\n",
	       __func__,
	       nt35510_rx_buf.len,
	       nt35510_rx_buf.data[0], disp_powered_up);
}
static int32 get_panel_info(struct msm_fb_data_type *mfd,
				struct  mipi_mot_panel *mot_panel,
				struct dsi_cmd_desc *cmd)
{
	struct dsi_buf *rp, *tp;
	uint32 *lp;
	int ret;

	tp = mot_panel->mot_tx_buf;
	rp = mot_panel->mot_rx_buf;
	mipi_dsi_buf_init(rp);
	mipi_dsi_buf_init(tp);

	ret = mipi_dsi_cmds_rx(mfd, tp, rp, cmd, 1);
	if (!ret)
		ret = -1;
	else {
		lp = (uint32 *)rp->data;
		ret = (int)*lp;
	}

	return ret;
}
Exemplo n.º 30
0
static uint32 mipi_renesas_read_buf(struct platform_device *pdev)
{
	struct dsi_buf *rp, *tp;
	struct dsi_cmd_desc *cmd;
	uint32 i;
	uint8 *lp;
	struct msm_fb_data_type *mfd;

	mfd = platform_get_drvdata(pdev);
    lp = NULL;
	tp = &renesas_tx_buf;
	rp = &renesas_rx_buf;
	cmd = &renesas_read_test_cmd;
	
	mipi_dsi_cmds_rx(mfd, tp, rp, cmd, 8);
	for(i=0; i<8;i++)
	{
		lp = ((uint8 *)rp->data++);
   		printk("%s: scanmode_off=0x%x\n", __func__, *lp);
		

	}
	return *lp;
}