From: "Du, Bin" <bin.du@amd.com>
To: Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: mchehab@kernel.org, hverkuil@xs4all.nl,
laurent.pinchart+renesas@ideasonboard.com,
bryan.odonoghue@linaro.org,
prabhakar.mahadev-lad.rj@bp.renesas.com,
linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
pratap.nirujogi@amd.com, benjamin.chan@amd.com, king.li@amd.com,
gjorgji.rosikopulos@amd.com, Phil.Jawich@amd.com,
Dominic.Antony@amd.com, bin.du@amd.com
Subject: Re: [PATCH v2 1/8] media: platform: amd: Introduce amd isp4 capture driver
Date: Mon, 28 Jul 2025 17:00:38 +0800 [thread overview]
Message-ID: <c8983a65-df58-471b-a90d-40c15129460a@amd.com> (raw)
In-Reply-To: <aIcQpB3pD8oWJPHZ@kekkonen.localdomain>
Many thanks Askari Alius for your careful review.
On 7/28/2025 1:54 PM, Sakari Ailus wrote:
> Hi Bin,
>
> On Wed, Jun 18, 2025 at 05:19:52PM +0800, Bin Du wrote:
>> Amd isp4 capture is a v4l2 media device which implements media controller
>> interface.
>> It has one sub-device (amd ISP4 sub-device) endpoint which can be connected
>> to a remote CSI2 TX endpoint. It supports only one physical interface for
>> now.
>> Also add ISP4 driver related entry info into the MAINAINERS file
>
> You could rewrap the text and use the full lines here -- up to 75
> characters per line.
>
Sure, will do in the next patch>>
>> Signed-off-by: Bin Du <Bin.Du@amd.com>
>> Signed-off-by: Svetoslav Stoilov <Svetoslav.Stoilov@amd.com>
>> ---
>> MAINTAINERS | 10 ++
>> drivers/media/platform/Kconfig | 1 +
>> drivers/media/platform/Makefile | 1 +
>> drivers/media/platform/amd/Kconfig | 17 +++
>> drivers/media/platform/amd/Makefile | 5 +
>> drivers/media/platform/amd/isp4/Makefile | 21 ++++
>> drivers/media/platform/amd/isp4/isp4.c | 139 +++++++++++++++++++++++
>> drivers/media/platform/amd/isp4/isp4.h | 35 ++++++
>> 8 files changed, 229 insertions(+)
>> create mode 100644 drivers/media/platform/amd/Kconfig
>> create mode 100644 drivers/media/platform/amd/Makefile
>> create mode 100644 drivers/media/platform/amd/isp4/Makefile
>> create mode 100644 drivers/media/platform/amd/isp4/isp4.c
>> create mode 100644 drivers/media/platform/amd/isp4/isp4.h
>>
>> diff --git a/MAINTAINERS b/MAINTAINERS
>> index 10893c91b1c1..15070afb14b5 100644
>> --- a/MAINTAINERS
>> +++ b/MAINTAINERS
>> @@ -1107,6 +1107,16 @@ T: git git://git.kernel.org/pub/scm/linux/kernel/git/iommu/linux.git
>> F: drivers/iommu/amd/
>> F: include/linux/amd-iommu.h
>>
>> +AMD ISP4 DRIVER
>> +M: Bin Du <bin.du@amd.com>
>> +M: Nirujogi Pratap <pratap.nirujogi@amd.com>
>> +L: linux-media@vger.kernel.org
>> +S: Maintained
>> +T: git git://linuxtv.org/media.git
>> +F: drivers/media/platform/amd/Kconfig
>> +F: drivers/media/platform/amd/Makefile
>> +F: drivers/media/platform/amd/isp4/*
>> +
>> AMD KFD
>> M: Felix Kuehling <Felix.Kuehling@amd.com>
>> L: amd-gfx@lists.freedesktop.org
>> diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig
>> index 85d2627776b6..d525c2262a7d 100644
>> --- a/drivers/media/platform/Kconfig
>> +++ b/drivers/media/platform/Kconfig
>> @@ -89,5 +89,6 @@ source "drivers/media/platform/ti/Kconfig"
>> source "drivers/media/platform/verisilicon/Kconfig"
>> source "drivers/media/platform/via/Kconfig"
>> source "drivers/media/platform/xilinx/Kconfig"
>> +source "drivers/media/platform/amd/Kconfig"
>>
>> endif # MEDIA_PLATFORM_DRIVERS
>> diff --git a/drivers/media/platform/Makefile b/drivers/media/platform/Makefile
>> index ace4e34483dd..9f3d1693868d 100644
>> --- a/drivers/media/platform/Makefile
>> +++ b/drivers/media/platform/Makefile
>> @@ -32,6 +32,7 @@ obj-y += ti/
>> obj-y += verisilicon/
>> obj-y += via/
>> obj-y += xilinx/
>> +obj-y += amd/
>>
>> # Please place here only ancillary drivers that aren't SoC-specific
>> # Please keep it alphabetically sorted by Kconfig name
>> diff --git a/drivers/media/platform/amd/Kconfig b/drivers/media/platform/amd/Kconfig
>> new file mode 100644
>> index 000000000000..3b1dba0400a0
>> --- /dev/null
>> +++ b/drivers/media/platform/amd/Kconfig
>> @@ -0,0 +1,17 @@
>> +# SPDX-License-Identifier: MIT
>> +
>> +config AMD_ISP4
>> + tristate "AMD ISP4 and camera driver"
>> + default y
>> + depends on VIDEO_DEV && VIDEO_V4L2_SUBDEV_API
>> + select VIDEOBUF2_CORE
>> + select VIDEOBUF2_V4L2
>> + select VIDEOBUF2_MEMOPS
>> + select VIDEOBUF2_VMALLOC
>> + select VIDEOBUF2_DMA_CONTIG
>> + select VIDEOBUF2_DMA_SG
>
> Do you need all these three? Most drivers need only one.
>
After double check, yes, none of theam are used in our code, will remove
them and also the header files included>> + help
>> + This is support for AMD ISP4 and camera subsystem driver.
>> + Say Y here to enable the ISP4 and camera device for video capture.
>> + To compile this driver as a module, choose M here. The module will
>> + be called amd_capture.
>> diff --git a/drivers/media/platform/amd/Makefile b/drivers/media/platform/amd/Makefile
>> new file mode 100644
>> index 000000000000..76146efcd2bf
>> --- /dev/null
>> +++ b/drivers/media/platform/amd/Makefile
>> @@ -0,0 +1,5 @@
>> +# Copyright 2024 Advanced Micro Devices, Inc.
>> +# add isp block
>> +ifneq ($(CONFIG_AMD_ISP4),)
>> +obj-y += isp4/
>> +endif
>> diff --git a/drivers/media/platform/amd/isp4/Makefile b/drivers/media/platform/amd/isp4/Makefile
>> new file mode 100644
>> index 000000000000..e9e84160517d
>> --- /dev/null
>> +++ b/drivers/media/platform/amd/isp4/Makefile
>> @@ -0,0 +1,21 @@
>> +# SPDX-License-Identifier: GPL-2.0+
>> +#
>> +# Copyright (C) 2025 Advanced Micro Devices, Inc.
>> +
>> +obj-$(CONFIG_AMD_ISP4) += amd_capture.o
>> +amd_capture-objs := isp4.o
>> +
>> +ccflags-y += -I$(srctree)/drivers/media/platform/amd/isp4
>> +ccflags-y += -I$(srctree)/include
>> +
>> +ifneq ($(call cc-option, -mpreferred-stack-boundary=4),)
>> + cc_stack_align := -mpreferred-stack-boundary=4
>> +endif
>
> Uh... does the driver actually depend on this?
>
Yes, other comments also mentioned this, will update in the next patch>> +
>> +ccflags-y += $(cc_stack_align)
>> +ccflags-y += -DCONFIG_COMPAT
>> +ccflags-y += -Wunused-but-set-variable
>> +ccflags-y += -Wmissing-include-dirs
>> +ccflags-y += -Wunused-const-variable
>> +ccflags-y += -Wmaybe-uninitialized
>> +ccflags-y += -Wunused-value
>> diff --git a/drivers/media/platform/amd/isp4/isp4.c b/drivers/media/platform/amd/isp4/isp4.c
>> new file mode 100644
>> index 000000000000..d0be90c5ec3b
>> --- /dev/null
>> +++ b/drivers/media/platform/amd/isp4/isp4.c
>> @@ -0,0 +1,139 @@
>> +// SPDX-License-Identifier: GPL-2.0+
>> +/*
>> + * Copyright (C) 2025 Advanced Micro Devices, Inc.
>> + */
>> +
>> +#include <linux/pm_runtime.h>
>> +#include <linux/vmalloc.h>
>> +#include <media/v4l2-ioctl.h>
>
> Alphabetic order, please.
>
Sorry, seems it's already in alphabetic order, an example in
drivers/media/v4l2-core/v4l2-ioctl.c is like
#include <linux/v4l2-subdev.h>
#include <linux/videodev2.h>
#include <media/media-device.h> /* for media_set_bus_info() */
#include <media/v4l2-common.h>
Suppose i can add an empty line before #include <media/v4l2-ioctl.h>>> +
>> +#include "isp4.h"
>> +
>> +#define VIDEO_BUF_NUM 5
>
> Unused.
>
Yes, other comments also mentioned this, will remove it in the next
patch>> +
>> +#define ISP4_DRV_NAME "amd_isp_capture"
>> +
>> +/* interrupt num */
>> +static const u32 isp4_ringbuf_interrupt_num[] = {
>> + 0, /* ISP_4_1__SRCID__ISP_RINGBUFFER_WPT9 */
>> + 1, /* ISP_4_1__SRCID__ISP_RINGBUFFER_WPT10 */
>> + 3, /* ISP_4_1__SRCID__ISP_RINGBUFFER_WPT11 */
>> + 4, /* ISP_4_1__SRCID__ISP_RINGBUFFER_WPT12 */
>> +};
>> +
>> +#define to_isp4_device(dev) \
>> + ((struct isp4_device *)container_of(dev, struct isp4_device, v4l2_dev))
>
> No need for the cast.
>
Sure, will remove the cast in the next patch>> +
>> +static irqreturn_t isp4_irq_handler(int irq, void *arg)
>> +{
>> + struct isp4_device *isp_dev = dev_get_drvdata((struct device *)arg);
>> +
>> + if (!isp_dev)
>> + goto error_drv_data;
>> +
>> +error_drv_data:
>> + return IRQ_HANDLED;
>> +}
>> +
>> +/*
>> + * amd capture module
>> + */
>> +static int isp4_capture_probe(struct platform_device *pdev)
>> +{
>> + struct device *dev = &pdev->dev;
>> + struct isp4_device *isp_dev;
>> +
>
> Extra newline.
>
Yes, other comments also mentioned this, will remove it in the next
patch>> + int i, irq, ret;
>
> unsigned int i?
>
Weired, no compile warning about this, will change it to size_t i in the
next patch.>> +
>> + isp_dev = devm_kzalloc(&pdev->dev, sizeof(*isp_dev), GFP_KERNEL);
>> + if (!isp_dev)
>> + return -ENOMEM;
>> +
>> + isp_dev->pdev = pdev;
>> + dev->init_name = ISP4_DRV_NAME;
>> +
>> + for (i = 0; i < ARRAY_SIZE(isp4_ringbuf_interrupt_num); i++) {
>> + irq = platform_get_irq(pdev, isp4_ringbuf_interrupt_num[i]);
>> + if (irq < 0)
>> + return dev_err_probe(dev, -ENODEV,
>> + "fail to get irq %d\n",
>> + isp4_ringbuf_interrupt_num[i]);
>> + ret = devm_request_irq(&pdev->dev, irq, isp4_irq_handler, 0,
>> + "ISP_IRQ", &pdev->dev);
>> + if (ret)
>> + return dev_err_probe(dev, ret, "fail to req irq %d\n",
>> + irq);
>> + }
>> +
>> + isp_dev->pltf_data = pdev->dev.platform_data;
>> +
>> + dev_dbg(dev, "isp irq registration successful\n");
>
> Please leave this out.
>
Yes, other comments also mentioned this, will remove it in the next
patch>> +
>> + /* Link the media device within the v4l2_device */
>> + isp_dev->v4l2_dev.mdev = &isp_dev->mdev;
>> +
>> + /* Initialize media device */
>> + strscpy(isp_dev->mdev.model, "amd_isp41_mdev",
>> + sizeof(isp_dev->mdev.model));
>> + snprintf(isp_dev->mdev.bus_info, sizeof(isp_dev->mdev.bus_info),
>> + "platform:%s", ISP4_DRV_NAME);
>> + isp_dev->mdev.dev = &pdev->dev;
>> + media_device_init(&isp_dev->mdev);
>> +
>> + /* register v4l2 device */
>> + snprintf(isp_dev->v4l2_dev.name, sizeof(isp_dev->v4l2_dev.name),
>> + "AMD-V4L2-ROOT");
>> + ret = v4l2_device_register(&pdev->dev, &isp_dev->v4l2_dev);
>> + if (ret)
>> + return dev_err_probe(dev, ret,
>> + "fail register v4l2 device\n");
>> +
>> + dev_dbg(dev, "AMD ISP v4l2 device registered\n");
>
> This doesn't seem useful.
>
Yes, other comments also mentioned this, will remove it in the next
patch>> +
>> + ret = media_device_register(&isp_dev->mdev);
>> + if (ret) {
>> + dev_err(dev, "fail to register media device %d\n", ret);
>> + goto err_unreg_v4l2;
>> + }
>> +
>> + platform_set_drvdata(pdev, isp_dev);
>> +
>> + pm_runtime_set_suspended(dev);
>> + pm_runtime_enable(dev);
>
> You'll need to enable runtime PM before registering any interfaces on UAPI.
> Same goes for setting driver data for the device.
>
Sure, will modify in the next patch>> +
>> + return 0;
>> +
>> +err_unreg_v4l2:
>> + v4l2_device_unregister(&isp_dev->v4l2_dev);
>> +
>> + return dev_err_probe(dev, ret, "isp probe fail\n");
>> +}
>> +
>> +static void isp4_capture_remove(struct platform_device *pdev)
>> +{
>> + struct isp4_device *isp_dev = platform_get_drvdata(pdev);
>> + struct device *dev = &pdev->dev;
>> +
>> + media_device_unregister(&isp_dev->mdev);
>> + v4l2_device_unregister(&isp_dev->v4l2_dev);
>> + dev_dbg(dev, "AMD ISP v4l2 device unregistered\n");
>
> I'd say this is redundant.
>
Yes, other comments also mentioned this, will remove it in the next
patch>> +}
>> +
>> +static struct platform_driver isp4_capture_drv = {
>> + .probe = isp4_capture_probe,
>> + .remove = isp4_capture_remove,
>> + .driver = {
>> + .name = ISP4_DRV_NAME,
>> + .owner = THIS_MODULE,
>> + }
>> +};
>> +
>> +module_platform_driver(isp4_capture_drv);
>> +
>> +MODULE_ALIAS("platform:" ISP4_DRV_NAME);
>> +MODULE_IMPORT_NS("DMA_BUF");
>> +
>> +MODULE_DESCRIPTION("AMD ISP4 Driver");
>> +MODULE_AUTHOR("Bin Du <bin.du@amd.com>");
>> +MODULE_AUTHOR("Pratap Nirujogi <pratap.nirujogi@amd.com>");
>> +MODULE_LICENSE("GPL");
>> diff --git a/drivers/media/platform/amd/isp4/isp4.h b/drivers/media/platform/amd/isp4/isp4.h
>> new file mode 100644
>> index 000000000000..27a7362ce6f9
>> --- /dev/null
>> +++ b/drivers/media/platform/amd/isp4/isp4.h
>> @@ -0,0 +1,35 @@
>> +/* SPDX-License-Identifier: GPL-2.0+ */
>> +/*
>> + * Copyright (C) 2025 Advanced Micro Devices, Inc.
>> + */
>> +
>> +#ifndef _ISP4_H_
>> +#define _ISP4_H_
>> +
>> +#include <linux/mutex.h>
>> +#include <media/v4l2-device.h>
>> +#include <media/videobuf2-memops.h>
>> +#include <media/videobuf2-vmalloc.h>
>> +
>> +#define ISP4_GET_ISP_REG_BASE(isp4sd) (((isp4sd))->mmio)
>> +
>> +struct isp4_platform_data {
>> + void *adev;
>> + void *bo;
>> + void *cpu_ptr;
>> + u64 gpu_addr;
>> + u32 size;
>> + u32 asic_type;
>> + resource_size_t base_rmmio_size;
>> +};
>> +
>> +struct isp4_device {
>> + struct v4l2_device v4l2_dev;
>> + struct media_device mdev;
>> +
>> + struct isp4_platform_data *pltf_data;
>> + struct platform_device *pdev;
>> + struct notifier_block i2c_nb;
>> +};
>> +
>> +#endif /* isp4.h */
>
> Use the same name as for the macro here, please.
>
Yes, other comments also mentioned this, will modify in the next patch
next prev parent reply other threads:[~2025-07-28 9:00 UTC|newest]
Thread overview: 98+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-18 9:19 [PATCH v2 0/8] Add AMD ISP4 driver Bin Du
2025-06-18 9:19 ` [PATCH v2 1/8] media: platform: amd: Introduce amd isp4 capture driver Bin Du
2025-06-18 15:58 ` Mario Limonciello
2025-06-19 7:46 ` Du, Bin
2025-06-19 13:00 ` Mario Limonciello
2025-06-20 3:08 ` Du, Bin
2025-07-28 5:54 ` Sakari Ailus
2025-07-28 9:00 ` Du, Bin [this message]
2025-06-18 9:19 ` [PATCH v2 2/8] media: platform: amd: low level support for isp4 firmware Bin Du
2025-06-18 16:00 ` Mario Limonciello
2025-06-19 7:53 ` Du, Bin
2025-07-28 5:57 ` Sakari Ailus
2025-07-28 9:24 ` Du, Bin
2025-06-18 9:19 ` [PATCH v2 3/8] media: platform: amd: Add helpers to configure isp4 mipi phy Bin Du
2025-07-28 6:33 ` Sakari Ailus
2025-08-05 9:53 ` Du, Bin
2025-08-05 10:53 ` Laurent Pinchart
2025-08-06 9:56 ` Du, Bin
2025-08-05 10:39 ` Laurent Pinchart
2025-08-06 9:45 ` Du, Bin
2025-07-28 7:28 ` Sakari Ailus
2025-07-31 9:31 ` Du, Bin
2025-06-18 9:19 ` [PATCH v2 4/8] media: platform: amd: Add isp4 fw and hw interface Bin Du
2025-06-18 16:17 ` Mario Limonciello
2025-06-19 9:58 ` Du, Bin
2025-06-19 15:11 ` Mario Limonciello
2025-06-20 3:32 ` Du, Bin
2025-07-28 7:23 ` Sakari Ailus
2025-07-29 9:12 ` Du, Bin
2025-08-11 11:46 ` Sakari Ailus
2025-08-11 12:31 ` Laurent Pinchart
2025-08-12 3:36 ` Du, Bin
2025-08-12 7:34 ` Laurent Pinchart
2025-08-12 8:08 ` Du, Bin
2025-08-12 8:20 ` Sakari Ailus
2025-08-12 10:04 ` Du, Bin
2025-08-12 2:44 ` Du, Bin
2025-06-18 9:19 ` [PATCH v2 5/8] media: platform: amd: isp4 subdev and firmware loading handling added Bin Du
2025-06-18 16:35 ` Mario Limonciello
2025-06-20 9:31 ` Du, Bin
2025-07-06 20:55 ` Mario Limonciello
2025-07-07 6:22 ` Du, Bin
2025-07-25 1:35 ` Sultan Alsawaf
2025-07-25 9:03 ` Du, Bin
2025-06-18 9:19 ` [PATCH v2 6/8] media: platform: amd: isp4 video node and buffers " Bin Du
2025-07-23 17:55 ` Sultan Alsawaf
2025-07-24 5:14 ` Sultan Alsawaf
2025-07-25 9:05 ` Du, Bin
2025-07-25 9:22 ` Du, Bin
2025-07-26 21:41 ` Sultan Alsawaf
2025-07-26 21:50 ` Sultan Alsawaf
2025-07-29 6:12 ` Du, Bin
2025-07-29 6:08 ` Du, Bin
2025-07-28 7:04 ` Sultan Alsawaf
2025-07-29 7:43 ` Du, Bin
2025-07-31 0:34 ` Sultan Alsawaf
2025-07-31 9:45 ` Du, Bin
2025-08-11 6:02 ` Sultan Alsawaf
2025-08-11 9:05 ` Du, Bin
2025-08-12 5:51 ` Sultan Alsawaf
2025-08-12 6:33 ` Du, Bin
2025-08-13 9:42 ` Du, Bin
2025-08-14 6:37 ` Sultan Alsawaf
2025-06-18 9:19 ` [PATCH v2 7/8] media: platform: amd: isp4 debug fs logging and more descriptive errors Bin Du
2025-06-18 9:19 ` [PATCH v2 8/8] Documentation: add documentation of AMD isp 4 driver Bin Du
2025-08-05 11:37 ` Laurent Pinchart
2025-08-12 1:36 ` Du, Bin
2025-08-12 13:42 ` Laurent Pinchart
2025-08-22 2:28 ` Du, Bin
2025-08-20 12:42 ` Sakari Ailus
2025-08-22 2:20 ` Du, Bin
2025-09-22 6:24 ` Sakari Ailus
2025-09-22 9:19 ` Du, Bin
2025-07-23 18:12 ` [PATCH v2 0/8] Add AMD ISP4 driver Sultan Alsawaf
2025-07-25 10:22 ` Du, Bin
2025-07-26 22:31 ` Sultan Alsawaf
2025-07-29 3:32 ` Du, Bin
2025-07-29 7:42 ` Sultan Alsawaf
2025-07-29 7:45 ` Sultan Alsawaf
2025-07-29 10:13 ` Du, Bin
2025-07-30 5:38 ` Sultan Alsawaf
2025-07-30 9:53 ` Du, Bin
2025-07-31 0:30 ` Sultan Alsawaf
2025-07-31 10:04 ` Du, Bin
2025-08-04 3:32 ` Du, Bin
2025-08-04 4:25 ` Sultan Alsawaf
2025-08-08 9:11 ` Du, Bin
2025-08-11 5:49 ` Sultan Alsawaf
2025-08-11 8:35 ` Du, Bin
2025-08-11 21:48 ` Sultan Alsawaf
2025-08-11 22:17 ` Sultan Alsawaf
2025-08-12 2:02 ` Du, Bin
2025-08-14 6:53 ` Sultan Alsawaf
2025-08-22 2:23 ` Du, Bin
2025-08-22 3:56 ` Sultan Alsawaf
2025-08-27 10:30 ` Du, Bin
2025-08-28 5:50 ` Sultan Alsawaf
2025-09-02 2:08 ` Du, Bin
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=c8983a65-df58-471b-a90d-40c15129460a@amd.com \
--to=bin.du@amd.com \
--cc=Dominic.Antony@amd.com \
--cc=Phil.Jawich@amd.com \
--cc=benjamin.chan@amd.com \
--cc=bryan.odonoghue@linaro.org \
--cc=gjorgji.rosikopulos@amd.com \
--cc=hverkuil@xs4all.nl \
--cc=king.li@amd.com \
--cc=laurent.pinchart+renesas@ideasonboard.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
--cc=pratap.nirujogi@amd.com \
--cc=sakari.ailus@linux.intel.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
all inboxes | Powered by JetHome®