[v4,0/1] Digiteq Automotive MGB4 driver

Message ID 20221123140431.4730-1-tumic@gpxsee.org (mailing list archive)
Headers
Series Digiteq Automotive MGB4 driver |

Message

Martin Tůma Nov. 23, 2022, 2:04 p.m. UTC
  From: Martin Tůma <martin.tuma@digiteqautomotive.com>

Hi,
This patch adds a driver for the Digiteq Automotive MGB4 grabber card.
MGB4 is a modular frame grabber PCIe card for automotive video interfaces
(FPD-Link and GMSL for now). It is based on a Xilinx FPGA and uses their
XDMA IP core for DMA transfers. Additionally, Xilinx I2C and SPI IP cores
which already have drivers in linux are used in the design.

The driver is a quite standard v4l2 driver, with one exception - there are
a lot of sysfs options that may/must be set before opening the v4l2 device
to adapt the card on a specific signal (see mgb4.rst for details)
as the card must be able to work with various signal sources (or displays)
that can not be auto-detected.

I have run the driver through the v4l2-compliance test suite for both the
input and the output and the results look fine to me (I can provide the
output if required).

The patch requires the new XDMA v10 driver from Xilinx/AMD from the dmaengine
mailing list to compile/work:
https://www.spinics.net/lists/dmaengine/msg31864.html

Changes in v4:
* Redesigned the signal change handling logic. Now using the propper timings
  API in the video input driver and a propper open() syscall check/logic in
  the video output driver.
* Fixed all minor issues from v3 review.
* 'checkpatch.pl --strict' used for checking the code.

Changes in v3:
* Rebased the DMA transfers part to use the new XDMA driver from Xilinx/AMD

Changes in v2:
* Completely rewritten the original Xilinx's XDMA driver to meet kernel code
  standards.
* Added all required "to" and "cc" mail addresses.

Martin Tůma (1):
  Added Digiteq Automotive MGB4 driver

 Documentation/admin-guide/media/mgb4.rst      | 352 ++++++++
 .../admin-guide/media/pci-cardlist.rst        |   1 +
 .../admin-guide/media/v4l-drivers.rst         |   1 +
 MAINTAINERS                                   |   7 +
 drivers/media/pci/Kconfig                     |   1 +
 drivers/media/pci/Makefile                    |   1 +
 drivers/media/pci/mgb4/Kconfig                |  17 +
 drivers/media/pci/mgb4/Makefile               |   6 +
 drivers/media/pci/mgb4/mgb4_cmt.c             | 247 ++++++
 drivers/media/pci/mgb4/mgb4_cmt.h             |  16 +
 drivers/media/pci/mgb4/mgb4_core.c            | 642 ++++++++++++++
 drivers/media/pci/mgb4/mgb4_core.h            |  65 ++
 drivers/media/pci/mgb4/mgb4_dma.c             | 123 +++
 drivers/media/pci/mgb4/mgb4_dma.h             |  18 +
 drivers/media/pci/mgb4/mgb4_i2c.c             | 141 +++
 drivers/media/pci/mgb4/mgb4_i2c.h             |  35 +
 drivers/media/pci/mgb4/mgb4_io.h              |  39 +
 drivers/media/pci/mgb4/mgb4_regs.c            |  30 +
 drivers/media/pci/mgb4/mgb4_regs.h            |  35 +
 drivers/media/pci/mgb4/mgb4_sysfs.h           |  18 +
 drivers/media/pci/mgb4/mgb4_sysfs_in.c        | 780 ++++++++++++++++
 drivers/media/pci/mgb4/mgb4_sysfs_out.c       | 732 +++++++++++++++
 drivers/media/pci/mgb4/mgb4_sysfs_pci.c       |  86 ++
 drivers/media/pci/mgb4/mgb4_trigger.c         | 209 +++++
 drivers/media/pci/mgb4/mgb4_trigger.h         |   8 +
 drivers/media/pci/mgb4/mgb4_vin.c             | 830 ++++++++++++++++++
 drivers/media/pci/mgb4/mgb4_vin.h             |  63 ++
 drivers/media/pci/mgb4/mgb4_vout.c            | 501 +++++++++++
 drivers/media/pci/mgb4/mgb4_vout.h            |  58 ++
 29 files changed, 5062 insertions(+)
 create mode 100644 Documentation/admin-guide/media/mgb4.rst
 create mode 100644 drivers/media/pci/mgb4/Kconfig
 create mode 100644 drivers/media/pci/mgb4/Makefile
 create mode 100644 drivers/media/pci/mgb4/mgb4_cmt.c
 create mode 100644 drivers/media/pci/mgb4/mgb4_cmt.h
 create mode 100644 drivers/media/pci/mgb4/mgb4_core.c
 create mode 100644 drivers/media/pci/mgb4/mgb4_core.h
 create mode 100644 drivers/media/pci/mgb4/mgb4_dma.c
 create mode 100644 drivers/media/pci/mgb4/mgb4_dma.h
 create mode 100644 drivers/media/pci/mgb4/mgb4_i2c.c
 create mode 100644 drivers/media/pci/mgb4/mgb4_i2c.h
 create mode 100644 drivers/media/pci/mgb4/mgb4_io.h
 create mode 100644 drivers/media/pci/mgb4/mgb4_regs.c
 create mode 100644 drivers/media/pci/mgb4/mgb4_regs.h
 create mode 100644 drivers/media/pci/mgb4/mgb4_sysfs.h
 create mode 100644 drivers/media/pci/mgb4/mgb4_sysfs_in.c
 create mode 100644 drivers/media/pci/mgb4/mgb4_sysfs_out.c
 create mode 100644 drivers/media/pci/mgb4/mgb4_sysfs_pci.c
 create mode 100644 drivers/media/pci/mgb4/mgb4_trigger.c
 create mode 100644 drivers/media/pci/mgb4/mgb4_trigger.h
 create mode 100644 drivers/media/pci/mgb4/mgb4_vin.c
 create mode 100644 drivers/media/pci/mgb4/mgb4_vin.h
 create mode 100644 drivers/media/pci/mgb4/mgb4_vout.c
 create mode 100644 drivers/media/pci/mgb4/mgb4_vout.h
  

Comments

Pavel Machek Dec. 18, 2022, 6:58 p.m. UTC | #1
Hi!

> From: Martin Tůma <martin.tuma@digiteqautomotive.com>
> 
> Hi,
> This patch adds a driver for the Digiteq Automotive MGB4 grabber card.
> MGB4 is a modular frame grabber PCIe card for automotive video interfaces
> (FPD-Link and GMSL for now). It is based on a Xilinx FPGA and uses their
> XDMA IP core for DMA transfers. Additionally, Xilinx I2C and SPI IP cores
> which already have drivers in linux are used in the design.
> 
> The driver is a quite standard v4l2 driver, with one exception - there are
> a lot of sysfs options that may/must be set before opening the v4l2 device
> to adapt the card on a specific signal (see mgb4.rst for details)
> as the card must be able to work with various signal sources (or displays)
> that can not be auto-detected.

Uff, that's "interesting". What kind of platform does this run on? You
should be getting non-probeable parameters from deice tree (or APCI).

Best regards,
								Pavel
  
Martin Tůma Dec. 19, 2022, 11:10 a.m. UTC | #2
On 18. 12. 22 19:58, Pavel Machek wrote:
> Hi!
> 
>> From: Martin Tůma <martin.tuma@digiteqautomotive.com>
>>
>> Hi,
>> This patch adds a driver for the Digiteq Automotive MGB4 grabber card.
>> MGB4 is a modular frame grabber PCIe card for automotive video interfaces
>> (FPD-Link and GMSL for now). It is based on a Xilinx FPGA and uses their
>> XDMA IP core for DMA transfers. Additionally, Xilinx I2C and SPI IP cores
>> which already have drivers in linux are used in the design.
>>
>> The driver is a quite standard v4l2 driver, with one exception - there are
>> a lot of sysfs options that may/must be set before opening the v4l2 device
>> to adapt the card on a specific signal (see mgb4.rst for details)
>> as the card must be able to work with various signal sources (or displays)
>> that can not be auto-detected.
> 
> Uff, that's "interesting". What kind of platform does this run on? You
> should be getting non-probeable parameters from deice tree (or APCI).
> 
> Best regards,
> 								Pavel
> 								

Hi,
It is a PCIe card, so it runs on any platform that supports PCIe cards. 
We do use the HW on x86_64 and arm platforms.

The parameters are in no way connected to the platform where the card is 
used, they are properties of the video signal that can change arbitrary 
as you can connect different car infotainments (the signal source) to 
the card (the same applies to the outputs - the car displays). Usually, 
there is no auto-configuration on the signal level, that's why you have 
to provide the various properties externally according to the 
infotainment that you have at the moment connected to the card.

Any kind of device tree or ACPI parameters make no sense for the HW/the 
intended usage.

M.