int hdmi_conf_apply(struct hdmi_device *hdmi_dev)
{
	struct device *dev = hdmi_dev->dev;
	const struct hdmi_preset_conf *conf = hdmi_dev->cur_conf;
	struct v4l2_dv_preset preset;
	int ret;

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

	/* reset hdmiphy */
	hdmi_write_mask(hdmi_dev, HDMI_PHY_RSTOUT, ~0, HDMI_PHY_SW_RSTOUT);
	mdelay(10);
	hdmi_write_mask(hdmi_dev, HDMI_PHY_RSTOUT,  0, HDMI_PHY_SW_RSTOUT);
	mdelay(10);

	/* configure presets */
	preset.preset = hdmi_dev->cur_preset;
	ret = v4l2_subdev_call(hdmi_dev->phy_sd, video, s_dv_preset, &preset);
	if (ret) {
		dev_err(dev, "failed to set preset (%u)\n", preset.preset);
		return ret;
	}

	/* resetting HDMI core */
	hdmi_write_mask(hdmi_dev, HDMI_CORE_RSTOUT,  0, HDMI_CORE_SW_RSTOUT);
	mdelay(10);
	hdmi_write_mask(hdmi_dev, HDMI_CORE_RSTOUT, ~0, HDMI_CORE_SW_RSTOUT);
	mdelay(10);

	hdmi_reg_init(hdmi_dev);

	/* setting core registers */
	hdmi_timing_apply(hdmi_dev, conf);

	return 0;
}
static int hdmi_streamon(struct hdmi_device *hdev)
{
    const struct hdmi_timings *conf = hdev->cur_conf;
    struct device *dev = hdev->dev;
    int ret;
    u32 val0, val1, val2;

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

    /* 3D test */
    hdmi_set_infoframe(hdev);

    /* set packets for audio */
    hdmi_set_packets(hdev);

    /* init audio */
#if defined(CONFIG_VIDEO_EXYNOS_HDMI_AUDIO_I2S)
    hdmi_reg_i2s_audio_init(hdev);
#elif defined(CONFIG_VIDEO_EXYNOS_HDMI_AUDIO_SPDIF)
    hdmi_reg_spdif_audio_init(hdev);
#endif
    /* enbale HDMI audio */
    if (hdev->audio_enable)
        hdmi_audio_enable(hdev, 1);

    hdmi_set_dvi_mode(hdev);

    /* controls the pixel value limitation */
    hdmi_reg_set_limits(hdev);

    /* setting core registers */
    hdmi_timing_apply(hdev, conf);

    /* enable HDMI and timing generator */
    hdmi_enable(hdev, 1);
    hdmi_tg_enable(hdev, 1);

    hdev->streaming = HDMI_STREAMING;

    /* change the HPD interrupt: External -> Internal */
    disable_irq(hdev->ext_irq);
    cancel_delayed_work_sync(&hdev->hpd_work_ext);
    hdmi_reg_set_int_hpd(hdev);
    enable_irq(hdev->int_irq);
    dev_info(hdev->dev, "HDMI interrupt changed to internal\n");

    /* start HDCP if enabled */
    if (hdev->hdcp_info.hdcp_enable) {
        ret = hdcp_start(hdev);
        if (ret)
            return ret;
    }

    val0 = hdmi_read(hdev, HDMI_ACR_MCTS0);
    val1 = hdmi_read(hdev, HDMI_ACR_MCTS1);
    val2 = hdmi_read(hdev, HDMI_ACR_MCTS2);
    dev_dbg(dev, "HDMI_ACR_MCTS0 : 0x%08x\n", val0);
    dev_dbg(dev, "HDMI_ACR_MCTS1 : 0x%08x\n", val1);
    dev_dbg(dev, "HDMI_ACR_MCTS2 : 0x%08x\n", val2);

    hdmi_dumpregs(hdev, "streamon");
    return 0;
}