Exemplo n.º 1
0
static int dpe_on(struct platform_device *pdev)
{
	int ret = 0;
	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);

	/* dis reset DSI */
	if (is_mipi_panel(k3fd)) {
		if (is_dual_mipi_panel(k3fd)) {
			outp32(k3fd->crgperi_base + PERRSTDIS3_OFFSET, 0x00030000);
		} else {
			outp32(k3fd->crgperi_base + PERRSTDIS3_OFFSET, 0x00020000);
		}
	}

	if (k3fd->index != PRIMARY_PANEL_IDX) {
		if (k3fd_list[PRIMARY_PANEL_IDX] &&
			(k3fd_list[PRIMARY_PANEL_IDX]->panel_info.vsync_ctrl_type & VSYNC_CTRL_CLK_OFF)) {
			K3_FB_DEBUG("fb%d, pdp clk enable!\n", k3fd->index);
			dpe_clk_enable(k3fd_list[PRIMARY_PANEL_IDX]);
		}
	}

	dpe_regulator_enable(k3fd);

	dpe_init(k3fd);

	if (is_ldi_panel(k3fd)) {
		k3fd->panel_info.lcd_init_step = LCD_INIT_POWER_ON;
		ret = panel_next_on(pdev);
	}

	ret = panel_next_on(pdev);

	if (k3fd->panel_info.vsync_ctrl_type == VSYNC_CTRL_NONE) {
		dpe_irq_enable(k3fd);
		dpe_interrupt_unmask(k3fd);
	}

#if 0
	if (k3fd->index == PRIMARY_PANEL_IDX) {
		enable_ldi_pdp(k3fd);
	} else if (k3fd->index == EXTERNAL_PANEL_IDX) {
		enable_ldi_sdp(k3fd);
	} else if (k3fd->index == AUXILIARY_PANEL_IDX) {
		; /* do nothing */
	} else {
		K3_FB_ERR("fb%d, not support this device!\n", k3fd->index);
	}
#endif

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

	return ret;
}
void hisifb_activate_vsync(struct hisi_fb_data_type *hisifd)
{
	struct hisi_fb_panel_data *pdata = NULL;
	struct hisifb_vsync *vsync_ctrl = NULL;
	unsigned long flags = 0;
	int clk_enabled = 0;

	BUG_ON(hisifd == NULL);
	pdata = dev_get_platdata(&hisifd->pdev->dev);
	BUG_ON(pdata == NULL);
	vsync_ctrl = &(hisifd->vsync_ctrl);
	BUG_ON(vsync_ctrl == NULL);

	if (hisifd->panel_info.vsync_ctrl_type == VSYNC_CTRL_NONE)
		return;

	mutex_lock(&(vsync_ctrl->vsync_lock));

	if (vsync_ctrl->vsync_ctrl_enabled == 0) {
		HISI_FB_DEBUG("fb%d, dss clk on!\n", hisifd->index);
		if (hisifd->panel_info.vsync_ctrl_type & VSYNC_CTRL_VCC_OFF) {
			dpe_regulator_enable(hisifd);
		}

		if (hisifd->panel_info.vsync_ctrl_type & VSYNC_CTRL_CLK_OFF) {
			mipi_dsi_clk_enable(hisifd);
			dpe_clk_enable(hisifd);
		}

		if (hisifd->panel_info.vsync_ctrl_type & VSYNC_CTRL_MIPI_ULPS) {
			mipi_dsi_ulps_cfg(hisifd, 1);
		}

		vsync_ctrl->vsync_ctrl_enabled = 1;
		clk_enabled = 1;
	}

	spin_lock_irqsave(&(vsync_ctrl->spin_lock), flags);
	vsync_ctrl->vsync_ctrl_disabled_set = 0;
	vsync_ctrl->vsync_ctrl_expire_count = 0;

	if (clk_enabled) {
		if (pdata->vsync_ctrl) {
			pdata->vsync_ctrl(hisifd->pdev, 1);
		} else {
			HISI_FB_ERR("fb%d, vsync_ctrl not supported!\n", hisifd->index);
		}
	}
	spin_unlock_irqrestore(&(vsync_ctrl->spin_lock), flags);

	mutex_unlock(&(vsync_ctrl->vsync_lock));
}