Ejemplo n.º 1
0
static int mipi_jdi_panel_remove(struct platform_device *pdev)
{
	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);*/
	if (!k3fd) {
		return 0;
	}

	/* tk vcc finit */
	if (g_touchkey_enable == true) {
		vcc_cmds_tx(pdev, jdi_tk_vcc_finit_cmds, \
			ARRAY_SIZE(jdi_tk_vcc_finit_cmds));
	}


	/* lcd vcc finit */
	vcc_cmds_tx(pdev, jdi_lcd_vcc_finit_cmds, \
		ARRAY_SIZE(jdi_lcd_vcc_finit_cmds));

	/* tp vcc finit */
	vcc_cmds_tx(pdev, jdi_tp_vcc_finit_cmds, \
		ARRAY_SIZE(jdi_tp_vcc_finit_cmds));

	jdi_sysfs_deinit(pdev);

	return 0;
}
Ejemplo n.º 2
0
static int mipi_jdi_panel_set_fastboot(struct platform_device *pdev)
{
	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);

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

	/* lcd iomux normal */
	iomux_cmds_tx(jdi_lcd_iomux_normal_cmds, \
		ARRAY_SIZE(jdi_lcd_iomux_normal_cmds));

	/* lcd gpio request */
	gpio_cmds_tx(jdi_lcd_gpio_request_cmds, \
		ARRAY_SIZE(jdi_lcd_gpio_request_cmds));

	g_display_on = true;

	return 0;
}
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;
}
static void cmi_disp_off(struct k3_fb_data_type *k3fd)
{
	u32 edc_base = 0;
	struct k3_panel_info *pinfo = NULL;

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

	/* lcd display off sequence */
	mipi_dsi_cmds_tx(cmi_display_off_cmds, \
		ARRAY_SIZE(cmi_display_off_cmds), edc_base);

	/* lcd gpio lowpower */
	gpio_cmds_tx(cmi_lcd_gpio_lowpower_cmds, \
		ARRAY_SIZE(cmi_lcd_gpio_lowpower_cmds));
	/* lcd gpio free */
	gpio_cmds_tx(cmi_lcd_gpio_free_cmds, \
		ARRAY_SIZE(cmi_lcd_gpio_free_cmds));

	/* lcd iomux lowpower */
	iomux_cmds_tx(cmi_lcd_iomux_lowpower_cmds, \
		ARRAY_SIZE(cmi_lcd_iomux_lowpower_cmds));

	/* lcd vcc disable */
	vcc_cmds_tx(NULL, cmi_lcd_vcc_disable_cmds, \
		ARRAY_SIZE(cmi_lcd_vcc_disable_cmds));
}
static int mipi_tianma_panel_off(struct platform_device *pdev)
{
	struct k3_fb_data_type *k3fd = NULL;
	struct k3_panel_info *pinfo = NULL;

	BUG_ON(pdev == NULL);
	k3fd = platform_get_drvdata(pdev);
	BUG_ON(k3fd == NULL);
	pinfo = &(k3fd->panel_info);
	BUG_ON(pinfo == NULL);

	K3_FB_DEBUG("fb%d, +.\n", k3fd->index);

	/* lcd display off sequence */
	rgb2mipi_cmds_tx(pinfo->spi_dev, tianma_display_off_cmds, \
		ARRAY_SIZE(tianma_display_off_cmds));

	/* lcd gpio lowpower */
	gpio_cmds_tx(tianma_lcd_gpio_lowpower_cmds, \
		ARRAY_SIZE(tianma_lcd_gpio_lowpower_cmds));
	/* lcd gpio free */
	gpio_cmds_tx(tianma_lcd_gpio_free_cmds, \
		ARRAY_SIZE(tianma_lcd_gpio_free_cmds));

	/* lcd vcc disable */
	vcc_cmds_tx(NULL, tianma_lcd_vcc_disable_cmds, \
		ARRAY_SIZE(tianma_lcd_vcc_disable_cmds));

	K3_FB_DEBUG("fb%d, -.\n", k3fd->index);

	return 0;
}
Ejemplo n.º 6
0
static void jdi_disp_off(struct k3_fb_data_type *k3fd)
{
	u32 edc_base = 0;
	struct k3_panel_info *pinfo = NULL;

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

	/* lcd display off sequence */
	mipi_dsi_cmds_tx(jdi_display_off_cmds,
		ARRAY_SIZE(jdi_display_off_cmds), edc_base);

	/* lcd gpio request */
	gpio_cmds_tx(jdi_lcd_gpio_lowpower_cmds, \
		ARRAY_SIZE(jdi_lcd_gpio_lowpower_cmds));
	/* lcd gpio free */
	gpio_cmds_tx(jdi_lcd_gpio_free_cmds, \
		ARRAY_SIZE(jdi_lcd_gpio_free_cmds));

	/* lcd iomux lowpower */
	iomux_cmds_tx(jdi_lcd_iomux_lowpower_cmds, \
		ARRAY_SIZE(jdi_lcd_iomux_lowpower_cmds));
	/* tp gpio request */
	printk("%s	enter:tp gpio request, free and iomux lowpower\n",__func__);
	gpio_cmds_tx(jdi_tp_gpio_lowpower_cmds, \
		ARRAY_SIZE(jdi_tp_gpio_lowpower_cmds));

	/* tp gpio free */
	gpio_cmds_tx(jdi_tp_gpio_free_cmds, \
		ARRAY_SIZE(jdi_tp_gpio_free_cmds));

	/* tp iomux lowpower */
	iomux_cmds_tx(jdi_tp_iomux_lowpower_cmds, \
		ARRAY_SIZE(jdi_tp_iomux_lowpower_cmds));
		
	/* lcd vcc disable */
	vcc_cmds_tx(NULL, jdi_lcd_vcc_disable_cmds, \
		ARRAY_SIZE(jdi_lcd_vcc_disable_cmds));

	/* tp vcc disable */
	vcc_cmds_tx(NULL, jdi_tp_vcc_disable_cmds, \
		ARRAY_SIZE(jdi_tp_vcc_disable_cmds));		
}
Ejemplo n.º 7
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;
}
static int mipi_tianma_panel_remove(struct platform_device *pdev)
{
	struct k3_fb_data_type *k3fd = NULL;

	BUG_ON(pdev == NULL);
	k3fd = platform_get_drvdata(pdev);
	BUG_ON(k3fd == NULL);

	K3_FB_DEBUG("fb%d, +.\n", k3fd->index);

	/* lcd vcc finit */
	vcc_cmds_tx(pdev, tianma_lcd_vcc_finit_cmds, \
		ARRAY_SIZE(tianma_lcd_vcc_finit_cmds));

	K3_FB_DEBUG("fb%d, -.\n", k3fd->index);

	return 0;
}
static int mipi_tianma_panel_on(struct platform_device *pdev)
{
	struct k3_fb_data_type *k3fd = NULL;
	struct k3_panel_info *pinfo = NULL;

	BUG_ON(pdev == NULL);
	k3fd = platform_get_drvdata(pdev);
	BUG_ON(k3fd == NULL);
	pinfo = &(k3fd->panel_info);
	BUG_ON(pinfo == NULL);

	K3_FB_DEBUG("fb%d, +.\n", k3fd->index);

	if (pinfo->lcd_init_step == LCD_INIT_POWER_ON) {
		/* lcd vcc enable */
		vcc_cmds_tx(NULL, tianma_lcd_vcc_enable_cmds, \
			ARRAY_SIZE(tianma_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) {
		/* lcd gpio request */
		gpio_cmds_tx(tianma_lcd_gpio_request_cmds, \
			ARRAY_SIZE(tianma_lcd_gpio_request_cmds));

		/* lcd gpio normal */
		gpio_cmds_tx(tianma_lcd_gpio_normal_cmds, \
			ARRAY_SIZE(tianma_lcd_gpio_normal_cmds));

		rgb2mipi_cmds_tx(pinfo->spi_dev, tianma_display_on_cmds, \
			ARRAY_SIZE(tianma_display_on_cmds));

		pinfo->lcd_init_step = LCD_INIT_MIPI_HS_SEND_SEQUENCE;
	} else if (pinfo->lcd_init_step == LCD_INIT_MIPI_HS_SEND_SEQUENCE) {
		;
	} else {
		K3_FB_ERR("failed to init lcd!\n");
	}

	K3_FB_DEBUG("fb%d, -.\n", k3fd->index);

	return 0;
}
static int mipi_cmi_panel_remove(struct platform_device *pdev)
{
	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);*/
	if (!k3fd) {
		return 0;
	}

	/* lcd vcc finit */
	vcc_cmds_tx(pdev, cmi_lcd_vcc_finit_cmds, \
		ARRAY_SIZE(cmi_lcd_vcc_finit_cmds));

	cmi_sysfs_deinit(pdev);

	return 0;
}
static int mipi_tianma_panel_set_fastboot(struct platform_device *pdev)
{
	struct k3_fb_data_type *k3fd = NULL;

	BUG_ON(pdev == NULL);
	k3fd = platform_get_drvdata(pdev);
	BUG_ON(k3fd == NULL);

	K3_FB_DEBUG("fb%d, +.\n", k3fd->index);

	/* lcd vcc enable */
	vcc_cmds_tx(pdev, tianma_lcd_vcc_enable_cmds, \
		ARRAY_SIZE(tianma_lcd_vcc_enable_cmds));

	/* lcd gpio request */
	gpio_cmds_tx(tianma_lcd_gpio_request_cmds, \
		ARRAY_SIZE(tianma_lcd_gpio_request_cmds));

	K3_FB_DEBUG("fb%d, -.\n", k3fd->index);

	return 0;
}
Ejemplo n.º 12
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;

	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;
}
static int mipi_tm_panel_on(struct platform_device* pdev)
{
    struct balong_fb_data_type* balongfd = NULL;
    struct balong_panel_info* pinfo = NULL;
    struct balong_fb_panel_data* pdata = NULL;

#if defined (CONFIG_HUAWEI_DSM)
    u8* ade_base = NULL;
    u32 int_st0 = 0, int_st1 = 0;
#endif

    BUG_ON(pdev == NULL);

    pr_info("%s enter succ!\n", __func__);
    balongfd = (struct balong_fb_data_type*)platform_get_drvdata(pdev);
    BUG_ON(balongfd == NULL);

#if defined (CONFIG_HUAWEI_DSM)
    ade_base = balongfd->ade_base;
#endif

    pinfo = &(balongfd->panel_info);
    pr_info("%s,pinfo->lcd_init_step = %d!\n", __func__, pinfo->lcd_init_step);

    if (pinfo->lcd_init_step == LCD_INIT_POWER_ON)
    {
        /* lcd set voltage */
        vcc_cmds_tx(NULL, tm_lcd_vcc_set_cmds, \
                    ARRAY_SIZE(tm_lcd_vcc_set_cmds));

        pinfo->lcd_init_step = LCD_INIT_SEND_SEQUENCE;
    }
    else if (pinfo->lcd_init_step == LCD_INIT_SEND_SEQUENCE)
    {
        if (!g_display_on)
        {
            LOG_JANK_D(JLID_KERNEL_LCD_POWER_ON, "%s", "JL_KERNEL_LCD_POWER_ON");
            g_debug_enable = true;

            /* lcd pinctrl normal */
            pinctrl_cmds_tx(pdev, tm_lcd_pinctrl_normal_cmds, \
                            ARRAY_SIZE(tm_lcd_pinctrl_normal_cmds));

            /* lcd gpio request */
            gpio_cmds_tx(NULL, tm_lcd_gpio_request_cmds, \
                         ARRAY_SIZE(tm_lcd_gpio_request_cmds));

            /* lcd vcc enable */
            if(1==is_vcc_disabled)
            {
                balongfb_logi("enable VSP and VSN \n");
                vcc_cmds_tx(NULL, tm_lcd_vcc_enable_cmds, \
                        ARRAY_SIZE(tm_lcd_vcc_enable_cmds));
            }
            else
            {
                /* lcd vcc does not enable vsp_vsn*/
                balongfb_logi("VSP VSN does not power on for is_vcc_disabled = %d\n",is_vcc_disabled);
            }
            /* lcd gpio normal */
            gpio_cmds_tx(NULL, tm_lcd_gpio_normal_cmds, \
                         ARRAY_SIZE(tm_lcd_gpio_normal_cmds));

            /* lcd display on sequence */
            mipi_dsi_cmds_tx(tm_display_on_cmds, \
                             ARRAY_SIZE(tm_display_on_cmds), balongfd->dsi_base);

            g_display_on = true;
            /*first set sbl to panel*/
            if (balongfd->panel_info.sbl_enable)
            {
                pdata = (struct balong_fb_panel_data*)balongfd->pdev->dev.platform_data;
                if (pdata->set_sre != NULL)
                {
                    pdata->set_sre(balongfd->pdev, balongfd->sbl_enable, balongfd->sbl_lsensor_value);
                }
            }
        }
    }
    else
    {
        balongfb_loge("failed to init lcd!\n");
    }

    pr_info("%s exit succ!\n", __func__);

#if defined (CONFIG_HUAWEI_DSM)
    int_st0 = inp32(ade_base +  MIPIDSI_INT_ST0_ADDR);
    int_st1 = inp32(ade_base +  MIPIDSI_INT_ST1_ADDR);
    if ((0x00 != int_st0 || 0x00 != int_st1) && (!dsm_client_ocuppy(lcd_dclient)))
    {
        dsm_client_record(lcd_dclient, "LCD dsi status. int_st0:0x%x,\
            int_st1:0x%x.\n", int_st0, int_st1);
        dsm_client_notify(lcd_dclient, DSM_LCD_STATUS_ERROR_NO);
    }
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;
}
Ejemplo n.º 15
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;
}
Ejemplo n.º 16
0
static void jdi_disp_off(struct k3_fb_data_type *k3fd)
{
	u32 edc_base = 0;
	int retval = 0;
	struct k3_panel_info *pinfo = NULL;

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

	/* lcd display off sequence */
	mipi_dsi_cmds_tx(jdi_display_off_cmds,
		ARRAY_SIZE(jdi_display_off_cmds), edc_base);

	if(rmi_fc != NULL){

		retval = rmi_f01_glove_switch_read(rmi_fc);
		if (retval < 0)
			dev_err(&rmi_fc->dev,
				"Failed to switch mode between finger and glove. Code: %d.\n",
				retval);
	}

	/*tk suspend should be here, becuase this function is called before suspend*/
	if (g_touchkey_enable == true) {
		touchkey_early_suspend_extern();
	}
    
	/*
	GPIO_19_5 is TP's interrupt GPIO, It is upload by ldo14 which will be closed here,
	so this irq should be disabled at first and then enable it in mipi_jdi_panel_on.
	*/

	disable_irq(gpio_to_irq(GPIO_19_5));

	/* lcd gpio request */
	gpio_cmds_tx(jdi_lcd_gpio_lowpower_cmds, \
		ARRAY_SIZE(jdi_lcd_gpio_lowpower_cmds));

	/* lcd gpio free */
	gpio_cmds_tx(jdi_lcd_gpio_free_cmds, \
		ARRAY_SIZE(jdi_lcd_gpio_free_cmds));

	/* lcd iomux lowpower */
	iomux_cmds_tx(jdi_lcd_iomux_lowpower_cmds, \
		ARRAY_SIZE(jdi_lcd_iomux_lowpower_cmds));

	/* tp gpio request */
	printk("%s	enter:tp gpio request, free and iomux lowpower\n",__func__);
	gpio_cmds_tx(jdi_tp_gpio_lowpower_cmds, \
		ARRAY_SIZE(jdi_tp_gpio_lowpower_cmds));

	/* tp gpio free */
	gpio_cmds_tx(jdi_tp_gpio_free_cmds, \
		ARRAY_SIZE(jdi_tp_gpio_free_cmds));

	/* tp iomux lowpower */
	iomux_cmds_tx(jdi_tp_iomux_lowpower_cmds, \
		ARRAY_SIZE(jdi_tp_iomux_lowpower_cmds));

	/* lcd vcc disable */
	vcc_cmds_tx(NULL, jdi_lcd_vcc_disable_cmds, \
		ARRAY_SIZE(jdi_lcd_vcc_disable_cmds));

	/* tk vcc disable */
	if (g_touchkey_enable == true) {
		vcc_cmds_tx(NULL, jdi_tk_vcc_disable_cmds, \
			ARRAY_SIZE(jdi_tk_vcc_disable_cmds));
	}

	/* tp vcc disable */
	vcc_cmds_tx(NULL, jdi_tp_vcc_disable_cmds, \
		ARRAY_SIZE(jdi_tp_vcc_disable_cmds));

}