drm/tegra: dc: Request syncpoint earlier
[firefly-linux-kernel-4.4.55.git] / drivers / gpu / drm / tegra / dc.c
index a287e4fec8653d91e55bb2765e2379984b65bef5..6347c0f8a9590412814eb40912c4ecee6d47614c 100644 (file)
@@ -759,7 +759,6 @@ static void tegra_cursor_atomic_update(struct drm_plane *plane,
        /* position the cursor */
        value = (state->crtc_y & 0x3fff) << 16 | (state->crtc_x & 0x3fff);
        tegra_dc_writel(dc, value, DC_DISP_CURSOR_POSITION);
-
 }
 
 static void tegra_cursor_atomic_disable(struct drm_plane *plane,
@@ -809,9 +808,11 @@ static struct drm_plane *tegra_dc_cursor_plane_create(struct drm_device *drm,
                return ERR_PTR(-ENOMEM);
 
        /*
-        * We'll treat the cursor as an overlay plane with index 6 here so
-        * that the update and activation request bits in DC_CMD_STATE_CONTROL
-        * match up.
+        * This index is kind of fake. The cursor isn't a regular plane, but
+        * its update and activation request bits in DC_CMD_STATE_CONTROL do
+        * use the same programming. Setting this fake index here allows the
+        * code in tegra_add_plane_state() to do the right thing without the
+        * need to special-casing the cursor plane.
         */
        plane->index = 6;
 
@@ -1015,6 +1016,8 @@ static void tegra_crtc_reset(struct drm_crtc *crtc)
                crtc->state = &state->base;
                crtc->state->crtc = crtc;
        }
+
+       drm_crtc_vblank_reset(crtc);
 }
 
 static struct drm_crtc_state *
@@ -1569,8 +1572,30 @@ static int tegra_dc_show_regs(struct seq_file *s, void *data)
        return 0;
 }
 
+static int tegra_dc_show_crc(struct seq_file *s, void *data)
+{
+       struct drm_info_node *node = s->private;
+       struct tegra_dc *dc = node->info_ent->data;
+       u32 value;
+
+       value = DC_COM_CRC_CONTROL_ACTIVE_DATA | DC_COM_CRC_CONTROL_ENABLE;
+       tegra_dc_writel(dc, value, DC_COM_CRC_CONTROL);
+       tegra_dc_commit(dc);
+
+       drm_crtc_wait_one_vblank(&dc->base);
+       drm_crtc_wait_one_vblank(&dc->base);
+
+       value = tegra_dc_readl(dc, DC_COM_CRC_CHECKSUM);
+       seq_printf(s, "%08x\n", value);
+
+       tegra_dc_writel(dc, 0, DC_COM_CRC_CONTROL);
+
+       return 0;
+}
+
 static struct drm_info_list debugfs_files[] = {
        { "regs", tegra_dc_show_regs, 0, NULL },
+       { "crc", tegra_dc_show_crc, 0, NULL },
 };
 
 static int tegra_dc_debugfs_init(struct tegra_dc *dc, struct drm_minor *minor)
@@ -1826,8 +1851,20 @@ static const struct tegra_dc_soc_info tegra124_dc_soc_info = {
        .has_powergate = true,
 };
 
+static const struct tegra_dc_soc_info tegra210_dc_soc_info = {
+       .supports_border_color = false,
+       .supports_interlacing = true,
+       .supports_cursor = true,
+       .supports_block_linear = true,
+       .pitch_align = 64,
+       .has_powergate = true,
+};
+
 static const struct of_device_id tegra_dc_of_match[] = {
        {
+               .compatible = "nvidia,tegra210-dc",
+               .data = &tegra210_dc_soc_info,
+       }, {
                .compatible = "nvidia,tegra124-dc",
                .data = &tegra124_dc_soc_info,
        }, {
@@ -1957,6 +1994,10 @@ static int tegra_dc_probe(struct platform_device *pdev)
                return -ENXIO;
        }
 
+       dc->syncpt = host1x_syncpt_request(&pdev->dev, flags);
+       if (!dc->syncpt)
+               dev_warn(&pdev->dev, "failed to allocate syncpoint\n");
+
        INIT_LIST_HEAD(&dc->client.list);
        dc->client.ops = &dc_client_ops;
        dc->client.dev = &pdev->dev;
@@ -1974,10 +2015,6 @@ static int tegra_dc_probe(struct platform_device *pdev)
                return err;
        }
 
-       dc->syncpt = host1x_syncpt_request(&pdev->dev, flags);
-       if (!dc->syncpt)
-               dev_warn(&pdev->dev, "failed to allocate syncpoint\n");
-
        platform_set_drvdata(pdev, dc);
 
        return 0;