hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/drivers/media/platform/davinci/vpif_display.c
....@@ -2,7 +2,7 @@
22 * vpif-display - VPIF display driver
33 * Display driver for TI DaVinci VPIF
44 *
5
- * Copyright (C) 2009 Texas Instruments Incorporated - http://www.ti.com/
5
+ * Copyright (C) 2009 Texas Instruments Incorporated - https://www.ti.com/
66 * Copyright (C) 2014 Lad, Prabhakar <prabhakar.csengg@gmail.com>
77 *
88 * This program is free software; you can redistribute it and/or
....@@ -138,7 +138,7 @@
138138 * vpif_buffer_queue : Callback function to add buffer to DMA queue
139139 * @vb: ptr to vb2_buffer
140140 *
141
- * This callback fucntion queues the buffer to DMA engine
141
+ * This callback function queues the buffer to DMA engine
142142 */
143143 static void vpif_buffer_queue(struct vb2_buffer *vb)
144144 {
....@@ -584,12 +584,10 @@
584584 {
585585 struct vpif_display_config *config = vpif_dev->platform_data;
586586
587
- cap->device_caps = V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_STREAMING;
588
- cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS;
589
- strlcpy(cap->driver, VPIF_DRIVER_NAME, sizeof(cap->driver));
587
+ strscpy(cap->driver, VPIF_DRIVER_NAME, sizeof(cap->driver));
590588 snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s",
591589 dev_name(vpif_dev));
592
- strlcpy(cap->card, config->card_name, sizeof(cap->card));
590
+ strscpy(cap->card, config->card_name, sizeof(cap->card));
593591
594592 return 0;
595593 }
....@@ -601,10 +599,7 @@
601599 return -EINVAL;
602600
603601 /* Fill in the information about format */
604
- fmt->type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
605
- strcpy(fmt->description, "YCbCr4:2:2 YC Planar");
606602 fmt->pixelformat = V4L2_PIX_FMT_YUV422P;
607
- fmt->flags = 0;
608603 return 0;
609604 }
610605
....@@ -634,7 +629,7 @@
634629 struct v4l2_pix_format *pixfmt = &fmt->fmt.pix;
635630
636631 /*
637
- * to supress v4l-compliance warnings silently correct
632
+ * to suppress v4l-compliance warnings silently correct
638633 * the pixelformat
639634 */
640635 if (pixfmt->pixelformat != V4L2_PIX_FMT_YUV422P)
....@@ -986,8 +981,8 @@
986981 } else {
987982 std_info->l5 = std_info->vsize - (bt->vfrontporch - 1);
988983 }
989
- strncpy(std_info->name, "Custom timings BT656/1120",
990
- VPIF_MAX_NAME);
984
+ strscpy(std_info->name, "Custom timings BT656/1120",
985
+ sizeof(std_info->name));
991986 std_info->width = bt->width;
992987 std_info->height = bt->height;
993988 std_info->frm_fmt = bt->interlaced ? 0 : 1;
....@@ -1209,7 +1204,7 @@
12091204
12101205 /* Initialize the video_device structure */
12111206 vdev = &ch->video_dev;
1212
- strlcpy(vdev->name, VPIF_DRIVER_NAME, sizeof(vdev->name));
1207
+ strscpy(vdev->name, VPIF_DRIVER_NAME, sizeof(vdev->name));
12131208 vdev->release = video_device_release_empty;
12141209 vdev->fops = &vpif_fops;
12151210 vdev->ioctl_ops = &vpif_ioctl_ops;
....@@ -1217,8 +1212,9 @@
12171212 vdev->vfl_dir = VFL_DIR_TX;
12181213 vdev->queue = q;
12191214 vdev->lock = &common->lock;
1215
+ vdev->device_caps = V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_STREAMING;
12201216 video_set_drvdata(&ch->video_dev, ch);
1221
- err = video_register_device(vdev, VFL_TYPE_GRABBER,
1217
+ err = video_register_device(vdev, VFL_TYPE_VIDEO,
12221218 (j ? 3 : 2));
12231219 if (err < 0)
12241220 goto probe_out;
....@@ -1229,7 +1225,6 @@
12291225 probe_out:
12301226 for (k = 0; k < j; k++) {
12311227 ch = vpif_obj.dev[k];
1232
- common = &ch->common[k];
12331228 video_unregister_device(&ch->video_dev);
12341229 }
12351230 return err;
....@@ -1299,6 +1294,8 @@
12991294 goto vpif_unregister;
13001295 }
13011296
1297
+ v4l2_async_notifier_init(&vpif_obj.notifier);
1298
+
13021299 if (!vpif_obj.config->asd_sizes) {
13031300 i2c_adap = i2c_get_adapter(vpif_obj.config->i2c_adapter_id);
13041301 for (i = 0; i < subdev_count; i++) {
....@@ -1322,20 +1319,27 @@
13221319 goto probe_subdev_out;
13231320 }
13241321 } else {
1325
- vpif_obj.notifier.subdevs = vpif_obj.config->asd;
1326
- vpif_obj.notifier.num_subdevs = vpif_obj.config->asd_sizes[0];
1322
+ for (i = 0; i < vpif_obj.config->asd_sizes[0]; i++) {
1323
+ err = v4l2_async_notifier_add_subdev(
1324
+ &vpif_obj.notifier, vpif_obj.config->asd[i]);
1325
+ if (err)
1326
+ goto probe_cleanup;
1327
+ }
1328
+
13271329 vpif_obj.notifier.ops = &vpif_async_ops;
13281330 err = v4l2_async_notifier_register(&vpif_obj.v4l2_dev,
13291331 &vpif_obj.notifier);
13301332 if (err) {
13311333 vpif_err("Error registering async notifier\n");
13321334 err = -EINVAL;
1333
- goto probe_subdev_out;
1335
+ goto probe_cleanup;
13341336 }
13351337 }
13361338
13371339 return 0;
13381340
1341
+probe_cleanup:
1342
+ v4l2_async_notifier_cleanup(&vpif_obj.notifier);
13391343 probe_subdev_out:
13401344 kfree(vpif_obj.sd);
13411345 vpif_unregister:
....@@ -1354,6 +1358,11 @@
13541358 struct channel_obj *ch;
13551359 int i;
13561360
1361
+ if (vpif_obj.config->asd_sizes) {
1362
+ v4l2_async_notifier_unregister(&vpif_obj.notifier);
1363
+ v4l2_async_notifier_cleanup(&vpif_obj.notifier);
1364
+ }
1365
+
13571366 v4l2_device_unregister(&vpif_obj.v4l2_dev);
13581367
13591368 kfree(vpif_obj.sd);