Message ID | 20220412103114.19922-8-jason-jh.lin@mediatek.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Add Mediatek Soc DRM (vdosys0) support for mt8195 | expand |
Hi "jason-jh.lin", Thank you for the patch! Perhaps something to improve: [auto build test WARNING on drm/drm-next] [also build test WARNING on robh/for-next krzk/for-next linus/master v5.18-rc2 next-20220414] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/intel-lab-lkp/linux/commits/jason-jh-lin/Add-Mediatek-Soc-DRM-vdosys0-support-for-mt8195/20220412-183359 base: git://anongit.freedesktop.org/drm/drm drm-next config: arm64-buildonly-randconfig-r001-20220413 (https://download.01.org/0day-ci/archive/20220414/202204142333.qXgcGMI1-lkp@intel.com/config) compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 6b7e6ea489f6dd45a9b0da9ac20871560917b9b0) reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # install arm64 cross compiling tool for clang build # apt-get install binutils-aarch64-linux-gnu # https://github.com/intel-lab-lkp/linux/commit/7c175317aa80bbc885609a730214448147a46b47 git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review jason-jh-lin/Add-Mediatek-Soc-DRM-vdosys0-support-for-mt8195/20220412-183359 git checkout 7c175317aa80bbc885609a730214448147a46b47 # save the config file to linux build tree mkdir build_dir COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=arm64 SHELL=/bin/bash drivers/gpu/drm/mediatek/ If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@intel.com> All warnings (new ones prefixed by >>): drivers/gpu/drm/mediatek/mtk_drm_drv.c:707:15: warning: cast to smaller integer type 'enum mtk_ddp_comp_type' from 'const void *' [-Wvoid-pointer-to-enum-cast] comp_type = (enum mtk_ddp_comp_type)of_id->data; ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >> drivers/gpu/drm/mediatek/mtk_drm_drv.c:203:42: warning: unused variable 'mt2701_mmsys_match_data' [-Wunused-const-variable] static const struct mtk_mmsys_match_data mt2701_mmsys_match_data = { ^ >> drivers/gpu/drm/mediatek/mtk_drm_drv.c:218:42: warning: unused variable 'mt7623_mmsys_match_data' [-Wunused-const-variable] static const struct mtk_mmsys_match_data mt7623_mmsys_match_data = { ^ >> drivers/gpu/drm/mediatek/mtk_drm_drv.c:234:42: warning: unused variable 'mt2712_mmsys_match_data' [-Wunused-const-variable] static const struct mtk_mmsys_match_data mt2712_mmsys_match_data = { ^ >> drivers/gpu/drm/mediatek/mtk_drm_drv.c:246:42: warning: unused variable 'mt8167_mmsys_match_data' [-Wunused-const-variable] static const struct mtk_mmsys_match_data mt8167_mmsys_match_data = { ^ >> drivers/gpu/drm/mediatek/mtk_drm_drv.c:260:42: warning: unused variable 'mt8173_mmsys_match_data' [-Wunused-const-variable] static const struct mtk_mmsys_match_data mt8173_mmsys_match_data = { ^ >> drivers/gpu/drm/mediatek/mtk_drm_drv.c:274:42: warning: unused variable 'mt8183_mmsys_match_data' [-Wunused-const-variable] static const struct mtk_mmsys_match_data mt8183_mmsys_match_data = { ^ >> drivers/gpu/drm/mediatek/mtk_drm_drv.c:288:42: warning: unused variable 'mt8192_mmsys_match_data' [-Wunused-const-variable] static const struct mtk_mmsys_match_data mt8192_mmsys_match_data = { ^ >> drivers/gpu/drm/mediatek/mtk_drm_drv.c:305:42: warning: unused variable 'mt8195_mmsys_match_data' [-Wunused-const-variable] static const struct mtk_mmsys_match_data mt8195_mmsys_match_data = { ^ 9 warnings generated. vim +/mt2701_mmsys_match_data +203 drivers/gpu/drm/mediatek/mtk_drm_drv.c 202 > 203 static const struct mtk_mmsys_match_data mt2701_mmsys_match_data = { 204 .num_drv_data = 1, 205 .drv_data = { 206 &mt2701_mmsys_driver_data, 207 }, 208 }; 209 210 static const struct mtk_mmsys_driver_data mt7623_mmsys_driver_data = { 211 .main_path = mt7623_mtk_ddp_main, 212 .main_len = ARRAY_SIZE(mt7623_mtk_ddp_main), 213 .ext_path = mt7623_mtk_ddp_ext, 214 .ext_len = ARRAY_SIZE(mt7623_mtk_ddp_ext), 215 .shadow_register = true, 216 }; 217 > 218 static const struct mtk_mmsys_match_data mt7623_mmsys_match_data = { 219 .num_drv_data = 1, 220 .drv_data = { 221 &mt7623_mmsys_driver_data, 222 }, 223 }; 224 225 static const struct mtk_mmsys_driver_data mt2712_mmsys_driver_data = { 226 .main_path = mt2712_mtk_ddp_main, 227 .main_len = ARRAY_SIZE(mt2712_mtk_ddp_main), 228 .ext_path = mt2712_mtk_ddp_ext, 229 .ext_len = ARRAY_SIZE(mt2712_mtk_ddp_ext), 230 .third_path = mt2712_mtk_ddp_third, 231 .third_len = ARRAY_SIZE(mt2712_mtk_ddp_third), 232 }; 233 > 234 static const struct mtk_mmsys_match_data mt2712_mmsys_match_data = { 235 .num_drv_data = 1, 236 .drv_data = { 237 &mt2712_mmsys_driver_data, 238 }, 239 }; 240 241 static const struct mtk_mmsys_driver_data mt8167_mmsys_driver_data = { 242 .main_path = mt8167_mtk_ddp_main, 243 .main_len = ARRAY_SIZE(mt8167_mtk_ddp_main), 244 }; 245 > 246 static const struct mtk_mmsys_match_data mt8167_mmsys_match_data = { 247 .num_drv_data = 1, 248 .drv_data = { 249 &mt8167_mmsys_driver_data, 250 }, 251 }; 252 253 static const struct mtk_mmsys_driver_data mt8173_mmsys_driver_data = { 254 .main_path = mt8173_mtk_ddp_main, 255 .main_len = ARRAY_SIZE(mt8173_mtk_ddp_main), 256 .ext_path = mt8173_mtk_ddp_ext, 257 .ext_len = ARRAY_SIZE(mt8173_mtk_ddp_ext), 258 }; 259 > 260 static const struct mtk_mmsys_match_data mt8173_mmsys_match_data = { 261 .num_drv_data = 1, 262 .drv_data = { 263 &mt8173_mmsys_driver_data, 264 }, 265 }; 266 267 static const struct mtk_mmsys_driver_data mt8183_mmsys_driver_data = { 268 .main_path = mt8183_mtk_ddp_main, 269 .main_len = ARRAY_SIZE(mt8183_mtk_ddp_main), 270 .ext_path = mt8183_mtk_ddp_ext, 271 .ext_len = ARRAY_SIZE(mt8183_mtk_ddp_ext), 272 }; 273 > 274 static const struct mtk_mmsys_match_data mt8183_mmsys_match_data = { 275 .num_drv_data = 1, 276 .drv_data = { 277 &mt8183_mmsys_driver_data, 278 }, 279 }; 280 281 static const struct mtk_mmsys_driver_data mt8192_mmsys_driver_data = { 282 .main_path = mt8192_mtk_ddp_main, 283 .main_len = ARRAY_SIZE(mt8192_mtk_ddp_main), 284 .ext_path = mt8192_mtk_ddp_ext, 285 .ext_len = ARRAY_SIZE(mt8192_mtk_ddp_ext), 286 }; 287 > 288 static const struct mtk_mmsys_match_data mt8192_mmsys_match_data = { 289 .num_drv_data = 1, 290 .drv_data = { 291 &mt8192_mmsys_driver_data, 292 }, 293 }; 294 295 static const struct mtk_mmsys_driver_data mt8195_vdosys0_driver_data = { 296 .io_start = 0x1c01a000, 297 .main_path = mt8195_mtk_ddp_main, 298 .main_len = ARRAY_SIZE(mt8195_mtk_ddp_main), 299 }; 300 301 static const struct mtk_mmsys_driver_data mt8195_vdosys1_driver_data = { 302 .io_start = 0x1c100000, 303 }; 304 > 305 static const struct mtk_mmsys_match_data mt8195_mmsys_match_data = { 306 .num_drv_data = 1, 307 .drv_data = { 308 &mt8195_vdosys0_driver_data, 309 &mt8195_vdosys1_driver_data, 310 }, 311 }; 312
Hi "kernel test robot", Thanks for the reviews. On Thu, 2022-04-14 at 23:31 +0800, kernel test robot wrote: > Hi "jason-jh.lin", > > Thank you for the patch! Perhaps something to improve: > > [auto build test WARNING on drm/drm-next] > [also build test WARNING on robh/for-next krzk/for-next linus/master > v5.18-rc2 next-20220414] > [If your patch is applied to the wrong git tree, kindly drop us a > note. > And when submitting patch, we suggest to use '--base' as documented > in > https://urldefense.com/v3/__https://git-scm.com/docs/git-format-patch__;!!CTRNKA9wMg0ARbw!1fp3H7fjidBzBzfT64rjyCv4-HN-czQi_52IEZTo18hsph4srdLAEfrGamKBaGS9DHJM$ > ] > > url: > https://urldefense.com/v3/__https://github.com/intel-lab-lkp/linux/commits/jason-jh-lin/Add-Mediatek-Soc-DRM-vdosys0-support-for-mt8195/20220412-183359__;!!CTRNKA9wMg0ARbw!1fp3H7fjidBzBzfT64rjyCv4-HN-czQi_52IEZTo18hsph4srdLAEfrGamKBaP5NY9rw$ > > base: git://anongit.freedesktop.org/drm/drm drm-next > config: arm64-buildonly-randconfig-r001-20220413 ( > https://urldefense.com/v3/__https://download.01.org/0day-ci/archive/20220414/202204142333.qXgcGMI1-lkp@intel.com/config__;!!CTRNKA9wMg0ARbw!1fp3H7fjidBzBzfT64rjyCv4-HN-czQi_52IEZTo18hsph4srdLAEfrGamKBaMatHhNq$ > ) > compiler: clang version 15.0.0 ( > https://urldefense.com/v3/__https://github.com/llvm/llvm-project__;!!CTRNKA9wMg0ARbw!1fp3H7fjidBzBzfT64rjyCv4-HN-czQi_52IEZTo18hsph4srdLAEfrGamKBaED4pz5K$ > $ 6b7e6ea489f6dd45a9b0da9ac20871560917b9b0) > reproduce (this is a W=1 build): > wget > https://urldefense.com/v3/__https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross__;!!CTRNKA9wMg0ARbw!1fp3H7fjidBzBzfT64rjyCv4-HN-czQi_52IEZTo18hsph4srdLAEfrGamKBaGF0WqUy$ > -O ~/bin/make.cross > chmod +x ~/bin/make.cross > # install arm64 cross compiling tool for clang build > # apt-get install binutils-aarch64-linux-gnu > # > https://urldefense.com/v3/__https://github.com/intel-lab-lkp/linux/commit/7c175317aa80bbc885609a730214448147a46b47__;!!CTRNKA9wMg0ARbw!1fp3H7fjidBzBzfT64rjyCv4-HN-czQi_52IEZTo18hsph4srdLAEfrGamKBaN_w7rr0$ > > git remote add linux-review > https://urldefense.com/v3/__https://github.com/intel-lab-lkp/linux__;!!CTRNKA9wMg0ARbw!1fp3H7fjidBzBzfT64rjyCv4-HN-czQi_52IEZTo18hsph4srdLAEfrGamKBaMen_Lno$ > > git fetch --no-tags linux-review jason-jh-lin/Add-Mediatek- > Soc-DRM-vdosys0-support-for-mt8195/20220412-183359 > git checkout 7c175317aa80bbc885609a730214448147a46b47 > # save the config file to linux build tree > mkdir build_dir > COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross > W=1 O=build_dir ARCH=arm64 SHELL=/bin/bash drivers/gpu/drm/mediatek/ > > If you fix the issue, kindly add following tag as appropriate > Reported-by: kernel test robot <lkp@intel.com> > > All warnings (new ones prefixed by >>): > > drivers/gpu/drm/mediatek/mtk_drm_drv.c:707:15: warning: cast to > smaller integer type 'enum mtk_ddp_comp_type' from 'const void *' [- > Wvoid-pointer-to-enum-cast] > comp_type = (enum mtk_ddp_comp_type)of_id->data; > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ I can't reproduce this build warning in my platform, but I'd found the same warning fixed patch: 20210928154620.11181-4-cgzones@googlemail.com It should not be fixed at this series. So I'll fixed this warning in another fixed patch. > > > drivers/gpu/drm/mediatek/mtk_drm_drv.c:203:42: warning: unused > > > variable 'mt2701_mmsys_match_data' [-Wunused-const-variable] > > static const struct mtk_mmsys_match_data mt2701_mmsys_match_data = > { > ^ > > > drivers/gpu/drm/mediatek/mtk_drm_drv.c:218:42: warning: unused > > > variable 'mt7623_mmsys_match_data' [-Wunused-const-variable] > > static const struct mtk_mmsys_match_data mt7623_mmsys_match_data = > { > ^ > > > drivers/gpu/drm/mediatek/mtk_drm_drv.c:234:42: warning: unused > > > variable 'mt2712_mmsys_match_data' [-Wunused-const-variable] > > static const struct mtk_mmsys_match_data mt2712_mmsys_match_data = > { > ^ > > > drivers/gpu/drm/mediatek/mtk_drm_drv.c:246:42: warning: unused > > > variable 'mt8167_mmsys_match_data' [-Wunused-const-variable] > > static const struct mtk_mmsys_match_data mt8167_mmsys_match_data = > { > ^ > > > drivers/gpu/drm/mediatek/mtk_drm_drv.c:260:42: warning: unused > > > variable 'mt8173_mmsys_match_data' [-Wunused-const-variable] > > static const struct mtk_mmsys_match_data mt8173_mmsys_match_data = > { > ^ > > > drivers/gpu/drm/mediatek/mtk_drm_drv.c:274:42: warning: unused > > > variable 'mt8183_mmsys_match_data' [-Wunused-const-variable] > > static const struct mtk_mmsys_match_data mt8183_mmsys_match_data = > { > ^ > > > drivers/gpu/drm/mediatek/mtk_drm_drv.c:288:42: warning: unused > > > variable 'mt8192_mmsys_match_data' [-Wunused-const-variable] > > static const struct mtk_mmsys_match_data mt8192_mmsys_match_data = > { > ^ > > > drivers/gpu/drm/mediatek/mtk_drm_drv.c:305:42: warning: unused > > > variable 'mt8195_mmsys_match_data' [-Wunused-const-variable] > > static const struct mtk_mmsys_match_data mt8195_mmsys_match_data = > { Oh, I forgot to replace the driver_data to match_data in mtk_drm_of_ids table. I'll fix them at the next version. Regards, Jason-JH.Lin
diff --git a/drivers/gpu/drm/mediatek/mtk_disp_rdma.c b/drivers/gpu/drm/mediatek/mtk_disp_rdma.c index 662e91d9d45f..8ce60371536e 100644 --- a/drivers/gpu/drm/mediatek/mtk_disp_rdma.c +++ b/drivers/gpu/drm/mediatek/mtk_disp_rdma.c @@ -364,6 +364,10 @@ static const struct mtk_disp_rdma_data mt8192_rdma_driver_data = { .fifo_size = 5 * SZ_1K, }; +static const struct mtk_disp_rdma_data mt8195_rdma_driver_data = { + .fifo_size = 1920, +}; + static const struct of_device_id mtk_disp_rdma_driver_dt_match[] = { { .compatible = "mediatek,mt2701-disp-rdma", .data = &mt2701_rdma_driver_data}, @@ -373,6 +377,8 @@ static const struct of_device_id mtk_disp_rdma_driver_dt_match[] = { .data = &mt8183_rdma_driver_data}, { .compatible = "mediatek,mt8192-disp-rdma", .data = &mt8192_rdma_driver_data}, + { .compatible = "mediatek,mt8195-disp-rdma", + .data = &mt8195_rdma_driver_data}, {}, }; MODULE_DEVICE_TABLE(of, mtk_disp_rdma_driver_dt_match); diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c index f54b650a2ea1..1b5bef25d17b 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c @@ -4,6 +4,8 @@ * Author: YT SHEN <yt.shen@mediatek.com> */ +#include <linux/clk.h> +#include <linux/clk-provider.h> #include <linux/component.h> #include <linux/iommu.h> #include <linux/module.h> @@ -177,6 +179,19 @@ static const enum mtk_ddp_comp_id mt8192_mtk_ddp_ext[] = { DDP_COMPONENT_DPI0, }; +static const enum mtk_ddp_comp_id mt8195_mtk_ddp_main[] = { + DDP_COMPONENT_OVL0, + DDP_COMPONENT_RDMA0, + DDP_COMPONENT_COLOR0, + DDP_COMPONENT_CCORR, + DDP_COMPONENT_AAL0, + DDP_COMPONENT_GAMMA, + DDP_COMPONENT_DITHER, + DDP_COMPONENT_DSC0, + DDP_COMPONENT_MERGE0, + DDP_COMPONENT_DP_INTF0, +}; + static const struct mtk_mmsys_driver_data mt2701_mmsys_driver_data = { .main_path = mt2701_mtk_ddp_main, .main_len = ARRAY_SIZE(mt2701_mtk_ddp_main), @@ -185,6 +200,13 @@ static const struct mtk_mmsys_driver_data mt2701_mmsys_driver_data = { .shadow_register = true, }; +static const struct mtk_mmsys_match_data mt2701_mmsys_match_data = { + .num_drv_data = 1, + .drv_data = { + &mt2701_mmsys_driver_data, + }, +}; + static const struct mtk_mmsys_driver_data mt7623_mmsys_driver_data = { .main_path = mt7623_mtk_ddp_main, .main_len = ARRAY_SIZE(mt7623_mtk_ddp_main), @@ -193,6 +215,13 @@ static const struct mtk_mmsys_driver_data mt7623_mmsys_driver_data = { .shadow_register = true, }; +static const struct mtk_mmsys_match_data mt7623_mmsys_match_data = { + .num_drv_data = 1, + .drv_data = { + &mt7623_mmsys_driver_data, + }, +}; + static const struct mtk_mmsys_driver_data mt2712_mmsys_driver_data = { .main_path = mt2712_mtk_ddp_main, .main_len = ARRAY_SIZE(mt2712_mtk_ddp_main), @@ -202,11 +231,25 @@ static const struct mtk_mmsys_driver_data mt2712_mmsys_driver_data = { .third_len = ARRAY_SIZE(mt2712_mtk_ddp_third), }; +static const struct mtk_mmsys_match_data mt2712_mmsys_match_data = { + .num_drv_data = 1, + .drv_data = { + &mt2712_mmsys_driver_data, + }, +}; + static const struct mtk_mmsys_driver_data mt8167_mmsys_driver_data = { .main_path = mt8167_mtk_ddp_main, .main_len = ARRAY_SIZE(mt8167_mtk_ddp_main), }; +static const struct mtk_mmsys_match_data mt8167_mmsys_match_data = { + .num_drv_data = 1, + .drv_data = { + &mt8167_mmsys_driver_data, + }, +}; + static const struct mtk_mmsys_driver_data mt8173_mmsys_driver_data = { .main_path = mt8173_mtk_ddp_main, .main_len = ARRAY_SIZE(mt8173_mtk_ddp_main), @@ -214,6 +257,13 @@ static const struct mtk_mmsys_driver_data mt8173_mmsys_driver_data = { .ext_len = ARRAY_SIZE(mt8173_mtk_ddp_ext), }; +static const struct mtk_mmsys_match_data mt8173_mmsys_match_data = { + .num_drv_data = 1, + .drv_data = { + &mt8173_mmsys_driver_data, + }, +}; + static const struct mtk_mmsys_driver_data mt8183_mmsys_driver_data = { .main_path = mt8183_mtk_ddp_main, .main_len = ARRAY_SIZE(mt8183_mtk_ddp_main), @@ -221,6 +271,13 @@ static const struct mtk_mmsys_driver_data mt8183_mmsys_driver_data = { .ext_len = ARRAY_SIZE(mt8183_mtk_ddp_ext), }; +static const struct mtk_mmsys_match_data mt8183_mmsys_match_data = { + .num_drv_data = 1, + .drv_data = { + &mt8183_mmsys_driver_data, + }, +}; + static const struct mtk_mmsys_driver_data mt8192_mmsys_driver_data = { .main_path = mt8192_mtk_ddp_main, .main_len = ARRAY_SIZE(mt8192_mtk_ddp_main), @@ -228,6 +285,31 @@ static const struct mtk_mmsys_driver_data mt8192_mmsys_driver_data = { .ext_len = ARRAY_SIZE(mt8192_mtk_ddp_ext), }; +static const struct mtk_mmsys_match_data mt8192_mmsys_match_data = { + .num_drv_data = 1, + .drv_data = { + &mt8192_mmsys_driver_data, + }, +}; + +static const struct mtk_mmsys_driver_data mt8195_vdosys0_driver_data = { + .io_start = 0x1c01a000, + .main_path = mt8195_mtk_ddp_main, + .main_len = ARRAY_SIZE(mt8195_mtk_ddp_main), +}; + +static const struct mtk_mmsys_driver_data mt8195_vdosys1_driver_data = { + .io_start = 0x1c100000, +}; + +static const struct mtk_mmsys_match_data mt8195_mmsys_match_data = { + .num_drv_data = 1, + .drv_data = { + &mt8195_vdosys0_driver_data, + &mt8195_vdosys1_driver_data, + }, +}; + static int mtk_drm_kms_init(struct drm_device *drm) { struct mtk_drm_private *private = drm->dev_private; @@ -445,12 +527,16 @@ static const struct of_device_id mtk_ddp_comp_dt_ids[] = { .data = (void *)MTK_DISP_DITHER }, { .compatible = "mediatek,mt8183-disp-dither", .data = (void *)MTK_DISP_DITHER }, + { .compatible = "mediatek,mt8195-disp-dsc", + .data = (void *)MTK_DISP_DSC }, { .compatible = "mediatek,mt8167-disp-gamma", .data = (void *)MTK_DISP_GAMMA, }, { .compatible = "mediatek,mt8173-disp-gamma", .data = (void *)MTK_DISP_GAMMA, }, { .compatible = "mediatek,mt8183-disp-gamma", .data = (void *)MTK_DISP_GAMMA, }, + { .compatible = "mediatek,mt8195-disp-merge", + .data = (void *)MTK_DISP_MERGE }, { .compatible = "mediatek,mt2701-disp-mutex", .data = (void *)MTK_DISP_MUTEX }, { .compatible = "mediatek,mt2712-disp-mutex", @@ -463,6 +549,8 @@ static const struct of_device_id mtk_ddp_comp_dt_ids[] = { .data = (void *)MTK_DISP_MUTEX }, { .compatible = "mediatek,mt8192-disp-mutex", .data = (void *)MTK_DISP_MUTEX }, + { .compatible = "mediatek,mt8195-disp-mutex", + .data = (void *)MTK_DISP_MUTEX }, { .compatible = "mediatek,mt8173-disp-od", .data = (void *)MTK_DISP_OD }, { .compatible = "mediatek,mt2701-disp-ovl", @@ -497,6 +585,8 @@ static const struct of_device_id mtk_ddp_comp_dt_ids[] = { .data = (void *)MTK_DISP_RDMA }, { .compatible = "mediatek,mt8192-disp-rdma", .data = (void *)MTK_DISP_RDMA }, + { .compatible = "mediatek,mt8195-disp-rdma", + .data = (void *)MTK_DISP_RDMA }, { .compatible = "mediatek,mt8173-disp-ufoe", .data = (void *)MTK_DISP_UFOE }, { .compatible = "mediatek,mt8173-disp-wdma", @@ -533,15 +623,37 @@ static const struct of_device_id mtk_drm_of_ids[] = { .data = &mt8183_mmsys_driver_data}, { .compatible = "mediatek,mt8192-mmsys", .data = &mt8192_mmsys_driver_data}, + { .compatible = "mediatek,mt8195-mmsys"}, { } }; MODULE_DEVICE_TABLE(of, mtk_drm_of_ids); +static int mtk_drm_find_match_data(struct device *dev, + const struct mtk_mmsys_match_data *match_data) +{ + int i; + struct platform_device *pdev = of_find_device_by_node(dev->parent->of_node); + struct resource *res; + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (IS_ERR(res)) { + dev_err(dev, "failed to get mmsys resource\n"); + return PTR_ERR(res); + } + + for (i = 0; i < match_data->num_drv_data; i++) + if (match_data->drv_data[i]->io_start == res->start) + return i; + + return -EINVAL; +} + static int mtk_drm_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct device_node *phandle = dev->parent->of_node; const struct of_device_id *of_id; + const struct mtk_mmsys_match_data *match_data; struct mtk_drm_private *private; struct device_node *node; struct component_match *match = NULL; @@ -562,7 +674,19 @@ static int mtk_drm_probe(struct platform_device *pdev) if (!of_id) return -ENODEV; - private->data = of_id->data; + match_data = of_id->data; + if (match_data->num_drv_data > 1) { + /* This SoC has multiple mmsys channels */ + ret = mtk_drm_find_match_data(dev, match_data); + if (ret < 0) { + dev_err(dev, "Couldn't get match driver data\n"); + return ret; + } + private->data = match_data->drv_data[ret]; + } else { + dev_dbg(dev, "Using single mmsys channel\n"); + private->data = match_data->drv_data[0]; + } /* Iterate over sibling DISP function blocks */ for_each_child_of_node(phandle->parent, node) { diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.h b/drivers/gpu/drm/mediatek/mtk_drm_drv.h index a58cebd01d35..e1a37ca091f3 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.h +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.h @@ -21,6 +21,7 @@ struct drm_property; struct regmap; struct mtk_mmsys_driver_data { + const unsigned int io_start; const enum mtk_ddp_comp_id *main_path; unsigned int main_len; const enum mtk_ddp_comp_id *ext_path; @@ -31,6 +32,11 @@ struct mtk_mmsys_driver_data { bool shadow_register; }; +struct mtk_mmsys_match_data { + unsigned short num_drv_data; + const struct mtk_mmsys_driver_data *drv_data[]; +}; + struct mtk_drm_private { struct drm_device *drm; struct device *dma_dev;
1. Add driver data of mt8195 vdosys0 to mediatek-drm and the sub driver. 2. Add get driver data function to identify which vdosys by io_start. Signed-off-by: jason-jh.lin <jason-jh.lin@mediatek.com> --- drivers/gpu/drm/mediatek/mtk_disp_rdma.c | 6 ++ drivers/gpu/drm/mediatek/mtk_drm_drv.c | 126 ++++++++++++++++++++++- drivers/gpu/drm/mediatek/mtk_drm_drv.h | 6 ++ 3 files changed, 137 insertions(+), 1 deletion(-)