Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c5dd52f6 authored by Dave Airlie's avatar Dave Airlie
Browse files

Merge branch 'drm/next/du' of git://linuxtv.org/pinchartl/media into drm-next

The series contains one patch that touches the V4L2 VSP driver. Mauro has
acked it for merge through your tree, it doesn't conflict with anything
scheduled for merge in v4.16 through Mauro's tree.

* 'drm/next/du' of git://linuxtv.org/pinchartl/media:
  drm: rcar-du: Clip planes to screen boundaries
  drm: rcar-du: Share plane atomic check code between Gen2 and Gen3
  v4l: vsp1: Start and stop DRM pipeline independently of planes
  drm: rcar-du: Remove unused CRTC suspend/resume functions
  drm: rcar-du: Implement system suspend/resume support
  drm: rcar-du: Don't set connector DPMS property
  drm: rcar-du: Add R8A7745 support
  drm: rcar-du: Add R8A7743 support
  dt-bindings: display: rcar-du: Document R8A774[35] DU
parents ca797d29 401712e0
Loading
Loading
Loading
Loading
+17 −13
Original line number Diff line number Diff line
@@ -3,6 +3,8 @@
Required Properties:

  - compatible: must be one of the following.
    - "renesas,du-r8a7743" for R8A7743 (RZ/G1M) compatible DU
    - "renesas,du-r8a7745" for R8A7745 (RZ/G1E) compatible DU
    - "renesas,du-r8a7779" for R8A7779 (R-Car H1) compatible DU
    - "renesas,du-r8a7790" for R8A7790 (R-Car H2) compatible DU
    - "renesas,du-r8a7791" for R8A7791 (R-Car M2-W) compatible DU
@@ -27,10 +29,10 @@ Required Properties:
  - clock-names: Name of the clocks. This property is model-dependent.
    - R8A7779 uses a single functional clock. The clock doesn't need to be
      named.
    - R8A779[0123456] use one functional clock per channel and one clock per
      LVDS encoder (if available). The functional clocks must be named "du.x"
      with "x" being the channel numerical index. The LVDS clocks must be
      named "lvds.x" with "x" being the LVDS encoder numerical index.
    - All other DU instances use one functional clock per channel and one
      clock per LVDS encoder (if available). The functional clocks must be
      named "du.x" with "x" being the channel numerical index. The LVDS clocks
      must be named "lvds.x" with "x" being the LVDS encoder numerical index.
    - In addition to the functional and encoder clocks, all DU versions also
      support externally supplied pixel clocks. Those clocks are optional.
      When supplied they must be named "dclkin.x" with "x" being the input
@@ -51,14 +53,16 @@ corresponding to each DU output.

                      Port0          Port1          Port2          Port3
-----------------------------------------------------------------------------
 R8A7779 (H1)	DPAD 0		DPAD 1		-		-
 R8A7790 (H2)	DPAD		LVDS 0		LVDS 1		-
 R8A7791 (M2-W)	DPAD		LVDS 0		-		-
 R8A7792 (V2H)	DPAD 0		DPAD 1		-		-
 R8A7793 (M2-N)	DPAD		LVDS 0		-		-
 R8A7794 (E2)	DPAD 0		DPAD 1		-		-
 R8A7795 (H3)	DPAD		HDMI 0		HDMI 1		LVDS
 R8A7796 (M3-W)	DPAD		HDMI		LVDS		-
 R8A7743 (RZ/G1M)     DPAD 0         LVDS 0         -              -
 R8A7745 (RZ/G1E)     DPAD 0         DPAD 1         -              -
 R8A7779 (R-Car H1)   DPAD 0         DPAD 1         -              -
 R8A7790 (R-Car H2)   DPAD 0         LVDS 0         LVDS 1         -
 R8A7791 (R-Car M2-W) DPAD 0         LVDS 0         -              -
 R8A7792 (R-Car V2H)  DPAD 0         DPAD 1         -              -
 R8A7793 (R-Car M2-N) DPAD 0         LVDS 0         -              -
 R8A7794 (R-Car E2)   DPAD 0         DPAD 1         -              -
 R8A7795 (R-Car H3)   DPAD 0         HDMI 0         HDMI 1         LVDS 0
 R8A7796 (R-Car M3-W) DPAD 0         HDMI 0         LVDS 0         -


Example: R8A7795 (R-Car H3) ES2.0 DU
+2 −36
Original line number Diff line number Diff line
@@ -319,7 +319,8 @@ static void rcar_du_crtc_update_planes(struct rcar_du_crtc *rcrtc)
		struct rcar_du_plane *plane = &rcrtc->group->planes[i];
		unsigned int j;

		if (plane->plane.state->crtc != &rcrtc->crtc)
		if (plane->plane.state->crtc != &rcrtc->crtc ||
		    !plane->plane.state->visible)
			continue;

		/* Insert the plane in the sorted planes array. */
@@ -557,41 +558,6 @@ static void rcar_du_crtc_stop(struct rcar_du_crtc *rcrtc)
	rcar_du_group_start_stop(rcrtc->group, false);
}

void rcar_du_crtc_suspend(struct rcar_du_crtc *rcrtc)
{
	if (rcar_du_has(rcrtc->group->dev, RCAR_DU_FEATURE_VSP1_SOURCE))
		rcar_du_vsp_disable(rcrtc);

	rcar_du_crtc_stop(rcrtc);
	rcar_du_crtc_put(rcrtc);
}

void rcar_du_crtc_resume(struct rcar_du_crtc *rcrtc)
{
	unsigned int i;

	if (!rcrtc->crtc.state->active)
		return;

	rcar_du_crtc_get(rcrtc);
	rcar_du_crtc_setup(rcrtc);

	/* Commit the planes state. */
	if (!rcar_du_has(rcrtc->group->dev, RCAR_DU_FEATURE_VSP1_SOURCE)) {
		for (i = 0; i < rcrtc->group->num_planes; ++i) {
			struct rcar_du_plane *plane = &rcrtc->group->planes[i];

			if (plane->plane.state->crtc != &rcrtc->crtc)
				continue;

			rcar_du_plane_setup(plane);
		}
	}

	rcar_du_crtc_update_planes(rcrtc);
	rcar_du_crtc_start(rcrtc);
}

/* -----------------------------------------------------------------------------
 * CRTC Functions
 */
+59 −3
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@
#include <linux/wait.h>

#include <drm/drmP.h>
#include <drm/drm_atomic_helper.h>
#include <drm/drm_crtc_helper.h>
#include <drm/drm_fb_cma_helper.h>
#include <drm/drm_gem_cma_helper.h>
@@ -34,6 +35,48 @@
 * Device Information
 */

static const struct rcar_du_device_info rzg1_du_r8a7743_info = {
	.gen = 2,
	.features = RCAR_DU_FEATURE_CRTC_IRQ_CLOCK
		  | RCAR_DU_FEATURE_EXT_CTRL_REGS,
	.num_crtcs = 2,
	.routes = {
		/*
		 * R8A7743 has one RGB output and one LVDS output
		 */
		[RCAR_DU_OUTPUT_DPAD0] = {
			.possible_crtcs = BIT(1) | BIT(0),
			.port = 0,
		},
		[RCAR_DU_OUTPUT_LVDS0] = {
			.possible_crtcs = BIT(0),
			.port = 1,
		},
	},
	.num_lvds = 1,
};

static const struct rcar_du_device_info rzg1_du_r8a7745_info = {
	.gen = 2,
	.features = RCAR_DU_FEATURE_CRTC_IRQ_CLOCK
		  | RCAR_DU_FEATURE_EXT_CTRL_REGS,
	.num_crtcs = 2,
	.routes = {
		/*
		 * R8A7745 has two RGB outputs
		 */
		[RCAR_DU_OUTPUT_DPAD0] = {
			.possible_crtcs = BIT(0),
			.port = 0,
		},
		[RCAR_DU_OUTPUT_DPAD1] = {
			.possible_crtcs = BIT(1),
			.port = 1,
		},
	},
	.num_lvds = 0,
};

static const struct rcar_du_device_info rcar_du_r8a7779_info = {
	.gen = 2,
	.features = 0,
@@ -207,6 +250,8 @@ static const struct rcar_du_device_info rcar_du_r8a7796_info = {
};

static const struct of_device_id rcar_du_of_table[] = {
	{ .compatible = "renesas,du-r8a7743", .data = &rzg1_du_r8a7743_info },
	{ .compatible = "renesas,du-r8a7745", .data = &rzg1_du_r8a7745_info },
	{ .compatible = "renesas,du-r8a7779", .data = &rcar_du_r8a7779_info },
	{ .compatible = "renesas,du-r8a7790", .data = &rcar_du_r8a7790_info },
	{ .compatible = "renesas,du-r8a7791", .data = &rcar_du_r8a7791_info },
@@ -265,9 +310,19 @@ static struct drm_driver rcar_du_driver = {
static int rcar_du_pm_suspend(struct device *dev)
{
	struct rcar_du_device *rcdu = dev_get_drvdata(dev);
	struct drm_atomic_state *state;

	drm_kms_helper_poll_disable(rcdu->ddev);
	/* TODO Suspend the CRTC */
	drm_fbdev_cma_set_suspend_unlocked(rcdu->fbdev, true);

	state = drm_atomic_helper_suspend(rcdu->ddev);
	if (IS_ERR(state)) {
		drm_fbdev_cma_set_suspend_unlocked(rcdu->fbdev, false);
		drm_kms_helper_poll_enable(rcdu->ddev);
		return PTR_ERR(state);
	}

	rcdu->suspend_state = state;

	return 0;
}
@@ -276,9 +331,10 @@ static int rcar_du_pm_resume(struct device *dev)
{
	struct rcar_du_device *rcdu = dev_get_drvdata(dev);

	/* TODO Resume the CRTC */

	drm_atomic_helper_resume(rcdu->ddev, rcdu->suspend_state);
	drm_fbdev_cma_set_suspend_unlocked(rcdu->fbdev, false);
	drm_kms_helper_poll_enable(rcdu->ddev);

	return 0;
}
#endif
+1 −0
Original line number Diff line number Diff line
@@ -81,6 +81,7 @@ struct rcar_du_device {

	struct drm_device *ddev;
	struct drm_fbdev_cma *fbdev;
	struct drm_atomic_state *suspend_state;

	struct rcar_du_crtc crtcs[RCAR_DU_MAX_CRTCS];
	unsigned int num_crtcs;
+0 −4
Original line number Diff line number Diff line
@@ -79,10 +79,6 @@ int rcar_du_lvds_connector_init(struct rcar_du_device *rcdu,

	drm_connector_helper_add(connector, &connector_helper_funcs);

	connector->dpms = DRM_MODE_DPMS_OFF;
	drm_object_property_set_value(&connector->base,
		rcdu->ddev->mode_config.dpms_property, DRM_MODE_DPMS_OFF);

	ret = drm_mode_connector_attach_encoder(connector, encoder);
	if (ret < 0)
		return ret;
Loading