static int mipi_tianma_probe(struct platform_device *pdev)
{
	int ret = 0;
	struct k3_panel_info *pinfo = NULL;
	struct device_node *np = NULL;

	if (k3_fb_device_probe_defer(PANEL_RGB2MIPI)) {
		goto err_probe_defer;
	}

	K3_FB_DEBUG("+.\n");

	np = of_find_compatible_node(NULL, NULL, DTS_COMP_MIPI_TIANMA_OTM9608A);
	if (!np) {
		K3_FB_ERR("NOT FOUND device node %s!\n", DTS_COMP_MIPI_TIANMA_OTM9608A);
		goto err_return;
	}

	gpio_lcd_power_2v85 = of_get_named_gpio(np, "gpios", 0);  /*GPIO_6_3*/
	gpio_lcd_power_1v8_en0 = of_get_named_gpio(np, "gpios", 1);  /*GPIO_6_4*/
	gpio_lcd_rst= of_get_named_gpio(np, "gpios", 2);  /*GPIO_8_4*/

	pdev->id = 1;
	/* init lcd panel info */
	pinfo = tianma_panel_data.panel_info;
	memset(pinfo, 0, sizeof(struct k3_panel_info));
	pinfo->xres = 540;
	pinfo->yres = 960;
	pinfo->width = 62;
	pinfo->height = 110;
	pinfo->type = PANEL_RGB2MIPI;
	pinfo->orientation = LCD_PORTRAIT;
	pinfo->bpp = LCD_RGB888;
	pinfo->bgr_fmt = LCD_RGB;
	pinfo->bl_set_type = BL_SET_BY_BLPWM;
	pinfo->bl_min = 1;
	pinfo->bl_max = 255;
	pinfo->ifbc_type = IFBC_TYPE_NON;

	pinfo->frc_enable = 0;
	pinfo->esd_enable = 0;
	pinfo->sbl_support = 0;

	pinfo->spi_dev = g_spi_dev;

	pinfo->ldi.h_back_porch = 50;
	pinfo->ldi.h_front_porch = 177;
	pinfo->ldi.h_pulse_width = 10;
	pinfo->ldi.v_back_porch = 32;
	pinfo->ldi.v_front_porch = 32;
	pinfo->ldi.v_pulse_width = 3;
	pinfo->ldi.hsync_plr = 1;
	pinfo->ldi.vsync_plr = 1;
	pinfo->ldi.pixelclk_plr = 0;
	pinfo->ldi.data_en_plr = 0;

	pinfo->mipi.lane_nums = DSI_2_LANES;
	pinfo->mipi.color_mode = DSI_24BITS_1;
	pinfo->mipi.vc = 0;
	pinfo->mipi.dsi_bit_clk = 241;

	pinfo->pxl_clk_rate = 40 * 1000000;

	/* lcd vcc init */
	ret = vcc_cmds_tx(pdev, tianma_lcd_vcc_init_cmds, \
		ARRAY_SIZE(tianma_lcd_vcc_init_cmds));
	if (ret != 0) {
	#if 0
		K3_FB_ERR("LCD vcc init failed!\n");
		goto err_return;
	#endif
	}

	/* alloc panel device data */
	ret = platform_device_add_data(pdev, &tianma_panel_data,
		sizeof(struct k3_fb_panel_data));
	if (ret) {
		K3_FB_ERR("platform_device_add_data failed!\n");
		goto err_device_put;
	}

	k3_fb_add_device(pdev);

	K3_FB_DEBUG("-.\n");

	return 0;

err_device_put:
	platform_device_put(pdev);
err_return:
	return ret;
err_probe_defer:
	return -EPROBE_DEFER;
}
static int __devinit jdi_probe(struct platform_device *pdev)
{
	struct k3_panel_info *pinfo = NULL;
	struct platform_device *reg_pdev = NULL;
	struct lcd_properities lcd_props;

	g_display_on = false;

	pinfo = jdi_panel_data.panel_info;
	/* init lcd panel info */
	pinfo->xres = 720;
	pinfo->yres = 1280;
	pinfo->type = PANEL_MIPI_CMD;
	pinfo->orientation = LCD_PORTRAIT;
	pinfo->bpp = EDC_OUT_RGB_888;
	pinfo->s3d_frm = EDC_FRM_FMT_2D;
	pinfo->bgr_fmt = EDC_RGB;
	pinfo->bl_set_type = BL_SET_BY_MIPI;
	pinfo->bl_min = 1;
	pinfo->bl_max = 100;

	pinfo->frc_enable = 0;
	pinfo->esd_enable = 1;
	pinfo->sbl_enable = 0;

	pinfo->sbl.bl_max = 0xff;
	pinfo->sbl.cal_a = 0x0f;
	pinfo->sbl.str_limit = 0x40;

	pinfo->ldi.h_back_porch = 16;
	pinfo->ldi.h_front_porch = 16;
	pinfo->ldi.h_pulse_width = 2;
	pinfo->ldi.v_back_porch = 2;
	pinfo->ldi.v_front_porch = 2;
	pinfo->ldi.v_pulse_width = 2;

	pinfo->ldi.hsync_plr = 1;
	pinfo->ldi.vsync_plr = 0;
	pinfo->ldi.pixelclk_plr = 1;
	pinfo->ldi.data_en_plr = 0;

	pinfo->ldi.disp_mode = LDI_DISP_MODE_NOT_3D_FBF;

	/* Note: must init here */
	pinfo->frame_rate = 60;
	pinfo->clk_rate = 76000000;

	pinfo->mipi.lane_nums = DSI_4_LANES;
	pinfo->mipi.color_mode = DSI_24BITS_1;
	pinfo->mipi.vc = 0;
	pinfo->mipi.dsi_bit_clk = 260;

	/* tp vcc init */
	vcc_cmds_tx(pdev, jdi_tp_vcc_init_cmds, \
		ARRAY_SIZE(jdi_tp_vcc_init_cmds));
	
	/* lcd vcc init */
	vcc_cmds_tx(pdev, jdi_lcd_vcc_init_cmds, \
		ARRAY_SIZE(jdi_lcd_vcc_init_cmds));

	/* tp iomux init */
	iomux_cmds_tx(jdi_tp_iomux_init_cmds, \
		ARRAY_SIZE(jdi_tp_iomux_init_cmds));

	/* lcd iomux init */
	iomux_cmds_tx(jdi_lcd_iomux_init_cmds, \
		ARRAY_SIZE(jdi_lcd_iomux_init_cmds));

	/* tp vcc enable */
	vcc_cmds_tx(NULL, jdi_tp_vcc_enable_cmds, \
		ARRAY_SIZE(jdi_tp_vcc_enable_cmds));

	/* lcd vcc enable */
	vcc_cmds_tx(NULL, jdi_lcd_vcc_enable_cmds, \
		ARRAY_SIZE(jdi_lcd_vcc_enable_cmds));

	/* alloc panel device data */
	if (platform_device_add_data(pdev, &jdi_panel_data,
		sizeof(struct k3_fb_panel_data))) {
		k3fb_loge("platform_device_add_data failed!\n");
		platform_device_put(pdev);
		return -ENOMEM;
	}

	reg_pdev = k3_fb_add_device(pdev);

	/* for cabc */
	lcd_props.type = TFT;
	lcd_props.default_gamma = GAMMA25;
	p_tuning_dev = lcd_tuning_dev_register(&lcd_props, &sp_tuning_ops, (void *)reg_pdev);
	if (IS_ERR(p_tuning_dev)) {
		k3fb_loge("lcd_tuning_dev_register failed!\n");
		return -1;
	}

	jdi_sysfs_init(pdev);

	return 0;
}
Esempio n. 3
0
static int __devinit jdi_probe(struct platform_device *pdev)
{
	struct k3_panel_info *pinfo = NULL;
	struct platform_device *reg_pdev = NULL;
	struct lcd_properities lcd_props;
    struct k3_fb_data_type *k3fd = NULL;
	int i;

	g_display_on = false;

	pinfo = jdi_panel_data.panel_info;
	/* init lcd panel info */
	pinfo->xres = 720;
	pinfo->yres = 1280;
	pinfo->width = 58;
	pinfo->height = 103;
	pinfo->type = PANEL_MIPI_CMD;
	pinfo->orientation = LCD_PORTRAIT;
	pinfo->bpp = EDC_OUT_RGB_888;
	pinfo->s3d_frm = EDC_FRM_FMT_2D;
	pinfo->bgr_fmt = EDC_RGB;
	pinfo->bl_set_type = BL_SET_BY_MIPI;
	pinfo->bl_min = 1;
	pinfo->bl_max = 100;

	pinfo->frc_enable = 1;
	pinfo->esd_enable = 1;
	pinfo->sbl_enable = 1;
	pinfo->sbl.bl_max = 0xff;
	pinfo->sbl.cal_a = 0x08;
	pinfo->sbl.cal_b = 0xd8;
	pinfo->sbl.str_limit = 0x40;

	pinfo->ldi.h_back_porch = 43;
	pinfo->ldi.h_front_porch = 80;
	pinfo->ldi.h_pulse_width = 57;
	pinfo->ldi.v_back_porch = 12;
	pinfo->ldi.v_front_porch = 14;
	pinfo->ldi.v_pulse_width = 2;

	pinfo->ldi.hsync_plr = 1;
	pinfo->ldi.vsync_plr = 0;
	pinfo->ldi.pixelclk_plr = 1;
	pinfo->ldi.data_en_plr = 0;

	pinfo->ldi.disp_mode = LDI_DISP_MODE_NOT_3D_FBF;

	/* Note: must init here */
	pinfo->frame_rate = 60;
	pinfo->clk_rate = 76000000;

	pinfo->mipi.lane_nums = DSI_4_LANES;
	pinfo->mipi.color_mode = DSI_24BITS_1;
	pinfo->mipi.vc = 0;
	pinfo->mipi.dsi_bit_clk = 241;

	/* tp vcc init */
	vcc_cmds_tx(pdev, jdi_tp_vcc_init_cmds, \
		ARRAY_SIZE(jdi_tp_vcc_init_cmds));

	/* lcd vcc init */
	vcc_cmds_tx(pdev, jdi_lcd_vcc_init_cmds, \
		ARRAY_SIZE(jdi_lcd_vcc_init_cmds));

        /*tk vcc init*/
	g_touchkey_enable = get_touchkey_enable();
	if (g_touchkey_enable == true) {
		vcc_cmds_tx(pdev, jdi_tk_vcc_init_cmds, \
			ARRAY_SIZE(jdi_tk_vcc_init_cmds));
	}
        
	/* tp iomux init */
	iomux_cmds_tx(jdi_tp_iomux_init_cmds, \
		ARRAY_SIZE(jdi_tp_iomux_init_cmds));

	/* lcd iomux init */
	iomux_cmds_tx(jdi_lcd_iomux_init_cmds, \
		ARRAY_SIZE(jdi_lcd_iomux_init_cmds));

	/* alloc panel device data */
	if (platform_device_add_data(pdev, &jdi_panel_data,
		sizeof(struct k3_fb_panel_data))) {
		k3fb_loge("platform_device_add_data failed!\n");
		platform_device_put(pdev);
		return -ENOMEM;
	}

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

    /* read product id */
	msleep(16); //TE masked in k3_fb_register(), wait 16ms for on-going refreshing
	for(i = 0; i < 150; i++){
	    outp32(k3fd->edc_base + MIPIDSI_GEN_HDR_OFFSET, 0xDA << 8 | 0x06);
	    udelay(120);
	    lcd_product_id = inp32(k3fd->edc_base + MIPIDSI_GEN_PLD_DATA_OFFSET);
		if(lcd_product_id && (lcd_product_id != 0xff))
			break;
	}
	printk("lcd product id is 0x%x, read times is %d\n", lcd_product_id, i);

	sema_init(&ct_sem, 1);
	g_csc_value[0] = 0;
	g_csc_value[1] = 0;
	g_csc_value[2] = 0;
	g_csc_value[3] = 0;
	g_csc_value[4] = 0;
	g_csc_value[5] = 0;
	g_csc_value[6] = 0;
	g_csc_value[7] = 0;
	g_csc_value[8] = 0;
	g_is_csc_set = 0;
	/* for cabc */
	lcd_props.type = TFT;
	lcd_props.default_gamma = GAMMA25;
	p_tuning_dev = lcd_tuning_dev_register(&lcd_props, &sp_tuning_ops, (void *)reg_pdev);
	if (IS_ERR(p_tuning_dev)) {
		k3fb_loge("lcd_tuning_dev_register failed!\n");
		return -1;
	}

	jdi_sysfs_init(pdev);

	return 0;
}