Re: [PATCH v4 3/9] drm: verisilicon: add a driver for Verisilicon display controllers

2025-12-31 Thread Luca Ceresoli
On Wed Dec 24, 2025 at 5:11 PM CET, Icenowy Zheng wrote:
> From: Icenowy Zheng 
>
> This is a from-scratch driver targeting Verisilicon DC-series display
> controllers, which feature self-identification functionality like their
> GC-series GPUs.
>
> Only DC8200 is being supported now, and only the main framebuffer is set
> up (as the DRM primary plane). Support for more DC models and more
> features is my further targets.
>
> As the display controller is delivered to SoC vendors as a whole part,
> this driver does not use component framework and extra bridges inside a
> SoC is expected to be implemented as dedicated bridges (this driver
> properly supports bridge chaining).
>
> Signed-off-by: Icenowy Zheng 
> Signed-off-by: Icenowy Zheng 

[...]

> +++ b/drivers/gpu/drm/verisilicon/vs_bridge.h

> +struct vs_bridge {
> + struct drm_bridge base;
> + struct drm_encoder *enc;
> + struct drm_connector *conn;
> +
> + struct vs_crtc *crtc;
> + struct drm_bridge *next;

It is a common convention to call this 'next_bridge'. This makes it easier
to understand but also to grep and find similar patterns.

For info, we are working to move to 'struct drm_bridge::next_bridge' [0] as
you can see from example patches like [1]. However this currently applies
only to drivers using of_drm_find_bridge(), so it does not affect your
driver.

I'm sorry I have seen your patch only at v4.

[0] 
https://gitlab.freedesktop.org/drm/misc/kernel/-/commit/3fdeae134ba956aacbd87d5532c025913c98fc49
[1] 
https://gitlab.freedesktop.org/drm/misc/kernel/-/commit/8f92a5fcbfe33f86b08f5f74dcc58a41425ea8c0

Luca

--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com


Re: [PATCH v4 3/9] drm: verisilicon: add a driver for Verisilicon display controllers

2025-12-25 Thread Han Gao (Revy)



> On Dec 25, 2025, at 00:11, Icenowy Zheng  wrote:
> 
> From: Icenowy Zheng 
> 
> This is a from-scratch driver targeting Verisilicon DC-series display
> controllers, which feature self-identification functionality like their
> GC-series GPUs.
> 
> Only DC8200 is being supported now, and only the main framebuffer is set
> up (as the DRM primary plane). Support for more DC models and more
> features is my further targets.
> 
> As the display controller is delivered to SoC vendors as a whole part,
> this driver does not use component framework and extra bridges inside a
> SoC is expected to be implemented as dedicated bridges (this driver
> properly supports bridge chaining).
> 
> Signed-off-by: Icenowy Zheng 
> Signed-off-by: Icenowy Zheng 
> ---
> Changes in v4:
> - Switch to drm_* logger when we're handling with struct drm_device.
> 
> Changes in v3:
> - Get rid of drm_atomic_get_existing_crtc_state() which is marked
>  deprecated.
> 
> Changes in v2:
> - Changed some Control flows according to previous reviews.
> - Added missing of_node_put when checking of endpoints for output type.
> - Switched all userspace-visible modeset objects to be managed by drmm
>  instead of devm.
> - Utilize devm_drm_bridge_alloc() in internal bridge.
> - Prevented the usage of simple encoder helpers by passing a NULL funcs 
> pointer.
> - Let devm enable clocks when getting them.
> - Removed explicit `.cache_type = REGCACHE_NONE` in regmap config.
> - Fixed a debug print using a variable before initialization.
> - Fixed a wrong index when using bulk to handle resets.
> - Added missing configuration for DPI format (currently fixed RGB888).
> 
> drivers/gpu/drm/Kconfig   |   2 +
> drivers/gpu/drm/Makefile  |   1 +
> drivers/gpu/drm/verisilicon/Kconfig   |  15 +
> drivers/gpu/drm/verisilicon/Makefile  |   5 +
> drivers/gpu/drm/verisilicon/vs_bridge.c   | 331 ++
> drivers/gpu/drm/verisilicon/vs_bridge.h   |  40 +++
> drivers/gpu/drm/verisilicon/vs_bridge_regs.h  |  54 +++
> drivers/gpu/drm/verisilicon/vs_crtc.c | 217 
> drivers/gpu/drm/verisilicon/vs_crtc.h |  29 ++
> drivers/gpu/drm/verisilicon/vs_crtc_regs.h|  60 
> drivers/gpu/drm/verisilicon/vs_dc.c   | 205 +++
> drivers/gpu/drm/verisilicon/vs_dc.h   |  39 +++
> drivers/gpu/drm/verisilicon/vs_dc_top_regs.h  |  27 ++
> drivers/gpu/drm/verisilicon/vs_drm.c  | 177 ++
> drivers/gpu/drm/verisilicon/vs_drm.h  |  29 ++
> drivers/gpu/drm/verisilicon/vs_hwdb.c | 150 
> drivers/gpu/drm/verisilicon/vs_hwdb.h |  29 ++
> drivers/gpu/drm/verisilicon/vs_plane.c| 102 ++
> drivers/gpu/drm/verisilicon/vs_plane.h|  68 
> .../gpu/drm/verisilicon/vs_primary_plane.c| 157 +
> .../drm/verisilicon/vs_primary_plane_regs.h   |  53 +++
> 21 files changed, 1790 insertions(+)
> create mode 100644 drivers/gpu/drm/verisilicon/Kconfig
> create mode 100644 drivers/gpu/drm/verisilicon/Makefile
> create mode 100644 drivers/gpu/drm/verisilicon/vs_bridge.c
> create mode 100644 drivers/gpu/drm/verisilicon/vs_bridge.h
> create mode 100644 drivers/gpu/drm/verisilicon/vs_bridge_regs.h
> create mode 100644 drivers/gpu/drm/verisilicon/vs_crtc.c
> create mode 100644 drivers/gpu/drm/verisilicon/vs_crtc.h
> create mode 100644 drivers/gpu/drm/verisilicon/vs_crtc_regs.h
> create mode 100644 drivers/gpu/drm/verisilicon/vs_dc.c
> create mode 100644 drivers/gpu/drm/verisilicon/vs_dc.h
> create mode 100644 drivers/gpu/drm/verisilicon/vs_dc_top_regs.h
> create mode 100644 drivers/gpu/drm/verisilicon/vs_drm.c
> create mode 100644 drivers/gpu/drm/verisilicon/vs_drm.h
> create mode 100644 drivers/gpu/drm/verisilicon/vs_hwdb.c
> create mode 100644 drivers/gpu/drm/verisilicon/vs_hwdb.h
> create mode 100644 drivers/gpu/drm/verisilicon/vs_plane.c
> create mode 100644 drivers/gpu/drm/verisilicon/vs_plane.h
> create mode 100644 drivers/gpu/drm/verisilicon/vs_primary_plane.c
> create mode 100644 drivers/gpu/drm/verisilicon/vs_primary_plane_regs.h
> 
> diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
> index 7e6bc0b3a589c..41363da2cc59f 100644
> --- a/drivers/gpu/drm/Kconfig
> +++ b/drivers/gpu/drm/Kconfig
> @@ -398,6 +398,8 @@ source "drivers/gpu/drm/imagination/Kconfig"
> 
> source "drivers/gpu/drm/tyr/Kconfig"
> 
> +source "drivers/gpu/drm/verisilicon/Kconfig"
> +
> config DRM_HYPERV
> tristate "DRM Support for Hyper-V synthetic video device"
> depends on DRM && PCI && HYPERV_VMBUS
> diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
> index 0e1c668b46d21..f2dfa0ad0ab78 100644
> --- a/drivers/gpu/drm/Makefile
> +++ b/drivers/gpu/drm/Makefile
> @@ -235,6 +235,7 @@ obj-y += solomon/
> obj-$(CONFIG_DRM_SPRD) += sprd/
> obj-$(CONFIG_DRM_LOONGSON) += loongson/
> obj-$(CONFIG_DRM_POWERVR) += imagination/
> +obj-$(CONFIG_DRM_VERISILICON_DC) += verisilicon/
> 
> # Ensure drm headers are self-c

Re: [PATCH v4 3/9] drm: verisilicon: add a driver for Verisilicon display controllers

2025-12-25 Thread Han Gao (Revy)



> On Dec 25, 2025, at 00:11, Icenowy Zheng  wrote:
> 
> From: Icenowy Zheng 
> 
> This is a from-scratch driver targeting Verisilicon DC-series display
> controllers, which feature self-identification functionality like their
> GC-series GPUs.
> 
> Only DC8200 is being supported now, and only the main framebuffer is set
> up (as the DRM primary plane). Support for more DC models and more
> features is my further targets.
> 
> As the display controller is delivered to SoC vendors as a whole part,
> this driver does not use component framework and extra bridges inside a
> SoC is expected to be implemented as dedicated bridges (this driver
> properly supports bridge chaining).
> 
> Signed-off-by: Icenowy Zheng 
> Signed-off-by: Icenowy Zheng 
> ---
> Changes in v4:
> - Switch to drm_* logger when we're handling with struct drm_device.
> 
> Changes in v3:
> - Get rid of drm_atomic_get_existing_crtc_state() which is marked
>  deprecated.
> 
> Changes in v2:
> - Changed some Control flows according to previous reviews.
> - Added missing of_node_put when checking of endpoints for output type.
> - Switched all userspace-visible modeset objects to be managed by drmm
>  instead of devm.
> - Utilize devm_drm_bridge_alloc() in internal bridge.
> - Prevented the usage of simple encoder helpers by passing a NULL funcs 
> pointer.
> - Let devm enable clocks when getting them.
> - Removed explicit `.cache_type = REGCACHE_NONE` in regmap config.
> - Fixed a debug print using a variable before initialization.
> - Fixed a wrong index when using bulk to handle resets.
> - Added missing configuration for DPI format (currently fixed RGB888).
> 
> drivers/gpu/drm/Kconfig   |   2 +
> drivers/gpu/drm/Makefile  |   1 +
> drivers/gpu/drm/verisilicon/Kconfig   |  15 +
> drivers/gpu/drm/verisilicon/Makefile  |   5 +
> drivers/gpu/drm/verisilicon/vs_bridge.c   | 331 ++
> drivers/gpu/drm/verisilicon/vs_bridge.h   |  40 +++
> drivers/gpu/drm/verisilicon/vs_bridge_regs.h  |  54 +++
> drivers/gpu/drm/verisilicon/vs_crtc.c | 217 
> drivers/gpu/drm/verisilicon/vs_crtc.h |  29 ++
> drivers/gpu/drm/verisilicon/vs_crtc_regs.h|  60 
> drivers/gpu/drm/verisilicon/vs_dc.c   | 205 +++
> drivers/gpu/drm/verisilicon/vs_dc.h   |  39 +++
> drivers/gpu/drm/verisilicon/vs_dc_top_regs.h  |  27 ++
> drivers/gpu/drm/verisilicon/vs_drm.c  | 177 ++
> drivers/gpu/drm/verisilicon/vs_drm.h  |  29 ++
> drivers/gpu/drm/verisilicon/vs_hwdb.c | 150 
> drivers/gpu/drm/verisilicon/vs_hwdb.h |  29 ++
> drivers/gpu/drm/verisilicon/vs_plane.c| 102 ++
> drivers/gpu/drm/verisilicon/vs_plane.h|  68 
> .../gpu/drm/verisilicon/vs_primary_plane.c| 157 +
> .../drm/verisilicon/vs_primary_plane_regs.h   |  53 +++
> 21 files changed, 1790 insertions(+)
> create mode 100644 drivers/gpu/drm/verisilicon/Kconfig
> create mode 100644 drivers/gpu/drm/verisilicon/Makefile
> create mode 100644 drivers/gpu/drm/verisilicon/vs_bridge.c
> create mode 100644 drivers/gpu/drm/verisilicon/vs_bridge.h
> create mode 100644 drivers/gpu/drm/verisilicon/vs_bridge_regs.h
> create mode 100644 drivers/gpu/drm/verisilicon/vs_crtc.c
> create mode 100644 drivers/gpu/drm/verisilicon/vs_crtc.h
> create mode 100644 drivers/gpu/drm/verisilicon/vs_crtc_regs.h
> create mode 100644 drivers/gpu/drm/verisilicon/vs_dc.c
> create mode 100644 drivers/gpu/drm/verisilicon/vs_dc.h
> create mode 100644 drivers/gpu/drm/verisilicon/vs_dc_top_regs.h
> create mode 100644 drivers/gpu/drm/verisilicon/vs_drm.c
> create mode 100644 drivers/gpu/drm/verisilicon/vs_drm.h
> create mode 100644 drivers/gpu/drm/verisilicon/vs_hwdb.c
> create mode 100644 drivers/gpu/drm/verisilicon/vs_hwdb.h
> create mode 100644 drivers/gpu/drm/verisilicon/vs_plane.c
> create mode 100644 drivers/gpu/drm/verisilicon/vs_plane.h
> create mode 100644 drivers/gpu/drm/verisilicon/vs_primary_plane.c
> create mode 100644 drivers/gpu/drm/verisilicon/vs_primary_plane_regs.h
> 
> diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
> index 7e6bc0b3a589c..41363da2cc59f 100644
> --- a/drivers/gpu/drm/Kconfig
> +++ b/drivers/gpu/drm/Kconfig
> @@ -398,6 +398,8 @@ source "drivers/gpu/drm/imagination/Kconfig"
> 
> source "drivers/gpu/drm/tyr/Kconfig"
> 
> +source "drivers/gpu/drm/verisilicon/Kconfig"
> +
> config DRM_HYPERV
> tristate "DRM Support for Hyper-V synthetic video device"
> depends on DRM && PCI && HYPERV_VMBUS
> diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile
> index 0e1c668b46d21..f2dfa0ad0ab78 100644
> --- a/drivers/gpu/drm/Makefile
> +++ b/drivers/gpu/drm/Makefile
> @@ -235,6 +235,7 @@ obj-y += solomon/
> obj-$(CONFIG_DRM_SPRD) += sprd/
> obj-$(CONFIG_DRM_LOONGSON) += loongson/
> obj-$(CONFIG_DRM_POWERVR) += imagination/
> +obj-$(CONFIG_DRM_VERISILICON_DC) += verisilicon/
> 
> # Ensure drm headers are self-c