All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Jacopo Mondi <jacopo+renesas@jmondi.org>
Cc: linux-renesas-soc@vger.kernel.org,
	VenkataRajesh.Kalakodima@in.bosch.com,
	Harsha.ManjulaMallikarjun@in.bosch.com,
	Jacopo Mondi <jacopo@jmondi.org>
Subject: Re: [RFC 6/9] drm: rcar-du: crtc: Setup the CMM
Date: Sat, 11 May 2019 21:59:51 +0300	[thread overview]
Message-ID: <20190511185951.GJ13043@pendragon.ideasonboard.com> (raw)
In-Reply-To: <20190508173428.22054-7-jacopo+renesas@jmondi.org>

Hi Jacopo,

Thank you for the patch.

On Wed, May 08, 2019 at 07:34:25PM +0200, Jacopo Mondi wrote:
> Save a reference to the CMM unit associated with the CRTC and set it up
> at rcar_du_crtc_setup() time, just after having enabled the compositor.
> 
> Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
> ---
>  drivers/gpu/drm/rcar-du/rcar_du_crtc.c | 38 ++++++++++++++++++++++++--
>  drivers/gpu/drm/rcar-du/rcar_du_crtc.h |  2 ++
>  2 files changed, 38 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
> index 2da46e3dc4ae..b5a9af8e4df0 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c
> @@ -9,6 +9,7 @@
>  
>  #include <linux/clk.h>
>  #include <linux/mutex.h>
> +#include <linux/of_platform.h>
>  #include <linux/platform_device.h>
>  #include <linux/sys_soc.h>
>  
> @@ -21,6 +22,7 @@
>  #include <drm/drm_plane_helper.h>
>  #include <drm/drm_vblank.h>
>  
> +#include "rcar_du_cmm.h"
>  #include "rcar_du_crtc.h"
>  #include "rcar_du_drv.h"
>  #include "rcar_du_encoder.h"
> @@ -478,7 +480,7 @@ static void rcar_du_crtc_wait_page_flip(struct rcar_du_crtc *rcrtc)
>   * Start/Stop and Suspend/Resume
>   */
>  
> -static void rcar_du_crtc_setup(struct rcar_du_crtc *rcrtc)
> +static int rcar_du_crtc_setup(struct rcar_du_crtc *rcrtc)
>  {
>  	/* Set display off and background to black */
>  	rcar_du_crtc_write(rcrtc, DOOR, DOOR_RGB(0, 0, 0));
> @@ -495,8 +497,24 @@ static void rcar_du_crtc_setup(struct rcar_du_crtc *rcrtc)
>  	if (rcar_du_has(rcrtc->dev, RCAR_DU_FEATURE_VSP1_SOURCE))
>  		rcar_du_vsp_enable(rcrtc);
>  
> +	/* Enable CMM, if present. */
> +	if (rcrtc->cmm) {
> +		struct platform_device *pdev;
> +		int ret;
> +
> +		pdev = of_find_device_by_node(rcrtc->cmm->np);
> +		if (!pdev)
> +			return PTR_ERR(pdev);

This should go to init time, in order to defer probing of the DU if CMM
isn't probed yet.

> +
> +		ret = rcar_du_cmm_setup(pdev, rcrtc);
> +		if (ret)
> +			return ret;
> +	}
> +
>  	/* Turn vertical blanking interrupt reporting on. */
>  	drm_crtc_vblank_on(&rcrtc->crtc);
> +
> +	return 0;
>  }
>  
>  static int rcar_du_crtc_get(struct rcar_du_crtc *rcrtc)
> @@ -522,7 +540,10 @@ static int rcar_du_crtc_get(struct rcar_du_crtc *rcrtc)
>  	if (ret < 0)
>  		goto error_group;
>  
> -	rcar_du_crtc_setup(rcrtc);
> +	ret = rcar_du_crtc_setup(rcrtc);
> +	if (ret < 0)
> +		goto error_group;
> +
>  	rcrtc->initialized = true;
>  
>  	return 0;
> @@ -1182,6 +1203,19 @@ int rcar_du_crtc_create(struct rcar_du_group *rgrp, unsigned int swindex,
>  	rcrtc->index = hwindex;
>  	rcrtc->dsysr = (rcrtc->index % 2 ? 0 : DSYSR_DRES) | DSYSR_TVM_TVSYNC;
>  
> +	if (rcar_du_has(rcdu, RCAR_DU_FEATURE_CMM)) {
> +		unsigned int i;
> +
> +		for (i = 0; i < RCAR_DU_MAX_CMMS; ++i) {
> +			struct rcar_du_cmm *cmm = &rcdu->cmms[i];
> +
> +			if (cmm->crtc != hwindex)
> +				continue;
> +
> +			rcrtc->cmm = cmm;

Let's just store the CMM instances in the same order as the CRTCs, and
this can becomre rcrtc->cmm = &rcdu->cmms[swindex]; (and should be moved
to the previous patch I think).

> +		}
> +	}
> +
>  	if (rcar_du_has(rcdu, RCAR_DU_FEATURE_VSP1_SOURCE))
>  		primary = &rcrtc->vsp->planes[rcrtc->vsp_pipe].plane;
>  	else
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.h b/drivers/gpu/drm/rcar-du/rcar_du_crtc.h
> index 3b7fc668996f..8b31406bd11b 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.h
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.h
> @@ -19,6 +19,7 @@
>  
>  #include <media/vsp1.h>
>  
> +struct rcar_du_cmm;
>  struct rcar_du_group;
>  struct rcar_du_vsp;
>  
> @@ -64,6 +65,7 @@ struct rcar_du_crtc {
>  	unsigned int vblank_count;
>  
>  	struct rcar_du_group *group;
> +	struct rcar_du_cmm *cmm;
>  	struct rcar_du_vsp *vsp;
>  	unsigned int vsp_pipe;
>  

-- 
Regards,

Laurent Pinchart

  reply	other threads:[~2019-05-11 19:00 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-08 17:34 [RFC 0/9] drm: rcar-du: Add CMM support to M3-W (plumbing only) Jacopo Mondi
2019-05-08 17:34 ` [RFC 1/9] dt-bindings: display: renesas,cmm: Add R-Car CMM documentation Jacopo Mondi
2019-05-11 18:16   ` Laurent Pinchart
2019-05-28 12:37     ` Jacopo Mondi
2019-05-28 14:25       ` Laurent Pinchart
2019-05-28 14:50         ` Geert Uytterhoeven
2019-05-08 17:34 ` [RFC 2/9] dt-bindings: display, renesas,du: Document cmms property Jacopo Mondi
2019-05-11 18:23   ` Laurent Pinchart
2019-05-15 14:12     ` Jacopo Mondi
2019-05-16 10:40       ` Laurent Pinchart
2019-05-08 17:34 ` [RFC 3/9] [TODO] drm: rcar-du: Add basic support for CMM Jacopo Mondi
2019-05-11 18:45   ` Laurent Pinchart
2019-05-08 17:34 ` [RFC 4/9] drm: rcar-du: kms: Create CMM instances Jacopo Mondi
2019-05-11 18:56   ` Laurent Pinchart
2019-05-08 17:34 ` [RFC 5/9] drm: rcar-du: Add CMM support for M3-W Jacopo Mondi
2019-05-11 18:47   ` Laurent Pinchart
2019-05-08 17:34 ` [RFC 6/9] drm: rcar-du: crtc: Setup the CMM Jacopo Mondi
2019-05-11 18:59   ` Laurent Pinchart [this message]
2019-05-08 17:34 ` [RFC 7/9] drm: rcar-du: group: Enable CMM unit Jacopo Mondi
2019-05-11 19:02   ` Laurent Pinchart
2019-05-08 17:34 ` [RFC 8/9] clk: renesas: r8a7796: Add CMM clocks Jacopo Mondi
2019-05-09  9:12   ` Geert Uytterhoeven
2019-05-11 18:21   ` Laurent Pinchart
2019-05-21  8:47     ` Geert Uytterhoeven
2019-05-08 17:34 ` [RFC 9/9] arm64: dts: renesas: r8a7796: Add CMM units Jacopo Mondi
2019-05-11 18:25   ` Laurent Pinchart

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190511185951.GJ13043@pendragon.ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=Harsha.ManjulaMallikarjun@in.bosch.com \
    --cc=VenkataRajesh.Kalakodima@in.bosch.com \
    --cc=jacopo+renesas@jmondi.org \
    --cc=jacopo@jmondi.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.