diff options
| -rw-r--r-- | drivers/gpu/drm/tegra/dc.c | 79 | ||||
| -rw-r--r-- | drivers/gpu/drm/tegra/hdmi.c | 8 |
2 files changed, 48 insertions, 39 deletions
diff --git a/drivers/gpu/drm/tegra/dc.c b/drivers/gpu/drm/tegra/dc.c index 3aaa84ae2681..1a52522f5da7 100644 --- a/drivers/gpu/drm/tegra/dc.c +++ b/drivers/gpu/drm/tegra/dc.c | |||
| @@ -997,8 +997,10 @@ static void tegra_crtc_reset(struct drm_crtc *crtc) | |||
| 997 | crtc->state = NULL; | 997 | crtc->state = NULL; |
| 998 | 998 | ||
| 999 | state = kzalloc(sizeof(*state), GFP_KERNEL); | 999 | state = kzalloc(sizeof(*state), GFP_KERNEL); |
| 1000 | if (state) | 1000 | if (state) { |
| 1001 | crtc->state = &state->base; | 1001 | crtc->state = &state->base; |
| 1002 | crtc->state->crtc = crtc; | ||
| 1003 | } | ||
| 1002 | } | 1004 | } |
| 1003 | 1005 | ||
| 1004 | static struct drm_crtc_state * | 1006 | static struct drm_crtc_state * |
| @@ -1012,6 +1014,7 @@ tegra_crtc_atomic_duplicate_state(struct drm_crtc *crtc) | |||
| 1012 | return NULL; | 1014 | return NULL; |
| 1013 | 1015 | ||
| 1014 | copy->base.mode_changed = false; | 1016 | copy->base.mode_changed = false; |
| 1017 | copy->base.active_changed = false; | ||
| 1015 | copy->base.planes_changed = false; | 1018 | copy->base.planes_changed = false; |
| 1016 | copy->base.event = NULL; | 1019 | copy->base.event = NULL; |
| 1017 | 1020 | ||
| @@ -1227,9 +1230,6 @@ static void tegra_crtc_mode_set_nofb(struct drm_crtc *crtc) | |||
| 1227 | /* program display mode */ | 1230 | /* program display mode */ |
| 1228 | tegra_dc_set_timings(dc, mode); | 1231 | tegra_dc_set_timings(dc, mode); |
| 1229 | 1232 | ||
| 1230 | if (dc->soc->supports_border_color) | ||
| 1231 | tegra_dc_writel(dc, 0, DC_DISP_BORDER_COLOR); | ||
| 1232 | |||
| 1233 | /* interlacing isn't supported yet, so disable it */ | 1233 | /* interlacing isn't supported yet, so disable it */ |
| 1234 | if (dc->soc->supports_interlacing) { | 1234 | if (dc->soc->supports_interlacing) { |
| 1235 | value = tegra_dc_readl(dc, DC_DISP_INTERLACE_CONTROL); | 1235 | value = tegra_dc_readl(dc, DC_DISP_INTERLACE_CONTROL); |
| @@ -1252,42 +1252,7 @@ static void tegra_crtc_mode_set_nofb(struct drm_crtc *crtc) | |||
| 1252 | 1252 | ||
| 1253 | static void tegra_crtc_prepare(struct drm_crtc *crtc) | 1253 | static void tegra_crtc_prepare(struct drm_crtc *crtc) |
| 1254 | { | 1254 | { |
| 1255 | struct tegra_dc *dc = to_tegra_dc(crtc); | ||
| 1256 | unsigned int syncpt; | ||
| 1257 | unsigned long value; | ||
| 1258 | |||
| 1259 | drm_crtc_vblank_off(crtc); | 1255 | drm_crtc_vblank_off(crtc); |
| 1260 | |||
| 1261 | if (dc->pipe) | ||
| 1262 | syncpt = SYNCPT_VBLANK1; | ||
| 1263 | else | ||
| 1264 | syncpt = SYNCPT_VBLANK0; | ||
| 1265 | |||
| 1266 | /* initialize display controller */ | ||
| 1267 | tegra_dc_writel(dc, 0x00000100, DC_CMD_GENERAL_INCR_SYNCPT_CNTRL); | ||
| 1268 | tegra_dc_writel(dc, 0x100 | syncpt, DC_CMD_CONT_SYNCPT_VSYNC); | ||
| 1269 | |||
| 1270 | value = WIN_A_UF_INT | WIN_B_UF_INT | WIN_C_UF_INT | WIN_A_OF_INT; | ||
| 1271 | tegra_dc_writel(dc, value, DC_CMD_INT_TYPE); | ||
| 1272 | |||
| 1273 | value = WIN_A_UF_INT | WIN_B_UF_INT | WIN_C_UF_INT | | ||
| 1274 | WIN_A_OF_INT | WIN_B_OF_INT | WIN_C_OF_INT; | ||
| 1275 | tegra_dc_writel(dc, value, DC_CMD_INT_POLARITY); | ||
| 1276 | |||
| 1277 | /* initialize timer */ | ||
| 1278 | value = CURSOR_THRESHOLD(0) | WINDOW_A_THRESHOLD(0x20) | | ||
| 1279 | WINDOW_B_THRESHOLD(0x20) | WINDOW_C_THRESHOLD(0x20); | ||
| 1280 | tegra_dc_writel(dc, value, DC_DISP_DISP_MEM_HIGH_PRIORITY); | ||
| 1281 | |||
| 1282 | value = CURSOR_THRESHOLD(0) | WINDOW_A_THRESHOLD(1) | | ||
| 1283 | WINDOW_B_THRESHOLD(1) | WINDOW_C_THRESHOLD(1); | ||
| 1284 | tegra_dc_writel(dc, value, DC_DISP_DISP_MEM_HIGH_PRIORITY_TIMER); | ||
| 1285 | |||
| 1286 | value = VBLANK_INT | WIN_A_UF_INT | WIN_B_UF_INT | WIN_C_UF_INT; | ||
| 1287 | tegra_dc_writel(dc, value, DC_CMD_INT_ENABLE); | ||
| 1288 | |||
| 1289 | value = WIN_A_UF_INT | WIN_B_UF_INT | WIN_C_UF_INT; | ||
| 1290 | tegra_dc_writel(dc, value, DC_CMD_INT_MASK); | ||
| 1291 | } | 1256 | } |
| 1292 | 1257 | ||
| 1293 | static void tegra_crtc_commit(struct drm_crtc *crtc) | 1258 | static void tegra_crtc_commit(struct drm_crtc *crtc) |
| @@ -1664,6 +1629,8 @@ static int tegra_dc_init(struct host1x_client *client) | |||
| 1664 | struct tegra_drm *tegra = drm->dev_private; | 1629 | struct tegra_drm *tegra = drm->dev_private; |
| 1665 | struct drm_plane *primary = NULL; | 1630 | struct drm_plane *primary = NULL; |
| 1666 | struct drm_plane *cursor = NULL; | 1631 | struct drm_plane *cursor = NULL; |
| 1632 | unsigned int syncpt; | ||
| 1633 | u32 value; | ||
| 1667 | int err; | 1634 | int err; |
| 1668 | 1635 | ||
| 1669 | if (tegra->domain) { | 1636 | if (tegra->domain) { |
| @@ -1730,6 +1697,40 @@ static int tegra_dc_init(struct host1x_client *client) | |||
| 1730 | goto cleanup; | 1697 | goto cleanup; |
| 1731 | } | 1698 | } |
| 1732 | 1699 | ||
| 1700 | /* initialize display controller */ | ||
| 1701 | if (dc->pipe) | ||
| 1702 | syncpt = SYNCPT_VBLANK1; | ||
| 1703 | else | ||
| 1704 | syncpt = SYNCPT_VBLANK0; | ||
| 1705 | |||
| 1706 | tegra_dc_writel(dc, 0x00000100, DC_CMD_GENERAL_INCR_SYNCPT_CNTRL); | ||
| 1707 | tegra_dc_writel(dc, 0x100 | syncpt, DC_CMD_CONT_SYNCPT_VSYNC); | ||
| 1708 | |||
| 1709 | value = WIN_A_UF_INT | WIN_B_UF_INT | WIN_C_UF_INT | WIN_A_OF_INT; | ||
| 1710 | tegra_dc_writel(dc, value, DC_CMD_INT_TYPE); | ||
| 1711 | |||
| 1712 | value = WIN_A_UF_INT | WIN_B_UF_INT | WIN_C_UF_INT | | ||
| 1713 | WIN_A_OF_INT | WIN_B_OF_INT | WIN_C_OF_INT; | ||
| 1714 | tegra_dc_writel(dc, value, DC_CMD_INT_POLARITY); | ||
| 1715 | |||
| 1716 | /* initialize timer */ | ||
| 1717 | value = CURSOR_THRESHOLD(0) | WINDOW_A_THRESHOLD(0x20) | | ||
| 1718 | WINDOW_B_THRESHOLD(0x20) | WINDOW_C_THRESHOLD(0x20); | ||
| 1719 | tegra_dc_writel(dc, value, DC_DISP_DISP_MEM_HIGH_PRIORITY); | ||
| 1720 | |||
| 1721 | value = CURSOR_THRESHOLD(0) | WINDOW_A_THRESHOLD(1) | | ||
| 1722 | WINDOW_B_THRESHOLD(1) | WINDOW_C_THRESHOLD(1); | ||
| 1723 | tegra_dc_writel(dc, value, DC_DISP_DISP_MEM_HIGH_PRIORITY_TIMER); | ||
| 1724 | |||
| 1725 | value = VBLANK_INT | WIN_A_UF_INT | WIN_B_UF_INT | WIN_C_UF_INT; | ||
| 1726 | tegra_dc_writel(dc, value, DC_CMD_INT_ENABLE); | ||
| 1727 | |||
| 1728 | value = WIN_A_UF_INT | WIN_B_UF_INT | WIN_C_UF_INT; | ||
| 1729 | tegra_dc_writel(dc, value, DC_CMD_INT_MASK); | ||
| 1730 | |||
| 1731 | if (dc->soc->supports_border_color) | ||
| 1732 | tegra_dc_writel(dc, 0, DC_DISP_BORDER_COLOR); | ||
| 1733 | |||
| 1733 | return 0; | 1734 | return 0; |
| 1734 | 1735 | ||
| 1735 | cleanup: | 1736 | cleanup: |
diff --git a/drivers/gpu/drm/tegra/hdmi.c b/drivers/gpu/drm/tegra/hdmi.c index 7e06657ae58b..7eaaee74a039 100644 --- a/drivers/gpu/drm/tegra/hdmi.c +++ b/drivers/gpu/drm/tegra/hdmi.c | |||
| @@ -851,6 +851,14 @@ static void tegra_hdmi_encoder_mode_set(struct drm_encoder *encoder, | |||
| 851 | h_back_porch = mode->htotal - mode->hsync_end; | 851 | h_back_porch = mode->htotal - mode->hsync_end; |
| 852 | h_front_porch = mode->hsync_start - mode->hdisplay; | 852 | h_front_porch = mode->hsync_start - mode->hdisplay; |
| 853 | 853 | ||
| 854 | err = clk_set_rate(hdmi->clk, pclk); | ||
| 855 | if (err < 0) { | ||
| 856 | dev_err(hdmi->dev, "failed to set HDMI clock frequency: %d\n", | ||
| 857 | err); | ||
| 858 | } | ||
| 859 | |||
| 860 | DRM_DEBUG_KMS("HDMI clock rate: %lu Hz\n", clk_get_rate(hdmi->clk)); | ||
| 861 | |||
| 854 | /* power up sequence */ | 862 | /* power up sequence */ |
| 855 | value = tegra_hdmi_readl(hdmi, HDMI_NV_PDISP_SOR_PLL0); | 863 | value = tegra_hdmi_readl(hdmi, HDMI_NV_PDISP_SOR_PLL0); |
| 856 | value &= ~SOR_PLL_PDBG; | 864 | value &= ~SOR_PLL_PDBG; |
