.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * stk-webcam.c : Driver for Syntek 1125 USB webcam controller |
---|
3 | 4 | * |
---|
.. | .. |
---|
6 | 7 | * |
---|
7 | 8 | * Some parts are inspired from cafe_ccic.c |
---|
8 | 9 | * Copyright 2006-2007 Jonathan Corbet |
---|
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 as published by |
---|
12 | | - * the Free Software Foundation; either version 2 of the License, or |
---|
13 | | - * any later version. |
---|
14 | | - * |
---|
15 | | - * This program is distributed in the hope that it will be useful, |
---|
16 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
17 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
18 | | - * GNU General Public License for more details. |
---|
19 | 10 | */ |
---|
20 | 11 | |
---|
21 | 12 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
---|
.. | .. |
---|
114 | 105 | .matches = { |
---|
115 | 106 | DMI_MATCH(DMI_SYS_VENDOR, "HCL Infosystems Limited"), |
---|
116 | 107 | DMI_MATCH(DMI_PRODUCT_NAME, "T12Rg-H") |
---|
| 108 | + } |
---|
| 109 | + }, |
---|
| 110 | + { |
---|
| 111 | + .ident = "ASUS A6VM", |
---|
| 112 | + .matches = { |
---|
| 113 | + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK Computer Inc."), |
---|
| 114 | + DMI_MATCH(DMI_PRODUCT_NAME, "A6VM") |
---|
117 | 115 | } |
---|
118 | 116 | }, |
---|
119 | 117 | {} |
---|
.. | .. |
---|
796 | 794 | { |
---|
797 | 795 | struct stk_camera *dev = video_drvdata(filp); |
---|
798 | 796 | |
---|
799 | | - strcpy(cap->driver, "stk"); |
---|
800 | | - strcpy(cap->card, "stk"); |
---|
| 797 | + strscpy(cap->driver, "stk", sizeof(cap->driver)); |
---|
| 798 | + strscpy(cap->card, "stk", sizeof(cap->card)); |
---|
801 | 799 | usb_make_path(dev->udev, cap->bus_info, sizeof(cap->bus_info)); |
---|
802 | | - |
---|
803 | | - cap->device_caps = V4L2_CAP_VIDEO_CAPTURE |
---|
804 | | - | V4L2_CAP_READWRITE | V4L2_CAP_STREAMING; |
---|
805 | | - cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS; |
---|
806 | 800 | return 0; |
---|
807 | 801 | } |
---|
808 | 802 | |
---|
.. | .. |
---|
812 | 806 | if (input->index != 0) |
---|
813 | 807 | return -EINVAL; |
---|
814 | 808 | |
---|
815 | | - strcpy(input->name, "Syntek USB Camera"); |
---|
| 809 | + strscpy(input->name, "Syntek USB Camera", sizeof(input->name)); |
---|
816 | 810 | input->type = V4L2_INPUT_TYPE_CAMERA; |
---|
817 | 811 | return 0; |
---|
818 | 812 | } |
---|
.. | .. |
---|
862 | 856 | switch (fmtd->index) { |
---|
863 | 857 | case 0: |
---|
864 | 858 | fmtd->pixelformat = V4L2_PIX_FMT_RGB565; |
---|
865 | | - strcpy(fmtd->description, "r5g6b5"); |
---|
866 | 859 | break; |
---|
867 | 860 | case 1: |
---|
868 | 861 | fmtd->pixelformat = V4L2_PIX_FMT_RGB565X; |
---|
869 | | - strcpy(fmtd->description, "r5g6b5BE"); |
---|
870 | 862 | break; |
---|
871 | 863 | case 2: |
---|
872 | 864 | fmtd->pixelformat = V4L2_PIX_FMT_UYVY; |
---|
873 | | - strcpy(fmtd->description, "yuv4:2:2"); |
---|
874 | 865 | break; |
---|
875 | 866 | case 3: |
---|
876 | 867 | fmtd->pixelformat = V4L2_PIX_FMT_SBGGR8; |
---|
877 | | - strcpy(fmtd->description, "Raw bayer"); |
---|
878 | 868 | break; |
---|
879 | 869 | case 4: |
---|
880 | 870 | fmtd->pixelformat = V4L2_PIX_FMT_YUYV; |
---|
881 | | - strcpy(fmtd->description, "yuv4:2:2"); |
---|
882 | 871 | break; |
---|
883 | 872 | default: |
---|
884 | 873 | return -EINVAL; |
---|
.. | .. |
---|
998 | 987 | stk_camera_write_reg(dev, 0x001c, 0x46); |
---|
999 | 988 | /* |
---|
1000 | 989 | * Registers 0x0115 0x0114 are the size of each line (bytes), |
---|
1001 | | - * regs 0x0117 0x0116 are the heigth of the image. |
---|
| 990 | + * regs 0x0117 0x0116 are the height of the image. |
---|
1002 | 991 | */ |
---|
1003 | 992 | stk_camera_write_reg(dev, 0x0115, |
---|
1004 | 993 | ((stk_sizes[i].w * depth) >> 8) & 0xff); |
---|
.. | .. |
---|
1136 | 1125 | sbuf->v4lbuf.flags &= ~V4L2_BUF_FLAG_QUEUED; |
---|
1137 | 1126 | sbuf->v4lbuf.flags |= V4L2_BUF_FLAG_DONE; |
---|
1138 | 1127 | sbuf->v4lbuf.sequence = ++dev->sequence; |
---|
1139 | | - v4l2_get_timestamp(&sbuf->v4lbuf.timestamp); |
---|
| 1128 | + v4l2_buffer_set_timestamp(&sbuf->v4lbuf, ktime_get_ns()); |
---|
1140 | 1129 | |
---|
1141 | 1130 | *buf = sbuf->v4lbuf; |
---|
1142 | 1131 | return 0; |
---|
.. | .. |
---|
1262 | 1251 | dev->vdev = stk_v4l_data; |
---|
1263 | 1252 | dev->vdev.lock = &dev->lock; |
---|
1264 | 1253 | dev->vdev.v4l2_dev = &dev->v4l2_dev; |
---|
| 1254 | + dev->vdev.device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE | |
---|
| 1255 | + V4L2_CAP_STREAMING; |
---|
1265 | 1256 | video_set_drvdata(&dev->vdev, dev); |
---|
1266 | | - err = video_register_device(&dev->vdev, VFL_TYPE_GRABBER, -1); |
---|
| 1257 | + err = video_register_device(&dev->vdev, VFL_TYPE_VIDEO, -1); |
---|
1267 | 1258 | if (err) |
---|
1268 | 1259 | pr_err("v4l registration failed\n"); |
---|
1269 | 1260 | else |
---|