.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * ispvideo.c |
---|
3 | 4 | * |
---|
.. | .. |
---|
7 | 8 | * |
---|
8 | 9 | * Contacts: Laurent Pinchart <laurent.pinchart@ideasonboard.com> |
---|
9 | 10 | * Sakari Ailus <sakari.ailus@iki.fi> |
---|
10 | | - * |
---|
11 | | - * This program is free software; you can redistribute it and/or modify |
---|
12 | | - * it under the terms of the GNU General Public License version 2 as |
---|
13 | | - * published by the Free Software Foundation. |
---|
14 | 11 | */ |
---|
15 | 12 | |
---|
16 | | -#include <asm/cacheflush.h> |
---|
17 | 13 | #include <linux/clk.h> |
---|
18 | 14 | #include <linux/mm.h> |
---|
19 | 15 | #include <linux/module.h> |
---|
.. | .. |
---|
654 | 650 | { |
---|
655 | 651 | struct isp_video *video = video_drvdata(file); |
---|
656 | 652 | |
---|
657 | | - strlcpy(cap->driver, ISP_VIDEO_DRIVER_NAME, sizeof(cap->driver)); |
---|
658 | | - strlcpy(cap->card, video->video.name, sizeof(cap->card)); |
---|
659 | | - strlcpy(cap->bus_info, "media", sizeof(cap->bus_info)); |
---|
| 653 | + strscpy(cap->driver, ISP_VIDEO_DRIVER_NAME, sizeof(cap->driver)); |
---|
| 654 | + strscpy(cap->card, video->video.name, sizeof(cap->card)); |
---|
| 655 | + strscpy(cap->bus_info, "media", sizeof(cap->bus_info)); |
---|
660 | 656 | |
---|
661 | 657 | cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_VIDEO_OUTPUT |
---|
662 | 658 | | V4L2_CAP_STREAMING | V4L2_CAP_DEVICE_CAPS; |
---|
663 | 659 | |
---|
664 | | - if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) |
---|
665 | | - cap->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING; |
---|
666 | | - else |
---|
667 | | - cap->device_caps = V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_STREAMING; |
---|
668 | 660 | |
---|
669 | 661 | return 0; |
---|
670 | 662 | } |
---|
.. | .. |
---|
711 | 703 | * requested. |
---|
712 | 704 | */ |
---|
713 | 705 | format->fmt.pix.field = V4L2_FIELD_INTERLACED_TB; |
---|
714 | | - /* Fall-through */ |
---|
| 706 | + fallthrough; |
---|
715 | 707 | case V4L2_FIELD_INTERLACED_TB: |
---|
716 | 708 | case V4L2_FIELD_INTERLACED_BT: |
---|
717 | 709 | /* Interlaced orders are only supported at the CCDC output. */ |
---|
.. | .. |
---|
940 | 932 | int ret; |
---|
941 | 933 | |
---|
942 | 934 | mutex_lock(&video->queue_lock); |
---|
943 | | - ret = vb2_qbuf(&vfh->queue, b); |
---|
| 935 | + ret = vb2_qbuf(&vfh->queue, video->video.v4l2_dev->mdev, b); |
---|
944 | 936 | mutex_unlock(&video->queue_lock); |
---|
945 | 937 | |
---|
946 | 938 | return ret; |
---|
.. | .. |
---|
1027 | 1019 | |
---|
1028 | 1020 | ctrls.count = 1; |
---|
1029 | 1021 | ctrls.controls = &ctrl; |
---|
1030 | | - |
---|
1031 | | - ret = v4l2_g_ext_ctrls(pipe->external->ctrl_handler, &ctrls); |
---|
| 1022 | + ret = v4l2_g_ext_ctrls(pipe->external->ctrl_handler, &video->video, |
---|
| 1023 | + NULL, &ctrls); |
---|
1032 | 1024 | if (ret < 0) { |
---|
1033 | 1025 | dev_warn(isp->dev, "no pixel rate control in subdev %s\n", |
---|
1034 | 1026 | pipe->external->name); |
---|
.. | .. |
---|
1251 | 1243 | if (input->index > 0) |
---|
1252 | 1244 | return -EINVAL; |
---|
1253 | 1245 | |
---|
1254 | | - strlcpy(input->name, "camera", sizeof(input->name)); |
---|
| 1246 | + strscpy(input->name, "camera", sizeof(input->name)); |
---|
1255 | 1247 | input->type = V4L2_INPUT_TYPE_CAMERA; |
---|
1256 | 1248 | |
---|
1257 | 1249 | return 0; |
---|
.. | .. |
---|
1318 | 1310 | goto done; |
---|
1319 | 1311 | } |
---|
1320 | 1312 | |
---|
1321 | | - ret = v4l2_pipeline_pm_use(&video->video.entity, 1); |
---|
| 1313 | + ret = v4l2_pipeline_pm_get(&video->video.entity); |
---|
1322 | 1314 | if (ret < 0) { |
---|
1323 | 1315 | omap3isp_put(video->isp); |
---|
1324 | 1316 | goto done; |
---|
.. | .. |
---|
1370 | 1362 | vb2_queue_release(&handle->queue); |
---|
1371 | 1363 | mutex_unlock(&video->queue_lock); |
---|
1372 | 1364 | |
---|
1373 | | - v4l2_pipeline_pm_use(&video->video.entity, 0); |
---|
| 1365 | + v4l2_pipeline_pm_put(&video->video.entity); |
---|
1374 | 1366 | |
---|
1375 | 1367 | /* Release the file handle. */ |
---|
1376 | 1368 | v4l2_fh_del(vfh); |
---|
.. | .. |
---|
1460 | 1452 | video->video.fops = &isp_video_fops; |
---|
1461 | 1453 | snprintf(video->video.name, sizeof(video->video.name), |
---|
1462 | 1454 | "OMAP3 ISP %s %s", name, direction); |
---|
1463 | | - video->video.vfl_type = VFL_TYPE_GRABBER; |
---|
| 1455 | + video->video.vfl_type = VFL_TYPE_VIDEO; |
---|
1464 | 1456 | video->video.release = video_device_release_empty; |
---|
1465 | 1457 | video->video.ioctl_ops = &isp_video_ioctl_ops; |
---|
| 1458 | + if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) |
---|
| 1459 | + video->video.device_caps = V4L2_CAP_VIDEO_CAPTURE |
---|
| 1460 | + | V4L2_CAP_STREAMING; |
---|
| 1461 | + else |
---|
| 1462 | + video->video.device_caps = V4L2_CAP_VIDEO_OUTPUT |
---|
| 1463 | + | V4L2_CAP_STREAMING; |
---|
| 1464 | + |
---|
1466 | 1465 | video->pipe.stream_state = ISP_PIPELINE_STREAM_STOPPED; |
---|
1467 | 1466 | |
---|
1468 | 1467 | video_set_drvdata(&video->video, video); |
---|
.. | .. |
---|
1484 | 1483 | |
---|
1485 | 1484 | video->video.v4l2_dev = vdev; |
---|
1486 | 1485 | |
---|
1487 | | - ret = video_register_device(&video->video, VFL_TYPE_GRABBER, -1); |
---|
| 1486 | + ret = video_register_device(&video->video, VFL_TYPE_VIDEO, -1); |
---|
1488 | 1487 | if (ret < 0) |
---|
1489 | 1488 | dev_err(video->isp->dev, |
---|
1490 | 1489 | "%s: could not register video device (%d)\n", |
---|
.. | .. |
---|
1495 | 1494 | |
---|
1496 | 1495 | void omap3isp_video_unregister(struct isp_video *video) |
---|
1497 | 1496 | { |
---|
1498 | | - if (video_is_registered(&video->video)) |
---|
1499 | | - video_unregister_device(&video->video); |
---|
| 1497 | + video_unregister_device(&video->video); |
---|
1500 | 1498 | } |
---|