[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <0a7f2c0e8618f89c1e2eede661cf5a59d68cecad.camel@pengutronix.de>
Date: Tue, 01 Dec 2020 12:20:18 +0100
From: Lucas Stach <l.stach@...gutronix.de>
To: Martin Kepplinger <martin.kepplinger@...i.sm>, marex@...x.de,
stefan@...er.ch, airlied@...ux.ie, daniel@...ll.ch,
shawnguo@...nel.org
Cc: linux-kernel@...r.kernel.org, dri-devel@...ts.freedesktop.org,
linux-imx@....com, kernel@...gutronix.de,
linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH] drm: mxsfb: Add interconnect path request
Am Dienstag, den 01.12.2020, 11:37 +0100 schrieb Martin Kepplinger:
> 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 <martin.kepplinger@...i.sm>
> ---
> 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 <linux/of_device.h>
> #include <linux/platform_device.h>
> #include <linux/pm_runtime.h>
> +#include <linux/interconnect.h>
>
>
>
>
> #include <drm/drm_atomic_helper.h>
> #include <drm/drm_bridge.h>
> @@ -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));
Shouldn't this be proportional to the current mode, instead of a fixed
value? 700MB looks like 1080p@...z@...pp with a bit of headroom, but
there are many valid use-cases where significantly smaller displays are
connected to the eLCDIF. Also it doesn't cover the case where an
overlay is active, which needs additional bandwidth.
> + if (ret) {
> + dev_err(drm->dev, "%s: icc_set_bw failed: %d\n", __func__, ret);
> + return ret;
> + }
> +
> + return 0;
> +}
> +
[...]
> #include <drm/drm_atomic.h>
> #include <drm/drm_atomic_helper.h>
> @@ -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);
Why ratelimited? I wouldn't expect atomic enable/disable to be called
often enough for this to make any difference.
Regards,
Lucas
>
> pm_runtime_get_sync(drm->dev);
> mxsfb_enable_axi_clk(mxsfb);
Powered by blists - more mailing lists