return container_of(e, struct imx_hdp, encoder);
}
+static inline bool imx_hdp_is_dual_mode(struct drm_display_mode *mode)
+{
+ return (mode->clock > HDP_DUAL_MODE_MIN_PCLK_RATE ||
+ mode->hdisplay > HDP_SINGLE_MODE_MAX_WIDTH) ? true : false;
+}
+
static void imx_hdp_state_init(struct imx_hdp *hdp)
{
state_struct *state = &hdp->state;
struct imx_hdp *hdp = state_to_imx_hdp(state);
u32 val;
- val = 4; /* RGB */
+ val = 0x4; /* RGB */
+ if (hdp->dual_mode)
+ val |= 0x2; /* pixel link 0 and 1 are active */
if (mode->flags & DRM_MODE_FLAG_PVSYNC)
val |= 1 << PL_MUX_CTL_VCP_OFFSET;
if (mode->flags & DRM_MODE_FLAG_PHSYNC)
DRM_ERROR("SC_R_DC_0:SC_C_PXL_LINK_MST1_VLD sc_misc_set_control failed! (sciError = %d)\n", sciErr);
return -EINVAL;
}
+ if (hdp->dual_mode) {
+ sciErr = sc_misc_set_control(hdp->ipcHndl, SC_R_DC_0,
+ SC_C_PXL_LINK_MST2_VLD, 1);
+ if (sciErr != SC_ERR_NONE) {
+ DRM_ERROR("SC_R_DC_0:SC_C_PXL_LINK_MST2_VLD sc_misc_set_control failed! (sciError = %d)\n", sciErr);
+ return -EINVAL;
+ }
+ }
sc_ipc_close(hdp->mu_id);
DRM_ERROR("SC_R_DC_0:SC_C_PXL_LINK_MST1_VLD sc_misc_set_control failed! (sciError = %d)\n", sciErr);
return -EINVAL;
}
+ if (hdp->dual_mode) {
+ sciErr = sc_misc_set_control(hdp->ipcHndl, SC_R_DC_0,
+ SC_C_PXL_LINK_MST2_VLD, 0);
+ if (sciErr != SC_ERR_NONE) {
+ DRM_ERROR("SC_R_DC_0:SC_C_PXL_LINK_MST2_VLD sc_misc_set_control failed! (sciError = %d)\n", sciErr);
+ return -EINVAL;
+ }
+ }
sc_ipc_close(hdp->mu_id);
return -EINVAL;
}
- sciErr = sc_misc_set_control(hdp->ipcHndl, SC_R_DC_0, SC_C_SYNC_CTRL0, 1);
- if (sciErr != SC_ERR_NONE) {
- DRM_ERROR("SC_R_DC_0:SC_C_SYNC_CTRL0 sc_misc_set_control failed! (sciError = %d)\n", sciErr);
- return -EINVAL;
+ if (hdp->dual_mode) {
+ sciErr = sc_misc_set_control(hdp->ipcHndl, SC_R_DC_0, SC_C_SYNC_CTRL, 3);
+ if (sciErr != SC_ERR_NONE) {
+ DRM_ERROR("SC_R_DC_0:SC_C_SYNC_CTRL sc_misc_set_control failed! (sciError = %d)\n", sciErr);
+ return -EINVAL;
+ }
+ } else {
+ sciErr = sc_misc_set_control(hdp->ipcHndl, SC_R_DC_0, SC_C_SYNC_CTRL0, 1);
+ if (sciErr != SC_ERR_NONE) {
+ DRM_ERROR("SC_R_DC_0:SC_C_SYNC_CTRL0 sc_misc_set_control failed! (sciError = %d)\n", sciErr);
+ return -EINVAL;
+ }
}
sc_ipc_close(hdp->mu_id);
return -EINVAL;
}
- sciErr = sc_misc_set_control(hdp->ipcHndl, SC_R_DC_0, SC_C_SYNC_CTRL0, 0);
- if (sciErr != SC_ERR_NONE) {
- DRM_ERROR("SC_R_DC_0:SC_C_SYNC_CTRL0 sc_misc_set_control failed! (sciError = %d)\n", sciErr);
- return -EINVAL;
+ if (hdp->dual_mode) {
+ sciErr = sc_misc_set_control(hdp->ipcHndl, SC_R_DC_0, SC_C_SYNC_CTRL, 0);
+ if (sciErr != SC_ERR_NONE) {
+ DRM_ERROR("SC_R_DC_0:SC_C_SYNC_CTRL sc_misc_set_control failed! (sciError = %d)\n", sciErr);
+ return -EINVAL;
+ }
+ } else {
+ sciErr = sc_misc_set_control(hdp->ipcHndl, SC_R_DC_0, SC_C_SYNC_CTRL0, 0);
+ if (sciErr != SC_ERR_NONE) {
+ DRM_ERROR("SC_R_DC_0:SC_C_SYNC_CTRL0 sc_misc_set_control failed! (sciError = %d)\n", sciErr);
+ return -EINVAL;
+ }
}
sc_ipc_close(hdp->mu_id);
mutex_lock(&hdp->mutex);
+ hdp->dual_mode = imx_hdp_is_dual_mode(mode);
+
memcpy(&hdp->video.cur_mode, mode, sizeof(hdp->video.cur_mode));
imx_hdp_mode_setup(hdp, mode);
/* Store the display mode for plugin/DKMS poweron events */
hdp->link_rate = AFE_LINK_RATE_1_6;
- hdp->dual_mode = false;
-
ret = imx_hdp_call(hdp, clock_init, &hdp->clks);
if (ret < 0) {
DRM_ERROR("Failed to initialize clock\n");