hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/drivers/media/platform/davinci/vpbe_display.c
....@@ -1,14 +1,6 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
2
- * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/
3
- *
4
- * This program is free software; you can redistribute it and/or
5
- * modify it under the terms of the GNU General Public License as
6
- * published by the Free Software Foundation version 2.
7
- *
8
- * This program is distributed WITHOUT ANY WARRANTY of any
9
- * kind, whether express or implied; without even the implied warranty
10
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
- * GNU General Public License for more details.
3
+ * Copyright (C) 2010 Texas Instruments Incorporated - https://www.ti.com/
124 */
135 #include <linux/kernel.h>
146 #include <linux/init.h>
....@@ -25,11 +17,6 @@
2517 #include <linux/videodev2.h>
2618 #include <linux/slab.h>
2719
28
-#include <asm/pgtable.h>
29
-
30
-#ifdef CONFIG_ARCH_DAVINCI
31
-#include <mach/cputype.h>
32
-#endif
3320
3421 #include <media/v4l2-dev.h>
3522 #include <media/v4l2-common.h>
....@@ -641,13 +628,11 @@
641628 struct vpbe_layer *layer = video_drvdata(file);
642629 struct vpbe_device *vpbe_dev = layer->disp_dev->vpbe_dev;
643630
644
- cap->device_caps = V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_STREAMING;
645
- cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS;
646631 snprintf(cap->driver, sizeof(cap->driver), "%s",
647632 dev_name(vpbe_dev->pdev));
648633 snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s",
649634 dev_name(vpbe_dev->pdev));
650
- strlcpy(cap->card, vpbe_dev->cfg->module_name, sizeof(cap->card));
635
+ strscpy(cap->card, vpbe_dev->cfg->module_name, sizeof(cap->card));
651636
652637 return 0;
653638 }
....@@ -759,18 +744,18 @@
759744 return 0;
760745 }
761746
762
-static int vpbe_display_cropcap(struct file *file, void *priv,
763
- struct v4l2_cropcap *cropcap)
747
+static int vpbe_display_g_pixelaspect(struct file *file, void *priv,
748
+ int type, struct v4l2_fract *f)
764749 {
765750 struct vpbe_layer *layer = video_drvdata(file);
766751 struct vpbe_device *vpbe_dev = layer->disp_dev->vpbe_dev;
767752
768753 v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, "VIDIOC_CROPCAP ioctl\n");
769754
770
- if (cropcap->type != V4L2_BUF_TYPE_VIDEO_OUTPUT)
755
+ if (type != V4L2_BUF_TYPE_VIDEO_OUTPUT)
771756 return -EINVAL;
772757
773
- cropcap->pixelaspect = vpbe_dev->current_timings.aspect;
758
+ *f = vpbe_dev->current_timings.aspect;
774759 return 0;
775760 }
776761
....@@ -800,7 +785,6 @@
800785 {
801786 struct vpbe_layer *layer = video_drvdata(file);
802787 struct vpbe_device *vpbe_dev = layer->disp_dev->vpbe_dev;
803
- unsigned int index = 0;
804788
805789 v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev,
806790 "VIDIOC_ENUM_FMT, layer id = %d\n",
....@@ -811,17 +795,10 @@
811795 }
812796
813797 /* Fill in the information about format */
814
- index = fmt->index;
815
- memset(fmt, 0, sizeof(*fmt));
816
- fmt->index = index;
817
- fmt->type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
818
- if (index == 0) {
819
- strcpy(fmt->description, "YUV 4:2:2 - UYVY");
798
+ if (fmt->index == 0)
820799 fmt->pixelformat = V4L2_PIX_FMT_UYVY;
821
- } else {
822
- strcpy(fmt->description, "Y/CbCr 4:2:0");
800
+ else
823801 fmt->pixelformat = V4L2_PIX_FMT_NV12;
824
- }
825802
826803 return 0;
827804 }
....@@ -1261,7 +1238,7 @@
12611238 .vidioc_streamoff = vb2_ioctl_streamoff,
12621239 .vidioc_expbuf = vb2_ioctl_expbuf,
12631240
1264
- .vidioc_cropcap = vpbe_display_cropcap,
1241
+ .vidioc_g_pixelaspect = vpbe_display_g_pixelaspect,
12651242 .vidioc_g_selection = vpbe_display_g_selection,
12661243 .vidioc_s_selection = vpbe_display_s_selection,
12671244
....@@ -1325,6 +1302,7 @@
13251302 vbd->v4l2_dev = &disp_dev->vpbe_dev->v4l2_dev;
13261303 vbd->lock = &vpbe_display_layer->opslock;
13271304 vbd->vfl_dir = VFL_DIR_TX;
1305
+ vbd->device_caps = V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_STREAMING;
13281306
13291307 if (disp_dev->vpbe_dev->current_timings.timings_type &
13301308 VPBE_ENC_STD)
....@@ -1360,7 +1338,7 @@
13601338
13611339 vpbe_display_layer->video_dev.queue = &vpbe_display_layer->buffer_queue;
13621340 err = video_register_device(&vpbe_display_layer->video_dev,
1363
- VFL_TYPE_GRABBER,
1341
+ VFL_TYPE_VIDEO,
13641342 -1);
13651343 if (err)
13661344 return -ENODEV;