forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-11 6778948f9de86c3cfaf36725a7c87dcff9ba247f
kernel/drivers/media/platform/s3c-camif/camif-capture.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * s3c24xx/s3c64xx SoC series Camera Interface (CAMIF) driver
34 *
....@@ -6,10 +7,6 @@
67 *
78 * Based on drivers/media/platform/s5p-fimc,
89 * Copyright (C) 2010 - 2012 Samsung Electronics Co., Ltd.
9
- *
10
- * This program is free software; you can redistribute it and/or modify
11
- * it under the terms of the GNU General Public License version 2 as
12
- * published by the Free Software Foundation.
1310 */
1411 #define pr_fmt(fmt) "%s:%d " fmt, __func__, __LINE__
1512
....@@ -640,14 +637,10 @@
640637 {
641638 struct camif_vp *vp = video_drvdata(file);
642639
643
- strlcpy(cap->driver, S3C_CAMIF_DRIVER_NAME, sizeof(cap->driver));
644
- strlcpy(cap->card, S3C_CAMIF_DRIVER_NAME, sizeof(cap->card));
640
+ strscpy(cap->driver, S3C_CAMIF_DRIVER_NAME, sizeof(cap->driver));
641
+ strscpy(cap->card, S3C_CAMIF_DRIVER_NAME, sizeof(cap->card));
645642 snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s.%d",
646643 dev_name(vp->camif->dev), vp->id);
647
-
648
- cap->device_caps = V4L2_CAP_STREAMING | V4L2_CAP_VIDEO_CAPTURE;
649
- cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS;
650
-
651644 return 0;
652645 }
653646
....@@ -661,7 +654,7 @@
661654 return -EINVAL;
662655
663656 input->type = V4L2_INPUT_TYPE_CAMERA;
664
- strlcpy(input->name, sensor->name, sizeof(input->name));
657
+ strscpy(input->name, sensor->name, sizeof(input->name));
665658 return 0;
666659 }
667660
....@@ -688,10 +681,7 @@
688681 if (!fmt)
689682 return -EINVAL;
690683
691
- strlcpy(f->description, fmt->name, sizeof(f->description));
692684 f->pixelformat = fmt->fourcc;
693
-
694
- pr_debug("fmt(%d): %s\n", f->index, f->description);
695685 return 0;
696686 }
697687
....@@ -805,10 +795,10 @@
805795 if (vp->owner == NULL)
806796 vp->owner = priv;
807797
808
- pr_debug("%ux%u. payload: %u. fmt: %s. %d %d. sizeimage: %d. bpl: %d\n",
809
- out_frame->f_width, out_frame->f_height, vp->payload, fmt->name,
810
- pix->width * pix->height * fmt->depth, fmt->depth,
811
- pix->sizeimage, pix->bytesperline);
798
+ pr_debug("%ux%u. payload: %u. fmt: 0x%08x. %d %d. sizeimage: %d. bpl: %d\n",
799
+ out_frame->f_width, out_frame->f_height, vp->payload,
800
+ fmt->fourcc, pix->width * pix->height * fmt->depth,
801
+ fmt->depth, pix->sizeimage, pix->bytesperline);
812802
813803 return 0;
814804 }
....@@ -943,7 +933,7 @@
943933 if (vp->owner && vp->owner != priv)
944934 return -EBUSY;
945935
946
- return vb2_qbuf(&vp->vb_queue, buf);
936
+ return vb2_qbuf(&vp->vb_queue, vp->vdev.v4l2_dev->mdev, buf);
947937 }
948938
949939 static int s3c_camif_dqbuf(struct file *file, void *priv,
....@@ -981,7 +971,7 @@
981971 struct v4l2_buffer *b)
982972 {
983973 struct camif_vp *vp = video_drvdata(file);
984
- return vb2_prepare_buf(&vp->vb_queue, b);
974
+ return vb2_prepare_buf(&vp->vb_queue, vp->vdev.v4l2_dev->mdev, b);
985975 }
986976
987977 static int s3c_camif_g_selection(struct file *file, void *priv,
....@@ -1166,8 +1156,9 @@
11661156 goto err_me_cleanup;
11671157
11681158 vfd->ctrl_handler = &vp->ctrl_handler;
1159
+ vfd->device_caps = V4L2_CAP_STREAMING | V4L2_CAP_VIDEO_CAPTURE;
11691160
1170
- ret = video_register_device(vfd, VFL_TYPE_GRABBER, -1);
1161
+ ret = video_register_device(vfd, VFL_TYPE_VIDEO, -1);
11711162 if (ret)
11721163 goto err_ctrlh_free;
11731164
....@@ -1555,7 +1546,7 @@
15551546
15561547 v4l2_subdev_init(sd, &s3c_camif_subdev_ops);
15571548 sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
1558
- strlcpy(sd->name, "S3C-CAMIF", sizeof(sd->name));
1549
+ strscpy(sd->name, "S3C-CAMIF", sizeof(sd->name));
15591550
15601551 camif->pads[CAMIF_SD_PAD_SINK].flags = MEDIA_PAD_FL_SINK;
15611552 camif->pads[CAMIF_SD_PAD_SOURCE_C].flags = MEDIA_PAD_FL_SOURCE;