media: mgb4: Added support for additional GMSL modules variants

Added support for GMSL modules variants 3 and 4. Variant 3 is the same as
variant 2 from the driver's point of view. Variant 4 has "hardwired" daisy
chain loopback outputs and thus missing the v4l2 outputs.

Signed-off-by: Martin Tůma <martin.tuma@digiteqautomotive.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
This commit is contained in:
Martin Tůma 2025-01-27 16:59:56 +01:00 committed by Hans Verkuil
parent 7b8b6bdfab
commit 22d3d1f0d1
2 changed files with 15 additions and 6 deletions

View File

@ -406,8 +406,9 @@ static int get_module_version(struct mgb4_dev *mgbdev)
dev_err(dev, "unknown module type\n");
return -EINVAL;
}
fw_version = mgb4_read_reg(&mgbdev->video, 0xC4);
if (fw_version >> 24 != mgbdev->module_version >> 4) {
fw_version = mgb4_read_reg(&mgbdev->video, 0xC4) >> 24;
if ((MGB4_IS_FPDL3(mgbdev) && fw_version != 1) ||
(MGB4_IS_GMSL(mgbdev) && fw_version != 2)) {
dev_err(dev, "module/firmware type mismatch\n");
return -EINVAL;
}
@ -599,14 +600,18 @@ static int mgb4_probe(struct pci_dev *pdev, const struct pci_device_id *id)
rv = get_module_version(mgbdev);
if (rv < 0)
goto exit;
/* Propagate the module type(version) to the FPGA */
mgb4_write_reg(&mgbdev->video, 0xD4, mgbdev->module_version);
/* Video input v4l2 devices */
for (i = 0; i < MGB4_VIN_DEVICES; i++)
mgbdev->vin[i] = mgb4_vin_create(mgbdev, i);
/* Video output v4l2 devices */
for (i = 0; i < MGB4_VOUT_DEVICES; i++)
mgbdev->vout[i] = mgb4_vout_create(mgbdev, i);
if (MGB4_HAS_VOUT(mgbdev)) {
for (i = 0; i < MGB4_VOUT_DEVICES; i++)
mgbdev->vout[i] = mgb4_vout_create(mgbdev, i);
}
/* Triggers */
mgbdev->indio_dev = mgb4_trigger_create(mgbdev);

View File

@ -19,9 +19,13 @@
#define MGB4_VOUT_DEVICES 2
#define MGB4_IS_GMSL(mgbdev) \
((mgbdev)->module_version >> 4 == 2)
((((mgbdev)->module_version >> 4) >= 2) && \
(((mgbdev)->module_version >> 4) <= 4))
#define MGB4_IS_FPDL3(mgbdev) \
((mgbdev)->module_version >> 4 == 1)
(((mgbdev)->module_version >> 4) == 1)
#define MGB4_HAS_VOUT(mgbdev) \
((((mgbdev)->module_version >> 4) >= 1) && \
(((mgbdev)->module_version >> 4) <= 3))
struct mgb4_dma_channel {
struct dma_chan *chan;