Skip to content

Commit 8a1e7c6

Browse files
Bin Du1Naim
authored andcommitted
media: platform: amd: isp4 video node and buffers handling added
Isp video implements v4l2 video interface and supports NV12 and YUYV. It manages buffers, pipeline power and state. Cherry-picked Sultan's DMA buffer related fix from branch v6.16-drm-tip-isp4-for-amd on https://github.com/kerneltoast/kernel_x86_laptop.git Co-developed-by: Sultan Alsawaf <sultan@kerneltoast.com> Signed-off-by: Sultan Alsawaf <sultan@kerneltoast.com> Co-developed-by: Svetoslav Stoilov <Svetoslav.Stoilov@amd.com> Signed-off-by: Svetoslav Stoilov <Svetoslav.Stoilov@amd.com> Signed-off-by: Bin Du <Bin.Du@amd.com> Reviewed-by: Sultan Alsawaf <sultan@kerneltoast.com> Tested-by: Alexey Zagorodnikov <xglooom@gmail.com> Tested-by: Kate Hsuan <hpa@redhat.com>
1 parent 96d6388 commit 8a1e7c6

7 files changed

Lines changed: 883 additions & 4 deletions

File tree

MAINTAINERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1180,6 +1180,8 @@ F: drivers/media/platform/amd/isp4/isp4_interface.c
11801180
F: drivers/media/platform/amd/isp4/isp4_interface.h
11811181
F: drivers/media/platform/amd/isp4/isp4_subdev.c
11821182
F: drivers/media/platform/amd/isp4/isp4_subdev.h
1183+
F: drivers/media/platform/amd/isp4/isp4_video.c
1184+
F: drivers/media/platform/amd/isp4/isp4_video.h
11831185

11841186
AMD KFD
11851187
M: Felix Kuehling <Felix.Kuehling@amd.com>

drivers/media/platform/amd/isp4/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@
55
obj-$(CONFIG_VIDEO_AMD_ISP4_CAPTURE) += amd_isp4_capture.o
66
amd_isp4_capture-objs := isp4.o \
77
isp4_interface.o \
8-
isp4_subdev.o
8+
isp4_subdev.o \
9+
isp4_video.o

drivers/media/platform/amd/isp4/isp4.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,17 @@ static int isp4_capture_probe(struct platform_device *pdev)
173173
goto err_pm_disable;
174174
}
175175

176+
ret = media_create_pad_link(&isp_dev->isp_subdev.sdev.entity,
177+
0,
178+
&isp_dev->isp_subdev.isp_vdev.vdev.entity,
179+
0,
180+
MEDIA_LNK_FL_ENABLED |
181+
MEDIA_LNK_FL_IMMUTABLE);
182+
if (ret) {
183+
dev_err_probe(dev, ret, "fail to create pad link\n");
184+
goto err_isp4_deinit;
185+
}
186+
176187
ret = media_device_register(&isp_dev->mdev);
177188
if (ret) {
178189
dev_err_probe(dev, ret, "fail to register media device\n");

drivers/media/platform/amd/isp4/isp4_subdev.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -467,11 +467,13 @@ static void isp4sd_fw_resp_frame_done(struct isp4_subdev *isp_subdev,
467467
meta->preview.status == ISP4FW_BUFFER_STATUS_DONE ||
468468
meta->preview.status == ISP4FW_BUFFER_STATUS_DIRTY)) {
469469
prev = isp4if_dequeue_buffer(ispif);
470-
if (prev)
470+
if (prev) {
471+
isp4vid_handle_frame_done(&isp_subdev->isp_vdev,
472+
&prev->buf_info);
471473
isp4if_dealloc_buffer_node(prev);
472-
else
474+
} else {
473475
dev_err(dev, "fail null prev buf\n");
474-
476+
}
475477
} else if (meta->preview.enabled) {
476478
dev_err(dev, "fail bad preview status %u\n",
477479
meta->preview.status);
@@ -1006,6 +1008,10 @@ int isp4sd_init(struct isp4_subdev *isp_subdev, struct v4l2_device *v4l2_dev,
10061008
isp_subdev->host2fw_seq_num = 1;
10071009
ispif->status = ISP4IF_STATUS_PWR_OFF;
10081010

1011+
ret = isp4vid_dev_init(&isp_subdev->isp_vdev, &isp_subdev->sdev);
1012+
if (ret)
1013+
goto err_subdev_unreg;
1014+
10091015
return 0;
10101016

10111017
err_subdev_unreg:
@@ -1020,6 +1026,7 @@ void isp4sd_deinit(struct isp4_subdev *isp_subdev)
10201026
{
10211027
struct isp4_interface *ispif = &isp_subdev->ispif;
10221028

1029+
isp4vid_dev_deinit(&isp_subdev->isp_vdev);
10231030
v4l2_device_unregister_subdev(&isp_subdev->sdev);
10241031
media_entity_cleanup(&isp_subdev->sdev.entity);
10251032
isp4if_deinit(ispif);

drivers/media/platform/amd/isp4/isp4_subdev.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include "isp4_fw_cmd_resp.h"
1818
#include "isp4_hw_reg.h"
1919
#include "isp4_interface.h"
20+
#include "isp4_video.h"
2021

2122
/*
2223
* One is for none sensor specific response which is not used now.
@@ -83,6 +84,7 @@ struct isp4_subdev_thread_param {
8384
struct isp4_subdev {
8485
struct v4l2_subdev sdev;
8586
struct isp4_interface ispif;
87+
struct isp4vid_dev isp_vdev;
8688

8789
struct media_pad sdev_pad;
8890

0 commit comments

Comments
 (0)