Re: [PATCH v4 7/7] drm/mediatek: Add mt8195 DisplayPort driver
Hi Markus, Thank you for the patch! Yet something to improve: [auto build test ERROR on robh/for-next] [also build test ERROR on pza/reset/next linus/master v5.15-rc5 next-20211011] [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/0day-ci/linux/commits/Markus-Schneider-Pargmann/drm-mediatek-Add-mt8195-DisplayPort-driver/20211011-174743 base: https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next config: arm-allyesconfig (attached as .config) compiler: arm-linux-gnueabi-gcc (GCC) 11.2.0 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 # https://github.com/0day-ci/linux/commit/dbbfbf0abd862cfc9b617b8a770a10a18d0183a9 git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Markus-Schneider-Pargmann/drm-mediatek-Add-mt8195-DisplayPort-driver/20211011-174743 git checkout dbbfbf0abd862cfc9b617b8a770a10a18d0183a9 # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=arm If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot All errors (new ones prefixed by >>): >> drivers/gpu/drm/mediatek/mtk_dp.c:1031:6: error: no previous prototype for >> 'mtk_dp_initialize_settings' [-Werror=missing-prototypes] 1031 | void mtk_dp_initialize_settings(struct mtk_dp *mtk_dp) | ^~ In file included from include/linux/device.h:15, from include/linux/acpi.h:15, from include/linux/i2c.h:13, from include/drm/drm_crtc.h:28, from include/drm/drm_atomic_helper.h:31, from drivers/gpu/drm/mediatek/mtk_dp.c:7: drivers/gpu/drm/mediatek/mtk_dp.c: In function 'mtk_dp_hpd_sink_event': >> include/drm/drm_print.h:412:39: error: format '%ld' expects argument of type >> 'long int', but argument 3 has type 'ssize_t' {aka 'int'} [-Werror=format=] 412 | dev_##level##type((drm)->dev, "[drm] " fmt, ##__VA_ARGS__) | ^~~~ include/linux/dev_printk.h:110:30: note: in definition of macro 'dev_printk_index_wrap' 110 | _p_func(dev, fmt, ##__VA_ARGS__); \ | ^~~ include/linux/dev_printk.h:150:58: note: in expansion of macro 'dev_fmt' 150 | dev_printk_index_wrap(_dev_info, KERN_INFO, dev, dev_fmt(fmt), ##__VA_ARGS__) | ^~~ include/drm/drm_print.h:412:9: note: in expansion of macro 'dev_info' 412 | dev_##level##type((drm)->dev, "[drm] " fmt, ##__VA_ARGS__) | ^~~~ include/drm/drm_print.h:416:9: note: in expansion of macro '__drm_printk' 416 | __drm_printk((drm), info,, fmt, ##__VA_ARGS__) | ^~~~ drivers/gpu/drm/mediatek/mtk_dp.c:1445:17: note: in expansion of macro 'drm_info' 1445 | drm_info(mtk_dp->drm_dev, | ^~~~ >> include/drm/drm_print.h:412:39: error: format '%ld' expects argument of type >> 'long int', but argument 3 has type 'ssize_t' {aka 'int'} [-Werror=format=] 412 | dev_##level##type((drm)->dev, "[drm] " fmt, ##__VA_ARGS__) | ^~~~ include/linux/dev_printk.h:110:30: note: in definition of macro 'dev_printk_index_wrap' 110 | _p_func(dev, fmt, ##__VA_ARGS__); \ | ^~~ include/linux/dev_printk.h:150:58: note: in expansion of macro 'dev_fmt' 150 | dev_printk_index_wrap(_dev_info, KERN_INFO, dev, dev_fmt(fmt), ##__VA_ARGS__) | ^~~ include/drm/drm_print.h:412:9: note: in expansion of macro 'dev_info' 412 | dev_##level##type((drm)->dev, "[drm] " fmt, ##__VA_ARGS__) | ^~~~ include/drm/drm_print.h:416:9: note: in expansion of macro '__drm_printk' 416 | __drm_printk((drm), info,, fmt, ##__VA_ARGS__) | ^~~~ drivers/gpu/drm/mediatek/mtk_dp.c:1452:17: note: in expansion of macro 'drm_info' 1452 | drm_info(mtk_dp->drm_dev, | ^~~~ >> include/drm/drm_print.h:412:39: error: format '%ld' expects argument of type >> 'long int', but argument 3 has type 'ssize_t' {aka 'int'} [-Werror=format=] 412 | dev_##level##type((drm)->dev, "[drm] " fmt, ##__VA_ARGS__) |
Re: [PATCH v4 7/7] drm/mediatek: Add mt8195 DisplayPort driver
Hi Markus, Thank you for the patch! Yet something to improve: [auto build test ERROR on robh/for-next] [also build test ERROR on pza/reset/next linus/master v5.15-rc5 next-20211011] [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/0day-ci/linux/commits/Markus-Schneider-Pargmann/drm-mediatek-Add-mt8195-DisplayPort-driver/20211011-174743 base: https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next config: arm64-randconfig-r025-20211011 (attached as .config) compiler: aarch64-linux-gcc (GCC) 11.2.0 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 # https://github.com/0day-ci/linux/commit/dbbfbf0abd862cfc9b617b8a770a10a18d0183a9 git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Markus-Schneider-Pargmann/drm-mediatek-Add-mt8195-DisplayPort-driver/20211011-174743 git checkout dbbfbf0abd862cfc9b617b8a770a10a18d0183a9 # save the attached .config to linux build tree mkdir build_dir COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=arm64 SHELL=/bin/bash If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot All errors (new ones prefixed by >>): aarch64-linux-ld: Unexpected GOT/PLT entries detected! aarch64-linux-ld: Unexpected run-time procedure linkages detected! aarch64-linux-ld: drivers/gpu/drm/drm_fb_helper.o: in function `drm_fb_helper_set_suspend': drm_fb_helper.c:(.text+0x25c): undefined reference to `fb_set_suspend' aarch64-linux-ld: drivers/gpu/drm/drm_fb_helper.o: in function `drm_fb_helper_resume_worker': drm_fb_helper.c:(.text+0x28c): undefined reference to `fb_set_suspend' aarch64-linux-ld: drivers/gpu/drm/drm_fb_helper.o: in function `drm_fb_helper_unregister_fbi': drm_fb_helper.c:(.text+0x2b4): undefined reference to `unregister_framebuffer' aarch64-linux-ld: drivers/gpu/drm/drm_fb_helper.o: in function `drm_fb_helper_sys_read': drm_fb_helper.c:(.text+0x2cc): undefined reference to `fb_sys_read' aarch64-linux-ld: drivers/gpu/drm/drm_fb_helper.o: in function `drm_fb_helper_fini': drm_fb_helper.c:(.text+0xde4): undefined reference to `framebuffer_release' aarch64-linux-ld: drm_fb_helper.c:(.text+0xe58): undefined reference to `fb_dealloc_cmap' aarch64-linux-ld: drivers/gpu/drm/drm_fb_helper.o: in function `drm_fb_helper_alloc_fbi': drm_fb_helper.c:(.text+0xfa4): undefined reference to `framebuffer_alloc' aarch64-linux-ld: drm_fb_helper.c:(.text+0xfc0): undefined reference to `fb_alloc_cmap' aarch64-linux-ld: drm_fb_helper.c:(.text+0xfd0): undefined reference to `framebuffer_release' aarch64-linux-ld: drm_fb_helper.c:(.text+0x1034): undefined reference to `fb_dealloc_cmap' aarch64-linux-ld: drivers/gpu/drm/drm_fb_helper.o: in function `__drm_fb_helper_initial_config_and_unlock': drm_fb_helper.c:(.text+0x10d8): undefined reference to `register_framebuffer' aarch64-linux-ld: drivers/gpu/drm/drm_fb_helper.o: in function `drm_fb_helper_generic_probe': drm_fb_helper.c:(.text+0x175c): undefined reference to `fb_deferred_io_init' aarch64-linux-ld: drivers/gpu/drm/drm_fb_helper.o: in function `drm_fb_helper_set_suspend_unlocked': drm_fb_helper.c:(.text+0x1868): undefined reference to `fb_set_suspend' aarch64-linux-ld: drivers/gpu/drm/drm_fb_helper.o: in function `drm_fbdev_cleanup': drm_fb_helper.c:(.text+0x1b30): undefined reference to `fb_deferred_io_cleanup' aarch64-linux-ld: drivers/gpu/drm/drm_fb_helper.o: in function `drm_fbdev_client_unregister': drm_fb_helper.c:(.text+0x1bd4): undefined reference to `unregister_framebuffer' aarch64-linux-ld: drivers/gpu/drm/drm_fb_helper.o: in function `drm_fb_helper_cfb_imageblit': drm_fb_helper.c:(.text+0x2aa8): undefined reference to `cfb_imageblit' aarch64-linux-ld: drivers/gpu/drm/drm_fb_helper.o: in function `drm_fb_helper_cfb_copyarea': drm_fb_helper.c:(.text+0x2ae4): undefined reference to `cfb_copyarea' aarch64-linux-ld: drivers/gpu/drm/drm_fb_helper.o: in function `drm_fb_helper_cfb_fillrect': drm_fb_helper.c:(.text+0x2b18): undefined reference to `cfb_fillrect' aarch64-linux-ld: drivers/gpu/drm/drm_fb_helper.o: in function `drm_fb_helper_sys_imageblit': drm_fb_helper.c:(.text+0x2b54): undefined reference to `sys_imageblit' aarch64-linux-ld: drivers/gpu/drm/drm_fb_helper.o: in function `drm_fb_helper_sys_copyarea': drm_fb_helper.c:(.text+0x2b88): undefined reference to `sys_copyarea' aarch64-linux-ld: drivers/gpu/drm/drm_fb_helper.o: in function `drm_fb_helper_sys_fillrect': drm_fb_helper.c:(.text+0x2bc4): undefined reference to `sys_fillre
Re: [PATCH v4 7/7] drm/mediatek: Add mt8195 DisplayPort driver
Hi Markus, Thank you for the patch! Yet something to improve: [auto build test ERROR on robh/for-next] [also build test ERROR on pza/reset/next linus/master v5.15-rc5 next-20211011] [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/0day-ci/linux/commits/Markus-Schneider-Pargmann/drm-mediatek-Add-mt8195-DisplayPort-driver/20211011-174743 base: https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux.git for-next config: arm64-randconfig-r005-20211011 (attached as .config) compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project f95d9c95bbf4cf662b9a181245fc6dcede39f590) 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/0day-ci/linux/commit/dbbfbf0abd862cfc9b617b8a770a10a18d0183a9 git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Markus-Schneider-Pargmann/drm-mediatek-Add-mt8195-DisplayPort-driver/20211011-174743 git checkout dbbfbf0abd862cfc9b617b8a770a10a18d0183a9 # save the attached .config 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 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot All errors (new ones prefixed by >>): >> ld.lld: error: undefined symbol: mtk_dp_driver >>> referenced by mtk_drm_drv.c >>> gpu/drm/mediatek/mtk_drm_drv.o:(mtk_drm_drivers) in archive drivers/built-in.a >>> did you mean: mtk_dpi_driver >>> defined in: drivers/built-in.a(gpu/drm/mediatek/mtk_dpi.o) --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-...@lists.01.org .config.gz Description: application/gzip
[PATCH v4 7/7] drm/mediatek: Add mt8195 DisplayPort driver
This patch adds a DisplayPort driver for the Mediatek mt8195 SoC and a according phy driver mediatek-dp-phy. It supports both functional units on the mt8195, the embedded DisplayPort as well as the external DisplayPort units. It offers hot-plug-detection, audio up to 8 channels, and DisplayPort 1.4 with up to 4 lanes. The driver creates a child device for the phy. The child device will never exist without the parent being active. As they are sharing a register range, the parent passes a regmap pointer to the child so that both can work with the same register range. The phy driver sets device data that is read by the parent to get the phy device that can be used to control the phy properties. This driver is based on an initial version by Jason-JH.Lin . Signed-off-by: Markus Schneider-Pargmann --- Notes: Changes v2 -> v3: - Solve TODOs and add defines for undescribed registers - Remove TODOs that were irrelevant Changes v1 -> v2: - Fix checkpatch --strict suggestions - General cleanups of the code. - Remove all remaining non-atomic functions. - Remove unused includes and sort them. - Remove unused select GENERIC_PHY - Rename phy registers DP_PHY -> MTK_DP_PHY - Replace usage of delays with usleep_range. - Split the phy register accesses into a separate phy driver. - Use a lock to guard access to mtk_dp->edid as it can be allocated/used/freed in different threads - use struct dp_sdp for sdp packets. Changes RFC -> v1: - Removed unused register definitions. - Replaced workqueue with threaded irq. - Removed connector code. - Move to atomic_* drm functions. - General cleanups of the code. - Remove unused select GENERIC_PHY. drivers/gpu/drm/mediatek/Kconfig |7 + drivers/gpu/drm/mediatek/Makefile |2 + drivers/gpu/drm/mediatek/mtk_dp.c | 2825 drivers/gpu/drm/mediatek/mtk_dp_reg.h | 535 + drivers/gpu/drm/mediatek/mtk_drm_drv.c |1 + drivers/gpu/drm/mediatek/mtk_drm_drv.h |1 + 6 files changed, 3371 insertions(+) create mode 100644 drivers/gpu/drm/mediatek/mtk_dp.c create mode 100644 drivers/gpu/drm/mediatek/mtk_dp_reg.h diff --git a/drivers/gpu/drm/mediatek/Kconfig b/drivers/gpu/drm/mediatek/Kconfig index 2976d21e9a34..029b94c71613 100644 --- a/drivers/gpu/drm/mediatek/Kconfig +++ b/drivers/gpu/drm/mediatek/Kconfig @@ -28,3 +28,10 @@ config DRM_MEDIATEK_HDMI select PHY_MTK_HDMI help DRM/KMS HDMI driver for Mediatek SoCs + +config MTK_DPTX_SUPPORT + tristate "DRM DPTX Support for Mediatek SoCs" + depends on DRM_MEDIATEK + select PHY_MTK_DP + help + DRM/KMS Display Port driver for Mediatek SoCs. diff --git a/drivers/gpu/drm/mediatek/Makefile b/drivers/gpu/drm/mediatek/Makefile index 29098d7c8307..d86a6406055e 100644 --- a/drivers/gpu/drm/mediatek/Makefile +++ b/drivers/gpu/drm/mediatek/Makefile @@ -21,3 +21,5 @@ mediatek-drm-hdmi-objs := mtk_cec.o \ mtk_hdmi_ddc.o obj-$(CONFIG_DRM_MEDIATEK_HDMI) += mediatek-drm-hdmi.o + +obj-$(CONFIG_MTK_DPTX_SUPPORT) += mtk_dp.o diff --git a/drivers/gpu/drm/mediatek/mtk_dp.c b/drivers/gpu/drm/mediatek/mtk_dp.c new file mode 100644 index ..8a5d03b8c5ff --- /dev/null +++ b/drivers/gpu/drm/mediatek/mtk_dp.c @@ -0,0 +1,2825 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2019 MediaTek Inc. + * Copyright (c) 2021 BayLibre + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "mtk_dp_reg.h" + +#define MTK_DP_AUX_WAIT_REPLY_COUNT2 +#define MTK_DP_CHECK_SINK_CAP_TIMEOUT_COUNT3 + +#define MTK_DP_MAX_LANES 4 +#define MTK_DP_MAX_LINK_RATE MTK_DP_LINKRATE_HBR3 + +#define MTK_DP_TBC_BUF_READ_START_ADDR 0x08 + +#define MTK_DP_TRAIN_RETRY_LIMIT 8 +#define MTK_DP_TRAIN_MAX_ITERATIONS5 + +#define MTK_DP_AUX_WRITE_READ_WAIT_TIME_US 20 + +#define MTK_DP_DP_VERSION_11 0x11 + +enum mtk_dp_state { + MTK_DP_STATE_INITIAL, + MTK_DP_STATE_IDLE, + MTK_DP_STATE_PREPARE, + MTK_DP_STATE_NORMAL, +}; + +enum mtk_dp_train_state { + MTK_DP_TRAIN_STATE_STARTUP = 0, + MTK_DP_TRAIN_STATE_CHECKCAP, + MTK_DP_TRAIN_STATE_CHECKEDID, + MTK_DP_TRAIN_STATE_TRAINING_PRE, + MTK_DP_TRAIN_STATE_TRAINING, + MTK_DP_TRAIN_STATE_CHECKTIMING, + MTK_DP_TRAIN_STATE_NORMAL, + MTK_DP_TRAIN_STATE_POWERSAVE, + MTK_DP_TRAIN_STATE_DPIDLE, +}; + +struct mtk_dp_timings { + struct videomode vm; + + u16 htotal; + u16 vtotal; + u8 frame_rate; + u32 pix_rate_khz; +}; + +struct mtk_dp_train_info { + bool tps3; + boo