mbox series

[v2,0/3] Digiteq Automotive MGB4 driver

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

Message

Martin Tůma Sept. 19, 2022, 6:55 p.m. UTC
From: Martin Tůma <martin.tuma@digiteqautomotive.com>

Hi,
This series of patches 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.

Except of the required xiic driver alias, the patches are split into two parts:
the XDMA driver and a "standard" v4l2 device driver. The XDMA driver is
originally based on Xilinx's sample code that can be found at:
https://github.com/Xilinx/dma_ip_drivers

The rest 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-sysfs.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).

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 (3):
  Added platform module alias for the xiic I2C driver
  Added Xilinx XDMA IP core driver
  Added Digiteq Automotive MGB4 driver

 Documentation/admin-guide/media/mgb4-iio.rst  |   30 +
 Documentation/admin-guide/media/mgb4-mtd.rst  |   16 +
 .../admin-guide/media/mgb4-sysfs.rst          |  297 +++
 drivers/dma/Kconfig                           |    7 +
 drivers/dma/xilinx/Makefile                   |    1 +
 drivers/dma/xilinx/xilinx_xdma.c              | 2042 +++++++++++++++++
 drivers/i2c/busses/i2c-xiic.c                 |    1 +
 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             |  243 ++
 drivers/media/pci/mgb4/mgb4_cmt.h             |   16 +
 drivers/media/pci/mgb4/mgb4_core.c            |  554 +++++
 drivers/media/pci/mgb4/mgb4_core.h            |   58 +
 drivers/media/pci/mgb4/mgb4_i2c.c             |  139 ++
 drivers/media/pci/mgb4/mgb4_i2c.h             |   35 +
 drivers/media/pci/mgb4/mgb4_io.h              |   36 +
 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        |  750 ++++++
 drivers/media/pci/mgb4/mgb4_sysfs_out.c       |  734 ++++++
 drivers/media/pci/mgb4/mgb4_sysfs_pci.c       |   83 +
 drivers/media/pci/mgb4/mgb4_trigger.c         |  202 ++
 drivers/media/pci/mgb4/mgb4_trigger.h         |    8 +
 drivers/media/pci/mgb4/mgb4_vin.c             |  656 ++++++
 drivers/media/pci/mgb4/mgb4_vin.h             |   64 +
 drivers/media/pci/mgb4/mgb4_vout.c            |  502 ++++
 drivers/media/pci/mgb4/mgb4_vout.h            |   58 +
 include/linux/dma/xilinx_xdma.h               |   44 +
 31 files changed, 6684 insertions(+)
 create mode 100644 Documentation/admin-guide/media/mgb4-iio.rst
 create mode 100644 Documentation/admin-guide/media/mgb4-mtd.rst
 create mode 100644 Documentation/admin-guide/media/mgb4-sysfs.rst
 create mode 100644 drivers/dma/xilinx/xilinx_xdma.c
 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_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
 create mode 100644 include/linux/dma/xilinx_xdma.h

Comments

Sonal Santan Sept. 21, 2022, 5:32 a.m. UTC | #1
On 9/19/22 11:55, tumic@gpxsee.org wrote:
> From: Martin Tůma <martin.tuma@digiteqautomotive.com>
> 
> Hi,
> This series of patches 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.
> 
> Except of the required xiic driver alias, the patches are split into two parts:
> the XDMA driver and a "standard" v4l2 device driver. The XDMA driver is
> originally based on Xilinx's sample code that can be found at:
> https://github.com/Xilinx/dma_ip_drivers

Hello Martin,

Xilinx/AMD is working on upstreaming the XDMA driver into Linux 
dmaengine subsystem for use by all users of XDMA IP. You can find the V3 
patch set here:

https://lore.kernel.org/dmaengine/1663631039-49732-1-git-send-email-lizhi.hou@amd.com/T/#t

Will appreciate your review of that patch set and hopefully MGB4 driver 
can be rebased on top it?

-Sonal
> 
> The rest 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-sysfs.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).
> 
> 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 (3):
>    Added platform module alias for the xiic I2C driver
>    Added Xilinx XDMA IP core driver
>    Added Digiteq Automotive MGB4 driver
> 
>   Documentation/admin-guide/media/mgb4-iio.rst  |   30 +
>   Documentation/admin-guide/media/mgb4-mtd.rst  |   16 +
>   .../admin-guide/media/mgb4-sysfs.rst          |  297 +++
>   drivers/dma/Kconfig                           |    7 +
>   drivers/dma/xilinx/Makefile                   |    1 +
>   drivers/dma/xilinx/xilinx_xdma.c              | 2042 +++++++++++++++++
>   drivers/i2c/busses/i2c-xiic.c                 |    1 +
>   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             |  243 ++
>   drivers/media/pci/mgb4/mgb4_cmt.h             |   16 +
>   drivers/media/pci/mgb4/mgb4_core.c            |  554 +++++
>   drivers/media/pci/mgb4/mgb4_core.h            |   58 +
>   drivers/media/pci/mgb4/mgb4_i2c.c             |  139 ++
>   drivers/media/pci/mgb4/mgb4_i2c.h             |   35 +
>   drivers/media/pci/mgb4/mgb4_io.h              |   36 +
>   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        |  750 ++++++
>   drivers/media/pci/mgb4/mgb4_sysfs_out.c       |  734 ++++++
>   drivers/media/pci/mgb4/mgb4_sysfs_pci.c       |   83 +
>   drivers/media/pci/mgb4/mgb4_trigger.c         |  202 ++
>   drivers/media/pci/mgb4/mgb4_trigger.h         |    8 +
>   drivers/media/pci/mgb4/mgb4_vin.c             |  656 ++++++
>   drivers/media/pci/mgb4/mgb4_vin.h             |   64 +
>   drivers/media/pci/mgb4/mgb4_vout.c            |  502 ++++
>   drivers/media/pci/mgb4/mgb4_vout.h            |   58 +
>   include/linux/dma/xilinx_xdma.h               |   44 +
>   31 files changed, 6684 insertions(+)
>   create mode 100644 Documentation/admin-guide/media/mgb4-iio.rst
>   create mode 100644 Documentation/admin-guide/media/mgb4-mtd.rst
>   create mode 100644 Documentation/admin-guide/media/mgb4-sysfs.rst
>   create mode 100644 drivers/dma/xilinx/xilinx_xdma.c
>   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_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
>   create mode 100644 include/linux/dma/xilinx_xdma.h
>
Martin Tůma Sept. 21, 2022, 9:44 a.m. UTC | #2
Hi,

 > Xilinx/AMD is working on upstreaming the XDMA driver into Linux
 > dmaengine subsystem for use by all users of XDMA IP. You can find the 
 > V3
 > patch set here:
 >
 > 
https://lore.kernel.org/dmaengine/1663631039-49732-1-git-send-email-lizhi.hou@amd.com/T/#t

That's good news. If this would happen before I have spend two weeks 
converting the original Xilinx "driver" to something with at least a 
theoretical chance to be included into the kernel, it would be even 
better... ;-)

 > Will appreciate your review of that patch set and hopefully MGB4 driver
 > can be rebased on top it?

As I already replied to Lizhi Hou, this new XDMA driver is at the moment 
unusable for most XDMA-based HW as it does not handle the user IRQs 
logic and as it also takes up the user IRQs register memory space, it 
even actively hinders other drivers to at least handle the IRQs themselves.

M.