- if (hdmi_v13_confs[i].width == mode->hdisplay &&
- hdmi_v13_confs[i].height == mode->vdisplay &&
- hdmi_v13_confs[i].vrefresh == mode->vrefresh &&
- hdmi_v13_confs[i].interlace ==
+ if (hdmi_v13_confs[i].width == mode->crtc_hdisplay &&
+ hdmi_v13_confs[i].height == mode->crtc_vdisplay &&
+ hdmi_v13_confs[i].vrefresh == mode->vrefresh &&
+ hdmi_v13_confs[i].interlace ==
- DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__);
+ DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n", DRM_BASE_ID(connector),
+ drm_get_connector_name(connector));
- DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__);
+ /* TODO: stringify HDMI_PACKET_TYPE */
+ DRM_DEBUG_KMS("type: %d ver: %d len: %d\n", infoframe->type,
+ infoframe->ver, infoframe->len);
mod = hdmi_reg_read(hdata, HDMI_MODE_SEL);
if (!hdata->has_hdmi_sink) {
hdmi_reg_writeb(hdata, HDMI_VSI_CON,
mod = hdmi_reg_read(hdata, HDMI_MODE_SEL);
if (!hdata->has_hdmi_sink) {
hdmi_reg_writeb(hdata, HDMI_VSI_CON,
DRM_DEBUG_KMS("[%d]x[%d] [%d]Hz [%x]\n", check_timing->xres,
check_timing->yres, check_timing->refresh,
check_timing->vmode);
DRM_DEBUG_KMS("[%d]x[%d] [%d]Hz [%x]\n", check_timing->xres,
check_timing->yres, check_timing->refresh,
check_timing->vmode);
/* following information should be preserved,
* required for releasing the drm_display_mode node,
* duplicated to recieve adjustment info. */
/* following information should be preserved,
* required for releasing the drm_display_mode node,
* duplicated to recieve adjustment info. */
struct drm_display_mode *mode,
struct drm_display_mode *adjusted_mode)
{
struct drm_display_mode *mode,
struct drm_display_mode *adjusted_mode)
{
- DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__);
+ DRM_DEBUG_KMS("[CONNECTOR:%d:%s] [MODE:%d:%s]\n",
+ DRM_BASE_ID(connector),
+ drm_get_connector_name(connector),
+ DRM_BASE_ID(mode), mode->name);
- drm_mode_set_crtcinfo(adjusted_mode, 0);
-
- if (hdata->is_v13)
- index = hdmi_v13_conf_index(adjusted_mode);
- else
- index = find_hdmiphy_conf(adjusted_mode->clock * 1000);
-
- /* just return if user desired mode exists. */
- if (index >= 0)
- return;
+ /*
+ * Match the incoming mode to a mode in the connector list and copy it
+ * over. This is important since this might be an adjusted mode from the
+ * mixer and those have differing crtc_* values.
+ */
+ list_for_each_entry_safe(con_mode, t, &connector->modes, head) {
+ if (mode->hdisplay == con_mode->hdisplay &&
+ mode->vdisplay == con_mode->vdisplay &&
+ mode->clock == con_mode->clock) {
+ hdmi_mode_copy(adjusted_mode, con_mode);
+ return;
+ }
+ }
- list_for_each_entry(m, &connector->modes, head) {
+ list_for_each_entry_safe(con_mode, t, &connector->modes, head) {
struct hdmi_core_regs *core = &hdata->mode_conf.core;
struct hdmi_tg_regs *tg = &hdata->mode_conf.tg;
struct hdmi_core_regs *core = &hdata->mode_conf.core;
struct hdmi_tg_regs *tg = &hdata->mode_conf.tg;
- hdmi_set_reg(core->h_blank, 2, m->htotal - m->hdisplay);
- hdmi_set_reg(core->v_line, 2, m->vtotal);
- hdmi_set_reg(core->h_line, 2, m->htotal);
+ hdmi_set_reg(core->h_blank, 2, m->crtc_htotal - m->crtc_hdisplay);
+ hdmi_set_reg(core->v_line, 2, m->crtc_vtotal);
+ hdmi_set_reg(core->h_line, 2, m->crtc_htotal);
hdmi_set_reg(core->hsync_pol, 1,
(m->flags & DRM_MODE_FLAG_NHSYNC) ? 1 : 0);
hdmi_set_reg(core->vsync_pol, 1,
hdmi_set_reg(core->hsync_pol, 1,
(m->flags & DRM_MODE_FLAG_NHSYNC) ? 1 : 0);
hdmi_set_reg(core->vsync_pol, 1,
if (m->flags & DRM_MODE_FLAG_INTERLACE) {
/* Interlaced Mode */
hdmi_set_reg(core->v_sync_line_bef_2, 2,
if (m->flags & DRM_MODE_FLAG_INTERLACE) {
/* Interlaced Mode */
hdmi_set_reg(core->v_sync_line_bef_2, 2,
- (m->vsync_start - m->vdisplay) / 2);
- hdmi_set_reg(core->v2_blank, 2, m->vtotal / 2);
- hdmi_set_reg(core->v1_blank, 2, (m->vtotal - m->vdisplay) / 2);
+ (m->crtc_vsync_start - m->crtc_vdisplay) / 2);
+ hdmi_set_reg(core->v2_blank, 2, m->crtc_vtotal / 2);
+ hdmi_set_reg(core->v1_blank, 2,
+ (m->crtc_vtotal - m->crtc_vdisplay) / 2);
- (m->vtotal + ((m->vsync_end - m->vsync_start) * 4) + 5) / 2);
- hdmi_set_reg(core->v_blank_f1, 2, m->vtotal);
- hdmi_set_reg(core->v_sync_line_aft_2, 2, (m->vtotal / 2) + 7);
- hdmi_set_reg(core->v_sync_line_aft_1, 2, (m->vtotal / 2) + 2);
+ (m->crtc_vtotal +
+ ((m->crtc_vsync_end - m->crtc_vsync_start) * 4) + 5)
+ / 2);
+ hdmi_set_reg(core->v_blank_f1, 2, m->crtc_vtotal);
+ hdmi_set_reg(core->v_sync_line_aft_2, 2,
+ (m->crtc_vtotal / 2) + 7);
+ hdmi_set_reg(core->v_sync_line_aft_1, 2,
+ (m->crtc_vtotal / 2) + 2);
- (m->htotal / 2) + (m->hsync_start - m->hdisplay));
- hdmi_set_reg(tg->vact_st, 2, (m->vtotal - m->vdisplay) / 2);
- hdmi_set_reg(tg->vact_sz, 2, m->vdisplay / 2);
+ (m->crtc_htotal / 2) +
+ (m->crtc_hsync_start - m->crtc_hdisplay));
+ hdmi_set_reg(tg->vact_st, 2,
+ (m->crtc_vtotal - m->crtc_vdisplay) / 2);
+ hdmi_set_reg(tg->vact_sz, 2, m->crtc_vdisplay / 2);
hdmi_set_reg(tg->vact_st2, 2, 0x249);/* Reset value + 1*/
hdmi_set_reg(tg->vact_st3, 2, 0x0);
hdmi_set_reg(tg->vact_st4, 2, 0x0);
} else {
/* Progressive Mode */
hdmi_set_reg(core->v_sync_line_bef_2, 2,
hdmi_set_reg(tg->vact_st2, 2, 0x249);/* Reset value + 1*/
hdmi_set_reg(tg->vact_st3, 2, 0x0);
hdmi_set_reg(tg->vact_st4, 2, 0x0);
} else {
/* Progressive Mode */
hdmi_set_reg(core->v_sync_line_bef_2, 2,
- m->vsync_start - m->vdisplay);
- hdmi_set_reg(core->v2_blank, 2, m->vtotal);
- hdmi_set_reg(core->v1_blank, 2, m->vtotal - m->vdisplay);
+ m->crtc_vsync_start - m->crtc_vdisplay);
+ hdmi_set_reg(core->v2_blank, 2, m->crtc_vtotal);
+ hdmi_set_reg(core->v1_blank, 2,
+ m->crtc_vtotal - m->crtc_vdisplay);
hdmi_set_reg(core->v_blank_f0, 2, 0xffff);
hdmi_set_reg(core->v_blank_f1, 2, 0xffff);
hdmi_set_reg(core->v_sync_line_aft_2, 2, 0xffff);
hdmi_set_reg(core->v_sync_line_aft_1, 2, 0xffff);
hdmi_set_reg(core->v_sync_line_aft_pxl_2, 2, 0xffff);
hdmi_set_reg(core->v_sync_line_aft_pxl_1, 2, 0xffff);
hdmi_set_reg(core->v_blank_f0, 2, 0xffff);
hdmi_set_reg(core->v_blank_f1, 2, 0xffff);
hdmi_set_reg(core->v_sync_line_aft_2, 2, 0xffff);
hdmi_set_reg(core->v_sync_line_aft_1, 2, 0xffff);
hdmi_set_reg(core->v_sync_line_aft_pxl_2, 2, 0xffff);
hdmi_set_reg(core->v_sync_line_aft_pxl_1, 2, 0xffff);
- hdmi_set_reg(tg->vact_st, 2, m->vtotal - m->vdisplay);
- hdmi_set_reg(tg->vact_sz, 2, m->vdisplay);
+ hdmi_set_reg(tg->vact_st, 2, m->crtc_vtotal - m->crtc_vdisplay);
+ hdmi_set_reg(tg->vact_sz, 2, m->crtc_vdisplay);
hdmi_set_reg(tg->vact_st2, 2, 0x248); /* Reset value */
hdmi_set_reg(tg->vact_st3, 2, 0x47b); /* Reset value */
hdmi_set_reg(tg->vact_st4, 2, 0x6ae); /* Reset value */
}
/* Following values & calculations are same irrespective of mode type */
hdmi_set_reg(tg->vact_st2, 2, 0x248); /* Reset value */
hdmi_set_reg(tg->vact_st3, 2, 0x47b); /* Reset value */
hdmi_set_reg(tg->vact_st4, 2, 0x6ae); /* Reset value */
}
/* Following values & calculations are same irrespective of mode type */
- hdmi_set_reg(core->h_sync_start, 2, m->hsync_start - m->hdisplay - 2);
- hdmi_set_reg(core->h_sync_end, 2, m->hsync_end - m->hdisplay - 2);
+ hdmi_set_reg(core->h_sync_start, 2,
+ m->crtc_hsync_start - m->crtc_hdisplay - 2);
+ hdmi_set_reg(core->h_sync_end, 2,
+ m->crtc_hsync_end - m->crtc_hdisplay - 2);
hdmi_set_reg(core->vact_space_1, 2, 0xffff);
hdmi_set_reg(core->vact_space_2, 2, 0xffff);
hdmi_set_reg(core->vact_space_3, 2, 0xffff);
hdmi_set_reg(core->vact_space_1, 2, 0xffff);
hdmi_set_reg(core->vact_space_2, 2, 0xffff);
hdmi_set_reg(core->vact_space_3, 2, 0xffff);
/* Timing generator registers */
hdmi_set_reg(tg->cmd, 1, 0x0);
/* Timing generator registers */
hdmi_set_reg(tg->cmd, 1, 0x0);
- hdmi_set_reg(tg->h_fsz, 2, m->htotal);
- hdmi_set_reg(tg->hact_st, 2, m->htotal - m->hdisplay);
- hdmi_set_reg(tg->hact_sz, 2, m->hdisplay);
- hdmi_set_reg(tg->v_fsz, 2, m->vtotal);
+ hdmi_set_reg(tg->h_fsz, 2, m->crtc_htotal);
+ hdmi_set_reg(tg->hact_st, 2, m->crtc_htotal - m->crtc_hdisplay);
+ hdmi_set_reg(tg->hact_sz, 2, m->crtc_hdisplay);
+ hdmi_set_reg(tg->v_fsz, 2, m->crtc_vtotal);
hdmi_set_reg(tg->vsync, 2, 0x1);
hdmi_set_reg(tg->vsync2, 2, 0x233); /* Reset value */
hdmi_set_reg(tg->field_chg, 2, 0x233); /* Reset value */
hdmi_set_reg(tg->vsync, 2, 0x1);
hdmi_set_reg(tg->vsync2, 2, 0x233); /* Reset value */
hdmi_set_reg(tg->field_chg, 2, 0x233); /* Reset value */
hdmi_set_reg(tg->field_bot_hdmi, 2, 0x233); /* Reset value */
hdmi_set_reg(tg->tg_3d, 1, 0x0);
hdmi_set_reg(tg->field_bot_hdmi, 2, 0x233); /* Reset value */
hdmi_set_reg(tg->tg_3d, 1, 0x0);
- /* Workaround 4 implementation for 1440x900 resolution support */
- if (m->hdisplay == 1440 && m->vdisplay == 900 && m->clock == 106500) {
- hdmi_set_reg(tg->hact_st, 2, m->htotal - m->hdisplay - 0xe0);
- hdmi_set_reg(tg->hact_sz, 2, m->hdisplay + 0xe0);
+ if (m->crtc_hdisplay == 1440 && m->crtc_vdisplay == 900 &&
+ m->clock == 106500) {
+ hdmi_set_reg(tg->hact_st, 2,
+ m->crtc_htotal - m->crtc_hdisplay - 0xe0);
+ hdmi_set_reg(tg->hact_sz, 2, m->crtc_hdisplay + 0xe0);
- if (m->hdisplay == 800 && m->vdisplay == 600 && m->clock == 40000) {
- hdmi_set_reg(tg->hact_st, 2, m->htotal - m->hdisplay - 0x20);
- hdmi_set_reg(tg->hact_sz, 2, m->hdisplay + 0x20);
+ if (m->hdisplay == 800 && m->vdisplay == 600
+ && m->clock == 40000) {
+ hdmi_set_reg(tg->hact_st, 2,
+ m->crtc_htotal - m->crtc_hdisplay - 0x20);
+ hdmi_set_reg(tg->hact_sz, 2, m->crtc_hdisplay + 0x20);
-static void hdmi_commit(void *ctx)
-{
- struct hdmi_context *hdata = ctx;
-
- DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__);
- if (!hdata->is_hdmi_powered_on)
- return;
-
- hdmi_conf_apply(hdata);
- hdata->enabled = true;
-}
-
-static void hdmi_apply(void *ctx)
-{
- hdmi_commit(ctx);
-}
-
.is_connected = hdmi_is_connected,
.get_edid = hdmi_get_edid,
.check_timing = hdmi_check_timing,
.is_connected = hdmi_is_connected,
.get_edid = hdmi_get_edid,
.check_timing = hdmi_check_timing,
/* manager */
.mode_fixup = hdmi_mode_fixup,
.mode_set = hdmi_mode_set,
/* manager */
.mode_fixup = hdmi_mode_fixup,
.mode_set = hdmi_mode_set,
static irqreturn_t hdmi_irq_handler(int irq, void *arg)
{
struct hdmi_context *hdata = arg;
static irqreturn_t hdmi_irq_handler(int irq, void *arg)
{
struct hdmi_context *hdata = arg;
if (hdata->is_hdmi_powered_on) {
intc_flag = hdmi_reg_read(hdata, HDMI_INTC_FLAG);
/* clearing flags for HPD plug/unplug */
if (hdata->is_hdmi_powered_on) {
intc_flag = hdmi_reg_read(hdata, HDMI_INTC_FLAG);
/* clearing flags for HPD plug/unplug */
hdmi_reg_writemask(hdata, HDMI_INTC_FLAG, ~0,
HDMI_INTC_FLAG_HPD_PLUG);
}
hdmi_reg_writemask(hdata, HDMI_INTC_FLAG, ~0,
HDMI_INTC_FLAG_HPD_PLUG);
}
audio_dev = platform_device_alloc("exynos-hdmi-audio", -1);
if (!audio_dev) {
DRM_ERROR("hdmi audio device allocation failed.\n");
audio_dev = platform_device_alloc("exynos-hdmi-audio", -1);
if (!audio_dev) {
DRM_ERROR("hdmi audio device allocation failed.\n");
- /* create workqueue and hotplug work */
- hdata->wq = alloc_workqueue("exynos-drm-hdmi",
- WQ_UNBOUND | WQ_NON_REENTRANT, 1);
- if (hdata->wq == NULL) {
- DRM_ERROR("Failed to create workqueue.\n");
- ret = -ENOMEM;
- goto err_hdmiphy;
- }
- INIT_WORK(&hdata->hotplug_work, hdmi_hotplug_func);
-
ret = request_irq(hdata->internal_irq, hdmi_irq_handler,
IRQF_SHARED, "int_hdmi", hdata);
if (ret) {
DRM_ERROR("request int interrupt failed.\n");
ret = request_irq(hdata->internal_irq, hdmi_irq_handler,
IRQF_SHARED, "int_hdmi", hdata);
if (ret) {
DRM_ERROR("request int interrupt failed.\n");
if (of_device_is_compatible(dev->of_node,
"samsung,exynos5-hdmi")) {
ret = hdmi_register_audio_device(pdev);
if (of_device_is_compatible(dev->of_node,
"samsung,exynos5-hdmi")) {
ret = hdmi_register_audio_device(pdev);
free_irq(hdata->external_irq, hdata);
err_int_irq:
free_irq(hdata->internal_irq, hdata);
free_irq(hdata->external_irq, hdata);
err_int_irq:
free_irq(hdata->internal_irq, hdata);
free_irq(hdata->internal_irq, hdata);
free_irq(hdata->external_irq, hdata);
free_irq(hdata->internal_irq, hdata);
free_irq(hdata->external_irq, hdata);