Пример #1
0
Файл: fb.c Проект: 0ida/coreboot
/*
 * Initialize DP display
 */
int dp_controller_init(struct s5p_dp_device *dp_device)
{
	int ret;
	struct s5p_dp_device *dp = dp_device;
	struct exynos5_dp *base;

	clock_init_dp_clock();

	power_enable_dp_phy();
	ret = s5p_dp_init_dp(dp);
	if (ret) {
		printk(BIOS_ERR, "%s: Could not initialize dp\n", __func__);
		return ret;
	}

	ret = s5p_dp_hw_link_training(dp, dp->video_info->lane_count,
				      dp->video_info->link_rate);
	if (ret) {
		printk(BIOS_ERR, "unable to do link train\n");
		return ret;
	}
	/* Minimum delay after H/w Link training */
	udelay(1000);

	ret = s5p_dp_enable_scramble(dp);
	if (ret) {
		printk(BIOS_ERR, "unable to set scramble mode\n");
		return ret;
	}

	ret = s5p_dp_enable_rx_to_enhanced_mode(dp);
	if (ret) {
		printk(BIOS_ERR, "unable to set enhanced mode\n");
		return ret;
	}


	base = dp->base;
	/* Enable enhanced mode */
	setbits_le32(&base->sys_ctl_4, ENHANCED);

	writel(dp->link_train.lane_count, &base->lane_count_set);
	writel(dp->link_train.link_rate, &base->link_bw_set);

	s5p_dp_init_video(dp);
	ret = s5p_dp_config_video(dp, dp->video_info);
	if (ret) {
		printk(BIOS_ERR, "unable to config video\n");
		return ret;
	}

	return 0;
}
Пример #2
0
static int s5p_dp_enable(struct s5p_dp_device *dp)
{
	int ret = 0;
	int retry = 0;
	struct s5p_dp_platdata *pdata = dp->dev->platform_data;
	u32 reg;

#ifdef CONFIG_S5P_DP_PSR
	if ((dp->psr_enter_state == PSR_PRE_ENTER) || (dp->psr_enter_state == PSR_ENTER_DONE)) {
		s5p_dp_psr_exit(dp);
	}
#endif

	mutex_lock(&dp->lock);

#ifdef CONFIG_S5P_DP_ESD_RECOVERY
	if (dp->enabled)
		s5p_dp_disable_esd_interrupt(dp);
#endif

	if (dp->enabled)
		goto out;

	dp->enabled = 1;

	clk_enable(dp->clock);
	pm_runtime_get_sync(dp->dev);

dp_phy_init:

	s5p_dp_init_dp(dp);

#if 0
	if (!soc_is_exynos5250()) {
		ret = s5p_dp_detect_hpd(dp);
		if (ret) {
			dev_err(dp->dev, "unable to detect hpd\n");
			goto out;
		}
	}
#endif

#if 0
	ret = s5p_dp_handle_edid(dp);
	if (ret) {
		dev_err(dp->dev, "unable to handle edid\n");
		goto out;
	}
#endif
	if (soc_is_exynos5250())
		s5p_dp_disable_rx_zmux(dp);

	/* Non-enhance mode setting */
	ret = s5p_dp_enable_scramble(dp, 0);
	if (ret) {
		dev_err(dp->dev, "unable to set scramble\n");
		goto out;
	}

	ret = s5p_dp_enable_rx_to_enhanced_mode(dp, 0);
	if (ret) {
		dev_err(dp->dev, "unable to set enhanced mode\n");
		goto out;
	}
	s5p_dp_enable_enhanced_mode(dp, 0);

	/* Rx data disable */
	if (soc_is_exynos5250())
		s5p_dp_rx_control(dp,0);

       /* Link Training */
	ret = s5p_dp_set_link_train(dp, dp->video_info->lane_count,
				dp->video_info->link_rate);
	if (ret) {
		dev_err(dp->dev, "unable to do link train\n");
		goto out;
	}

	/* Rx data enable */
	if (soc_is_exynos5250())
		s5p_dp_rx_control(dp,1);

	s5p_dp_set_lane_count(dp, dp->video_info->lane_count);
	s5p_dp_set_link_bandwidth(dp, dp->video_info->link_rate);

	s5p_dp_init_video(dp);
	ret = s5p_dp_config_video(dp, dp->video_info);
	if (ret) {
		dev_err(dp->dev, "unable to config video\n");
		goto out;
	}

#ifdef CONFIG_S5P_DP_PSR
	s5p_dp_scramber_rst_cnt(dp);

	s5p_dp_write_byte_to_dpcd(dp, 0x491, 0x80);
	s5p_dp_write_byte_to_dpcd(dp, 0x492, 0x04);
	s5p_dp_write_byte_to_dpcd(dp, 0x493, 0x31);

	writel(0x2F, dp->reg_base + 0x730); /* S5P_DP_VIDEO_FIFO_THRD */

	reg = readl(dp->reg_base + 0x800); /* S5P_DP_SOC_GENERAL_CTL */
	reg |= (1<<31);
	writel(reg, dp->reg_base + 0x800);

	s5p_dp_write_byte_to_dpcd(dp,
		DPCD_ADDR_PSR_CONFIGURATION,
		DPCD_PSR_ENABLE);

	s5p_dp_set_video_timing(dp);
#endif

	if (pdata->backlight_on)
		pdata->backlight_on();

#ifdef CONFIG_S5P_DP_ESD_RECOVERY
	s5p_dp_enable_esd_interrupt(dp);
#endif

	mutex_unlock(&dp->lock);
	return 0;

out:

	if (retry < 3) {
		if (pdata->lcd_off)
			pdata->lcd_off();

		if (pdata->lcd_on)
			pdata->lcd_on();

		retry++;
		goto dp_phy_init;
	}
	dev_err(dp->dev, "DP LT exceeds max retry count");

	if (pdata->backlight_off)
		pdata->backlight_off();

	if (pdata->lcd_off)
		pdata->lcd_off();

	mutex_unlock(&dp->lock);
	return ret;
}
static int s5p_dp_enable(struct s5p_dp_device *dp)
{
	int ret = 0;
	int retry = 0;
	struct s5p_dp_platdata *pdata = dp->dev->platform_data;

	mutex_lock(&dp->lock);

	if (dp->enabled)
		goto out;

	dp->enabled = 1;

	clk_enable(dp->clock);
	pm_runtime_get_sync(dp->dev);

    printk("####### start dp enable #########\n");

dp_phy_init:

	if (pdata->phy_init)
		pdata->phy_init();
    else {
        printk("phy_init is null");
    }

    printk("done..\n");

	s5p_dp_init_dp(dp);

#if 0 
	if (!soc_is_exynos5250()) {
		ret = s5p_dp_detect_hpd(dp);
		if (ret) {
			dev_err(dp->dev, "unable to detect hpd\n");
			goto out;
		}
	}
#endif

	ret = s5p_dp_handle_edid(dp);
	if (ret) {
		dev_err(dp->dev, "unable to handle edid\n");
		goto out;
	}
#if 0 
	s5p_dp_disable_rx_zmux(dp);
#endif

	/* Non-enhance mode setting */
	ret = s5p_dp_enable_scramble(dp, 0);
	if (ret) {
		dev_err(dp->dev, "unable to set scramble\n");
		goto out;
	}

	ret = s5p_dp_enable_rx_to_enhanced_mode(dp, 0);
	if (ret) {
		dev_err(dp->dev, "unable to set enhanced mode\n");
		goto out;
	}
	s5p_dp_enable_enhanced_mode(dp, 0);
#if 0 
	/* Rx data disable */
	s5p_dp_rx_control(dp,0);
#endif
       /* Link Training */
	ret = s5p_dp_set_link_train(dp, dp->video_info->lane_count,
				dp->video_info->link_rate);
	if (ret) {
		dev_err(dp->dev, "unable to do link train\n");
		goto out;
	}
#if 0
	/* Rx data enable */
	s5p_dp_rx_control(dp,1);
#endif
	s5p_dp_set_lane_count(dp, dp->video_info->lane_count);
	s5p_dp_set_link_bandwidth(dp, dp->video_info->link_rate);

	s5p_dp_init_video(dp);
	ret = s5p_dp_config_video(dp, dp->video_info);
	if (ret) {
		dev_err(dp->dev, "unable to config video\n");
		goto out;
	}

	if (pdata->backlight_on)
		pdata->backlight_on();

	mutex_unlock(&dp->lock);
	return 0;

out:
	if (pdata->phy_exit)
		pdata->phy_exit();

	if (retry < 3) {
		if (pdata->lcd_off)
			pdata->lcd_off();

        msleep(500);

		if (pdata->lcd_on)
			pdata->lcd_on();

		retry++;
		goto dp_phy_init;
	}
	dev_err(dp->dev, "DP LT exceeds max retry count");

	mutex_unlock(&dp->lock);
	return ret;
}
Пример #4
0
static int s5p_dp_enable(struct s5p_dp_device *dp)
{
	int ret = 0;
	int retry = 0;
	struct s5p_dp_platdata *pdata = dp->dev->platform_data;

	if ((pdata->clock_reinit == true )&& (dp->clock_status == false)) {
		if (s5p_dp_clock_reinit() < 0)
			pr_err("failed to get disp clock\n");
		dp->clock_status = true;
	}

	mutex_lock(&dp->lock);

	if (dp->enabled)
		goto out;

	dp->enabled = 1;

	clk_enable(dp->clock);
	pm_runtime_get_sync(dp->dev);

dp_phy_init:

	if (pdata->phy_init)
		pdata->phy_init();

	s5p_dp_init_dp(dp);

	ret = s5p_dp_handle_edid(dp);
	if (ret) {
		dev_err(dp->dev, "unable to handle edid\n");
		goto out;
	}

#if defined(CONFIG_SOC_EXYNOS5250)
	s5p_dp_disable_rx_zmux(dp);
#endif

	/* Non-enhance mode setting */
	ret = s5p_dp_enable_scramble(dp, 0);
	if (ret) {
		dev_err(dp->dev, "unable to set scramble\n");
		goto out;
	}

	ret = s5p_dp_enable_rx_to_enhanced_mode(dp, 0);
	if (ret) {
		dev_err(dp->dev, "unable to set enhanced mode\n");
		goto out;
	}
	s5p_dp_enable_enhanced_mode(dp, 0);

	/* Rx data disable */
#if defined(CONFIG_SOC_EXYNOS5250)
	s5p_dp_rx_control(dp,0);
#endif

       /* Link Training */
	ret = s5p_dp_set_link_train(dp, dp->video_info->lane_count,
				dp->video_info->link_rate);
	if (ret) {
		dev_err(dp->dev, "unable to do link train\n");
		goto out;
	}

	/* Rx data enable */
#if defined(CONFIG_SOC_EXYNOS5250)
	s5p_dp_rx_control(dp,1);
#endif

	s5p_dp_set_lane_count(dp, dp->video_info->lane_count);
	s5p_dp_set_link_bandwidth(dp, dp->video_info->link_rate);

	s5p_dp_init_video(dp);
	ret = s5p_dp_config_video(dp, dp->video_info);
	if (ret) {
		dev_err(dp->dev, "unable to config video\n");
		goto out;
	}

	if (pdata->backlight_on)
		pdata->backlight_on();

	mutex_unlock(&dp->lock);
	return 0;

out:
	if (pdata->phy_exit)
		pdata->phy_exit();

	if (retry < 3) {
		if (pdata->lcd_off)
			pdata->lcd_off();

		if (pdata->lcd_on)
			pdata->lcd_on();

		retry++;
		goto dp_phy_init;
	}
	dev_err(dp->dev, "DP LT exceeds max retry count");

	mutex_unlock(&dp->lock);
	return ret;
}