From patchwork Tue Dec 1 10:37:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kepplinger X-Patchwork-Id: 11942561 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=-15.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable 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 16062C64E7B for ; Tue, 1 Dec 2020 10:39:21 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 94DC520644 for ; Tue, 1 Dec 2020 10:39:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Pbw0jGBe" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 94DC520644 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=puri.sm Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:MIME-Version:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Owner; bh=dZlPqPxhMxY6XELrNHcqEnOF9ZfjX/RGoSvi5NDuYnQ=; b=Pbw0jGBecauTQQzsDVIao6aMmD QVN0mBrGxU57VAdvaBcWMpDhEo1bCBiO3ho4wlkt8ts5D5+Opouo52tla4CdHFMKbvdQPnc2+swlc wgwDdgtj5vojqSLXZNUYoPpQ7kcd68yekSA6viiB5Exyv+uTYf9O2iu001+ImkjwsSRm6Rirn1cAA ImEFJmIt+NinfGU3DmsfZKZ041VmlYSyxWQqwsv053Rp/75dgDxCFLfxxprTX8hLn1yc83xJGIxGS X4Tn0U+YmLLctyk6E3E0VqYizzC8BqNuPaTEn5LewuwJxiennJNFiiq3t8nRtd9Ki1b3yQZnQ9pJU 6DCrwAKw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kk330-0000m6-1Q; Tue, 01 Dec 2020 10:38:14 +0000 Received: from comms.puri.sm ([159.203.221.185]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kk32x-0000lV-P8 for linux-arm-kernel@lists.infradead.org; Tue, 01 Dec 2020 10:38:12 +0000 Received: from localhost (localhost [127.0.0.1]) by comms.puri.sm (Postfix) with ESMTP id DE821E0141; Tue, 1 Dec 2020 02:38:10 -0800 (PST) Received: from comms.puri.sm ([127.0.0.1]) by localhost (comms.puri.sm [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 1Eg-ax_6CXk5; Tue, 1 Dec 2020 02:38:09 -0800 (PST) From: Martin Kepplinger To: marex@denx.de, stefan@agner.ch, airlied@linux.ie, daniel@ffwll.ch, shawnguo@kernel.org Subject: [PATCH] drm: mxsfb: Add interconnect path request Date: Tue, 1 Dec 2020 11:37:57 +0100 Message-Id: <20201201103757.32165-1-martin.kepplinger@puri.sm> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201201_053811_981289_AD11AB5A X-CRM114-Status: GOOD ( 15.88 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Martin Kepplinger , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-imx@nxp.com, kernel@pengutronix.de, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add interconnect support to mxsfb so that it is able to request enough bandwidth to DDR for display output to work. Signed-off-by: Martin Kepplinger --- drivers/gpu/drm/mxsfb/mxsfb_drv.c | 33 +++++++++++++++++++++++++++++++ drivers/gpu/drm/mxsfb/mxsfb_drv.h | 2 ++ drivers/gpu/drm/mxsfb/mxsfb_kms.c | 13 ++++++++++++ 3 files changed, 48 insertions(+) diff --git a/drivers/gpu/drm/mxsfb/mxsfb_drv.c b/drivers/gpu/drm/mxsfb/mxsfb_drv.c index 6faf17b6408d..b05e8e5f1e38 100644 --- a/drivers/gpu/drm/mxsfb/mxsfb_drv.c +++ b/drivers/gpu/drm/mxsfb/mxsfb_drv.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include @@ -311,6 +312,34 @@ static const struct of_device_id mxsfb_dt_ids[] = { }; MODULE_DEVICE_TABLE(of, mxsfb_dt_ids); + +static int mxsfb_init_icc(struct platform_device *pdev) +{ + struct drm_device *drm = platform_get_drvdata(pdev); + struct mxsfb_drm_private *mxsfb = drm->dev_private; + int ret; + + /* Optional interconnect request */ + mxsfb->icc_path = devm_of_icc_get(&pdev->dev, "lcdif-dram"); + if (IS_ERR(mxsfb->icc_path)) { + ret = PTR_ERR(mxsfb->icc_path); + if (ret == -EPROBE_DEFER) + return ret; + + mxsfb->icc_path = NULL; + dev_dbg(drm->dev, + "No interconnect may cause display underflows!\n"); + } + + ret = icc_set_bw(mxsfb->icc_path, 0, MBps_to_icc(700)); + if (ret) { + dev_err(drm->dev, "%s: icc_set_bw failed: %d\n", __func__, ret); + return ret; + } + + return 0; +} + static int mxsfb_probe(struct platform_device *pdev) { struct drm_device *drm; @@ -329,6 +358,10 @@ static int mxsfb_probe(struct platform_device *pdev) if (ret) goto err_free; + ret = mxsfb_init_icc(pdev); + if (ret) + goto err_free; + ret = drm_dev_register(drm, 0); if (ret) goto err_unload; diff --git a/drivers/gpu/drm/mxsfb/mxsfb_drv.h b/drivers/gpu/drm/mxsfb/mxsfb_drv.h index 399d23e91ed1..d74ff4818e62 100644 --- a/drivers/gpu/drm/mxsfb/mxsfb_drv.h +++ b/drivers/gpu/drm/mxsfb/mxsfb_drv.h @@ -41,6 +41,8 @@ struct mxsfb_drm_private { struct drm_encoder encoder; struct drm_connector *connector; struct drm_bridge *bridge; + + struct icc_path *icc_path; }; static inline struct mxsfb_drm_private * diff --git a/drivers/gpu/drm/mxsfb/mxsfb_kms.c b/drivers/gpu/drm/mxsfb/mxsfb_kms.c index 3e1bb0aefb87..8925ee7deeaa 100644 --- a/drivers/gpu/drm/mxsfb/mxsfb_kms.c +++ b/drivers/gpu/drm/mxsfb/mxsfb_kms.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include @@ -310,6 +311,12 @@ static void mxsfb_crtc_atomic_enable(struct drm_crtc *crtc, struct mxsfb_drm_private *mxsfb = to_mxsfb_drm_private(crtc->dev); struct drm_device *drm = mxsfb->drm; dma_addr_t paddr; + int ret; + + ret = icc_enable(mxsfb->icc_path); + if (ret) + dev_err_ratelimited(drm->dev, "%s: icc_enable failed: %d\n", + __func__, ret); pm_runtime_get_sync(drm->dev); mxsfb_enable_axi_clk(mxsfb); @@ -334,6 +341,7 @@ static void mxsfb_crtc_atomic_disable(struct drm_crtc *crtc, struct mxsfb_drm_private *mxsfb = to_mxsfb_drm_private(crtc->dev); struct drm_device *drm = mxsfb->drm; struct drm_pending_vblank_event *event; + int ret; mxsfb_disable_controller(mxsfb); @@ -349,6 +357,11 @@ static void mxsfb_crtc_atomic_disable(struct drm_crtc *crtc, mxsfb_disable_axi_clk(mxsfb); pm_runtime_put_sync(drm->dev); + + ret = icc_disable(mxsfb->icc_path); + if (ret) + dev_err_ratelimited(drm->dev, "%s: icc_disable failed: %d\n", + __func__, ret); } static int mxsfb_crtc_enable_vblank(struct drm_crtc *crtc)