[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20250821-95_cam-v3-31-c9286fbb34b9@nxp.com>
Date: Thu, 21 Aug 2025 16:16:06 -0400
From: Frank Li <Frank.Li@....com>
To: Rui Miguel Silva <rmfrfs@...il.com>,
Laurent Pinchart <laurent.pinchart@...asonboard.com>,
Martin Kepplinger <martink@...teo.de>, Purism Kernel Team <kernel@...i.sm>,
Mauro Carvalho Chehab <mchehab@...nel.org>, Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>,
Conor Dooley <conor+dt@...nel.org>,
Eugen Hristev <eugen.hristev@...aro.org>, Shawn Guo <shawnguo@...nel.org>,
Sascha Hauer <s.hauer@...gutronix.de>,
Pengutronix Kernel Team <kernel@...gutronix.de>,
Fabio Estevam <festevam@...il.com>, Peng Fan <peng.fan@....com>,
Alice Yuan <alice.yuan@....com>, Vinod Koul <vkoul@...nel.org>,
Kishon Vijay Abraham I <kishon@...nel.org>,
Philipp Zabel <p.zabel@...gutronix.de>,
Steve Longerbeam <slongerbeam@...il.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: linux-media@...r.kernel.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org, imx@...ts.linux.dev,
linux-arm-kernel@...ts.infradead.org, linux-phy@...ts.infradead.org,
linux-staging@...ts.linux.dev, Frank Li <Frank.Li@....com>
Subject: [PATCH v3 31/31] media: synopsys: csi2: Add simple synopsys
platform driver
Add simple synosys platform driver, which use standard PHY interface and
only 1 sink and 1 source pad. No format convert between source and sink
pad.
Signed-off-by: Frank Li <Frank.Li@....com>
---
drivers/media/platform/synopsys/Kconfig | 8 +++
drivers/media/platform/synopsys/Makefile | 1 +
drivers/media/platform/synopsys/mipi-csi2-simple.c | 75 ++++++++++++++++++++++
3 files changed, 84 insertions(+)
diff --git a/drivers/media/platform/synopsys/Kconfig b/drivers/media/platform/synopsys/Kconfig
index e54dad835349d420dead6d5313c0623567c28c0b..642b7dcd8dfb1bafa3b6dbdba1a1d99559d3c01a 100644
--- a/drivers/media/platform/synopsys/Kconfig
+++ b/drivers/media/platform/synopsys/Kconfig
@@ -12,4 +12,12 @@ config VIDEO_SYNOPSYS_MIPI_CSI2
To compile this driver as a module, choose M here. The module
will be called synopsys_hdmirx
+config VIDEO_SYNOPSYS_MIPI_CSI2_SIMPLE
+ tristate "Simple Synopsys DesignWare HDMI Receiver platform driver"
+ depends on VIDEO_SYNOPSYS_MIPI_CSI2
+ help
+ Simple platform Synopsys MIPI CSI2 platform driver, which not format
+ convert between sink and source pad. Only 1 source pad and 1 sink
+ pad, use standard PHY interface to initialize DPHY.
+
source "drivers/media/platform/synopsys/hdmirx/Kconfig"
diff --git a/drivers/media/platform/synopsys/Makefile b/drivers/media/platform/synopsys/Makefile
index 045ed3177738e6d28aa223804b79e6774e141dc8..cac610c8e08abeebdbf14157d8edcdc5a635dd00 100644
--- a/drivers/media/platform/synopsys/Makefile
+++ b/drivers/media/platform/synopsys/Makefile
@@ -2,3 +2,4 @@
obj-y += hdmirx/
obj-$(CONFIG_VIDEO_SYNOPSYS_MIPI_CSI2) += mipi-csi2.o
+obj-$(CONFIG_VIDEO_SYNOPSYS_MIPI_CSI2_SIMPLE) += mipi-csi2-simple.o
diff --git a/drivers/media/platform/synopsys/mipi-csi2-simple.c b/drivers/media/platform/synopsys/mipi-csi2-simple.c
new file mode 100644
index 0000000000000000000000000000000000000000..bf34a515b41290339db06d74d7135c575a8bf031
--- /dev/null
+++ b/drivers/media/platform/synopsys/mipi-csi2-simple.c
@@ -0,0 +1,75 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Synosis MIPI CSI-2 Simple platform driver
+ *
+ * Copyright (c) 2025 NXP.
+ */
+#include <linux/bits.h>
+#include <linux/clk.h>
+#include <linux/interrupt.h>
+#include <linux/io.h>
+#include <linux/iopoll.h>
+#include <linux/irq.h>
+#include <linux/module.h>
+#include <linux/of_graph.h>
+#include <linux/platform_device.h>
+
+#include <media/dw-mipi-csi2.h>
+
+struct simple_csi2 {
+ struct dw_mipi_csi2_dev dw;
+};
+
+static const struct dw_mipi_csi2_config simple_config = {
+ .module = THIS_MODULE,
+ .name = "dw-mipi-csi2",
+ .num_pads = 2,
+ .sink_pad_mask = BIT(0),
+ .has_irq = true,
+ .has_phy = true,
+ .need_dphy_reset = true,
+};
+
+static DEFINE_RUNTIME_DEV_PM_OPS(csi2_pm_ops, dw_mipi_csi2_runtime_suspend,
+ dw_mipi_csi2_runtime_resume, NULL);
+
+static int csi2_probe(struct platform_device *pdev)
+{
+ struct simple_csi2 *csi2;
+
+ csi2 = devm_kzalloc(&pdev->dev, sizeof(*csi2), GFP_KERNEL);
+ if (!csi2)
+ return -ENOMEM;
+
+ return dw_mipi_csi2_init(pdev, &csi2->dw, &simple_config);
+}
+
+static void csi2_remove(struct platform_device *pdev)
+{
+ struct v4l2_subdev *sd = platform_get_drvdata(pdev);
+ struct dw_mipi_csi2_dev *csi2 = sd_to_dw_mipi_csi2_dev(sd);
+
+ dw_mipi_csi2_deinit(csi2);
+}
+
+static const struct of_device_id csi2_dt_ids[] = {
+ { .compatible = "snps,dw-mipi-csi2-v150" },
+ { /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, csi2_dt_ids);
+
+static struct platform_driver csi2_driver = {
+ .driver = {
+ .name = "dw-mipi-csi2",
+ .of_match_table = csi2_dt_ids,
+ .pm = pm_ptr(&csi2_pm_ops),
+ },
+ .probe = csi2_probe,
+ .remove = csi2_remove,
+};
+
+module_platform_driver(csi2_driver);
+
+MODULE_DESCRIPTION("Simple Synosis MIPI CSI-2 Receiver platform driver");
+MODULE_AUTHOR("Frank Li <Frank.li@....com>");
+MODULE_LICENSE("GPL");
--
2.34.1
Powered by blists - more mailing lists