Hello Luo,

在 2026-11-16 17:33:34,"Luo Liu" <[email protected]> 写道:
>Hello Andy,
>
>   Thank you very much for your reply and suggestions.
>
>> -----邮件原件-----
>> 发件人: Andy Yan <[email protected]>
>> 发送时间: 2026年11月14日 19:20
>> 收件人: Luo Liu <[email protected]>
>> 抄送: [email protected]; [email protected];
>> [email protected]; [email protected]; [email protected];
>> [email protected]; [email protected];
>> [email protected]; Wuyi Shen (沈武义) <[email protected]>;
>> cix-kernel-upstream <[email protected]>
>> 主题: Re:[PATCH 2/2] drm/cix: add Sky1 DisplayPort transmitter driver
>>
>> [Some people who received this message don't often get email from
>> [email protected]. Learn why this is important at
>> https://aka.ms/LearnAboutSenderIdentification ]
>>
>> EXTERNAL EMAIL
>>
>> Hello Luo,
>>
>> At 2026-11-09 18:30:10, "Luo Liu" <[email protected]> wrote:
>> >Add a DRM bridge driver for the CIX Sky1 DisplayPort transmitter. The
>> >controller implements the DP link training and the source side of the
>> >DisplayPort protocol, and is fed by one of the SoC display pipelines.
>> >
>> >The transmitter is exposed as a DRM bridge. The CIX display pipeline
>> >attaches bridges without DRM_BRIDGE_ATTACH_NO_CONNECTOR, so the
>> driver
>> >creates the connector from .attach. When that flag is set, connector
>> >creation is left to the display controller. The connector reads the
>> >EDID, validates modes against the link bandwidth, supports YCbCr 4:2:0
>> >and signals hotplug through drm_helper_hpd_irq_event().
>> >
>> >The DisplayPort PHY is driven through the generic PHY API: link-rate
>> >and voltage-swing updates are forwarded to the PHY and the link is
>> >retrained when the sink requests it. Audio and DSC are not supported yet.
>> >
>> >Signed-off-by: Luo Liu <[email protected]>
>> >---
>> > MAINTAINERS                             |    1 +
>> > drivers/gpu/drm/Kconfig                 |    1 +
>> > drivers/gpu/drm/Makefile                |    1 +
>> > drivers/gpu/drm/cix/Kconfig             |    3 +
>> > drivers/gpu/drm/cix/Makefile            |    3 +
>> > drivers/gpu/drm/cix/dptx/Kconfig        |   16 +
>> > drivers/gpu/drm/cix/dptx/Makefile       |    4 +
>> > drivers/gpu/drm/cix/dptx/cix_dptx.c     | 2086
>> +++++++++++++++++++++++
>> > drivers/gpu/drm/cix/dptx/cix_dptx.h     |  370 ++++
>> > drivers/gpu/drm/cix/dptx/cix_dptx_drm.c |  653 +++++++
>> > drivers/gpu/drm/cix/dptx/cix_dptx_drm.h |   16 +
>> > 11 files changed, 3154 insertions(+)
>> > create mode 100644 drivers/gpu/drm/cix/Kconfig  create mode 100644
>> >drivers/gpu/drm/cix/Makefile  create mode 100644
>> >drivers/gpu/drm/cix/dptx/Kconfig  create mode 100644
>> >drivers/gpu/drm/cix/dptx/Makefile
>> > create mode 100644 drivers/gpu/drm/cix/dptx/cix_dptx.c
>> > create mode 100644 drivers/gpu/drm/cix/dptx/cix_dptx.h
>> > create mode 100644 drivers/gpu/drm/cix/dptx/cix_dptx_drm.c
>> > create mode 100644 drivers/gpu/drm/cix/dptx/cix_dptx_drm.h
>> >
>> >diff --git a/MAINTAINERS b/MAINTAINERS
>> >index 7d5283d83022..18ee884ae158 100644
>> >--- a/MAINTAINERS
>> >+++ b/MAINTAINERS
>> >@@ -6529,6 +6529,7 @@ R:       CIX Linux Kernel Upstream Group
>> <[email protected]>
>> > L:    [email protected]
>> > S:    Maintained
>> > F:    Documentation/devicetree/bindings/display/cix,sky1-dptx.yaml
>> >+F:    drivers/gpu/drm/cix/dptx/
>> >
>> > CLANG CONTEXT ANALYSIS
>> > M:    Marco Elver <[email protected]>
>> >diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig index
>> >61111d50b1c6..a1808db8b9c8 100644
>> >--- a/drivers/gpu/drm/Kconfig
>> >+++ b/drivers/gpu/drm/Kconfig
>> >@@ -311,6 +311,7 @@ source "drivers/gpu/drm/aspeed/Kconfig"
>> > source "drivers/gpu/drm/ast/Kconfig"
>> > source "drivers/gpu/drm/atmel-hlcdc/Kconfig"
>> > source "drivers/gpu/drm/bridge/Kconfig"
>> >+source "drivers/gpu/drm/cix/Kconfig"
>> > source "drivers/gpu/drm/etnaviv/Kconfig"
>> > source "drivers/gpu/drm/exynos/Kconfig"
>> > source "drivers/gpu/drm/fsl-dcu/Kconfig"
>> >diff --git a/drivers/gpu/drm/Makefile b/drivers/gpu/drm/Makefile index
>> >2c6bc093a923..6ed7456bb993 100644
>> >--- a/drivers/gpu/drm/Makefile
>> >+++ b/drivers/gpu/drm/Makefile
>> >@@ -169,6 +169,7 @@ obj-y                      += tests/
>> > obj-$(CONFIG_DRM_MIPI_DBI) += drm_mipi_dbi.o
>> > obj-$(CONFIG_DRM_MIPI_DSI) += drm_mipi_dsi.o
>> > obj-y                 += arm/
>> >+obj-y                 += cix/
>> > obj-y                 += clients/
>> > obj-y                 += display/
>> > obj-$(CONFIG_DRM_TTM) += ttm/
>> >diff --git a/drivers/gpu/drm/cix/Kconfig b/drivers/gpu/drm/cix/Kconfig
>> >new file mode 100644 index 000000000000..6cbaa5bf9fe9
>> >--- /dev/null
>> >+++ b/drivers/gpu/drm/cix/Kconfig
>> >@@ -0,0 +1,3 @@
>> >+# SPDX-License-Identifier: GPL-2.0-only
>> >+
>> >+source "drivers/gpu/drm/cix/dptx/Kconfig"
>> >diff --git a/drivers/gpu/drm/cix/Makefile
>> >b/drivers/gpu/drm/cix/Makefile new file mode 100644 index
>> >000000000000..a93591fc49e8
>> >--- /dev/null
>> >+++ b/drivers/gpu/drm/cix/Makefile
>> >@@ -0,0 +1,3 @@
>> >+# SPDX-License-Identifier: GPL-2.0
>> >+
>> >+obj-$(CONFIG_DRM_CIX_DP) += dptx/
>> >diff --git a/drivers/gpu/drm/cix/dptx/Kconfig
>> >b/drivers/gpu/drm/cix/dptx/Kconfig
>> >new file mode 100644
>> >index 000000000000..0b099f7d2ed5
>> >--- /dev/null
>> >+++ b/drivers/gpu/drm/cix/dptx/Kconfig
>> >@@ -0,0 +1,16 @@
>> >+# SPDX-License-Identifier: GPL-2.0-only
>> >+
>> >+config DRM_CIX_DP
>> >+      tristate "Cix DisplayPort Controller Driver"
>> >+      depends on COMMON_CLK && DRM && OF
>> >+      depends on GENERIC_PHY
>> >+      select DRM_KMS_HELPER
>> >+      select DRM_DISPLAY_HELPER
>> >+      select DRM_DISPLAY_DP_HELPER
>> >+      help
>> >+        DRM/KMS driver for the Cix DisplayPort controller. It implements
>> >+        the standard DRM bridge interface and drives an external
>> >+        DisplayPort PHY through the generic PHY framework.
>> >+
>> >+        To compile this driver as a module, choose M here: the module will
>> >+        be called cix-dptx.
>> >diff --git a/drivers/gpu/drm/cix/dptx/Makefile
>> >b/drivers/gpu/drm/cix/dptx/Makefile
>> >new file mode 100644
>> >index 000000000000..d156178d9a34
>> >--- /dev/null
>> >+++ b/drivers/gpu/drm/cix/dptx/Makefile
>> >@@ -0,0 +1,4 @@
>> >+# SPDX-License-Identifier: GPL-2.0-only
>> >+
>> >+cix-dptx-y := cix_dptx.o cix_dptx_drm.o
>> >+obj-$(CONFIG_DRM_CIX_DP) += cix-dptx.o
>> >diff --git a/drivers/gpu/drm/cix/dptx/cix_dptx.c
>> >b/drivers/gpu/drm/cix/dptx/cix_dptx.c
>> >new file mode 100644
>> >index 000000000000..8915c50bc9db
>> >--- /dev/null
>> >+++ b/drivers/gpu/drm/cix/dptx/cix_dptx.c
>> >@@ -0,0 +1,2086 @@
>> >+// SPDX-License-Identifier: GPL-2.0-only
>> >+/*
>> >+ * CIX Sky1 DisplayPort transmitter driver
>> >+ *
>> >+ * Copyright (C) 2026 Trilinear Technologies
>>
>>  This indicates that this is a third-party IP, which is typically also used 
>> by other
>> SoC platforms.
>> To my knowledge, Allwinner's A733 also uses this IP. Therefore, I suggest
>> following the practice of DesignWare HDMI and DP drivers, and implementing a
>> common library for this driver under drivers/gpu/drm/bridge/trilinear, while
>> implementing the Cix platform-specific glue layer under the cix directory.
>> This would make it easier for other platforms to reuse this driver in the 
>> future.
>>
>> .............
>
>This is a very good suggestion. A shared Trilinear library under 
>drivers/gpu/drm/bridge/trilinear/, with the
>
>Cix-specific glue kept separate, matches the DesignWare HDMI and DP split and 
>would make the IP reusable.
>
>That common part does not exist yet, and this series is the first mainline 
>user of the IP. We will split the driver
>
>when the Allwinner A733 support, or another platform using the same IP, is 
>submitted.


Actually, when I added mainline support for the DW DP driver, Rockchip was the 
only user back then. 
The same situation applied when Heiko worked on upstreaming the DW MIPI DSI2 
driver. However, 
we both chose to implement the core portion as a standalone library, since a 
solid initial design makes
it easier to add support for other platforms later on.

>
>
>>
>> >+ * Copyright 2026 Cix Technology Group Co., Ltd.
>> >+ */
>> >+
>> >+#include <linux/clk.h>
>> >+#include <linux/delay.h>
>> >+#include <linux/irq.h>
>> >+#include <linux/module.h>
>> >+#include <linux/of.h>
>> >+#include <linux/platform_device.h>
>> >+#include <linux/reset.h>
>> >+#include <linux/string.h>
>> >+
>> >+#include <drm/drm_probe_helper.h>
>> >+
>> >+#include "cix_dptx.h"
>> >+#include "cix_dptx_drm.h"
>> >+
>>
>>
>> ........
>>
>>
>> >+
>> >+static int cix_dp_connector_create(struct cix_dp *dp,
>> >+                                 struct drm_encoder *encoder) {
>> >+      struct cix_connector *conn = &dp->connector;
>> >+      struct drm_connector *connector = &conn->base;
>> >+      int ret;
>> >+
>> >+      conn->dp = dp;
>> >+
>> >+      connector->polled = DRM_CONNECTOR_POLL_HPD;
>> >+      connector->ycbcr_420_allowed = true;
>> >+
>> >+      ret = drm_connector_init_with_ddc(encoder->dev, connector,
>> >+                                        &cix_dp_connector_funcs,
>> >+
>> DRM_MODE_CONNECTOR_DisplayPort,
>> >+                                        &dp->aux.ddc);
>> >+      if (ret)
>> >+              return ret;
>> >+
>> >+      drm_connector_helper_add(connector,
>> >+ &cix_dp_connector_helper_funcs);
>> >+
>> >+      drm_atomic_helper_connector_reset(connector);
>> >+
>> >+      ret = drm_connector_attach_encoder(connector, encoder);
>> >+      if (ret)
>> >+              goto err_cleanup;
>> >+
>> >+      cix_dp_add_properties(connector);
>> >+
>> >+      dp->dp_panel.connector = conn;
>> >+
>> >+      return 0;
>> >+
>> >+err_cleanup:
>> >+      drm_connector_cleanup(connector);
>> >+      return ret;
>> >+}
>> >+
>> >+static int cix_dp_bridge_attach(struct drm_bridge *bridge,
>> >+                              struct drm_encoder *encoder,
>> >+                              enum drm_bridge_attach_flags flags) {
>> >+      struct cix_dp *dp = bridge_to_dp(bridge);
>> >+      int ret;
>> >+
>> >+      dp->drm = bridge->dev;
>> >+
>> >+      ret = dp->ops->aux_register(dp);
>> >+      if (ret)
>> >+              goto err_clear_drm;
>> >+
>> >+      if (flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR)
>> >+              return 0;
>>
>>
>>   As I understand it, any new bridge driver is required to support
>> DRM_BRIDGE_ATTACH_NO_CONNECTOR
>>
>>
>
>The driver does support DRM_BRIDGE_ATTACH_NO_CONNECTOR. When that flag is set, 
>attach skips connector creation and returns 0.
>
>The connector path is still required because the display controller paired 
>with this bridge is the Arm Komeda driver, which has not moved
>
>to the new model. komeda_attach_bridge() calls drm_bridge_attach() with flags 
>0 and does not create a connector itself, so this driver creates it.

This also explains why you should implement the core driver as a library, and 
then put the CIX platform-specific parts inside the separate glue layer. 
In this way, you can invoke helpers like drm_bridge_connector_init within the 
glue layer to create the required connector. Only by doing so
can this core library behave more like a modern bridge driver.



>
>This is the transition case described in drm_bridge.c: a bridge may implement 
>both models while its display driver still uses the old one.
>>
>> >+
>> >+      ret = cix_dp_connector_create(dp, encoder);
>> >+      if (ret)
>> >+              goto err_aux;
>> >+
>> >+      /* The bridge may have been attached long after the sink was plugged.
>> */
>> >+      dp->ops->replay_deferred_hotplug(dp);
>> >+
>> >+      return 0;
>> >+
>> >+err_aux:
>> >+      dp->ops->aux_cleanup(dp);
>> >+err_clear_drm:
>> >+      dp->drm = NULL;
>> >+      return ret;
>> >+}
>> >+
>> >+static void cix_dp_bridge_detach(struct drm_bridge *bridge) {
>> >+      struct cix_dp *dp = bridge_to_dp(bridge);
>> >+
>> >+      /* The hotplug workers reach the connector, stop them first. */
>> >+      cancel_delayed_work_sync(&dp->hpd_event_work);
>> >+      cancel_delayed_work_sync(&dp->hpd_irq_work);
>> >+      cancel_delayed_work_sync(&dp->sw_hpd_irq_work);
>> >+
>> >+      if (dp->connector.base.dev)
>> >+              drm_connector_cleanup(&dp->connector.base);
>> >+
>> >+      dp->dp_panel.connector = NULL;
>> >+
>> >+      dp->ops->aux_cleanup(dp);
>> >+
>> >+      dp->drm = NULL;
>> >+}
>> >+
>> >+static const struct drm_bridge_funcs cix_dp_bridge_funcs = {
>> >+      .attach = cix_dp_bridge_attach,
>> >+      .detach = cix_dp_bridge_detach,
>> >+      .atomic_check = cix_dp_bridge_atomic_check,
>> >+      .atomic_enable = cix_dp_bridge_atomic_enable,
>> >+      .atomic_disable = cix_dp_bridge_atomic_disable,
>> >+      .atomic_create_state = drm_atomic_helper_bridge_create_state,
>> >+      .atomic_duplicate_state =
>> drm_atomic_helper_bridge_duplicate_state,
>> >+      .atomic_destroy_state = drm_atomic_helper_bridge_destroy_state,
>> >+};
>> >+
>> >+struct cix_dp *cix_dp_bridge_alloc(struct device *dev) {
>> >+      return devm_drm_bridge_alloc(dev, struct cix_dp, bridge,
>> >+                                   &cix_dp_bridge_funcs); }
>> >diff --git a/drivers/gpu/drm/cix/dptx/cix_dptx_drm.h
>> >b/drivers/gpu/drm/cix/dptx/cix_dptx_drm.h
>> >new file mode 100644
>> >index 000000000000..3ac57faa349e
>> >--- /dev/null
>> >+++ b/drivers/gpu/drm/cix/dptx/cix_dptx_drm.h
>> >@@ -0,0 +1,16 @@
>> >+/* SPDX-License-Identifier: GPL-2.0-only */
>> >+/*
>> >+ * CIX Sky1 DisplayPort DRM helpers
>> >+ *
>> >+ * Copyright 2026 Cix Technology Group Co., Ltd.
>> >+ */
>> >+
>> >+#ifndef CIX_DPTX_DRM_H
>> >+#define CIX_DPTX_DRM_H
>> >+
>> >+struct cix_dp;
>> >+struct device;
>> >+
>> >+struct cix_dp *cix_dp_bridge_alloc(struct device *dev);
>> >+
>> >+#endif /* CIX_DPTX_DRM_H */
>> >--
>> >2.25.1
>
>
>本邮件及其附件包含CIX公司的保密信息,受法律保护,仅供本邮件指定的收件人查阅。严禁任何未经授权的使用、传播、分发或复制本邮件及其任何内容。此限制适用于指定收件人以外的所有人员,包括未经明确授权处理此类信息的CIX公司员工或代理人。若您误收本邮件,请立即通知发件人,并永久删除邮件及所有附件。互联网传输无法保证及时性、安全性、完整性和无病毒性,CIX公司对任何传输错误或遗漏概不承担责任。

Reply via email to