From f67adf545f9e7db4731fb7721597557e2571f891 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Martin=20T=C5=AFma?= Date: Fri, 16 Jan 2026 13:55:54 +0100 Subject: [PATCH] media: pci: mgb4: Add support for GMSL3 coaxial modules MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Add support for GMSL3 modules with a coaxial interface, a variant of the already existing module with the id #4. The FW is the same as for all other GMSL3 modules. Signed-off-by: Martin Tůma Signed-off-by: Hans Verkuil --- drivers/media/pci/mgb4/mgb4_core.h | 7 +++++-- drivers/media/pci/mgb4/mgb4_vin.c | 27 +++++++++++++++++++++++---- 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/drivers/media/pci/mgb4/mgb4_core.h b/drivers/media/pci/mgb4/mgb4_core.h index 06ef8bb440895..bfae75f30c7c7 100644 --- a/drivers/media/pci/mgb4/mgb4_core.h +++ b/drivers/media/pci/mgb4/mgb4_core.h @@ -21,8 +21,11 @@ #define MGB4_IS_GMSL1(mgbdev) \ (((mgbdev)->module_version >> 4) == 6) #define MGB4_IS_GMSL3(mgbdev) \ - ((((mgbdev)->module_version >> 4) >= 2) && \ - (((mgbdev)->module_version >> 4) <= 4)) + (((((mgbdev)->module_version >> 4) >= 2) && \ + (((mgbdev)->module_version >> 4) <= 4)) || \ + (((mgbdev)->module_version >> 4) == 8)) +#define MGB4_IS_GMSL3C(mgbdev) \ + (((mgbdev)->module_version >> 4) == 8) #define MGB4_IS_FPDL3(mgbdev) \ (((mgbdev)->module_version >> 4) == 1) #define MGB4_HAS_VOUT(mgbdev) \ diff --git a/drivers/media/pci/mgb4/mgb4_vin.c b/drivers/media/pci/mgb4/mgb4_vin.c index be55491b52b24..e782db79686f0 100644 --- a/drivers/media/pci/mgb4/mgb4_vin.c +++ b/drivers/media/pci/mgb4/mgb4_vin.c @@ -50,6 +50,11 @@ static const struct i2c_board_info gmsl3_deser_info[] = { {I2C_BOARD_INFO("deserializer2", 0x2A)}, }; +static const struct i2c_board_info gmsl3c_deser_info[] = { + {I2C_BOARD_INFO("deserializer1", 0x6A)}, + {I2C_BOARD_INFO("deserializer2", 0x6C)}, +}; + static const struct i2c_board_info gmsl1_deser_info[] = { {I2C_BOARD_INFO("deserializer1", 0x2C)}, {I2C_BOARD_INFO("deserializer2", 0x6C)}, @@ -67,6 +72,13 @@ static const struct mgb4_i2c_kv gmsl3_i2c[] = { {0x308, 0x01, 0x01}, {0x10, 0x20, 0x20}, {0x300, 0x40, 0x40} }; +static const struct mgb4_i2c_kv gmsl3c_i2c[] = { + {0x01, 0x03, 0x02}, {0x300, 0x0C, 0x08}, {0x03, 0xC0, 0x00}, + {0x1CE, 0x0E, 0x0E}, {0x11, 0x05, 0x05}, {0x05, 0xC0, 0x40}, + {0x307, 0x0F, 0x00}, {0xA0, 0x03, 0x00}, {0x3E0, 0x07, 0x00}, + {0x308, 0x01, 0x00}, {0x10, 0x20, 0x20}, {0x300, 0x40, 0x40} +}; + static const struct mgb4_i2c_kv gmsl1_i2c[] = { }; @@ -812,10 +824,17 @@ static int deser_init(struct mgb4_vin_dev *vindev, int id) struct device *dev = &vindev->mgbdev->pdev->dev; if (MGB4_IS_GMSL3(vindev->mgbdev)) { - info = &gmsl3_deser_info[id]; - addr_size = 16; - values = gmsl3_i2c; - count = ARRAY_SIZE(gmsl3_i2c); + if (MGB4_IS_GMSL3C(vindev->mgbdev)) { + info = &gmsl3c_deser_info[id]; + addr_size = 16; + values = gmsl3c_i2c; + count = ARRAY_SIZE(gmsl3c_i2c); + } else { + info = &gmsl3_deser_info[id]; + addr_size = 16; + values = gmsl3_i2c; + count = ARRAY_SIZE(gmsl3_i2c); + } } else if (MGB4_IS_FPDL3(vindev->mgbdev)) { info = &fpdl3_deser_info[id]; addr_size = 8; -- 2.47.3