[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAAOTY__QCoV62OZO__6Dg+r0sbJK3AgV7FzFPFYoz_DvXMj7uQ@mail.gmail.com>
Date: Sun, 2 Aug 2020 11:02:33 +0800
From: Chun-Kuang Hu <chunkuang.hu@...nel.org>
To: Frank Wunderlich <frank-w@...lic-files.de>
Cc: "moderated list:ARM/Mediatek SoC support"
<linux-mediatek@...ts.infradead.org>,
Chun-Kuang Hu <chunkuang.hu@...nel.org>,
Philipp Zabel <p.zabel@...gutronix.de>,
David Airlie <airlied@...ux.ie>,
Daniel Vetter <daniel@...ll.ch>,
Matthias Brugger <matthias.bgg@...il.com>,
DRI Development <dri-devel@...ts.freedesktop.org>,
Linux ARM <linux-arm-kernel@...ts.infradead.org>,
linux-kernel <linux-kernel@...r.kernel.org>,
Stu Hsieh <stu.hsieh@...iatek.com>
Subject: Re: [PATCH v2 3/5] drm: Add get_possible_crtc API for dpi, dsi
Hi, Frank:
Frank Wunderlich <frank-w@...lic-files.de> 於 2020年7月28日 週二 下午7:18寫道:
>
Describe why need this patch. I think the reason is:
For current mediatek dsi encoder, its possible crtc is fixed in crtc
0, and mediatek dpi encoder's possible crtc is fixed in crtc 1. In
some SoC the possible crtc is not fixed in this case, so search
pipeline information to find out the correct possible crtc.
> From: Stu Hsieh <stu.hsieh@...iatek.com>
>
> Test: build pass and run ok
>
> Signed-off-by: Stu Hsieh <stu.hsieh@...iatek.com>
Need your signed-off-by tag.
> ---
> drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c | 42 +++++++++++++++++++++
> drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h | 2 +
> 2 files changed, 44 insertions(+)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
> index 57c88de9a329..a5f2ff6bea93 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
> @@ -13,6 +13,8 @@
> #include <linux/of_platform.h>
> #include <linux/platform_device.h>
> #include <linux/soc/mediatek/mtk-cmdq.h>
> +#include <drm/drm_print.h>
> +
> #include "mtk_drm_drv.h"
> #include "mtk_drm_plane.h"
> #include "mtk_drm_ddp_comp.h"
> @@ -412,6 +414,22 @@ static const struct mtk_ddp_comp_match mtk_ddp_matches[DDP_COMPONENT_ID_MAX] = {
> [DDP_COMPONENT_WDMA1] = { MTK_DISP_WDMA, 1, NULL },
> };
>
> +static bool mtk_drm_find_comp_in_ddp(struct mtk_ddp_comp ddp_comp,
> + const enum mtk_ddp_comp_id *path,
> + unsigned int path_len)
> +{
> + unsigned int i;
> +
> + if (path == NULL)
> + return false;
This checking is redundant, so remove it.
> +
> + for (i = 0U; i < path_len; i++)
> + if (ddp_comp.id == path[i])
> + return true;
> +
> + return false;
> +}
> +
> int mtk_ddp_comp_get_id(struct device_node *node,
> enum mtk_ddp_comp_type comp_type)
> {
> @@ -427,6 +445,30 @@ int mtk_ddp_comp_get_id(struct device_node *node,
> return -EINVAL;
> }
>
> +unsigned int mtk_drm_find_possible_crtc_by_comp(struct drm_device *drm,
> + struct mtk_ddp_comp ddp_comp)
> +{
> + struct mtk_drm_private *private = drm->dev_private;
> + unsigned int ret;
> +
> + if (mtk_drm_find_comp_in_ddp(ddp_comp, private->data->main_path,
> + private->data->main_len) == true) {
' == true' is redundant, so remove it.
> + ret = BIT(0);
> + } else if (mtk_drm_find_comp_in_ddp(ddp_comp,
> + private->data->ext_path,
> + private->data->ext_len) == true) {
Ditto.
> + ret = BIT(1);
> + } else if (mtk_drm_find_comp_in_ddp(ddp_comp,
> + private->data->third_path,
> + private->data->third_len) == true) {
Ditto.
> + ret = BIT(2);
> + } else {
> + DRM_INFO("Failed to find comp in ddp table\n");
> + ret = 0;
> + }
> + return ret;
> +}
> +
> int mtk_ddp_comp_init(struct device *dev, struct device_node *node,
> struct mtk_ddp_comp *comp, enum mtk_ddp_comp_id comp_id,
> const struct mtk_ddp_comp_funcs *funcs)
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h
> index debe36395fe7..1d9e00b69462 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h
> @@ -202,6 +202,8 @@ static inline void mtk_ddp_ctm_set(struct mtk_ddp_comp *comp,
>
> int mtk_ddp_comp_get_id(struct device_node *node,
> enum mtk_ddp_comp_type comp_type);
> +unsigned int mtk_drm_find_possible_crtc_by_comp(struct drm_device *drm,
> + struct mtk_ddp_comp ddp_comp);
> int mtk_ddp_comp_init(struct device *dev, struct device_node *comp_node,
> struct mtk_ddp_comp *comp, enum mtk_ddp_comp_id comp_id,
> const struct mtk_ddp_comp_funcs *funcs);
> --
> 2.25.1
>
Powered by blists - more mailing lists