From: Luo Liu <Luo.Liu@cixtech.com>
To: maarten.lankhorst@linux.intel.com, mripard@kernel.org,
tzimmermann@suse.de, andrzej.hajda@intel.com,
neil.armstrong@linaro.org, rfoss@kernel.org, robh@kernel.org,
krzk+dt@kernel.org, conor+dt@kernel.org
Cc: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org,
laurent.pinchart@ideasonboard.com, jonas@kwiboo.se,
jernej.skrabec@gmail.com, luca.ceresoli@bootlin.com,
wuyi.shen@cixtech.com, cix-kernel-upstream@cixtech.com
Subject: [PATCH v3 5/5] drm/cix: add the Sky1 DisplayPort platform glue
Date: Tue, 24 Nov 2026 20:01:14 +0800 [thread overview]
Message-ID: <20261124120114.3273161-6-Luo.Liu@cixtech.com> (raw)
In-Reply-To: <20261124120114.3273161-1-Luo.Liu@cixtech.com>
Add the platform driver that maps the Sky1 RCSU video adapter registers
and programs the pixel format and pixel-per-clock mode for the
Trilinear DisplayPort transmitter.
The DP protocol, link training and the DRM bridge live in the shared
Trilinear bridge driver. This glue only fills in the SoC-specific parts
through dptx_plat_data, declared in include/drm/bridge/dptx.h.
Signed-off-by: Luo Liu <Luo.Liu@cixtech.com>
---
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 | 15 +++
drivers/gpu/drm/cix/dptx/Makefile | 4 +
drivers/gpu/drm/cix/dptx/cix_dptx.c | 163 ++++++++++++++++++++++++++++
7 files changed, 190 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
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..f5d3afe5699f
--- /dev/null
+++ b/drivers/gpu/drm/cix/dptx/Kconfig
@@ -0,0 +1,15 @@
+# SPDX-License-Identifier: GPL-2.0-only
+
+config DRM_CIX_DP
+ tristate "Cix Sky1 DisplayPort platform glue"
+ depends on ARCH_CIX || COMPILE_TEST
+ depends on COMMON_CLK && DRM && OF
+ depends on GENERIC_PHY
+ select DRM_TRILINEAR_DPTX
+ help
+ Platform glue for the Cix Sky1 DisplayPort output. It maps the
+ SoC video adapter registers and binds the shared Trilinear DPTX
+ bridge driver.
+
+ 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..64226bbd7c49
--- /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
+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..f2a344999faf
--- /dev/null
+++ b/drivers/gpu/drm/cix/dptx/cix_dptx.c
@@ -0,0 +1,163 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * CIX Sky1 DisplayPort platform glue
+ *
+ * Copyright 2026 Cix Technology Group Co., Ltd.
+ */
+
+#include <linux/bits.h>
+#include <linux/io.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/platform_device.h>
+
+#include <drm/bridge/dptx.h>
+
+#define CFG_ADAPTER_VIDEO0_OFFSET 0x300
+#define CFG_ADAPTER_VIDEO1_OFFSET 0x304
+#define CFG_ADAPTER_VIDEO_OFFSET_DP2 0x320
+
+struct cix_dp_adapter_fmt {
+ int offset;
+ u32 shift;
+};
+
+struct cix_dptx {
+ void __iomem *rcsu;
+};
+
+static const struct cix_dp_adapter_fmt usbc_adapter_fmt[] = {
+ { CFG_ADAPTER_VIDEO0_OFFSET, 30 },
+ { CFG_ADAPTER_VIDEO1_OFFSET, 19 },
+};
+
+static const struct cix_dp_adapter_fmt dp2_adapter_fmt[] = {
+ { CFG_ADAPTER_VIDEO_OFFSET_DP2, 17 },
+ { CFG_ADAPTER_VIDEO_OFFSET_DP2, 20 },
+};
+
+static void cix_dp_adapter_fmt_set(void __iomem *rcsu,
+ const struct cix_dp_adapter_fmt *adapter,
+ enum dp_pixelformat format, bool ppc2)
+{
+ u32 fmt_mask;
+ u32 ppc_bit;
+ u32 value;
+
+ /* The PPC control bit sits directly below the pixel format field. */
+ fmt_mask = GENMASK(adapter->shift + 1, adapter->shift);
+ ppc_bit = BIT(adapter->shift - 1);
+
+ value = readl(rcsu + adapter->offset);
+
+ value &= ~fmt_mask;
+ if (format == DP_PIXELFORMAT_YUV422)
+ value |= 2U << adapter->shift;
+ else if (format == DP_PIXELFORMAT_YUV420)
+ value |= 3U << adapter->shift;
+
+ if (ppc2)
+ value |= ppc_bit;
+ else
+ value &= ~ppc_bit;
+
+ writel(value, rcsu + adapter->offset);
+}
+
+static void cix_dp_usbc_adapter_config(void *data, int pipe_id,
+ enum dp_pixelformat format, bool ppc2)
+{
+ struct cix_dptx *priv = data;
+
+ cix_dp_adapter_fmt_set(priv->rcsu, &usbc_adapter_fmt[pipe_id], format,
+ ppc2);
+}
+
+static void cix_dp_native_adapter_config(void *data, int pipe_id,
+ enum dp_pixelformat format, bool ppc2)
+{
+ struct cix_dptx *priv = data;
+
+ cix_dp_adapter_fmt_set(priv->rcsu, &dp2_adapter_fmt[pipe_id], format,
+ ppc2);
+}
+
+static int cix_dptx_probe(struct platform_device *pdev)
+{
+ struct device *dev = &pdev->dev;
+ const struct dptx_plat_data *soc_data;
+ struct cix_dptx *priv;
+ struct dptx_dev *dp;
+ void __iomem *rcsu;
+
+ soc_data = of_device_get_match_data(dev);
+ if (!soc_data)
+ return -ENODEV;
+
+ priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
+ if (!priv)
+ return -ENOMEM;
+
+ rcsu = devm_platform_ioremap_resource_byname(pdev, "rcsu");
+ if (IS_ERR(rcsu))
+ return dev_err_probe(dev, PTR_ERR(rcsu),
+ "failed to map rcsu registers\n");
+
+ priv->rcsu = rcsu;
+
+ dp = dptx_probe(dev, soc_data, priv);
+ if (IS_ERR(dp))
+ return PTR_ERR(dp);
+
+ return 0;
+}
+
+static int cix_dptx_pm_suspend(struct device *dev)
+{
+ return dptx_suspend(dev_get_drvdata(dev));
+}
+
+static int cix_dptx_pm_resume(struct device *dev)
+{
+ return dptx_resume(dev_get_drvdata(dev));
+}
+
+static DEFINE_SIMPLE_DEV_PM_OPS(cix_dptx_pm_ops, cix_dptx_pm_suspend,
+ cix_dptx_pm_resume);
+
+static void cix_dptx_shutdown(struct platform_device *pdev)
+{
+ dptx_shutdown(platform_get_drvdata(pdev));
+}
+
+static const struct dptx_plat_data sky1_usbdp_data = {
+ .adapter_config = cix_dp_usbc_adapter_config,
+};
+
+static const struct dptx_plat_data sky1_dp_data = {
+ .adapter_config = cix_dp_native_adapter_config,
+};
+
+static const struct of_device_id cix_dptx_dt_ids[] = {
+ { .compatible = "cix,sky1-usbdp", .data = &sky1_usbdp_data },
+ { .compatible = "cix,sky1-dp", .data = &sky1_dp_data },
+ { /* sentinel */ },
+};
+MODULE_DEVICE_TABLE(of, cix_dptx_dt_ids);
+
+static struct platform_driver cix_dp_driver = {
+ .probe = cix_dptx_probe,
+ .shutdown = cix_dptx_shutdown,
+ .driver = {
+ .name = "cix-dptx",
+ .of_match_table = cix_dptx_dt_ids,
+ .pm = pm_sleep_ptr(&cix_dptx_pm_ops),
+ },
+};
+
+module_platform_driver(cix_dp_driver);
+
+MODULE_AUTHOR("Luo Liu <Luo.Liu@cixtech.com>");
+MODULE_AUTHOR("Wuyi Shen <wuyi.shen@cixtech.com>");
+MODULE_DESCRIPTION("Cix Sky1 DisplayPort platform glue");
+MODULE_LICENSE("GPL");
--
2.25.1
prev parent reply other threads:[~2026-11-24 12:01 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-24 12:01 [PATCH v3 0/5] drm/bridge: trilinear: add the Sky1 DisplayPort transmitter Luo Liu
2026-11-24 12:01 ` [PATCH v3 1/5] dt-bindings: display: add CIX " Luo Liu
2026-11-24 12:12 ` sashiko-bot
2026-11-24 12:01 ` [PATCH v3 2/5] drm/bridge: trilinear: add the DPTX hardware layer Luo Liu
2026-11-24 12:22 ` sashiko-bot
2026-11-24 12:01 ` [PATCH v3 3/5] drm/bridge: trilinear: add the DPTX DRM bridge Luo Liu
2026-11-24 12:28 ` sashiko-bot
2026-11-24 12:01 ` [PATCH v3 4/5] drm/bridge: trilinear: add the DPTX core and build glue Luo Liu
2026-11-24 12:25 ` sashiko-bot
2026-11-24 12:01 ` Luo Liu [this message]
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=20261124120114.3273161-6-Luo.Liu@cixtech.com \
--to=luo.liu@cixtech.com \
--cc=andrzej.hajda@intel.com \
--cc=cix-kernel-upstream@cixtech.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=jernej.skrabec@gmail.com \
--cc=jonas@kwiboo.se \
--cc=krzk+dt@kernel.org \
--cc=laurent.pinchart@ideasonboard.com \
--cc=luca.ceresoli@bootlin.com \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=neil.armstrong@linaro.org \
--cc=rfoss@kernel.org \
--cc=robh@kernel.org \
--cc=tzimmermann@suse.de \
--cc=wuyi.shen@cixtech.com \
/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