From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.5 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_PASS,USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1FC2FC04AB1 for ; Sat, 11 May 2019 19:00:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DC02920881 for ; Sat, 11 May 2019 19:00:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="jFsT5kU+" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726038AbfEKTAJ (ORCPT ); Sat, 11 May 2019 15:00:09 -0400 Received: from perceval.ideasonboard.com ([213.167.242.64]:57264 "EHLO perceval.ideasonboard.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725911AbfEKTAJ (ORCPT ); Sat, 11 May 2019 15:00:09 -0400 Received: from pendragon.ideasonboard.com (dfj612yhrgyx302h3jwwy-3.rev.dnainternet.fi [IPv6:2001:14ba:21f5:5b00:ce28:277f:58d7:3ca4]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 76DF1D5; Sat, 11 May 2019 21:00:07 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1557601207; bh=cCQVDFTpU0B0Pl+h0O58Yw/KKmsNxAZbYUq6W7gAn3M=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=jFsT5kU+NAXy8WlAQiVn6cNIoufyKVJlN5/RyeDcfapN/Mn1eRs9coZim1/rhZNQR PrjglNeQx4K1alusK6gIiQ9zKaXwZxPt08Qq4V/dxERKnJkQTUQQMMQlALzcKrOVOB SqcmkwIJRFjqkgjXMXYWU9hETbF6vmVvEC1CyAQk= Date: Sat, 11 May 2019 21:59:51 +0300 From: Laurent Pinchart To: Jacopo Mondi Cc: linux-renesas-soc@vger.kernel.org, VenkataRajesh.Kalakodima@in.bosch.com, Harsha.ManjulaMallikarjun@in.bosch.com, Jacopo Mondi Subject: Re: [RFC 6/9] drm: rcar-du: crtc: Setup the CMM Message-ID: <20190511185951.GJ13043@pendragon.ideasonboard.com> References: <20190508173428.22054-1-jacopo+renesas@jmondi.org> <20190508173428.22054-7-jacopo+renesas@jmondi.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20190508173428.22054-7-jacopo+renesas@jmondi.org> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.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 > --- > 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 > #include > +#include > #include > #include > > @@ -21,6 +22,7 @@ > #include > #include > > +#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 > > +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