[PATCH] drm: mxsfb: Add interconnect path request
Lucas Stach
l.stach at pengutronix.de
Tue Dec 1 06:20:18 EST 2020
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 at puri.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 at 60Hz@32bpp 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);
More information about the linux-arm-kernel
mailing list