devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Icenowy Zheng <uwu@icenowy.me>
To: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Maxime Ripard <mripard@kernel.org>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	Drew Fustini <fustini@kernel.org>, Guo Ren <guoren@kernel.org>,
	Fu Wei <wefu@redhat.com>, Philipp Zabel <p.zabel@pengutronix.de>,
	Heiko Stuebner <heiko@sntech.de>,
	Andrzej Hajda <andrzej.hajda@intel.com>,
	Neil Armstrong <neil.armstrong@linaro.org>,
	 Robert Foss <rfoss@kernel.org>,
	Laurent Pinchart <Laurent.pinchart@ideasonboard.com>,
	Jonas Karlman <jonas@kwiboo.se>,
	Jernej Skrabec <jernej.skrabec@gmail.com>,
	Michal Wilczynski <m.wilczynski@samsung.com>,
	Han Gao <rabenda.cn@gmail.com>, Yao Zi <ziyao@disroot.org>,
	dri-devel@lists.freedesktop.org,  devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org,  linux-riscv@lists.infradead.org
Subject: Re: [PATCH v2 3/8] drm: verisilicon: add a driver for Verisilicon display controllers
Date: Tue, 23 Sep 2025 09:10:28 +0800	[thread overview]
Message-ID: <dacdfabb30fae413949d8bde28a709096ecda4c7.camel@icenowy.me> (raw)
In-Reply-To: <a46szgmjrwgqhv5issuijyvih4tof3xa45tdhxv4qjplekszpz@55tgbkeby7zr>

在 2025-09-23星期二的 03:53 +0300,Dmitry Baryshkov写道:
> On Sun, Sep 21, 2025 at 04:34:41PM +0800, Icenowy Zheng wrote:
> > 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 <uwu@icenowy.me>
> > ---
> > 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       | 330
> > ++++++++++++++++++
> >  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, 1789 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
> > 
> > +
> > +static int vs_bridge_atomic_check(struct drm_bridge *bridge,
> > +                                 struct drm_bridge_state
> > *bridge_state,
> > +                                 struct drm_crtc_state
> > *crtc_state,
> > +                                 struct drm_connector_state
> > *conn_state)
> > +{
> > +       struct vs_bridge *vbridge =
> > drm_bridge_to_vs_bridge(bridge);
> > +
> > +       if (vbridge->intf == VSDC_OUTPUT_INTERFACE_DP &&
> > +           !vs_bridge_out_dp_fmt_supported(bridge_state-
> > >output_bus_cfg.format))
> > +               return -EINVAL;
> 
> I still think that it's better to have per-interface type bridge
> funcs
> rather than checking for the interface type inside the function.
> 
> > +
> > +       vbridge->output_bus_fmt = bridge_state-
> > >output_bus_cfg.format;
> > +
> > +       return 0;
> > +}
> > +
> > +
> > +       bridge = devm_drm_bridge_alloc(drm_dev->dev, struct
> > vs_bridge, base,
> > +                                      &vs_bridge_funcs);
> > +       if (!bridge)
> > +               return ERR_PTR(-ENOMEM);
> > +
> > +       bridge->crtc = crtc;
> > +       bridge->intf = intf;
> > +       bridge->next = next;
> > +
> > +       if (intf == VSDC_OUTPUT_INTERFACE_DPI)
> > +               enctype = DRM_MODE_ENCODER_DPI;
> > +       else
> > +               enctype = DRM_MODE_ENCODER_NONE;
> 
> Nit: DRM_MODE_ENCODER_TMDS ?

The DC it self never encodes TMDS, and although most SoC connect the DP
interface to HDMI TX controllers, it's theortically to use other
bridges here (e.g. DP TX controllers).

> 
> > +
> > +       bridge->enc = drmm_plain_encoder_alloc(drm_dev, NULL,
> > enctype, NULL);
> > +       if (IS_ERR(bridge->enc)) {
> > +               dev_err(drm_dev->dev,
> > +                       "Cannot initialize encoder for output
> > %u\n", output);
> > +               ret = PTR_ERR(bridge->enc);
> > +               return ERR_PTR(ret);
> > +       }
> > +
> > +       bridge->enc->possible_crtcs = drm_crtc_mask(&crtc->base);
> > +
> > +       ret = drm_bridge_attach(bridge->enc, &bridge->base, NULL,
> > +                               DRM_BRIDGE_ATTACH_NO_CONNECTOR);
> > +       if (ret) {
> > +               dev_err(drm_dev->dev,
> > +                       "Cannot attach bridge for output %u\n",
> > output);
> > +               return ERR_PTR(ret);
> > +       }
> > +
> > +       bridge->conn = drm_bridge_connector_init(drm_dev, bridge-
> > >enc);
> > +       if (IS_ERR(bridge->conn)) {
> > +               dev_err(drm_dev->dev,
> > +                       "Cannot create connector for output %u\n",
> > output);
> > +               ret = PTR_ERR(bridge->conn);
> > +               return ERR_PTR(ret);
> > +       }
> > +       drm_connector_attach_encoder(bridge->conn, bridge->enc);
> > +
> > +       return bridge;
> > +}
> 
> Other than that LGTM.
> 


  reply	other threads:[~2025-09-23  1:11 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-21  8:34 [PATCH v2 0/8] Verisilicon DC8200 driver (and adaption to TH1520) Icenowy Zheng
2025-09-21  8:34 ` [PATCH v2 1/8] dt-bindings: vendor-prefixes: add verisilicon Icenowy Zheng
2025-09-22 20:39   ` Rob Herring (Arm)
2025-09-21  8:34 ` [PATCH v2 2/8] dt-bindings: display: add verisilicon,dc Icenowy Zheng
2025-09-22 20:43   ` Rob Herring
2025-09-23  0:33     ` Icenowy Zheng
2025-09-24 17:01       ` Icenowy Zheng
2025-09-24 18:15         ` Christian Gmeiner
2025-09-25  5:57           ` Icenowy Zheng
2025-10-06 16:33             ` Icenowy Zheng
2025-10-06 19:01               ` Christian Gmeiner
2025-09-21  8:34 ` [PATCH v2 3/8] drm: verisilicon: add a driver for Verisilicon display controllers Icenowy Zheng
2025-09-23  0:53   ` Dmitry Baryshkov
2025-09-23  1:10     ` Icenowy Zheng [this message]
2025-09-23  1:58       ` Dmitry Baryshkov
2025-10-01 10:42   ` Icenowy Zheng
2025-09-21  8:34 ` [PATCH v2 4/8] dt-bindings: display/bridge: add binding for TH1520 HDMI controller Icenowy Zheng
2025-09-21  8:34 ` [PATCH v2 5/8] drm/bridge: add a driver for T-Head " Icenowy Zheng
2025-09-23  1:00   ` Dmitry Baryshkov
2025-09-23  1:11     ` Icenowy Zheng
2025-09-23  1:30       ` Icenowy Zheng
2025-09-23  2:22         ` Dmitry Baryshkov
2025-09-21  8:34 ` [PATCH v2 6/8] riscv: dts: thead: add DPU and HDMI device tree nodes Icenowy Zheng
2025-09-21  8:34 ` [PATCH v2 7/8] riscv: dts: thead: lichee-pi-4a: enable HDMI Icenowy Zheng
2025-09-21  8:34 ` [PATCH v2 8/8] MAINTAINERS: assign myself as maintainer for verisilicon DC driver Icenowy Zheng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=dacdfabb30fae413949d8bde28a709096ecda4c7.camel@icenowy.me \
    --to=uwu@icenowy.me \
    --cc=Laurent.pinchart@ideasonboard.com \
    --cc=airlied@gmail.com \
    --cc=andrzej.hajda@intel.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dmitry.baryshkov@oss.qualcomm.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=fustini@kernel.org \
    --cc=guoren@kernel.org \
    --cc=heiko@sntech.de \
    --cc=jernej.skrabec@gmail.com \
    --cc=jonas@kwiboo.se \
    --cc=krzk+dt@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=m.wilczynski@samsung.com \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=neil.armstrong@linaro.org \
    --cc=p.zabel@pengutronix.de \
    --cc=rabenda.cn@gmail.com \
    --cc=rfoss@kernel.org \
    --cc=robh@kernel.org \
    --cc=simona@ffwll.ch \
    --cc=tzimmermann@suse.de \
    --cc=wefu@redhat.com \
    --cc=ziyao@disroot.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).