From: Krzysztof Kozlowski <krzk@kernel.org>
To: Inbaraj E <inbaraj.e@samsung.com>,
mturquette@baylibre.com, sboyd@kernel.org, robh@kernel.org,
krzk+dt@kernel.org, conor+dt@kernel.org, s.nawrocki@samsung.com,
s.hauer@pengutronix.de, shawnguo@kernel.org,
cw00.choi@samsung.com, rmfrfs@gmail.com,
laurent.pinchart@ideasonboard.com, martink@posteo.de,
mchehab@kernel.org, linux-fsd@tesla.com, will@kernel.org,
catalin.marinas@arm.com, pankaj.dubey@samsung.com,
shradha.t@samsung.com, ravi.patel@samsung.com
Cc: linux-clk@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, alim.akhtar@samsung.com,
linux-samsung-soc@vger.kernel.org, kernel@puri.sm,
kernel@pengutronix.de, festevam@gmail.com,
linux-media@vger.kernel.org, imx@lists.linux.dev,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v2 12/12] media: fsd-csis: Add support for FSD CSIS DMA
Date: Mon, 18 Aug 2025 10:49:04 +0200 [thread overview]
Message-ID: <b1f59033-12d0-4395-85f1-e296a5dbca5f@kernel.org> (raw)
In-Reply-To: <20250814140943.22531-13-inbaraj.e@samsung.com>
On 14/08/2025 16:09, Inbaraj E wrote:
> FSD CSIS IP bundles DMA engine for receiving frames from MIPI-CSI2 bus.
> Add support internal DMA controller to capture the frames.
>
> Signed-off-by: Inbaraj E <inbaraj.e@samsung.com>
I commented on order of patches and got more surprise - final driver
patch after DTS defconfig. It's really wrong order.
> ---
> MAINTAINERS | 8 +
> drivers/media/platform/samsung/Kconfig | 1 +
> drivers/media/platform/samsung/Makefile | 1 +
> .../media/platform/samsung/fsd-csis/Kconfig | 18 +
> .../media/platform/samsung/fsd-csis/Makefile | 3 +
> .../platform/samsung/fsd-csis/fsd-csis.c | 1709 +++++++++++++++++
> 6 files changed, 1740 insertions(+)
> create mode 100644 drivers/media/platform/samsung/fsd-csis/Kconfig
> create mode 100644 drivers/media/platform/samsung/fsd-csis/Makefile
> create mode 100644 drivers/media/platform/samsung/fsd-csis/fsd-csis.c
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index bd62ad58a47f..1e17fb0581d2 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -3334,6 +3334,14 @@ S: Maintained
> F: Documentation/devicetree/bindings/media/samsung,s5p-mfc.yaml
> F: drivers/media/platform/samsung/s5p-mfc/
>
> +ARM/SAMSUNG FSD BRIDGE DRIVER
TESLA FSD BRIDGE DRIVER
(because ARM/foo are only SoC maintainer entries)
> +M: Inbaraj E <inbaraj.e@samsung.com>
> +L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
Replace above list with samsung-soc list.
> +L: linux-media@vger.kernel.org
> +S: Maintained
> +F: Documentation/devicetree/bindings/media/tesla,fsd-csis-media.yaml
> +F: drivers/media/platform/samsung/fsd-csis/fsd-csis.c
> +
> ARM/SOCFPGA ARCHITECTURE
> M: Dinh Nguyen <dinguyen@kernel.org>
> S: Maintained
> diff --git a/drivers/media/platform/samsung/Kconfig b/drivers/media/platform/samsung/Kconfig
> index 0e34c5fc1dfc..4cebe2ae24a3 100644
> --- a/drivers/media/platform/samsung/Kconfig
> +++ b/drivers/media/platform/samsung/Kconfig
> @@ -4,6 +4,7 @@ comment "Samsung media platform drivers"
>
> source "drivers/media/platform/samsung/exynos-gsc/Kconfig"
> source "drivers/media/platform/samsung/exynos4-is/Kconfig"
> +source "drivers/media/platform/samsung/fsd-csis/Kconfig"
> source "drivers/media/platform/samsung/s3c-camif/Kconfig"
> source "drivers/media/platform/samsung/s5p-g2d/Kconfig"
> source "drivers/media/platform/samsung/s5p-jpeg/Kconfig"
> diff --git a/drivers/media/platform/samsung/Makefile b/drivers/media/platform/samsung/Makefile
> index 21fea3330e4b..fde1b9626713 100644
> --- a/drivers/media/platform/samsung/Makefile
> +++ b/drivers/media/platform/samsung/Makefile
> @@ -1,6 +1,7 @@
> # SPDX-License-Identifier: GPL-2.0-only
> obj-y += exynos-gsc/
> obj-y += exynos4-is/
> +obj-y += fsd-csis/
> obj-y += s3c-camif/
> obj-y += s5p-g2d/
> obj-y += s5p-jpeg/
> diff --git a/drivers/media/platform/samsung/fsd-csis/Kconfig b/drivers/media/platform/samsung/fsd-csis/Kconfig
> new file mode 100644
> index 000000000000..99803e924682
> --- /dev/null
> +++ b/drivers/media/platform/samsung/fsd-csis/Kconfig
> @@ -0,0 +1,18 @@
> +# SPDX-License-Identifier: GPL-2.0-only
> +#
> +# FSD MIPI CSI-2 Rx controller configurations
> +
> +config VIDEO_FSD_CSIS
VIDEO_TSLA_FSD_CSIS
> + tristate "FSD SoC MIPI-CSI2 media controller driver"
> + depends on VIDEO_DEV && VIDEO_V4L2_SUBDEV_API
> + depends on HAS_DMA
> + depends on OF
OF seems unneeded dependency
But you miss ARCH_TESLA_FSD instead.
> + select VIDEOBUF2_DMA_CONTIG
> + select V4L2_FWNODE
> + help
> + This is a video4linux2 driver for FSD SoC MIPI-CSI2 Rx.
Tesla FSD
> + The driver provides interface for capturing frames.
> +
> + To compile this driver as a module, choose M here. The module
> + will be called fsd-csis.
> +
> diff --git a/drivers/media/platform/samsung/fsd-csis/Makefile b/drivers/media/platform/samsung/fsd-csis/Makefile
> new file mode 100644
> index 000000000000..eba8c0c6a7cc
> --- /dev/null
> +++ b/drivers/media/platform/samsung/fsd-csis/Makefile
> @@ -0,0 +1,3 @@
> +# SPDX-License-Identifier: GPL-2.0-only
> +
> +obj-$(CONFIG_VIDEO_FSD_CSIS) += fsd-csis.o
> diff --git a/drivers/media/platform/samsung/fsd-csis/fsd-csis.c b/drivers/media/platform/samsung/fsd-csis/fsd-csis.c
> new file mode 100644
> index 000000000000..74f46038d506
> --- /dev/null
> +++ b/drivers/media/platform/samsung/fsd-csis/fsd-csis.c
> @@ -0,0 +1,1709 @@
> +// SPDX-License-Identifier: GPL-2.0-only
> +/*
> + * Copyright (c) 2022-2025 Samsung Electronics Co., Ltd.
> + * https://www.samsung.com
> + *
> + * FSD CSIS V4L2 Capture driver for FSD SoC.
"Tesla FSD" in both places
> + */
> +
> +#include <linux/clk.h>
> +#include <linux/pm_runtime.h>
> +#include <linux/regmap.h>
> +#include <media/v4l2-device.h>
> +#include <media/v4l2-ioctl.h>
> +#include <media/videobuf2-dma-contig.h>
> +#include <media/v4l2-mc.h>
How can you depend on OF if there is no single OF header?
> +
> +#define FSD_CSIS_DMA_COHERENT_MASK_SIZE 32
> +#define FSD_CSIS_NB_MIN_CH 2
> +#define FSD_CSIS_NB_VC 4
> +#define FSD_CSIS_MEDIA_NUM_PADS 2
> +#define FSD_CSIS_NB_DMA_OUT_CH 8
> +#define FSD_CSIS_MAX_VC 4
> +#define FSD_CSIS_NB_CLOCK 2
> +#define FSD_CSIS_NB_OF_BUFS_ON_DMA_CHANNELS 2
> +#define FSD_CSIS_DMA_LINE_ALIGN_SIZE 128
> +#define FSD_CSIS_DMA_CH_OFFSET 0x100
...
> +
> +static int fsd_csis_probe(struct platform_device *pdev)
> +{
> + struct device *dev = &pdev->dev;
> + struct fsd_csis *csis;
> + int ret = 0;
> + int irq;
> +
> + csis = devm_kzalloc(dev, sizeof(*csis), GFP_KERNEL);
> + if (!csis)
> + return -ENOMEM;
> +
> + csis->dev = dev;
> + csis->info = of_device_get_match_data(dev);
> +
> + csis->dma_base = devm_platform_ioremap_resource(pdev, 0);
> + if (IS_ERR(csis->dma_base))
> + return PTR_ERR(csis->dma_base);
> +
> + irq = platform_get_irq(pdev, 0);
> + if (irq < 0)
> + return irq;
> +
> + ret = devm_request_irq(dev, irq,
> + csis_irq_handler, IRQF_SHARED, pdev->name, csis);
Please align these (checkpatch --strict)
> +
> + ret = fsd_csis_clk_get(csis);
> + if (ret < 0)
> + return ret;
> +
> + pm_runtime_enable(dev);
> + if (!pm_runtime_enabled(dev)) {
That's odd code. Why?
> + ret = fsd_csis_runtime_resume(dev);
Even more questions why?
> + if (ret < 0)
> + return ret;
> + }
> +
> + platform_set_drvdata(pdev, csis);
> +
> + ret = fsd_csis_enable_pll(csis);
> + if (ret)
> + return ret;
> +
> + ret = fsd_csis_media_init(csis);
> + if (ret)
> + return ret;
I think you miss clean up of csis->pll completely. Just use
devm_clk_get_enabled and convert everything here to devm.
> +
> + ret = fsd_csis_async_register(csis);
> + if (ret)
> + goto err_media_cleanup;
> +
> + return 0;
> +
> +err_media_cleanup:
> + fsd_csis_media_cleanup(csis);
Also this...
> +
> + return ret;
> +}
> +
> +static void fsd_csis_remove(struct platform_device *pdev)
> +{
> + struct fsd_csis *csis = platform_get_drvdata(pdev);
> +
> + fsd_csis_media_cleanup(csis);
> +
> + v4l2_async_nf_unregister(&csis->notifier);
> + v4l2_async_nf_cleanup(&csis->notifier);
> + v4l2_async_unregister_subdev(&csis->subdev.sd);
> +
> + if (!pm_runtime_enabled(csis->dev))
> + fsd_csis_runtime_suspend(csis->dev);
> +
> + pm_runtime_disable(csis->dev);
> + pm_runtime_set_suspended(csis->dev);
> +}
> +
> +static const struct of_device_id fsd_csis_of_match[] = {
> + { .compatible = "tesla,fsd-csis-media", },
> + { },
> +};
> +
> +MODULE_DEVICE_TABLE(of, fsd_csis_of_match);
> +
> +static struct platform_driver fsd_csis_driver = {
> + .probe = fsd_csis_probe,
> + .remove = fsd_csis_remove,
> + .driver = {
> + .name = FSD_CSIS_MODULE_NAME,
> + .of_match_table = of_match_ptr(fsd_csis_of_match),
Drop of_match_ptr, it is not really correct.
> + .pm = &fsd_csis_pm_ops,
> + },
> +};
> +
> +module_platform_driver(fsd_csis_driver);
> +
> +MODULE_DESCRIPTION("FSD CSIS Driver");
> +MODULE_AUTHOR("Inbaraj E <inbaraj.e@samsung.com>");
> +MODULE_LICENSE("GPL");
> +
Best regards,
Krzysztof
next prev parent reply other threads:[~2025-08-18 8:49 UTC|newest]
Thread overview: 54+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20250814140956epcas5p480aa24441933523484da5c241a201d3c@epcas5p4.samsung.com>
2025-08-14 14:09 ` [PATCH v2 00/12] Add FSD CSI support Inbaraj E
2025-08-14 14:09 ` [PATCH v2 01/12] dt-bindings: clock: Add CAM_CSI clock macro for FSD Inbaraj E
2025-08-18 8:47 ` (subset) " Krzysztof Kozlowski
2025-08-14 14:09 ` [PATCH v2 02/12] clk: samsung: fsd: Add clk id for PCLK and PLL in CAM_CSI block Inbaraj E
2025-08-18 8:47 ` (subset) " Krzysztof Kozlowski
2025-08-14 14:09 ` [PATCH v2 03/12] dt-bindings: media: nxp: Add support for FSD SoC Inbaraj E
2025-08-18 8:24 ` Krzysztof Kozlowski
2025-08-22 13:39 ` Inbaraj E
2025-08-22 13:50 ` Krzysztof Kozlowski
2025-08-22 14:00 ` Inbaraj E
2025-08-23 15:37 ` Krzysztof Kozlowski
2025-08-25 12:50 ` Inbaraj E
2025-08-14 14:09 ` [PATCH v2 04/12] arm64: dts: fsd: Add CSI nodes Inbaraj E
2025-08-18 8:26 ` Krzysztof Kozlowski
2025-08-22 13:57 ` Inbaraj E
2025-08-23 15:39 ` Krzysztof Kozlowski
2025-08-25 13:05 ` Inbaraj E
2025-08-26 8:36 ` Krzysztof Kozlowski
2025-08-26 10:08 ` Inbaraj E
2025-08-26 11:43 ` Laurent Pinchart
2025-08-14 14:09 ` [PATCH v2 05/12] media: imx-mipi-csis: Move clk to mipi_csis_info structure Inbaraj E
2025-08-18 9:21 ` Laurent Pinchart
2025-08-23 13:11 ` Inbaraj E
2025-08-14 14:09 ` [PATCH v2 06/12] media: imx-mipi-csis: Move irq flag and handler " Inbaraj E
2025-08-14 14:09 ` [PATCH v2 07/12] media: imx-mipi-csis: Add support to configure specific vc Inbaraj E
2025-08-18 9:33 ` Laurent Pinchart
2025-08-23 13:29 ` Inbaraj E
2025-08-14 14:09 ` [PATCH v2 08/12] media: imx-mipi-csis: Add support to dump all vc regs Inbaraj E
2025-08-18 9:30 ` Laurent Pinchart
2025-08-23 13:15 ` Inbaraj E
2025-08-14 14:09 ` [PATCH v2 09/12] media: imx-mipi-csis: Add support for FSD CSI Rx Inbaraj E
2025-08-14 14:09 ` [PATCH v2 10/12] dt-bindings: media: fsd: Document CSIS DMA controller Inbaraj E
2025-08-18 8:29 ` Krzysztof Kozlowski
2025-08-23 1:54 ` Inbaraj E
2025-08-18 8:45 ` Krzysztof Kozlowski
2025-08-23 2:39 ` Inbaraj E
2025-08-23 15:32 ` Krzysztof Kozlowski
2025-08-25 12:01 ` Inbaraj E
2025-08-25 12:25 ` Krzysztof Kozlowski
2025-08-24 21:15 ` Laurent Pinchart
2025-08-25 7:34 ` Krzysztof Kozlowski
2025-08-14 14:09 ` [PATCH v2 11/12] arm64: defconfig: Enable FSD CSIS DMA driver Inbaraj E
2025-08-18 8:32 ` Krzysztof Kozlowski
2025-08-23 2:05 ` Inbaraj E
2025-08-23 15:31 ` Krzysztof Kozlowski
2025-08-25 11:54 ` Inbaraj E
2025-08-14 14:09 ` [PATCH v2 12/12] media: fsd-csis: Add support for FSD CSIS DMA Inbaraj E
2025-08-18 8:49 ` Krzysztof Kozlowski [this message]
2025-08-23 11:49 ` Inbaraj E
2025-08-23 15:34 ` Krzysztof Kozlowski
2025-08-25 12:46 ` Inbaraj E
2025-08-23 11:59 ` Inbaraj E
2025-08-18 8:22 ` [PATCH v2 00/12] Add FSD CSI support Krzysztof Kozlowski
2025-08-22 13:16 ` Inbaraj E
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=b1f59033-12d0-4395-85f1-e296a5dbca5f@kernel.org \
--to=krzk@kernel.org \
--cc=alim.akhtar@samsung.com \
--cc=catalin.marinas@arm.com \
--cc=conor+dt@kernel.org \
--cc=cw00.choi@samsung.com \
--cc=devicetree@vger.kernel.org \
--cc=festevam@gmail.com \
--cc=imx@lists.linux.dev \
--cc=inbaraj.e@samsung.com \
--cc=kernel@pengutronix.de \
--cc=kernel@puri.sm \
--cc=krzk+dt@kernel.org \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-fsd@tesla.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=martink@posteo.de \
--cc=mchehab@kernel.org \
--cc=mturquette@baylibre.com \
--cc=pankaj.dubey@samsung.com \
--cc=ravi.patel@samsung.com \
--cc=rmfrfs@gmail.com \
--cc=robh@kernel.org \
--cc=s.hauer@pengutronix.de \
--cc=s.nawrocki@samsung.com \
--cc=sboyd@kernel.org \
--cc=shawnguo@kernel.org \
--cc=shradha.t@samsung.com \
--cc=will@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.