Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1653433pxk; Tue, 1 Sep 2020 04:31:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxrTFHE1uVyZF6AMtprQBNd7P5BgZ13YVo5AvOEITbdUgS+97vk5F1jUw8YUrgzbk5EI1YN X-Received: by 2002:a17:906:e0c2:: with SMTP id gl2mr1041574ejb.160.1598959874612; Tue, 01 Sep 2020 04:31:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598959874; cv=none; d=google.com; s=arc-20160816; b=eiYklWz+2jNGxxLeycwOr8dhq4xJLvHgH8Ytwhd2aZHu1bY4BQKOGfl+9NXC8tvbcR Xknz09s4ZFeZOXsciZlycM8uHlesgJ93x3ffvceAYmkuFKfAhqHvURJxoowHWa1WCKhd ZttGYfRxThvXyniM+xO4TUxSB9MYmFESICD3czB+IDEI5e/odyzNrOkClqSi6zww/tii UPi9xEVvZ4TbHxGL6F8sm/8K82P99t+D1H3dS6ijWLq3PClBCtrFBf2vVA0FqkRDmTcJ WpJMk+DwZiCJ3Cw/FZux1fGMXElYS2BcPVW5nVtZcArihB5Hq4q1vSC6ilhAcdrgyoI5 HAig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:dlp-filter:cms-type :content-transfer-encoding:content-language:in-reply-to:mime-version :user-agent:date:message-id:organization:from:cc:to:subject :dkim-signature:dkim-filter; bh=ln393y8fuOqkR5rfKtX5PMD/RrB2vBw4AuzvUPUfPcw=; b=M/AQ+7JRVUEmHOf++rMqIBuqoafObaqgDbbRPNBDYuWd0mQf444tUJqJ2lIpWsJdzX kkwAbgFecT1+w7Eu3NpmHsUaYLHTDU0BnRbJG0UEUJr1uFw7yBZWAlPgNwta5e2Ftqgc ykPz7zfBPyZ6tbTtcBQ45s+THA+Bm7zsquOD43AuAh28tgmvg6mTidmoNJ+qnr9eiTG2 iSjIUjIBN9YrBt2Pn++0ePx0g96+8brpsE3NWoFq5LoJ+Am76OXWPsD2mDLHd9FNwD3r 3XfP7mvdoQQv4jX9wrcreSsw4dA/a5Km5fbUpADpTSprugyT9mnfcCiChxyF2/R8QVhe MYbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=UbJk5lGb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h4si395453edv.181.2020.09.01.04.30.48; Tue, 01 Sep 2020 04:31:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=UbJk5lGb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726122AbgIAL1d (ORCPT + 99 others); Tue, 1 Sep 2020 07:27:33 -0400 Received: from mailout1.samsung.com ([203.254.224.24]:20518 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726124AbgIALZy (ORCPT ); Tue, 1 Sep 2020 07:25:54 -0400 Received: from epcas1p2.samsung.com (unknown [182.195.41.46]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20200901110912epoutp01dadee983fe72e97a7fe6c8827bf859f8~wpFUMEfW62030420304epoutp01T for ; Tue, 1 Sep 2020 11:09:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20200901110912epoutp01dadee983fe72e97a7fe6c8827bf859f8~wpFUMEfW62030420304epoutp01T DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1598958552; bh=ln393y8fuOqkR5rfKtX5PMD/RrB2vBw4AuzvUPUfPcw=; h=Subject:To:Cc:From:Date:In-Reply-To:References:From; b=UbJk5lGbgXnobVuEuqCVH1sP0xmvLdUjQlldEO2v7b1BvsTPLZTzF4r18EtVyJlhx GfVo5NvTRGrPZ8fSgqXCvSwmtKPlUaAnZzHIv3MWb6E9tJ2q5ZS2WE5KeZqJsf1nGb j9z05fwSr4pc85SC/Zg20sBWv8VBOn3hI11EQstU= Received: from epsnrtp3.localdomain (unknown [182.195.42.164]) by epcas1p2.samsung.com (KnoxPortal) with ESMTP id 20200901110912epcas1p2481b6b4988a9ced45b659c1c17f105ba~wpFT6Bp191035710357epcas1p2A; Tue, 1 Sep 2020 11:09:12 +0000 (GMT) Received: from epsmges1p2.samsung.com (unknown [182.195.40.153]) by epsnrtp3.localdomain (Postfix) with ESMTP id 4Bgkps2C8pzMqYkj; Tue, 1 Sep 2020 11:09:09 +0000 (GMT) Received: from epcas1p2.samsung.com ( [182.195.41.46]) by epsmges1p2.samsung.com (Symantec Messaging Gateway) with SMTP id 80.52.19033.5DB2E4F5; Tue, 1 Sep 2020 20:09:09 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas1p1.samsung.com (KnoxPortal) with ESMTPA id 20200901110908epcas1p1187737a9b58b1dd8b868c1a3f520bd0f~wpFQKiytE1134811348epcas1p1k; Tue, 1 Sep 2020 11:09:08 +0000 (GMT) Received: from epsmgms1p1new.samsung.com (unknown [182.195.42.41]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20200901110908epsmtrp1fe02625d823aed052a4c5ddcc2f8c6db~wpFQJt9g82800628006epsmtrp1P; Tue, 1 Sep 2020 11:09:08 +0000 (GMT) X-AuditID: b6c32a36-16fff70000004a59-35-5f4e2bd5e0f3 Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p1new.samsung.com (Symantec Messaging Gateway) with SMTP id A2.A2.08382.4DB2E4F5; Tue, 1 Sep 2020 20:09:08 +0900 (KST) Received: from [10.113.221.102] (unknown [10.113.221.102]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20200901110908epsmtip1b27fd75b2e63060dc5505a48f1cd9f57~wpFP8ZKCm0094600946epsmtip1M; Tue, 1 Sep 2020 11:09:08 +0000 (GMT) Subject: Re: [PATCH v4 03/78] drm/vc4: hvs: Boost the core clock during modeset To: Maxime Ripard , Nicolas Saenz Julienne , Eric Anholt Cc: dri-devel@lists.freedesktop.org, linux-rpi-kernel@lists.infradead.org, bcm-kernel-feedback-list@broadcom.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Dave Stevenson , Tim Gover , Phil Elwell From: Chanwoo Choi Organization: Samsung Electronics Message-ID: Date: Tue, 1 Sep 2020 20:21:36 +0900 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:59.0) Gecko/20100101 Thunderbird/59.0 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Content-Transfer-Encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrOJsWRmVeSWpSXmKPExsWy7bCmnu5Vbb94g3nL+SzW9h5lsXg7dzGL xZWv79ksDjReZrTY9Pgaq8XlXXPYLCbe3sBuMePHP0aLbbOWs1msu/WazeLR1PuMDtweTe+P sXnMun+WzePOufNsHve7jzN5bF5S79F69BeLx+bT1R6fN8kFcERl22SkJqakFimk5iXnp2Tm pdsqeQfHO8ebmhkY6hpaWpgrKeQl5qbaKrn4BOi6ZeYA3amkUJaYUwoUCkgsLlbSt7Mpyi8t SVXIyC8usVVKLUjJKbAs0CtOzC0uzUvXS87PtTI0MDAyBSpMyM5492gCY8E3hYodm26yNTDe lexi5OSQEDCRaLn1nLGLkYtDSGAHo8S/04/ZIJxPjBJv1l5jgXC+MUqs+9jOCNNybtNzdhBb S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NsHve7jzN5bF5S79F69BeLx+bT1R6fN8kFcERx2aSk5mSWpRbp2yVwZbx7 NIGx4JtCxY5NN9kaGO9KdjFyckgImEic2/ScvYuRi0NIYDejxJLW2cwQCUmJaRePAtkcQLaw xOHDxRA1bxkljsw/BxYXFgiUmLBbCaRcRKBS4vOcXcwgNcwCO5gkuh6fZoFo6GWS2PNnOztI FZuAlsT+FzfYQGx+AUWJqz8eM4LYvAJ2EgdWXWAFsVkEVCTans1kArFFBcIkdi55zARRIyhx cuYTFpDFnALxEl92mIKEmQXUJf7Mu8QMYYtL3HoynwnClpfY/nYO8wRG4VlIumchaZmFpGUW kpYFjCyrGCVTC4pz03OLDQsM81LL9YoTc4tL89L1kvNzNzGC41FLcwfj9lUf9A4xMnEwHmKU 4GBWEuGdecM3Xog3JbGyKrUoP76oNCe1+BCjNAeLkjjvjcKFcUIC6YklqdmpqQWpRTBZJg5O qQam0Ne6Nx77Zj6N9rumcXjnkfl5zQ7y26yTQmq/F5kkzT7x1VIgaPu3XLa6Fuk57cKLGjtz /1y0nWnh3b17nvaPV4wpgteSEqP5eauPL+K4t02kZRqLu1VhSYPDpM2qEn/U8ybevhB9qfD+ X075E5O/6bcx67Ff6N0z7/+ZSQnWMqIzuVWma++/+Lom+njakXzX600xKqELl70U4/tXMz1/ xpOfXxjStq274VqhdeVIymLdgMvFnjbOpyUf9PAu0XC7eLHhrrdEcLBsRtohVvNgu3cFCv/3 b/xwKbYkulZY9J7Iqt8dzUt8ZPxOpaWZy+Sn3qubphvmv1TqtrzVC9d9IrUzl0fOvWXDvtWw eKkSS3FGoqEWc1FxIgDiyowgNgMAAA== X-CMS-MailID: 20200901110908epcas1p1187737a9b58b1dd8b868c1a3f520bd0f X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-Sendblock-Type: SVC_REQ_APPROVE CMS-TYPE: 101P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20200708174243epcas1p2b5646e3d45e412d1cd1286d90cb9cc37 References: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Maxime, On 7/9/20 2:41 AM, Maxime Ripard wrote: > In order to prevent timeouts and stalls in the pipeline, the core clock > needs to be maxed at 500MHz during a modeset on the BCM2711. > > Reviewed-by: Eric Anholt > Signed-off-by: Maxime Ripard > --- > drivers/gpu/drm/vc4/vc4_drv.h | 2 ++ > drivers/gpu/drm/vc4/vc4_hvs.c | 9 +++++++++ > drivers/gpu/drm/vc4/vc4_kms.c | 9 +++++++++ > 3 files changed, 20 insertions(+) > > diff --git a/drivers/gpu/drm/vc4/vc4_drv.h b/drivers/gpu/drm/vc4/vc4_drv.h > index e4cde1f9224b..6358f6ca8d56 100644 > --- a/drivers/gpu/drm/vc4/vc4_drv.h > +++ b/drivers/gpu/drm/vc4/vc4_drv.h > @@ -320,6 +320,8 @@ struct vc4_hvs { > void __iomem *regs; > u32 __iomem *dlist; > > + struct clk *core_clk; > + > /* Memory manager for CRTCs to allocate space in the display > * list. Units are dwords. > */ > diff --git a/drivers/gpu/drm/vc4/vc4_hvs.c b/drivers/gpu/drm/vc4/vc4_hvs.c > index 836d8799d79e..091fdf4908aa 100644 > --- a/drivers/gpu/drm/vc4/vc4_hvs.c > +++ b/drivers/gpu/drm/vc4/vc4_hvs.c > @@ -19,6 +19,7 @@ > * each CRTC. > */ > > +#include > #include > #include > > @@ -540,6 +541,14 @@ static int vc4_hvs_bind(struct device *dev, struct device *master, void *data) > hvs->regset.regs = hvs_regs; > hvs->regset.nregs = ARRAY_SIZE(hvs_regs); > > + if (hvs->hvs5) { > + hvs->core_clk = devm_clk_get(&pdev->dev, NULL); > + if (IS_ERR(hvs->core_clk)) { > + dev_err(&pdev->dev, "Couldn't get core clock\n"); > + return PTR_ERR(hvs->core_clk); > + } > + } > + > if (!hvs->hvs5) > hvs->dlist = hvs->regs + SCALER_DLIST_START; > else > diff --git a/drivers/gpu/drm/vc4/vc4_kms.c b/drivers/gpu/drm/vc4/vc4_kms.c > index 08318e69061b..210cc2408087 100644 > --- a/drivers/gpu/drm/vc4/vc4_kms.c > +++ b/drivers/gpu/drm/vc4/vc4_kms.c > @@ -11,6 +11,8 @@ > * crtc, HDMI encoder). > */ > > +#include > + > #include > #include > #include > @@ -149,6 +151,7 @@ vc4_atomic_complete_commit(struct drm_atomic_state *state) > { > struct drm_device *dev = state->dev; > struct vc4_dev *vc4 = to_vc4_dev(dev); > + struct vc4_hvs *hvs = vc4->hvs; > struct vc4_crtc *vc4_crtc; > int i; > > @@ -160,6 +163,9 @@ vc4_atomic_complete_commit(struct drm_atomic_state *state) > vc4_hvs_mask_underrun(dev, vc4_crtc->channel); > } > > + if (vc4->hvs->hvs5) > + clk_set_min_rate(hvs->core_clk, 500000000); > + > drm_atomic_helper_wait_for_fences(dev, state, false); > > drm_atomic_helper_wait_for_dependencies(state); > @@ -182,6 +188,9 @@ vc4_atomic_complete_commit(struct drm_atomic_state *state) > > drm_atomic_helper_commit_cleanup_done(state); > > + if (vc4->hvs->hvs5) > + clk_set_min_rate(hvs->core_clk, 0); > + > drm_atomic_state_put(state); > > up(&vc4->async_modeset); > This patch doesn't control the enable/disable of core_clk. So, I think that it need to handle the clock as following: diff --git a/drivers/gpu/drm/vc4/vc4_hvs.c b/drivers/gpu/drm/vc4/vc4_hvs.c index 4ef88c0b51ab..355d67fd8beb 100644 --- a/drivers/gpu/drm/vc4/vc4_hvs.c +++ b/drivers/gpu/drm/vc4/vc4_hvs.c @@ -588,6 +588,12 @@ static int vc4_hvs_bind(struct device *dev, struct device *master, void *data) dev_err(&pdev->dev, "Couldn't get core clock\n"); return PTR_ERR(hvs->core_clk); } + + ret = clk_prepare_enable(hvs->core_clk); + if (ret) { + dev_err(&pdev->dev, "Couldn't enable core clock\n"); + return ret; + } } if (!hvs->hvs5) @@ -681,6 +687,8 @@ static void vc4_hvs_unbind(struct device *dev, struct device *master, drm_mm_takedown(&vc4->hvs->dlist_mm); drm_mm_takedown(&vc4->hvs->lbm_mm); + clk_prepare_enable(vc4->hvs->core_clk); + vc4->hvs = NULL; } -- Best Regards, Chanwoo Choi Samsung Electronics