Re: [PATCH v5 02/12] media: platform: mtk-mdp3: add chip configuration header file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2023-01-23 at 16:01 +0100, Hans Verkuil wrote:
> On 13/01/2023 07:40, Moudy Ho wrote:
> > In order to be compatible with more MDP3 chip settings in the
> > future,
> > move the chip-related configuration to a separate header file.
> > 
> > Signed-off-by: Moudy Ho <moudy.ho@xxxxxxxxxxxx>
> > ---
> >  .../mediatek/mdp3/mt8183/mdp3-plat-mt8183.h   | 35
> > +++++++++++++++++++
> >  .../platform/mediatek/mdp3/mtk-mdp3-core.c    | 27 ++------------
> >  2 files changed, 37 insertions(+), 25 deletions(-)
> >  create mode 100644
> > drivers/media/platform/mediatek/mdp3/mt8183/mdp3-plat-mt8183.h
> > 
> > diff --git a/drivers/media/platform/mediatek/mdp3/mt8183/mdp3-plat-
> > mt8183.h b/drivers/media/platform/mediatek/mdp3/mt8183/mdp3-plat-
> > mt8183.h
> > new file mode 100644
> > index 000000000000..3084f62e7df5
> > --- /dev/null
> > +++ b/drivers/media/platform/mediatek/mdp3/mt8183/mdp3-plat-
> > mt8183.h
> > @@ -0,0 +1,35 @@
> > +/* SPDX-License-Identifier: GPL-2.0-only */
> > +/*
> > + * Copyright (c) 2022 MediaTek Inc.
> > + * Author: Ping-Hsun Wu <ping-hsun.wu@xxxxxxxxxxxx>
> > + */
> > +
> > +#ifndef __MDP3_PLAT_MT8183_H__
> > +#define __MDP3_PLAT_MT8183_H__
> > +
> > +static const struct mdp_platform_config mt8183_plat_cfg = {
> > +	.rdma_support_10bit		= true,
> > +	.rdma_rsz1_sram_sharing		= true,
> > +	.rdma_upsample_repeat_only	= true,
> > +	.rsz_disable_dcm_small_sample	= false,
> > +	.wrot_filter_constraint		= false,
> > +};
> > +
> > +static const struct of_device_id
> > mt8183_mdp_probe_infra[MDP_INFRA_MAX] = {
> > +	[MDP_INFRA_MMSYS] = { .compatible = "mediatek,mt8183-mmsys" },
> > +	[MDP_INFRA_MUTEX] = { .compatible = "mediatek,mt8183-disp-
> > mutex" },
> > +	[MDP_INFRA_SCP] = { .compatible = "mediatek,mt8183-scp" }
> > +};
> > +
> > +static const u32 mt8183_mutex_idx[MDP_MAX_COMP_COUNT] = {
> > +	[MDP_COMP_RDMA0] = MUTEX_MOD_IDX_MDP_RDMA0,
> > +	[MDP_COMP_RSZ0] = MUTEX_MOD_IDX_MDP_RSZ0,
> > +	[MDP_COMP_RSZ1] = MUTEX_MOD_IDX_MDP_RSZ1,
> > +	[MDP_COMP_TDSHP0] = MUTEX_MOD_IDX_MDP_TDSHP0,
> > +	[MDP_COMP_WROT0] = MUTEX_MOD_IDX_MDP_WROT0,
> > +	[MDP_COMP_WDMA] = MUTEX_MOD_IDX_MDP_WDMA,
> > +	[MDP_COMP_AAL0] = MUTEX_MOD_IDX_MDP_AAL0,
> > +	[MDP_COMP_CCORR0] = MUTEX_MOD_IDX_MDP_CCORR0,
> > +};
> 
> I am really not keen on storing variable declarations in a header.
> This belongs
> in a source.
> 
> What you typically do is put this in a source together with the
> declaration
> of the mt8183_mdp_driver_data struct for the chip config, and just
> export that
> top-level struct as an extern.
> 
> An example of how to do this is
> drivers/media/platform/verisilicon/imx8m_vpu_hw.c.
> 
> Regards,
> 
> 	Hans
> 

Hi Hans,

Thanks for taking the time to advise, I'll make corresponding
adjustments in the next version.

Sincerely,
Moudy

> > ++#endif  /* __MDP3_PLAT_MT8183_H__ */
> > diff --git a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c
> > b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c
> > index 2d1f6ae9f080..658037d06250 100644
> > --- a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c
> > +++ b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c
> > @@ -12,33 +12,10 @@
> >  #include <linux/remoteproc.h>
> >  #include <linux/remoteproc/mtk_scp.h>
> >  #include <media/videobuf2-dma-contig.h>
> > +
> >  #include "mtk-mdp3-core.h"
> >  #include "mtk-mdp3-m2m.h"
> > -
> > -static const struct mdp_platform_config mt8183_plat_cfg = {
> > -	.rdma_support_10bit		= true,
> > -	.rdma_rsz1_sram_sharing		= true,
> > -	.rdma_upsample_repeat_only	= true,
> > -	.rsz_disable_dcm_small_sample	= false,
> > -	.wrot_filter_constraint		= false,
> > -};
> > -
> > -static const struct of_device_id
> > mt8183_mdp_probe_infra[MDP_INFRA_MAX] = {
> > -	[MDP_INFRA_MMSYS] = { .compatible = "mediatek,mt8183-mmsys" },
> > -	[MDP_INFRA_MUTEX] = { .compatible = "mediatek,mt8183-disp-
> > mutex" },
> > -	[MDP_INFRA_SCP] = { .compatible = "mediatek,mt8183-scp" }
> > -};
> > -
> > -static const u32 mt8183_mutex_idx[MDP_MAX_COMP_COUNT] = {
> > -	[MDP_COMP_RDMA0] = MUTEX_MOD_IDX_MDP_RDMA0,
> > -	[MDP_COMP_RSZ0] = MUTEX_MOD_IDX_MDP_RSZ0,
> > -	[MDP_COMP_RSZ1] = MUTEX_MOD_IDX_MDP_RSZ1,
> > -	[MDP_COMP_TDSHP0] = MUTEX_MOD_IDX_MDP_TDSHP0,
> > -	[MDP_COMP_WROT0] = MUTEX_MOD_IDX_MDP_WROT0,
> > -	[MDP_COMP_WDMA] = MUTEX_MOD_IDX_MDP_WDMA,
> > -	[MDP_COMP_AAL0] = MUTEX_MOD_IDX_MDP_AAL0,
> > -	[MDP_COMP_CCORR0] = MUTEX_MOD_IDX_MDP_CCORR0,
> > -};
> > +#include "mt8183/mdp3-plat-mt8183.h"
> >  
> >  static const struct mtk_mdp_driver_data mt8183_mdp_driver_data = {
> >  	.mdp_probe_infra = mt8183_mdp_probe_infra,
> 
> Appreciate for the time and advice, I'll make corresponding adjust in
> the next version.




[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux