Commit 26c35d1d authored by Jason-JH.Lin's avatar Jason-JH.Lin Committed by Chun-Kuang Hu

drm/mediatek: Add crtc path enum for all_drm_priv array

Add mtk_drm_crtc_path enum for each display path.

Instead of using array index of all_drm_priv in mtk_drm_kms_init(),
mtk_drm_crtc_path enum can make code more readable.
Signed-off-by: default avatarJason-JH.Lin <jason-jh.lin@mediatek.com>
Reviewed-by: default avatarFei Shao <fshao@chromium.org>
Reviewed-by: default avatarCK Hu <ck.hu@mediatek.com>
Reviewed-by: default avatarAngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Tested-by: default avatarFei Shao <fshao@chromium.org>
Link: https://patchwork.kernel.org/project/dri-devel/patch/20231004024013.18956-3-jason-jh.lin@mediatek.com/Signed-off-by: default avatarChun-Kuang Hu <chunkuang.hu@kernel.org>
parent ff64e4c3
...@@ -469,21 +469,21 @@ static int mtk_drm_kms_init(struct drm_device *drm) ...@@ -469,21 +469,21 @@ static int mtk_drm_kms_init(struct drm_device *drm)
for (j = 0; j < private->data->mmsys_dev_num; j++) { for (j = 0; j < private->data->mmsys_dev_num; j++) {
priv_n = private->all_drm_private[j]; priv_n = private->all_drm_private[j];
if (i == 0 && priv_n->data->main_len) { if (i == CRTC_MAIN && priv_n->data->main_len) {
ret = mtk_drm_crtc_create(drm, priv_n->data->main_path, ret = mtk_drm_crtc_create(drm, priv_n->data->main_path,
priv_n->data->main_len, j); priv_n->data->main_len, j);
if (ret) if (ret)
goto err_component_unbind; goto err_component_unbind;
continue; continue;
} else if (i == 1 && priv_n->data->ext_len) { } else if (i == CRTC_EXT && priv_n->data->ext_len) {
ret = mtk_drm_crtc_create(drm, priv_n->data->ext_path, ret = mtk_drm_crtc_create(drm, priv_n->data->ext_path,
priv_n->data->ext_len, j); priv_n->data->ext_len, j);
if (ret) if (ret)
goto err_component_unbind; goto err_component_unbind;
continue; continue;
} else if (i == 2 && priv_n->data->third_len) { } else if (i == CRTC_THIRD && priv_n->data->third_len) {
ret = mtk_drm_crtc_create(drm, priv_n->data->third_path, ret = mtk_drm_crtc_create(drm, priv_n->data->third_path,
priv_n->data->third_len, j); priv_n->data->third_len, j);
if (ret) if (ret)
......
...@@ -9,11 +9,17 @@ ...@@ -9,11 +9,17 @@
#include <linux/io.h> #include <linux/io.h>
#include "mtk_drm_ddp_comp.h" #include "mtk_drm_ddp_comp.h"
#define MAX_CRTC 3
#define MAX_CONNECTOR 2 #define MAX_CONNECTOR 2
#define DDP_COMPONENT_DRM_OVL_ADAPTOR (DDP_COMPONENT_ID_MAX + 1) #define DDP_COMPONENT_DRM_OVL_ADAPTOR (DDP_COMPONENT_ID_MAX + 1)
#define DDP_COMPONENT_DRM_ID_MAX (DDP_COMPONENT_DRM_OVL_ADAPTOR + 1) #define DDP_COMPONENT_DRM_ID_MAX (DDP_COMPONENT_DRM_OVL_ADAPTOR + 1)
enum mtk_drm_crtc_path {
CRTC_MAIN,
CRTC_EXT,
CRTC_THIRD,
MAX_CRTC,
};
struct device; struct device;
struct device_node; struct device_node;
struct drm_crtc; struct drm_crtc;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment