Commit 395be0f4 authored by Dave Airlie's avatar Dave Airlie
Browse files

Merge tag 'drm/tegra/for-5.9-rc1' of ssh://git.freedesktop.org/git/tegra/linux into drm-next



drm/tegra: Changes for v5.9-rc1

This set of patches contains a few preparatory patches to enable video
capture support from external camera modules. This is a dependency for
the V4L2 driver patches that will likely be merged in v5.9 or v5.10.

On top of that there are a couple of fixes across the board as well as
some improvements.

From a feature point of view this also adds support for horizontal
reflection and 180° rotation of planes.

Signed-off-by: default avatarDave Airlie <airlied@redhat.com>

From: Thierry Reding <thierry.reding@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200717162011.1661788-1-thierry.reding@gmail.com
parents 41206a07 4fba6d22
Loading
Loading
Loading
Loading
+38 −12
Original line number Diff line number Diff line
@@ -368,6 +368,12 @@ static void tegra_dc_setup_window(struct tegra_plane *plane,
	h_size = window->src.w * bpp;
	v_size = window->src.h;

	if (window->reflect_x)
		h_offset += (window->src.w - 1) * bpp;

	if (window->reflect_y)
		v_offset += window->src.h - 1;

	value = V_PRESCALED_SIZE(v_size) | H_PRESCALED_SIZE(h_size);
	tegra_plane_writel(plane, value, DC_WIN_PRESCALED_SIZE);

@@ -404,9 +410,6 @@ static void tegra_dc_setup_window(struct tegra_plane *plane,
		tegra_plane_writel(plane, window->stride[0], DC_WIN_LINE_STRIDE);
	}

	if (window->bottom_up)
		v_offset += window->src.h - 1;

	tegra_plane_writel(plane, h_offset, DC_WINBUF_ADDR_H_OFFSET);
	tegra_plane_writel(plane, v_offset, DC_WINBUF_ADDR_V_OFFSET);

@@ -470,7 +473,10 @@ static void tegra_dc_setup_window(struct tegra_plane *plane,
		value |= COLOR_EXPAND;
	}

	if (window->bottom_up)
	if (window->reflect_x)
		value |= H_DIRECTION;

	if (window->reflect_y)
		value |= V_DIRECTION;

	if (tegra_plane_use_horizontal_filtering(plane, window)) {
@@ -601,7 +607,10 @@ static int tegra_plane_atomic_check(struct drm_plane *plane,
				    struct drm_plane_state *state)
{
	struct tegra_plane_state *plane_state = to_tegra_plane_state(state);
	unsigned int rotation = DRM_MODE_ROTATE_0 | DRM_MODE_REFLECT_Y;
	unsigned int supported_rotation = DRM_MODE_ROTATE_0 |
					  DRM_MODE_REFLECT_X |
					  DRM_MODE_REFLECT_Y;
	unsigned int rotation = state->rotation;
	struct tegra_bo_tiling *tiling = &plane_state->tiling;
	struct tegra_plane *tegra = to_tegra_plane(plane);
	struct tegra_dc *dc = to_tegra_dc(state->crtc);
@@ -639,12 +648,26 @@ static int tegra_plane_atomic_check(struct drm_plane *plane,
		return -EINVAL;
	}

	rotation = drm_rotation_simplify(state->rotation, rotation);
	/*
	 * Older userspace used custom BO flag in order to specify the Y
	 * reflection, while modern userspace uses the generic DRM rotation
	 * property in order to achieve the same result.  The legacy BO flag
	 * duplicates the DRM rotation property when both are set.
	 */
	if (tegra_fb_is_bottom_up(state->fb))
		rotation |= DRM_MODE_REFLECT_Y;

	rotation = drm_rotation_simplify(rotation, supported_rotation);

	if (rotation & DRM_MODE_REFLECT_X)
		plane_state->reflect_x = true;
	else
		plane_state->reflect_x = false;

	if (rotation & DRM_MODE_REFLECT_Y)
		plane_state->bottom_up = true;
		plane_state->reflect_y = true;
	else
		plane_state->bottom_up = false;
		plane_state->reflect_y = false;

	/*
	 * Tegra doesn't support different strides for U and V planes so we
@@ -706,7 +729,8 @@ static void tegra_plane_atomic_update(struct drm_plane *plane,
	window.dst.w = drm_rect_width(&plane->state->dst);
	window.dst.h = drm_rect_height(&plane->state->dst);
	window.bits_per_pixel = fb->format->cpp[0] * 8;
	window.bottom_up = tegra_fb_is_bottom_up(fb) || state->bottom_up;
	window.reflect_x = state->reflect_x;
	window.reflect_y = state->reflect_y;

	/* copy from state */
	window.zpos = plane->state->normalized_zpos;
@@ -792,6 +816,8 @@ static struct drm_plane *tegra_primary_plane_create(struct drm_device *drm,
	err = drm_plane_create_rotation_property(&plane->base,
						 DRM_MODE_ROTATE_0,
						 DRM_MODE_ROTATE_0 |
						 DRM_MODE_ROTATE_180 |
						 DRM_MODE_REFLECT_X |
						 DRM_MODE_REFLECT_Y);
	if (err < 0)
		dev_err(dc->dev, "failed to create rotation property: %d\n",
@@ -1080,6 +1106,8 @@ static struct drm_plane *tegra_dc_overlay_plane_create(struct drm_device *drm,
	err = drm_plane_create_rotation_property(&plane->base,
						 DRM_MODE_ROTATE_0,
						 DRM_MODE_ROTATE_0 |
						 DRM_MODE_ROTATE_180 |
						 DRM_MODE_REFLECT_X |
						 DRM_MODE_REFLECT_Y);
	if (err < 0)
		dev_err(dc->dev, "failed to create rotation property: %d\n",
@@ -2555,10 +2583,8 @@ static int tegra_dc_probe(struct platform_device *pdev)
		return PTR_ERR(dc->regs);

	dc->irq = platform_get_irq(pdev, 0);
	if (dc->irq < 0) {
		dev_err(&pdev->dev, "failed to get IRQ\n");
	if (dc->irq < 0)
		return -ENXIO;
	}

	err = tegra_dc_rgb_probe(dc);
	if (err < 0 && err != -ENODEV) {
+2 −1
Original line number Diff line number Diff line
@@ -136,7 +136,8 @@ struct tegra_dc_window {
	unsigned int stride[2];
	unsigned long base[3];
	unsigned int zpos;
	bool bottom_up;
	bool reflect_x;
	bool reflect_y;

	struct tegra_bo_tiling tiling;
	u32 format;
+7 −2
Original line number Diff line number Diff line
@@ -670,6 +670,7 @@ static int tegra_dsi_pad_enable(struct tegra_dsi *dsi)
static int tegra_dsi_pad_calibrate(struct tegra_dsi *dsi)
{
	u32 value;
	int err;

	/*
	 * XXX Is this still needed? The module reset is deasserted right
@@ -693,7 +694,11 @@ static int tegra_dsi_pad_calibrate(struct tegra_dsi *dsi)
		DSI_PAD_PREEMP_PD(0x03) | DSI_PAD_PREEMP_PU(0x3);
	tegra_dsi_writel(dsi, value, DSI_PAD_CONTROL_3);

	return tegra_mipi_calibrate(dsi->mipi);
	err = tegra_mipi_calibrate(dsi->mipi);
	if (err < 0)
		return err;

	return tegra_mipi_wait(dsi->mipi);
}

static void tegra_dsi_set_timeout(struct tegra_dsi *dsi, unsigned long bclk,
@@ -1618,7 +1623,7 @@ static int tegra_dsi_probe(struct platform_device *pdev)
	if (IS_ERR(dsi->regs))
		return PTR_ERR(dsi->regs);

	dsi->mipi = tegra_mipi_request(&pdev->dev);
	dsi->mipi = tegra_mipi_request(&pdev->dev, pdev->dev.of_node);
	if (IS_ERR(dsi->mipi))
		return PTR_ERR(dsi->mipi);

+1 −0
Original line number Diff line number Diff line
@@ -177,6 +177,7 @@ static const u32 gr2d_addr_regs[] = {
	GR2D_DSTC_BASE_ADDR,
	GR2D_SRCA_BASE_ADDR,
	GR2D_SRCB_BASE_ADDR,
	GR2D_PATBASE_ADDR,
	GR2D_SRC_BASE_ADDR_SB,
	GR2D_DSTA_BASE_ADDR_SB,
	GR2D_DSTB_BASE_ADDR_SB,
+1 −0
Original line number Diff line number Diff line
@@ -14,6 +14,7 @@
#define GR2D_DSTC_BASE_ADDR		0x2d
#define GR2D_SRCA_BASE_ADDR		0x31
#define GR2D_SRCB_BASE_ADDR		0x32
#define GR2D_PATBASE_ADDR		0x47
#define GR2D_SRC_BASE_ADDR_SB		0x48
#define GR2D_DSTA_BASE_ADDR_SB		0x49
#define GR2D_DSTB_BASE_ADDR_SB		0x4a
Loading