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.
.............
>+ * 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
>+
>+ 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