hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/drivers/media/platform/sh_vou.c
....@@ -138,7 +138,6 @@
138138
139139 struct sh_vou_fmt {
140140 u32 pfmt;
141
- char *desc;
142141 unsigned char bpp;
143142 unsigned char bpl;
144143 unsigned char rgb;
....@@ -152,7 +151,6 @@
152151 .pfmt = V4L2_PIX_FMT_NV12,
153152 .bpp = 12,
154153 .bpl = 1,
155
- .desc = "YVU420 planar",
156154 .yf = 0,
157155 .rgb = 0,
158156 },
....@@ -160,7 +158,6 @@
160158 .pfmt = V4L2_PIX_FMT_NV16,
161159 .bpp = 16,
162160 .bpl = 1,
163
- .desc = "YVYU planar",
164161 .yf = 1,
165162 .rgb = 0,
166163 },
....@@ -168,7 +165,6 @@
168165 .pfmt = V4L2_PIX_FMT_RGB24,
169166 .bpp = 24,
170167 .bpl = 3,
171
- .desc = "RGB24",
172168 .pkf = 2,
173169 .rgb = 1,
174170 },
....@@ -176,7 +172,6 @@
176172 .pfmt = V4L2_PIX_FMT_RGB565,
177173 .bpp = 16,
178174 .bpl = 2,
179
- .desc = "RGB565",
180175 .pkf = 3,
181176 .rgb = 1,
182177 },
....@@ -184,7 +179,6 @@
184179 .pfmt = V4L2_PIX_FMT_RGB565X,
185180 .bpp = 16,
186181 .bpl = 2,
187
- .desc = "RGB565 byteswapped",
188182 .pkf = 3,
189183 .rgb = 1,
190184 },
....@@ -226,7 +220,7 @@
226220 break;
227221 case V4L2_PIX_FMT_RGB565:
228222 dataswap ^= 1;
229
- /* fall through */
223
+ fallthrough;
230224 case V4L2_PIX_FMT_RGB565X:
231225 row_coeff = 2;
232226 break;
....@@ -378,12 +372,9 @@
378372
379373 dev_dbg(vou_dev->v4l2_dev.dev, "%s()\n", __func__);
380374
381
- strlcpy(cap->card, "SuperH VOU", sizeof(cap->card));
382
- strlcpy(cap->driver, "sh-vou", sizeof(cap->driver));
383
- strlcpy(cap->bus_info, "platform:sh-vou", sizeof(cap->bus_info));
384
- cap->device_caps = V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_READWRITE |
385
- V4L2_CAP_STREAMING;
386
- cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS;
375
+ strscpy(cap->card, "SuperH VOU", sizeof(cap->card));
376
+ strscpy(cap->driver, "sh-vou", sizeof(cap->driver));
377
+ strscpy(cap->bus_info, "platform:sh-vou", sizeof(cap->bus_info));
387378 return 0;
388379 }
389380
....@@ -398,9 +389,6 @@
398389
399390 dev_dbg(vou_dev->v4l2_dev.dev, "%s()\n", __func__);
400391
401
- fmt->type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
402
- strlcpy(fmt->description, vou_fmt[fmt->index].desc,
403
- sizeof(fmt->description));
404392 fmt->pixelformat = vou_fmt[fmt->index].pfmt;
405393
406394 return 0;
....@@ -494,7 +482,8 @@
494482 if (h_idx)
495483 vouvcr |= (1 << 14) | vou_scale_v_fld[h_idx - 1];
496484
497
- dev_dbg(vou_dev->v4l2_dev.dev, "%s: scaling 0x%x\n", fmt->desc, vouvcr);
485
+ dev_dbg(vou_dev->v4l2_dev.dev, "0x%08x: scaling 0x%x\n",
486
+ fmt->pfmt, vouvcr);
498487
499488 /* To produce a colour bar for testing set bit 23 of VOUVCR */
500489 sh_vou_reg_ab_write(vou_dev, VOUVCR, vouvcr);
....@@ -790,7 +779,7 @@
790779
791780 if (a->index)
792781 return -EINVAL;
793
- strlcpy(a->name, "Video Out", sizeof(a->name));
782
+ strscpy(a->name, "Video Out", sizeof(a->name));
794783 a->type = V4L2_OUTPUT_TYPE_ANALOG;
795784 a->std = vou_dev->vdev.tvnorms;
796785 return 0;
....@@ -813,7 +802,7 @@
813802 default:
814803 pr_warn("%s(): Invalid bus-format code %d, using default 8-bit\n",
815804 __func__, bus_fmt);
816
- /* fall through */
805
+ fallthrough;
817806 case SH_VOU_BUS_8BIT:
818807 return 1;
819808 case SH_VOU_BUS_16BIT:
....@@ -1007,7 +996,7 @@
1007996
1008997 /*
1009998 * No down-scaling. According to the API, current call has precedence:
1010
- * http://v4l2spec.bytesex.org/spec/x1904.htm#AEN1954 paragraph two.
999
+ * https://linuxtv.org/downloads/v4l-dvb-apis/uapi/v4l/crop.html#cropping-structures
10111000 */
10121001 vou_adjust_input(&geo, vou_dev->std);
10131002
....@@ -1144,7 +1133,11 @@
11441133 if (v4l2_fh_is_singular_file(file) &&
11451134 vou_dev->status == SH_VOU_INITIALISING) {
11461135 /* First open */
1147
- pm_runtime_get_sync(vou_dev->v4l2_dev.dev);
1136
+ err = pm_runtime_resume_and_get(vou_dev->v4l2_dev.dev);
1137
+ if (err < 0) {
1138
+ v4l2_fh_release(file);
1139
+ goto done_open;
1140
+ }
11481141 err = sh_vou_hw_init(vou_dev);
11491142 if (err < 0) {
11501143 pm_runtime_put(vou_dev->v4l2_dev.dev);
....@@ -1218,6 +1211,8 @@
12181211 .ioctl_ops = &sh_vou_ioctl_ops,
12191212 .tvnorms = V4L2_STD_525_60, /* PAL only supported in 8-bit non-bt656 mode */
12201213 .vfl_dir = VFL_DIR_TX,
1214
+ .device_caps = V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_READWRITE |
1215
+ V4L2_CAP_STREAMING,
12211216 };
12221217
12231218 static int sh_vou_probe(struct platform_device *pdev)
....@@ -1332,7 +1327,7 @@
13321327 goto ei2cnd;
13331328 }
13341329
1335
- ret = video_register_device(vdev, VFL_TYPE_GRABBER, -1);
1330
+ ret = video_register_device(vdev, VFL_TYPE_VIDEO, -1);
13361331 if (ret < 0)
13371332 goto evregdev;
13381333