drm/mediatek: Rename files "mtk_drm_ddp_comp.h" to "mtk_ddp_comp.h"
authorHsiao Chien Sung <shawn.sung@mediatek.corp-partner.google.com>
Fri, 22 Mar 2024 09:12:26 +0000 (17:12 +0800)
committerChun-Kuang Hu <chunkuang.hu@kernel.org>
Mon, 1 Apr 2024 15:26:45 +0000 (15:26 +0000)
Rename files mtk_drm_ddp_comp.h to mtk_ddp_comp.h.

Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Reviewed-by: CK Hu <ck.hu@mediatek.com>
Signed-off-by: Hsiao Chien Sung <shawn.sung@mediatek.corp-partner.google.com>
Link: https://patchwork.kernel.org/project/dri-devel/patch/20240322091232.26387-9-shawn.sung@mediatek.com/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
20 files changed:
drivers/gpu/drm/mediatek/mtk_crtc.c
drivers/gpu/drm/mediatek/mtk_crtc.h
drivers/gpu/drm/mediatek/mtk_ddp_comp.h [new file with mode: 0644]
drivers/gpu/drm/mediatek/mtk_disp_aal.c
drivers/gpu/drm/mediatek/mtk_disp_ccorr.c
drivers/gpu/drm/mediatek/mtk_disp_color.c
drivers/gpu/drm/mediatek/mtk_disp_gamma.c
drivers/gpu/drm/mediatek/mtk_disp_merge.c
drivers/gpu/drm/mediatek/mtk_disp_ovl.c
drivers/gpu/drm/mediatek/mtk_disp_ovl_adaptor.c
drivers/gpu/drm/mediatek/mtk_disp_rdma.c
drivers/gpu/drm/mediatek/mtk_dpi.c
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c
drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h [deleted file]
drivers/gpu/drm/mediatek/mtk_drm_drv.c
drivers/gpu/drm/mediatek/mtk_drm_drv.h
drivers/gpu/drm/mediatek/mtk_drm_plane.c
drivers/gpu/drm/mediatek/mtk_dsi.c
drivers/gpu/drm/mediatek/mtk_ethdr.c
drivers/gpu/drm/mediatek/mtk_padding.c

index de84735cbdd4557356f0cce3d49f5f875ad5d7fd..a34682c3de4a1b63ec2d5c7c821195632648dfd1 100644 (file)
@@ -20,8 +20,8 @@
 #include <drm/drm_vblank.h>
 
 #include "mtk_crtc.h"
+#include "mtk_ddp_comp.h"
 #include "mtk_drm_drv.h"
-#include "mtk_drm_ddp_comp.h"
 #include "mtk_drm_gem.h"
 #include "mtk_drm_plane.h"
 
index 2d9f28f436aeac6f4c92dfe8bc58c7f32c9fdc6e..fd6c006f0c169451c9715bd5d1193d38c0d6c01c 100644 (file)
@@ -7,7 +7,7 @@
 #define MTK_CRTC_H
 
 #include <drm/drm_crtc.h>
-#include "mtk_drm_ddp_comp.h"
+#include "mtk_ddp_comp.h"
 #include "mtk_drm_drv.h"
 #include "mtk_drm_plane.h"
 
diff --git a/drivers/gpu/drm/mediatek/mtk_ddp_comp.h b/drivers/gpu/drm/mediatek/mtk_ddp_comp.h
new file mode 100644 (file)
index 0000000..ba98520
--- /dev/null
@@ -0,0 +1,343 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ * Copyright (c) 2015 MediaTek Inc.
+ */
+
+#ifndef MTK_DDP_COMP_H
+#define MTK_DDP_COMP_H
+
+#include <linux/io.h>
+#include <linux/pm_runtime.h>
+#include <linux/soc/mediatek/mtk-cmdq.h>
+#include <linux/soc/mediatek/mtk-mmsys.h>
+#include <linux/soc/mediatek/mtk-mutex.h>
+
+#include <drm/drm_modes.h>
+
+struct device;
+struct device_node;
+struct drm_crtc;
+struct drm_device;
+struct mtk_plane_state;
+struct drm_crtc_state;
+
+enum mtk_ddp_comp_type {
+       MTK_DISP_AAL,
+       MTK_DISP_BLS,
+       MTK_DISP_CCORR,
+       MTK_DISP_COLOR,
+       MTK_DISP_DITHER,
+       MTK_DISP_DSC,
+       MTK_DISP_GAMMA,
+       MTK_DISP_MERGE,
+       MTK_DISP_MUTEX,
+       MTK_DISP_OD,
+       MTK_DISP_OVL,
+       MTK_DISP_OVL_2L,
+       MTK_DISP_OVL_ADAPTOR,
+       MTK_DISP_POSTMASK,
+       MTK_DISP_PWM,
+       MTK_DISP_RDMA,
+       MTK_DISP_UFOE,
+       MTK_DISP_WDMA,
+       MTK_DPI,
+       MTK_DP_INTF,
+       MTK_DSI,
+       MTK_DDP_COMP_TYPE_MAX,
+};
+
+struct mtk_ddp_comp;
+struct cmdq_pkt;
+struct mtk_ddp_comp_funcs {
+       int (*power_on)(struct device *dev);
+       void (*power_off)(struct device *dev);
+       int (*clk_enable)(struct device *dev);
+       void (*clk_disable)(struct device *dev);
+       void (*config)(struct device *dev, unsigned int w,
+                      unsigned int h, unsigned int vrefresh,
+                      unsigned int bpc, struct cmdq_pkt *cmdq_pkt);
+       void (*start)(struct device *dev);
+       void (*stop)(struct device *dev);
+       void (*register_vblank_cb)(struct device *dev,
+                                  void (*vblank_cb)(void *),
+                                  void *vblank_cb_data);
+       void (*unregister_vblank_cb)(struct device *dev);
+       void (*enable_vblank)(struct device *dev);
+       void (*disable_vblank)(struct device *dev);
+       unsigned int (*supported_rotations)(struct device *dev);
+       unsigned int (*layer_nr)(struct device *dev);
+       int (*layer_check)(struct device *dev,
+                          unsigned int idx,
+                          struct mtk_plane_state *state);
+       void (*layer_config)(struct device *dev, unsigned int idx,
+                            struct mtk_plane_state *state,
+                            struct cmdq_pkt *cmdq_pkt);
+       unsigned int (*gamma_get_lut_size)(struct device *dev);
+       void (*gamma_set)(struct device *dev,
+                         struct drm_crtc_state *state);
+       void (*bgclr_in_on)(struct device *dev);
+       void (*bgclr_in_off)(struct device *dev);
+       void (*ctm_set)(struct device *dev,
+                       struct drm_crtc_state *state);
+       struct device * (*dma_dev_get)(struct device *dev);
+       const u32 *(*get_formats)(struct device *dev);
+       size_t (*get_num_formats)(struct device *dev);
+       void (*connect)(struct device *dev, struct device *mmsys_dev, unsigned int next);
+       void (*disconnect)(struct device *dev, struct device *mmsys_dev, unsigned int next);
+       void (*add)(struct device *dev, struct mtk_mutex *mutex);
+       void (*remove)(struct device *dev, struct mtk_mutex *mutex);
+       unsigned int (*encoder_index)(struct device *dev);
+       enum drm_mode_status (*mode_valid)(struct device *dev, const struct drm_display_mode *mode);
+};
+
+struct mtk_ddp_comp {
+       struct device *dev;
+       int irq;
+       unsigned int id;
+       int encoder_index;
+       const struct mtk_ddp_comp_funcs *funcs;
+};
+
+static inline int mtk_ddp_comp_power_on(struct mtk_ddp_comp *comp)
+{
+       if (comp->funcs && comp->funcs->power_on)
+               return comp->funcs->power_on(comp->dev);
+       else
+               return pm_runtime_resume_and_get(comp->dev);
+       return 0;
+}
+
+static inline void mtk_ddp_comp_power_off(struct mtk_ddp_comp *comp)
+{
+       if (comp->funcs && comp->funcs->power_off)
+               comp->funcs->power_off(comp->dev);
+       else
+               pm_runtime_put(comp->dev);
+}
+
+static inline int mtk_ddp_comp_clk_enable(struct mtk_ddp_comp *comp)
+{
+       if (comp->funcs && comp->funcs->clk_enable)
+               return comp->funcs->clk_enable(comp->dev);
+
+       return 0;
+}
+
+static inline void mtk_ddp_comp_clk_disable(struct mtk_ddp_comp *comp)
+{
+       if (comp->funcs && comp->funcs->clk_disable)
+               comp->funcs->clk_disable(comp->dev);
+}
+
+static inline
+enum drm_mode_status mtk_ddp_comp_mode_valid(struct mtk_ddp_comp *comp,
+                                            const struct drm_display_mode *mode)
+{
+       if (comp && comp->funcs && comp->funcs->mode_valid)
+               return comp->funcs->mode_valid(comp->dev, mode);
+       return MODE_OK;
+}
+
+static inline void mtk_ddp_comp_config(struct mtk_ddp_comp *comp,
+                                      unsigned int w, unsigned int h,
+                                      unsigned int vrefresh, unsigned int bpc,
+                                      struct cmdq_pkt *cmdq_pkt)
+{
+       if (comp->funcs && comp->funcs->config)
+               comp->funcs->config(comp->dev, w, h, vrefresh, bpc, cmdq_pkt);
+}
+
+static inline void mtk_ddp_comp_start(struct mtk_ddp_comp *comp)
+{
+       if (comp->funcs && comp->funcs->start)
+               comp->funcs->start(comp->dev);
+}
+
+static inline void mtk_ddp_comp_stop(struct mtk_ddp_comp *comp)
+{
+       if (comp->funcs && comp->funcs->stop)
+               comp->funcs->stop(comp->dev);
+}
+
+static inline void mtk_ddp_comp_register_vblank_cb(struct mtk_ddp_comp *comp,
+                                                  void (*vblank_cb)(void *),
+                                                  void *vblank_cb_data)
+{
+       if (comp->funcs && comp->funcs->register_vblank_cb)
+               comp->funcs->register_vblank_cb(comp->dev, vblank_cb,
+                                               vblank_cb_data);
+}
+
+static inline void mtk_ddp_comp_unregister_vblank_cb(struct mtk_ddp_comp *comp)
+{
+       if (comp->funcs && comp->funcs->unregister_vblank_cb)
+               comp->funcs->unregister_vblank_cb(comp->dev);
+}
+
+static inline void mtk_ddp_comp_enable_vblank(struct mtk_ddp_comp *comp)
+{
+       if (comp->funcs && comp->funcs->enable_vblank)
+               comp->funcs->enable_vblank(comp->dev);
+}
+
+static inline void mtk_ddp_comp_disable_vblank(struct mtk_ddp_comp *comp)
+{
+       if (comp->funcs && comp->funcs->disable_vblank)
+               comp->funcs->disable_vblank(comp->dev);
+}
+
+static inline
+unsigned int mtk_ddp_comp_supported_rotations(struct mtk_ddp_comp *comp)
+{
+       if (comp->funcs && comp->funcs->supported_rotations)
+               return comp->funcs->supported_rotations(comp->dev);
+
+       return 0;
+}
+
+static inline unsigned int mtk_ddp_comp_layer_nr(struct mtk_ddp_comp *comp)
+{
+       if (comp->funcs && comp->funcs->layer_nr)
+               return comp->funcs->layer_nr(comp->dev);
+
+       return 0;
+}
+
+static inline int mtk_ddp_comp_layer_check(struct mtk_ddp_comp *comp,
+                                          unsigned int idx,
+                                          struct mtk_plane_state *state)
+{
+       if (comp->funcs && comp->funcs->layer_check)
+               return comp->funcs->layer_check(comp->dev, idx, state);
+       return 0;
+}
+
+static inline void mtk_ddp_comp_layer_config(struct mtk_ddp_comp *comp,
+                                            unsigned int idx,
+                                            struct mtk_plane_state *state,
+                                            struct cmdq_pkt *cmdq_pkt)
+{
+       if (comp->funcs && comp->funcs->layer_config)
+               comp->funcs->layer_config(comp->dev, idx, state, cmdq_pkt);
+}
+
+static inline unsigned int mtk_ddp_gamma_get_lut_size(struct mtk_ddp_comp *comp)
+{
+       if (comp->funcs && comp->funcs->gamma_get_lut_size)
+               return comp->funcs->gamma_get_lut_size(comp->dev);
+
+       return 0;
+}
+
+static inline void mtk_ddp_gamma_set(struct mtk_ddp_comp *comp,
+                                    struct drm_crtc_state *state)
+{
+       if (comp->funcs && comp->funcs->gamma_set)
+               comp->funcs->gamma_set(comp->dev, state);
+}
+
+static inline void mtk_ddp_comp_bgclr_in_on(struct mtk_ddp_comp *comp)
+{
+       if (comp->funcs && comp->funcs->bgclr_in_on)
+               comp->funcs->bgclr_in_on(comp->dev);
+}
+
+static inline void mtk_ddp_comp_bgclr_in_off(struct mtk_ddp_comp *comp)
+{
+       if (comp->funcs && comp->funcs->bgclr_in_off)
+               comp->funcs->bgclr_in_off(comp->dev);
+}
+
+static inline void mtk_ddp_ctm_set(struct mtk_ddp_comp *comp,
+                                  struct drm_crtc_state *state)
+{
+       if (comp->funcs && comp->funcs->ctm_set)
+               comp->funcs->ctm_set(comp->dev, state);
+}
+
+static inline struct device *mtk_ddp_comp_dma_dev_get(struct mtk_ddp_comp *comp)
+{
+       if (comp->funcs && comp->funcs->dma_dev_get)
+               return comp->funcs->dma_dev_get(comp->dev);
+       return comp->dev;
+}
+
+static inline
+const u32 *mtk_ddp_comp_get_formats(struct mtk_ddp_comp *comp)
+{
+       if (comp->funcs && comp->funcs->get_formats)
+               return comp->funcs->get_formats(comp->dev);
+
+       return NULL;
+}
+
+static inline
+size_t mtk_ddp_comp_get_num_formats(struct mtk_ddp_comp *comp)
+{
+       if (comp->funcs && comp->funcs->get_num_formats)
+               return comp->funcs->get_num_formats(comp->dev);
+
+       return 0;
+}
+
+static inline bool mtk_ddp_comp_add(struct mtk_ddp_comp *comp, struct mtk_mutex *mutex)
+{
+       if (comp->funcs && comp->funcs->add) {
+               comp->funcs->add(comp->dev, mutex);
+               return true;
+       }
+       return false;
+}
+
+static inline bool mtk_ddp_comp_remove(struct mtk_ddp_comp *comp, struct mtk_mutex *mutex)
+{
+       if (comp->funcs && comp->funcs->remove) {
+               comp->funcs->remove(comp->dev, mutex);
+               return true;
+       }
+       return false;
+}
+
+static inline bool mtk_ddp_comp_connect(struct mtk_ddp_comp *comp, struct device *mmsys_dev,
+                                       unsigned int next)
+{
+       if (comp->funcs && comp->funcs->connect) {
+               comp->funcs->connect(comp->dev, mmsys_dev, next);
+               return true;
+       }
+       return false;
+}
+
+static inline bool mtk_ddp_comp_disconnect(struct mtk_ddp_comp *comp, struct device *mmsys_dev,
+                                          unsigned int next)
+{
+       if (comp->funcs && comp->funcs->disconnect) {
+               comp->funcs->disconnect(comp->dev, mmsys_dev, next);
+               return true;
+       }
+       return false;
+}
+
+static inline void mtk_ddp_comp_encoder_index_set(struct mtk_ddp_comp *comp)
+{
+       if (comp->funcs && comp->funcs->encoder_index)
+               comp->encoder_index = (int)comp->funcs->encoder_index(comp->dev);
+}
+
+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 device *dev);
+int mtk_ddp_comp_init(struct device_node *comp_node, struct mtk_ddp_comp *comp,
+                     unsigned int comp_id);
+enum mtk_ddp_comp_type mtk_ddp_comp_get_type(unsigned int comp_id);
+void mtk_ddp_write(struct cmdq_pkt *cmdq_pkt, unsigned int value,
+                  struct cmdq_client_reg *cmdq_reg, void __iomem *regs,
+                  unsigned int offset);
+void mtk_ddp_write_relaxed(struct cmdq_pkt *cmdq_pkt, unsigned int value,
+                          struct cmdq_client_reg *cmdq_reg, void __iomem *regs,
+                          unsigned int offset);
+void mtk_ddp_write_mask(struct cmdq_pkt *cmdq_pkt, unsigned int value,
+                       struct cmdq_client_reg *cmdq_reg, void __iomem *regs,
+                       unsigned int offset, unsigned int mask);
+#endif /* MTK_DDP_COMP_H */
index ba926e797af8aff4ec1cf03963ac8f42e0b0b8a7..92acdaddd648d200005f2bb6bf87ba87edf13c61 100644 (file)
@@ -12,8 +12,8 @@
 #include <linux/soc/mediatek/mtk-cmdq.h>
 
 #include "mtk_crtc.h"
+#include "mtk_ddp_comp.h"
 #include "mtk_disp_drv.h"
-#include "mtk_drm_ddp_comp.h"
 #include "mtk_drm_drv.h"
 
 #define DISP_AAL_EN                            0x0000
index 79bcd3c487563a41cc68318248623912ffd47e0d..975ee45a0f72c40b4d1a333e76698061feae0299 100644 (file)
@@ -11,8 +11,8 @@
 #include <linux/soc/mediatek/mtk-cmdq.h>
 
 #include "mtk_crtc.h"
+#include "mtk_ddp_comp.h"
 #include "mtk_disp_drv.h"
-#include "mtk_drm_ddp_comp.h"
 #include "mtk_drm_drv.h"
 
 #define DISP_CCORR_EN                          0x0000
index 4aa41b1ff2602dcd280658f55fea4b38b61933e7..91e7837a32c86a85166e68c5c3375233788a1ff5 100644 (file)
@@ -11,8 +11,8 @@
 #include <linux/soc/mediatek/mtk-cmdq.h>
 
 #include "mtk_crtc.h"
+#include "mtk_ddp_comp.h"
 #include "mtk_disp_drv.h"
-#include "mtk_drm_ddp_comp.h"
 #include "mtk_drm_drv.h"
 
 #define DISP_COLOR_CFG_MAIN                    0x0400
index 1a1ee77127ee969dd0d463832979e273a06b2dc5..51ae4f947c7146d73b9bedbc07c1dc157c613ab2 100644 (file)
@@ -12,8 +12,8 @@
 #include <linux/soc/mediatek/mtk-cmdq.h>
 
 #include "mtk_crtc.h"
+#include "mtk_ddp_comp.h"
 #include "mtk_disp_drv.h"
-#include "mtk_drm_ddp_comp.h"
 #include "mtk_drm_drv.h"
 
 #define DISP_GAMMA_EN                          0x0000
index 32a29924bd54cf6c9791c22a49cb789aba111f08..3b1e04ecb9d45becd842976012ebe04e72e95d42 100644 (file)
@@ -10,7 +10,7 @@
 #include <linux/reset.h>
 #include <linux/soc/mediatek/mtk-cmdq.h>
 
-#include "mtk_drm_ddp_comp.h"
+#include "mtk_ddp_comp.h"
 #include "mtk_drm_drv.h"
 #include "mtk_disp_drv.h"
 
index 7f2219c0119beea7911d10c5c4c28668a2bbfe95..0ebeaf9830d83e197f04d34fc9d17403c1f5c3ee 100644 (file)
@@ -16,8 +16,8 @@
 #include <linux/soc/mediatek/mtk-cmdq.h>
 
 #include "mtk_crtc.h"
+#include "mtk_ddp_comp.h"
 #include "mtk_disp_drv.h"
-#include "mtk_drm_ddp_comp.h"
 #include "mtk_drm_drv.h"
 
 #define DISP_REG_OVL_INTEN                     0x0004
index 542dc2a20ea90bcfdfee24f664a41350df80a3f1..d957f5c8ccf922348ae5c7b6d944083ea77b0afa 100644 (file)
@@ -18,8 +18,8 @@
 #include <linux/soc/mediatek/mtk-mutex.h>
 
 #include "mtk_crtc.h"
+#include "mtk_ddp_comp.h"
 #include "mtk_disp_drv.h"
-#include "mtk_drm_ddp_comp.h"
 #include "mtk_drm_drv.h"
 #include "mtk_ethdr.h"
 
index 04f584372214f9566e45ff29b651adb7840d1d79..f06b048c124794c0f1192591136a3d7bc7ce35e4 100644 (file)
@@ -14,8 +14,8 @@
 #include <linux/soc/mediatek/mtk-cmdq.h>
 
 #include "mtk_crtc.h"
+#include "mtk_ddp_comp.h"
 #include "mtk_disp_drv.h"
-#include "mtk_drm_ddp_comp.h"
 #include "mtk_drm_drv.h"
 
 #define DISP_REG_RDMA_INT_ENABLE               0x0000
index beb7d9d08e97159e33599c378bdf2e69b7360ba2..fbf63e04413371c2de6875fead9dd2390a94a1f1 100644 (file)
@@ -26,9 +26,9 @@
 #include <drm/drm_of.h>
 #include <drm/drm_simple_kms_helper.h>
 
+#include "mtk_ddp_comp.h"
 #include "mtk_disp_drv.h"
 #include "mtk_dpi_regs.h"
-#include "mtk_drm_ddp_comp.h"
 #include "mtk_drm_drv.h"
 
 enum mtk_dpi_out_bit_num {
index 24389c6c3561f1ffb231ef2dfcbff96fd9cb0cf2..ab96b1001de3e3b8df40ae40686e8c7c0bbc0d61 100644 (file)
 #include <drm/drm_print.h>
 
 #include "mtk_crtc.h"
+#include "mtk_ddp_comp.h"
 #include "mtk_disp_drv.h"
 #include "mtk_drm_drv.h"
 #include "mtk_drm_plane.h"
-#include "mtk_drm_ddp_comp.h"
 
 
 #define DISP_REG_DITHER_EN                     0x0000
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h
deleted file mode 100644 (file)
index ba98520..0000000
+++ /dev/null
@@ -1,343 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-/*
- * Copyright (c) 2015 MediaTek Inc.
- */
-
-#ifndef MTK_DDP_COMP_H
-#define MTK_DDP_COMP_H
-
-#include <linux/io.h>
-#include <linux/pm_runtime.h>
-#include <linux/soc/mediatek/mtk-cmdq.h>
-#include <linux/soc/mediatek/mtk-mmsys.h>
-#include <linux/soc/mediatek/mtk-mutex.h>
-
-#include <drm/drm_modes.h>
-
-struct device;
-struct device_node;
-struct drm_crtc;
-struct drm_device;
-struct mtk_plane_state;
-struct drm_crtc_state;
-
-enum mtk_ddp_comp_type {
-       MTK_DISP_AAL,
-       MTK_DISP_BLS,
-       MTK_DISP_CCORR,
-       MTK_DISP_COLOR,
-       MTK_DISP_DITHER,
-       MTK_DISP_DSC,
-       MTK_DISP_GAMMA,
-       MTK_DISP_MERGE,
-       MTK_DISP_MUTEX,
-       MTK_DISP_OD,
-       MTK_DISP_OVL,
-       MTK_DISP_OVL_2L,
-       MTK_DISP_OVL_ADAPTOR,
-       MTK_DISP_POSTMASK,
-       MTK_DISP_PWM,
-       MTK_DISP_RDMA,
-       MTK_DISP_UFOE,
-       MTK_DISP_WDMA,
-       MTK_DPI,
-       MTK_DP_INTF,
-       MTK_DSI,
-       MTK_DDP_COMP_TYPE_MAX,
-};
-
-struct mtk_ddp_comp;
-struct cmdq_pkt;
-struct mtk_ddp_comp_funcs {
-       int (*power_on)(struct device *dev);
-       void (*power_off)(struct device *dev);
-       int (*clk_enable)(struct device *dev);
-       void (*clk_disable)(struct device *dev);
-       void (*config)(struct device *dev, unsigned int w,
-                      unsigned int h, unsigned int vrefresh,
-                      unsigned int bpc, struct cmdq_pkt *cmdq_pkt);
-       void (*start)(struct device *dev);
-       void (*stop)(struct device *dev);
-       void (*register_vblank_cb)(struct device *dev,
-                                  void (*vblank_cb)(void *),
-                                  void *vblank_cb_data);
-       void (*unregister_vblank_cb)(struct device *dev);
-       void (*enable_vblank)(struct device *dev);
-       void (*disable_vblank)(struct device *dev);
-       unsigned int (*supported_rotations)(struct device *dev);
-       unsigned int (*layer_nr)(struct device *dev);
-       int (*layer_check)(struct device *dev,
-                          unsigned int idx,
-                          struct mtk_plane_state *state);
-       void (*layer_config)(struct device *dev, unsigned int idx,
-                            struct mtk_plane_state *state,
-                            struct cmdq_pkt *cmdq_pkt);
-       unsigned int (*gamma_get_lut_size)(struct device *dev);
-       void (*gamma_set)(struct device *dev,
-                         struct drm_crtc_state *state);
-       void (*bgclr_in_on)(struct device *dev);
-       void (*bgclr_in_off)(struct device *dev);
-       void (*ctm_set)(struct device *dev,
-                       struct drm_crtc_state *state);
-       struct device * (*dma_dev_get)(struct device *dev);
-       const u32 *(*get_formats)(struct device *dev);
-       size_t (*get_num_formats)(struct device *dev);
-       void (*connect)(struct device *dev, struct device *mmsys_dev, unsigned int next);
-       void (*disconnect)(struct device *dev, struct device *mmsys_dev, unsigned int next);
-       void (*add)(struct device *dev, struct mtk_mutex *mutex);
-       void (*remove)(struct device *dev, struct mtk_mutex *mutex);
-       unsigned int (*encoder_index)(struct device *dev);
-       enum drm_mode_status (*mode_valid)(struct device *dev, const struct drm_display_mode *mode);
-};
-
-struct mtk_ddp_comp {
-       struct device *dev;
-       int irq;
-       unsigned int id;
-       int encoder_index;
-       const struct mtk_ddp_comp_funcs *funcs;
-};
-
-static inline int mtk_ddp_comp_power_on(struct mtk_ddp_comp *comp)
-{
-       if (comp->funcs && comp->funcs->power_on)
-               return comp->funcs->power_on(comp->dev);
-       else
-               return pm_runtime_resume_and_get(comp->dev);
-       return 0;
-}
-
-static inline void mtk_ddp_comp_power_off(struct mtk_ddp_comp *comp)
-{
-       if (comp->funcs && comp->funcs->power_off)
-               comp->funcs->power_off(comp->dev);
-       else
-               pm_runtime_put(comp->dev);
-}
-
-static inline int mtk_ddp_comp_clk_enable(struct mtk_ddp_comp *comp)
-{
-       if (comp->funcs && comp->funcs->clk_enable)
-               return comp->funcs->clk_enable(comp->dev);
-
-       return 0;
-}
-
-static inline void mtk_ddp_comp_clk_disable(struct mtk_ddp_comp *comp)
-{
-       if (comp->funcs && comp->funcs->clk_disable)
-               comp->funcs->clk_disable(comp->dev);
-}
-
-static inline
-enum drm_mode_status mtk_ddp_comp_mode_valid(struct mtk_ddp_comp *comp,
-                                            const struct drm_display_mode *mode)
-{
-       if (comp && comp->funcs && comp->funcs->mode_valid)
-               return comp->funcs->mode_valid(comp->dev, mode);
-       return MODE_OK;
-}
-
-static inline void mtk_ddp_comp_config(struct mtk_ddp_comp *comp,
-                                      unsigned int w, unsigned int h,
-                                      unsigned int vrefresh, unsigned int bpc,
-                                      struct cmdq_pkt *cmdq_pkt)
-{
-       if (comp->funcs && comp->funcs->config)
-               comp->funcs->config(comp->dev, w, h, vrefresh, bpc, cmdq_pkt);
-}
-
-static inline void mtk_ddp_comp_start(struct mtk_ddp_comp *comp)
-{
-       if (comp->funcs && comp->funcs->start)
-               comp->funcs->start(comp->dev);
-}
-
-static inline void mtk_ddp_comp_stop(struct mtk_ddp_comp *comp)
-{
-       if (comp->funcs && comp->funcs->stop)
-               comp->funcs->stop(comp->dev);
-}
-
-static inline void mtk_ddp_comp_register_vblank_cb(struct mtk_ddp_comp *comp,
-                                                  void (*vblank_cb)(void *),
-                                                  void *vblank_cb_data)
-{
-       if (comp->funcs && comp->funcs->register_vblank_cb)
-               comp->funcs->register_vblank_cb(comp->dev, vblank_cb,
-                                               vblank_cb_data);
-}
-
-static inline void mtk_ddp_comp_unregister_vblank_cb(struct mtk_ddp_comp *comp)
-{
-       if (comp->funcs && comp->funcs->unregister_vblank_cb)
-               comp->funcs->unregister_vblank_cb(comp->dev);
-}
-
-static inline void mtk_ddp_comp_enable_vblank(struct mtk_ddp_comp *comp)
-{
-       if (comp->funcs && comp->funcs->enable_vblank)
-               comp->funcs->enable_vblank(comp->dev);
-}
-
-static inline void mtk_ddp_comp_disable_vblank(struct mtk_ddp_comp *comp)
-{
-       if (comp->funcs && comp->funcs->disable_vblank)
-               comp->funcs->disable_vblank(comp->dev);
-}
-
-static inline
-unsigned int mtk_ddp_comp_supported_rotations(struct mtk_ddp_comp *comp)
-{
-       if (comp->funcs && comp->funcs->supported_rotations)
-               return comp->funcs->supported_rotations(comp->dev);
-
-       return 0;
-}
-
-static inline unsigned int mtk_ddp_comp_layer_nr(struct mtk_ddp_comp *comp)
-{
-       if (comp->funcs && comp->funcs->layer_nr)
-               return comp->funcs->layer_nr(comp->dev);
-
-       return 0;
-}
-
-static inline int mtk_ddp_comp_layer_check(struct mtk_ddp_comp *comp,
-                                          unsigned int idx,
-                                          struct mtk_plane_state *state)
-{
-       if (comp->funcs && comp->funcs->layer_check)
-               return comp->funcs->layer_check(comp->dev, idx, state);
-       return 0;
-}
-
-static inline void mtk_ddp_comp_layer_config(struct mtk_ddp_comp *comp,
-                                            unsigned int idx,
-                                            struct mtk_plane_state *state,
-                                            struct cmdq_pkt *cmdq_pkt)
-{
-       if (comp->funcs && comp->funcs->layer_config)
-               comp->funcs->layer_config(comp->dev, idx, state, cmdq_pkt);
-}
-
-static inline unsigned int mtk_ddp_gamma_get_lut_size(struct mtk_ddp_comp *comp)
-{
-       if (comp->funcs && comp->funcs->gamma_get_lut_size)
-               return comp->funcs->gamma_get_lut_size(comp->dev);
-
-       return 0;
-}
-
-static inline void mtk_ddp_gamma_set(struct mtk_ddp_comp *comp,
-                                    struct drm_crtc_state *state)
-{
-       if (comp->funcs && comp->funcs->gamma_set)
-               comp->funcs->gamma_set(comp->dev, state);
-}
-
-static inline void mtk_ddp_comp_bgclr_in_on(struct mtk_ddp_comp *comp)
-{
-       if (comp->funcs && comp->funcs->bgclr_in_on)
-               comp->funcs->bgclr_in_on(comp->dev);
-}
-
-static inline void mtk_ddp_comp_bgclr_in_off(struct mtk_ddp_comp *comp)
-{
-       if (comp->funcs && comp->funcs->bgclr_in_off)
-               comp->funcs->bgclr_in_off(comp->dev);
-}
-
-static inline void mtk_ddp_ctm_set(struct mtk_ddp_comp *comp,
-                                  struct drm_crtc_state *state)
-{
-       if (comp->funcs && comp->funcs->ctm_set)
-               comp->funcs->ctm_set(comp->dev, state);
-}
-
-static inline struct device *mtk_ddp_comp_dma_dev_get(struct mtk_ddp_comp *comp)
-{
-       if (comp->funcs && comp->funcs->dma_dev_get)
-               return comp->funcs->dma_dev_get(comp->dev);
-       return comp->dev;
-}
-
-static inline
-const u32 *mtk_ddp_comp_get_formats(struct mtk_ddp_comp *comp)
-{
-       if (comp->funcs && comp->funcs->get_formats)
-               return comp->funcs->get_formats(comp->dev);
-
-       return NULL;
-}
-
-static inline
-size_t mtk_ddp_comp_get_num_formats(struct mtk_ddp_comp *comp)
-{
-       if (comp->funcs && comp->funcs->get_num_formats)
-               return comp->funcs->get_num_formats(comp->dev);
-
-       return 0;
-}
-
-static inline bool mtk_ddp_comp_add(struct mtk_ddp_comp *comp, struct mtk_mutex *mutex)
-{
-       if (comp->funcs && comp->funcs->add) {
-               comp->funcs->add(comp->dev, mutex);
-               return true;
-       }
-       return false;
-}
-
-static inline bool mtk_ddp_comp_remove(struct mtk_ddp_comp *comp, struct mtk_mutex *mutex)
-{
-       if (comp->funcs && comp->funcs->remove) {
-               comp->funcs->remove(comp->dev, mutex);
-               return true;
-       }
-       return false;
-}
-
-static inline bool mtk_ddp_comp_connect(struct mtk_ddp_comp *comp, struct device *mmsys_dev,
-                                       unsigned int next)
-{
-       if (comp->funcs && comp->funcs->connect) {
-               comp->funcs->connect(comp->dev, mmsys_dev, next);
-               return true;
-       }
-       return false;
-}
-
-static inline bool mtk_ddp_comp_disconnect(struct mtk_ddp_comp *comp, struct device *mmsys_dev,
-                                          unsigned int next)
-{
-       if (comp->funcs && comp->funcs->disconnect) {
-               comp->funcs->disconnect(comp->dev, mmsys_dev, next);
-               return true;
-       }
-       return false;
-}
-
-static inline void mtk_ddp_comp_encoder_index_set(struct mtk_ddp_comp *comp)
-{
-       if (comp->funcs && comp->funcs->encoder_index)
-               comp->encoder_index = (int)comp->funcs->encoder_index(comp->dev);
-}
-
-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 device *dev);
-int mtk_ddp_comp_init(struct device_node *comp_node, struct mtk_ddp_comp *comp,
-                     unsigned int comp_id);
-enum mtk_ddp_comp_type mtk_ddp_comp_get_type(unsigned int comp_id);
-void mtk_ddp_write(struct cmdq_pkt *cmdq_pkt, unsigned int value,
-                  struct cmdq_client_reg *cmdq_reg, void __iomem *regs,
-                  unsigned int offset);
-void mtk_ddp_write_relaxed(struct cmdq_pkt *cmdq_pkt, unsigned int value,
-                          struct cmdq_client_reg *cmdq_reg, void __iomem *regs,
-                          unsigned int offset);
-void mtk_ddp_write_mask(struct cmdq_pkt *cmdq_pkt, unsigned int value,
-                       struct cmdq_client_reg *cmdq_reg, void __iomem *regs,
-                       unsigned int offset, unsigned int mask);
-#endif /* MTK_DDP_COMP_H */
index ae131c037af5679022a8efb03a20e3bf0fcce048..73992ec35e60fe1103bf5c8fb786177544c4e9bd 100644 (file)
@@ -25,7 +25,7 @@
 #include <drm/drm_vblank.h>
 
 #include "mtk_crtc.h"
-#include "mtk_drm_ddp_comp.h"
+#include "mtk_ddp_comp.h"
 #include "mtk_drm_drv.h"
 #include "mtk_drm_gem.h"
 
index 24c4d59085bd61566849f3364036bd2f08d6a87b..78d698ede1bf806f86e403830a0823c5b69fde21 100644 (file)
@@ -7,7 +7,7 @@
 #define MTK_DRM_DRV_H
 
 #include <linux/io.h>
-#include "mtk_drm_ddp_comp.h"
+#include "mtk_ddp_comp.h"
 
 #define MAX_CONNECTOR  2
 #define DDP_COMPONENT_DRM_OVL_ADAPTOR (DDP_COMPONENT_ID_MAX + 1)
index 720f6b4b08215f8cd0901a4dec2ad75c8c77473d..63a7a24468c13f161979dce25d4d41f141eebf89 100644 (file)
@@ -14,7 +14,7 @@
 #include <linux/align.h>
 
 #include "mtk_crtc.h"
-#include "mtk_drm_ddp_comp.h"
+#include "mtk_ddp_comp.h"
 #include "mtk_drm_drv.h"
 #include "mtk_drm_gem.h"
 #include "mtk_drm_plane.h"
index ec9d96396d7b25ceea6d7365e79e9baccff2b87f..e29c37fb5be092b7b24eda185c2ed9724fad9516 100644 (file)
@@ -28,8 +28,8 @@
 #include <drm/drm_probe_helper.h>
 #include <drm/drm_simple_kms_helper.h>
 
+#include "mtk_ddp_comp.h"
 #include "mtk_disp_drv.h"
-#include "mtk_drm_ddp_comp.h"
 #include "mtk_drm_drv.h"
 
 #define DSI_START              0x00
index 41efaafe26f1a8bb1ab5c0b7929ca693890190be..9b0264bd5e731aae3601ed0f053ee2063873798c 100644 (file)
@@ -15,7 +15,7 @@
 #include <linux/soc/mediatek/mtk-mmsys.h>
 
 #include "mtk_crtc.h"
-#include "mtk_drm_ddp_comp.h"
+#include "mtk_ddp_comp.h"
 #include "mtk_drm_drv.h"
 #include "mtk_ethdr.h"
 
index ff6a5c695128ccf2fb447e13db425daba4bea7c8..1f91805cd9aac7b544f91b25cd0e691827519432 100644 (file)
@@ -12,8 +12,8 @@
 #include <linux/soc/mediatek/mtk-cmdq.h>
 
 #include "mtk_crtc.h"
+#include "mtk_ddp_comp.h"
 #include "mtk_disp_drv.h"
-#include "mtk_drm_ddp_comp.h"
 
 #define PADDING_CONTROL_REG    0x00
 #define PADDING_BYPASS                 BIT(0)