lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b1f59033-12d0-4395-85f1-e296a5dbca5f@kernel.org>
Date: Mon, 18 Aug 2025 10:49:04 +0200
From: Krzysztof Kozlowski <krzk@...nel.org>
To: Inbaraj E <inbaraj.e@...sung.com>, mturquette@...libre.com,
 sboyd@...nel.org, robh@...nel.org, krzk+dt@...nel.org, conor+dt@...nel.org,
 s.nawrocki@...sung.com, s.hauer@...gutronix.de, shawnguo@...nel.org,
 cw00.choi@...sung.com, rmfrfs@...il.com, laurent.pinchart@...asonboard.com,
 martink@...teo.de, mchehab@...nel.org, linux-fsd@...la.com, will@...nel.org,
 catalin.marinas@....com, pankaj.dubey@...sung.com, shradha.t@...sung.com,
 ravi.patel@...sung.com
Cc: linux-clk@...r.kernel.org, devicetree@...r.kernel.org,
 linux-kernel@...r.kernel.org, alim.akhtar@...sung.com,
 linux-samsung-soc@...r.kernel.org, kernel@...i.sm, kernel@...gutronix.de,
 festevam@...il.com, linux-media@...r.kernel.org, imx@...ts.linux.dev,
 linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH v2 12/12] media: fsd-csis: Add support for FSD CSIS DMA

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@...sung.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@...sung.com>
> +L:	linux-arm-kernel@...ts.infradead.org (moderated for non-subscribers)

Replace above list with samsung-soc list.

> +L:	linux-media@...r.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@...nel.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@...sung.com>");
> +MODULE_LICENSE("GPL");
> +


Best regards,
Krzysztof

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ