Re: [PATCH v28 4/4] media: platform: mtk-mdp3: add MediaTek MDP3 driver

Hans Verkuil
2022-08-24T08:39:35Z

Hi Moudy,

On 23/08/2022 04:38, Moudy Ho wrote:
> This patch adds driver for MediaTek's Media Data Path ver.3 (MDP3).
> It provides the following functions:
> color transform, format conversion, resize, crop, rotate, flip
> and additional image quality enhancement.
>
> The MDP3 driver is mainly used for Google Chromebook products to
> import the new architecture to set the HW settings as shown below:
> User -> V4L2 framework
> -> MDP3 driver -> SCP (setting calculations)
> -> MDP3 driver -> CMDQ (GCE driver) -> HW
>
> Each modules' related operation control is sited in mtk-mdp3-comp.c
> Each modules' register table is defined in file with "mdp_reg_" prefix
> GCE related API, operation control sited in mtk-mdp3-cmdq.c
> V4L2 m2m device functions are implemented in mtk-mdp3-m2m.c
> Probe, power, suspend/resume, system level functions are defined in
> mtk-mdp3-core.c
>
> Signed-off-by: Ping-Hsun Wu <ping-hsun.wu@mediatek.com>
> Signed-off-by: daoyuan huang <daoyuan.huang@mediatek.com>
> Signed-off-by: Moudy Ho <moudy.ho@mediatek.com>
> Tested-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
> ---
> drivers/media/platform/mediatek/Kconfig | 1 +
> drivers/media/platform/mediatek/Makefile | 1 +
> drivers/media/platform/mediatek/mdp3/Kconfig | 20 +
> drivers/media/platform/mediatek/mdp3/Makefile | 6 +
> .../platform/mediatek/mdp3/mdp_reg_ccorr.h | 19 +
> .../platform/mediatek/mdp3/mdp_reg_rdma.h | 65 ++
> .../platform/mediatek/mdp3/mdp_reg_rsz.h | 39 +
> .../platform/mediatek/mdp3/mdp_reg_wdma.h | 47 +
> .../platform/mediatek/mdp3/mdp_reg_wrot.h | 55 +
> .../platform/mediatek/mdp3/mtk-img-ipi.h | 290 +++++
> .../platform/mediatek/mdp3/mtk-mdp3-cmdq.c | 466 ++++++++
> .../platform/mediatek/mdp3/mtk-mdp3-cmdq.h | 43 +
> .../platform/mediatek/mdp3/mtk-mdp3-comp.c | 1033 +++++++++++++++++
> .../platform/mediatek/mdp3/mtk-mdp3-comp.h | 186 +++
> .../platform/mediatek/mdp3/mtk-mdp3-core.c | 357 ++++++
> .../platform/mediatek/mdp3/mtk-mdp3-core.h | 94 ++
> .../platform/mediatek/mdp3/mtk-mdp3-m2m.c | 724 ++++++++++++
> .../platform/mediatek/mdp3/mtk-mdp3-m2m.h | 48 +
> .../platform/mediatek/mdp3/mtk-mdp3-regs.c | 735 ++++++++++++
> .../platform/mediatek/mdp3/mtk-mdp3-regs.h | 373 ++++++
> .../platform/mediatek/mdp3/mtk-mdp3-vpu.c | 313 +++++
> .../platform/mediatek/mdp3/mtk-mdp3-vpu.h | 78 ++
> 22 files changed, 4993 insertions(+)
> create mode 100644 drivers/media/platform/mediatek/mdp3/Kconfig
> create mode 100644 drivers/media/platform/mediatek/mdp3/Makefile
> create mode 100644 drivers/media/platform/mediatek/mdp3/mdp_reg_ccorr.h
> create mode 100644 drivers/media/platform/mediatek/mdp3/mdp_reg_rdma.h
> create mode 100644 drivers/media/platform/mediatek/mdp3/mdp_reg_rsz.h
> create mode 100644 drivers/media/platform/mediatek/mdp3/mdp_reg_wdma.h
> create mode 100644 drivers/media/platform/mediatek/mdp3/mdp_reg_wrot.h
> create mode 100644 drivers/media/platform/mediatek/mdp3/mtk-img-ipi.h
> create mode 100644 drivers/media/platform/mediatek/mdp3/mtk-mdp3-cmdq.c
> create mode 100644 drivers/media/platform/mediatek/mdp3/mtk-mdp3-cmdq.h
> create mode 100644 drivers/media/platform/mediatek/mdp3/mtk-mdp3-comp.c
> create mode 100644 drivers/media/platform/mediatek/mdp3/mtk-mdp3-comp.h
> create mode 100644 drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c
> create mode 100644 drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.h
> create mode 100644 drivers/media/platform/mediatek/mdp3/mtk-mdp3-m2m.c
> create mode 100644 drivers/media/platform/mediatek/mdp3/mtk-mdp3-m2m.h
> create mode 100644 drivers/media/platform/mediatek/mdp3/mtk-mdp3-regs.c
> create mode 100644 drivers/media/platform/mediatek/mdp3/mtk-mdp3-regs.h
> create mode 100644 drivers/media/platform/mediatek/mdp3/mtk-mdp3-vpu.c
> create mode 100644 drivers/media/platform/mediatek/mdp3/mtk-mdp3-vpu.h
>
> diff --git a/drivers/media/platform/mediatek/Kconfig b/drivers/media/platform/mediatek/Kconfig
> index af47d9888552..84104e2cd024 100644
> --- a/drivers/media/platform/mediatek/Kconfig
> +++ b/drivers/media/platform/mediatek/Kconfig
> @@ -6,3 +6,4 @@ source "drivers/media/platform/mediatek/jpeg/Kconfig"
> source "drivers/media/platform/mediatek/mdp/Kconfig"
> source "drivers/media/platform/mediatek/vcodec/Kconfig"
> source "drivers/media/platform/mediatek/vpu/Kconfig"
> +source "drivers/media/platform/mediatek/mdp3/Kconfig"
> diff --git a/drivers/media/platform/mediatek/Makefile b/drivers/media/platform/mediatek/Makefile
> index d3850a13f128..38e6ba917fe5 100644
> --- a/drivers/media/platform/mediatek/Makefile
> +++ b/drivers/media/platform/mediatek/Makefile
> @@ -3,3 +3,4 @@ obj-y += jpeg/
> obj-y += mdp/
> obj-y += vcodec/
> obj-y += vpu/
> +obj-y += mdp3/
> diff --git a/drivers/media/platform/mediatek/mdp3/Kconfig b/drivers/media/platform/mediatek/mdp3/Kconfig
> new file mode 100644
> index 000000000000..af371c17c386
> --- /dev/null
> +++ b/drivers/media/platform/mediatek/mdp3/Kconfig
> @@ -0,0 +1,20 @@
> +# SPDX-License-Identifier: GPL-2.0-only
> +config VIDEO_MEDIATEK_MDP3
> + tristate "MediaTek MDP v3 driver"
> + depends on MTK_IOMMU || COMPILE_TEST
> + depends on VIDEO_DEV
> + depends on ARCH_MEDIATEK || COMPILE_TEST
> + depends on HAS_DMA

A 'depends on REMOTEPROC' is missing here (see the 'kernel test robot' email
you received), but I have added that myself.

It's now in my for-v6.1c branch. If I don't see any new 'kernel test robot'
emails in the next few days, then I'll make a PR early next week.

Regards,

Hans

> + select VIDEOBUF2_DMA_CONTIG
> + select V4L2_MEM2MEM_DEV
> + select MTK_MMSYS
> + select VIDEO_MEDIATEK_VPU
> + select MTK_CMDQ
> + select MTK_SCP
> + default n
> + help
> + It is a v4l2 driver and present in MediaTek MT8183 SoC.
> + The driver supports scaling and color space conversion.
> +
> + To compile this driver as a module, choose M here: the
> + module will be called mtk-mdp3.