mirror of
https://github.com/Ysurac/openmptcprouter.git
synced 2025-02-13 20:01:55 +00:00
84 lines
2.9 KiB
Diff
84 lines
2.9 KiB
Diff
From 452b508468a46ef0fe7357fab6b000c52fd047d3 Mon Sep 17 00:00:00 2001
|
|
From: Stu Hsieh <stu.hsieh@mediatek.com>
|
|
Date: Fri, 16 Nov 2018 16:33:00 +0100
|
|
Subject: [PATCH] drm: Add get_possible_crtc API for dpi, dsi
|
|
|
|
Test: build pass and run ok
|
|
|
|
Signed-off-by: Stu Hsieh <stu.hsieh@mediatek.com>
|
|
---
|
|
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c | 40 +++++++++++++++++++++
|
|
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h | 2 ++
|
|
2 files changed, 42 insertions(+)
|
|
|
|
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
|
|
index efa85973e46b..29796e78b26a 100644
|
|
--- a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
|
|
+++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
|
|
@@ -237,6 +237,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;
|
|
+
|
|
+ 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)
|
|
{
|
|
@@ -252,6 +268,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) {
|
|
+ ret = BIT(0);
|
|
+ } else if (mtk_drm_find_comp_in_ddp(ddp_comp,
|
|
+ private->data->ext_path,
|
|
+ private->data->ext_len) == true) {
|
|
+ ret = BIT(1);
|
|
+ } else if (mtk_drm_find_comp_in_ddp(ddp_comp,
|
|
+ private->data->third_path,
|
|
+ private->data->third_len) == true) {
|
|
+ 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 0ad287f427cc..97be111c3e52 100644
|
|
--- a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h
|
|
+++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h
|
|
@@ -160,6 +160,8 @@ static inline void mtk_ddp_gamma_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);
|