.. | .. |
---|
138 | 138 | |
---|
139 | 139 | struct sh_vou_fmt { |
---|
140 | 140 | u32 pfmt; |
---|
141 | | - char *desc; |
---|
142 | 141 | unsigned char bpp; |
---|
143 | 142 | unsigned char bpl; |
---|
144 | 143 | unsigned char rgb; |
---|
.. | .. |
---|
152 | 151 | .pfmt = V4L2_PIX_FMT_NV12, |
---|
153 | 152 | .bpp = 12, |
---|
154 | 153 | .bpl = 1, |
---|
155 | | - .desc = "YVU420 planar", |
---|
156 | 154 | .yf = 0, |
---|
157 | 155 | .rgb = 0, |
---|
158 | 156 | }, |
---|
.. | .. |
---|
160 | 158 | .pfmt = V4L2_PIX_FMT_NV16, |
---|
161 | 159 | .bpp = 16, |
---|
162 | 160 | .bpl = 1, |
---|
163 | | - .desc = "YVYU planar", |
---|
164 | 161 | .yf = 1, |
---|
165 | 162 | .rgb = 0, |
---|
166 | 163 | }, |
---|
.. | .. |
---|
168 | 165 | .pfmt = V4L2_PIX_FMT_RGB24, |
---|
169 | 166 | .bpp = 24, |
---|
170 | 167 | .bpl = 3, |
---|
171 | | - .desc = "RGB24", |
---|
172 | 168 | .pkf = 2, |
---|
173 | 169 | .rgb = 1, |
---|
174 | 170 | }, |
---|
.. | .. |
---|
176 | 172 | .pfmt = V4L2_PIX_FMT_RGB565, |
---|
177 | 173 | .bpp = 16, |
---|
178 | 174 | .bpl = 2, |
---|
179 | | - .desc = "RGB565", |
---|
180 | 175 | .pkf = 3, |
---|
181 | 176 | .rgb = 1, |
---|
182 | 177 | }, |
---|
.. | .. |
---|
184 | 179 | .pfmt = V4L2_PIX_FMT_RGB565X, |
---|
185 | 180 | .bpp = 16, |
---|
186 | 181 | .bpl = 2, |
---|
187 | | - .desc = "RGB565 byteswapped", |
---|
188 | 182 | .pkf = 3, |
---|
189 | 183 | .rgb = 1, |
---|
190 | 184 | }, |
---|
.. | .. |
---|
226 | 220 | break; |
---|
227 | 221 | case V4L2_PIX_FMT_RGB565: |
---|
228 | 222 | dataswap ^= 1; |
---|
229 | | - /* fall through */ |
---|
| 223 | + fallthrough; |
---|
230 | 224 | case V4L2_PIX_FMT_RGB565X: |
---|
231 | 225 | row_coeff = 2; |
---|
232 | 226 | break; |
---|
.. | .. |
---|
378 | 372 | |
---|
379 | 373 | dev_dbg(vou_dev->v4l2_dev.dev, "%s()\n", __func__); |
---|
380 | 374 | |
---|
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)); |
---|
387 | 378 | return 0; |
---|
388 | 379 | } |
---|
389 | 380 | |
---|
.. | .. |
---|
398 | 389 | |
---|
399 | 390 | dev_dbg(vou_dev->v4l2_dev.dev, "%s()\n", __func__); |
---|
400 | 391 | |
---|
401 | | - fmt->type = V4L2_BUF_TYPE_VIDEO_OUTPUT; |
---|
402 | | - strlcpy(fmt->description, vou_fmt[fmt->index].desc, |
---|
403 | | - sizeof(fmt->description)); |
---|
404 | 392 | fmt->pixelformat = vou_fmt[fmt->index].pfmt; |
---|
405 | 393 | |
---|
406 | 394 | return 0; |
---|
.. | .. |
---|
494 | 482 | if (h_idx) |
---|
495 | 483 | vouvcr |= (1 << 14) | vou_scale_v_fld[h_idx - 1]; |
---|
496 | 484 | |
---|
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); |
---|
498 | 487 | |
---|
499 | 488 | /* To produce a colour bar for testing set bit 23 of VOUVCR */ |
---|
500 | 489 | sh_vou_reg_ab_write(vou_dev, VOUVCR, vouvcr); |
---|
.. | .. |
---|
790 | 779 | |
---|
791 | 780 | if (a->index) |
---|
792 | 781 | return -EINVAL; |
---|
793 | | - strlcpy(a->name, "Video Out", sizeof(a->name)); |
---|
| 782 | + strscpy(a->name, "Video Out", sizeof(a->name)); |
---|
794 | 783 | a->type = V4L2_OUTPUT_TYPE_ANALOG; |
---|
795 | 784 | a->std = vou_dev->vdev.tvnorms; |
---|
796 | 785 | return 0; |
---|
.. | .. |
---|
813 | 802 | default: |
---|
814 | 803 | pr_warn("%s(): Invalid bus-format code %d, using default 8-bit\n", |
---|
815 | 804 | __func__, bus_fmt); |
---|
816 | | - /* fall through */ |
---|
| 805 | + fallthrough; |
---|
817 | 806 | case SH_VOU_BUS_8BIT: |
---|
818 | 807 | return 1; |
---|
819 | 808 | case SH_VOU_BUS_16BIT: |
---|
.. | .. |
---|
1007 | 996 | |
---|
1008 | 997 | /* |
---|
1009 | 998 | * 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 |
---|
1011 | 1000 | */ |
---|
1012 | 1001 | vou_adjust_input(&geo, vou_dev->std); |
---|
1013 | 1002 | |
---|
.. | .. |
---|
1144 | 1133 | if (v4l2_fh_is_singular_file(file) && |
---|
1145 | 1134 | vou_dev->status == SH_VOU_INITIALISING) { |
---|
1146 | 1135 | /* 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 | + } |
---|
1148 | 1141 | err = sh_vou_hw_init(vou_dev); |
---|
1149 | 1142 | if (err < 0) { |
---|
1150 | 1143 | pm_runtime_put(vou_dev->v4l2_dev.dev); |
---|
.. | .. |
---|
1218 | 1211 | .ioctl_ops = &sh_vou_ioctl_ops, |
---|
1219 | 1212 | .tvnorms = V4L2_STD_525_60, /* PAL only supported in 8-bit non-bt656 mode */ |
---|
1220 | 1213 | .vfl_dir = VFL_DIR_TX, |
---|
| 1214 | + .device_caps = V4L2_CAP_VIDEO_OUTPUT | V4L2_CAP_READWRITE | |
---|
| 1215 | + V4L2_CAP_STREAMING, |
---|
1221 | 1216 | }; |
---|
1222 | 1217 | |
---|
1223 | 1218 | static int sh_vou_probe(struct platform_device *pdev) |
---|
.. | .. |
---|
1332 | 1327 | goto ei2cnd; |
---|
1333 | 1328 | } |
---|
1334 | 1329 | |
---|
1335 | | - ret = video_register_device(vdev, VFL_TYPE_GRABBER, -1); |
---|
| 1330 | + ret = video_register_device(vdev, VFL_TYPE_VIDEO, -1); |
---|
1336 | 1331 | if (ret < 0) |
---|
1337 | 1332 | goto evregdev; |
---|
1338 | 1333 | |
---|