.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
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/ |
---|
12 | 4 | */ |
---|
13 | 5 | #include <linux/kernel.h> |
---|
14 | 6 | #include <linux/init.h> |
---|
.. | .. |
---|
25 | 17 | #include <linux/videodev2.h> |
---|
26 | 18 | #include <linux/slab.h> |
---|
27 | 19 | |
---|
28 | | -#include <asm/pgtable.h> |
---|
29 | | - |
---|
30 | | -#ifdef CONFIG_ARCH_DAVINCI |
---|
31 | | -#include <mach/cputype.h> |
---|
32 | | -#endif |
---|
33 | 20 | |
---|
34 | 21 | #include <media/v4l2-dev.h> |
---|
35 | 22 | #include <media/v4l2-common.h> |
---|
.. | .. |
---|
641 | 628 | struct vpbe_layer *layer = video_drvdata(file); |
---|
642 | 629 | struct vpbe_device *vpbe_dev = layer->disp_dev->vpbe_dev; |
---|
643 | 630 | |
---|
644 | | - cap->device_caps = V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_STREAMING; |
---|
645 | | - cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS; |
---|
646 | 631 | snprintf(cap->driver, sizeof(cap->driver), "%s", |
---|
647 | 632 | dev_name(vpbe_dev->pdev)); |
---|
648 | 633 | snprintf(cap->bus_info, sizeof(cap->bus_info), "platform:%s", |
---|
649 | 634 | 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)); |
---|
651 | 636 | |
---|
652 | 637 | return 0; |
---|
653 | 638 | } |
---|
.. | .. |
---|
759 | 744 | return 0; |
---|
760 | 745 | } |
---|
761 | 746 | |
---|
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) |
---|
764 | 749 | { |
---|
765 | 750 | struct vpbe_layer *layer = video_drvdata(file); |
---|
766 | 751 | struct vpbe_device *vpbe_dev = layer->disp_dev->vpbe_dev; |
---|
767 | 752 | |
---|
768 | 753 | v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, "VIDIOC_CROPCAP ioctl\n"); |
---|
769 | 754 | |
---|
770 | | - if (cropcap->type != V4L2_BUF_TYPE_VIDEO_OUTPUT) |
---|
| 755 | + if (type != V4L2_BUF_TYPE_VIDEO_OUTPUT) |
---|
771 | 756 | return -EINVAL; |
---|
772 | 757 | |
---|
773 | | - cropcap->pixelaspect = vpbe_dev->current_timings.aspect; |
---|
| 758 | + *f = vpbe_dev->current_timings.aspect; |
---|
774 | 759 | return 0; |
---|
775 | 760 | } |
---|
776 | 761 | |
---|
.. | .. |
---|
800 | 785 | { |
---|
801 | 786 | struct vpbe_layer *layer = video_drvdata(file); |
---|
802 | 787 | struct vpbe_device *vpbe_dev = layer->disp_dev->vpbe_dev; |
---|
803 | | - unsigned int index = 0; |
---|
804 | 788 | |
---|
805 | 789 | v4l2_dbg(1, debug, &vpbe_dev->v4l2_dev, |
---|
806 | 790 | "VIDIOC_ENUM_FMT, layer id = %d\n", |
---|
.. | .. |
---|
811 | 795 | } |
---|
812 | 796 | |
---|
813 | 797 | /* 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) |
---|
820 | 799 | fmt->pixelformat = V4L2_PIX_FMT_UYVY; |
---|
821 | | - } else { |
---|
822 | | - strcpy(fmt->description, "Y/CbCr 4:2:0"); |
---|
| 800 | + else |
---|
823 | 801 | fmt->pixelformat = V4L2_PIX_FMT_NV12; |
---|
824 | | - } |
---|
825 | 802 | |
---|
826 | 803 | return 0; |
---|
827 | 804 | } |
---|
.. | .. |
---|
1261 | 1238 | .vidioc_streamoff = vb2_ioctl_streamoff, |
---|
1262 | 1239 | .vidioc_expbuf = vb2_ioctl_expbuf, |
---|
1263 | 1240 | |
---|
1264 | | - .vidioc_cropcap = vpbe_display_cropcap, |
---|
| 1241 | + .vidioc_g_pixelaspect = vpbe_display_g_pixelaspect, |
---|
1265 | 1242 | .vidioc_g_selection = vpbe_display_g_selection, |
---|
1266 | 1243 | .vidioc_s_selection = vpbe_display_s_selection, |
---|
1267 | 1244 | |
---|
.. | .. |
---|
1325 | 1302 | vbd->v4l2_dev = &disp_dev->vpbe_dev->v4l2_dev; |
---|
1326 | 1303 | vbd->lock = &vpbe_display_layer->opslock; |
---|
1327 | 1304 | vbd->vfl_dir = VFL_DIR_TX; |
---|
| 1305 | + vbd->device_caps = V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_STREAMING; |
---|
1328 | 1306 | |
---|
1329 | 1307 | if (disp_dev->vpbe_dev->current_timings.timings_type & |
---|
1330 | 1308 | VPBE_ENC_STD) |
---|
.. | .. |
---|
1360 | 1338 | |
---|
1361 | 1339 | vpbe_display_layer->video_dev.queue = &vpbe_display_layer->buffer_queue; |
---|
1362 | 1340 | err = video_register_device(&vpbe_display_layer->video_dev, |
---|
1363 | | - VFL_TYPE_GRABBER, |
---|
| 1341 | + VFL_TYPE_VIDEO, |
---|
1364 | 1342 | -1); |
---|
1365 | 1343 | if (err) |
---|
1366 | 1344 | return -ENODEV; |
---|