.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /*************************************************************************** |
---|
2 | 3 | * Copyright (C) 2006-2010 by Marin Mitov * |
---|
3 | 4 | * mitov@issp.bas.bg * |
---|
4 | 5 | * * |
---|
5 | | - * This program is free software; you can redistribute it and/or modify * |
---|
6 | | - * it under the terms of the GNU General Public License as published by * |
---|
7 | | - * the Free Software Foundation; either version 2 of the License, or * |
---|
8 | | - * (at your option) any later version. * |
---|
9 | | - * * |
---|
10 | | - * This program is distributed in the hope that it will be useful, * |
---|
11 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of * |
---|
12 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * |
---|
13 | | - * GNU General Public License for more details. * |
---|
14 | 6 | * * |
---|
15 | 7 | ***************************************************************************/ |
---|
16 | 8 | |
---|
.. | .. |
---|
46 | 38 | u32 tmp = index; |
---|
47 | 39 | |
---|
48 | 40 | iowrite32((tmp << 17) | IIC_READ, addr + IIC_CSR2); |
---|
49 | | - mmiowb(); |
---|
50 | 41 | udelay(45); /* wait at least 43 usec for NEW_CYCLE to clear */ |
---|
51 | 42 | if (ioread32(addr + IIC_CSR2) & NEW_CYCLE) |
---|
52 | 43 | return -EIO; /* error: NEW_CYCLE not cleared */ |
---|
.. | .. |
---|
77 | 68 | u32 tmp = index; |
---|
78 | 69 | |
---|
79 | 70 | iowrite32((tmp << 17) | IIC_WRITE | data, addr + IIC_CSR2); |
---|
80 | | - mmiowb(); |
---|
81 | 71 | udelay(65); /* wait at least 63 usec for NEW_CYCLE to clear */ |
---|
82 | 72 | if (ioread32(addr + IIC_CSR2) & NEW_CYCLE) |
---|
83 | 73 | return -EIO; /* error: NEW_CYCLE not cleared */ |
---|
.. | .. |
---|
104 | 94 | u32 tmp = index; |
---|
105 | 95 | |
---|
106 | 96 | iowrite32((tmp << 17) | IIC_WRITE | data, addr + IIC_CSR2); |
---|
107 | | - mmiowb(); |
---|
108 | 97 | } |
---|
109 | 98 | |
---|
110 | 99 | /** |
---|
.. | .. |
---|
264 | 253 | FLD_DN_ODD | FLD_DN_EVEN | |
---|
265 | 254 | CAP_CONT_EVEN | CAP_CONT_ODD, |
---|
266 | 255 | ipd->regs + CSR1); |
---|
267 | | - mmiowb(); |
---|
268 | 256 | } |
---|
269 | 257 | |
---|
270 | 258 | spin_lock(&ipd->lock); |
---|
.. | .. |
---|
282 | 270 | iowrite32(dma_addr + ipd->width, ipd->regs + ODD_DMA_START); |
---|
283 | 271 | iowrite32(ipd->width, ipd->regs + EVEN_DMA_STRIDE); |
---|
284 | 272 | iowrite32(ipd->width, ipd->regs + ODD_DMA_STRIDE); |
---|
285 | | - mmiowb(); |
---|
286 | 273 | } |
---|
287 | 274 | |
---|
288 | 275 | /* enable interrupts, clear all irq flags */ |
---|
.. | .. |
---|
307 | 294 | { |
---|
308 | 295 | struct dt3155_priv *pd = video_drvdata(filp); |
---|
309 | 296 | |
---|
310 | | - strcpy(cap->driver, DT3155_NAME); |
---|
311 | | - strcpy(cap->card, DT3155_NAME " frame grabber"); |
---|
| 297 | + strscpy(cap->driver, DT3155_NAME, sizeof(cap->driver)); |
---|
| 298 | + strscpy(cap->card, DT3155_NAME " frame grabber", sizeof(cap->card)); |
---|
312 | 299 | sprintf(cap->bus_info, "PCI:%s", pci_name(pd->pdev)); |
---|
313 | | - cap->device_caps = V4L2_CAP_VIDEO_CAPTURE | |
---|
314 | | - V4L2_CAP_STREAMING | V4L2_CAP_READWRITE; |
---|
315 | | - cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS; |
---|
316 | 300 | return 0; |
---|
317 | 301 | } |
---|
318 | 302 | |
---|
.. | .. |
---|
322 | 306 | if (f->index) |
---|
323 | 307 | return -EINVAL; |
---|
324 | 308 | f->pixelformat = V4L2_PIX_FMT_GREY; |
---|
325 | | - strcpy(f->description, "8-bit Greyscale"); |
---|
326 | 309 | return 0; |
---|
327 | 310 | } |
---|
328 | 311 | |
---|
.. | .. |
---|
378 | 361 | snprintf(input->name, sizeof(input->name), "VID%d", |
---|
379 | 362 | input->index); |
---|
380 | 363 | else |
---|
381 | | - strlcpy(input->name, "J2/VID0", sizeof(input->name)); |
---|
| 364 | + strscpy(input->name, "J2/VID0", sizeof(input->name)); |
---|
382 | 365 | input->type = V4L2_INPUT_TYPE_CAMERA; |
---|
383 | 366 | input->std = V4L2_STD_ALL; |
---|
384 | 367 | input->status = 0; |
---|
.. | .. |
---|
437 | 420 | /* resetting the adapter */ |
---|
438 | 421 | iowrite32(ADDR_ERR_ODD | ADDR_ERR_EVEN | FLD_CRPT_ODD | FLD_CRPT_EVEN | |
---|
439 | 422 | FLD_DN_ODD | FLD_DN_EVEN, pd->regs + CSR1); |
---|
440 | | - mmiowb(); |
---|
441 | 423 | msleep(20); |
---|
442 | 424 | |
---|
443 | 425 | /* initializing adapter registers */ |
---|
444 | 426 | iowrite32(FIFO_EN | SRST, pd->regs + CSR1); |
---|
445 | | - mmiowb(); |
---|
446 | 427 | iowrite32(0xEEEEEE01, pd->regs + EVEN_PIXEL_FMT); |
---|
447 | 428 | iowrite32(0xEEEEEE01, pd->regs + ODD_PIXEL_FMT); |
---|
448 | | - iowrite32(0x00000020, pd->regs + FIFO_TRIGER); |
---|
| 429 | + iowrite32(0x00000020, pd->regs + FIFO_TRIGGER); |
---|
449 | 430 | iowrite32(0x00000103, pd->regs + XFER_MODE); |
---|
450 | 431 | iowrite32(0, pd->regs + RETRY_WAIT_CNT); |
---|
451 | 432 | iowrite32(0, pd->regs + INT_CSR); |
---|
.. | .. |
---|
454 | 435 | iowrite32(0, pd->regs + MASK_LENGTH); |
---|
455 | 436 | iowrite32(0x0005007C, pd->regs + FIFO_FLAG_CNT); |
---|
456 | 437 | iowrite32(0x01010101, pd->regs + IIC_CLK_DUR); |
---|
457 | | - mmiowb(); |
---|
458 | 438 | |
---|
459 | 439 | /* verifying that we have a DT3155 board (not just a SAA7116 chip) */ |
---|
460 | 440 | read_i2c_reg(pd->regs, DT_ID, &tmp); |
---|
.. | .. |
---|
506 | 486 | .minor = -1, |
---|
507 | 487 | .release = video_device_release_empty, |
---|
508 | 488 | .tvnorms = V4L2_STD_ALL, |
---|
| 489 | + .device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING | |
---|
| 490 | + V4L2_CAP_READWRITE, |
---|
509 | 491 | }; |
---|
510 | 492 | |
---|
511 | 493 | static int dt3155_probe(struct pci_dev *pdev, const struct pci_device_id *id) |
---|
.. | .. |
---|
568 | 550 | IRQF_SHARED, DT3155_NAME, pd); |
---|
569 | 551 | if (err) |
---|
570 | 552 | goto err_iounmap; |
---|
571 | | - err = video_register_device(&pd->vdev, VFL_TYPE_GRABBER, -1); |
---|
| 553 | + err = video_register_device(&pd->vdev, VFL_TYPE_VIDEO, -1); |
---|
572 | 554 | if (err) |
---|
573 | 555 | goto err_free_irq; |
---|
574 | 556 | dev_info(&pdev->dev, "/dev/video%i is ready\n", pd->vdev.minor); |
---|
.. | .. |
---|
593 | 575 | struct dt3155_priv *pd = container_of(v4l2_dev, struct dt3155_priv, |
---|
594 | 576 | v4l2_dev); |
---|
595 | 577 | |
---|
596 | | - video_unregister_device(&pd->vdev); |
---|
| 578 | + vb2_video_unregister_device(&pd->vdev); |
---|
597 | 579 | free_irq(pd->pdev->irq, pd); |
---|
598 | | - vb2_queue_release(&pd->vidq); |
---|
599 | 580 | v4l2_device_unregister(&pd->v4l2_dev); |
---|
600 | 581 | pci_iounmap(pdev, pd->regs); |
---|
601 | 582 | pci_release_region(pdev, 0); |
---|