Re: [PATCH v5 18/24] media: i2c: maxim-serdes: add MAX96717 driver

From: Cosmin Tanislav
Date: Thu Jul 03 2025 - 08:32:19 EST




On 7/3/25 3:16 PM, Julien Massot wrote:
On Wed, 2025-07-02 at 16:20 +0300, Cosmin Tanislav wrote:
Add a new MAX96717 driver that also supports MAX9295A, MAX96717F and
MAX96793.

Integrate it with the common serializer framework, while keeping
compatibility with existing usecases, avoiding code duplication, and
also enabling more features across all chips.

Signed-off-by: Cosmin Tanislav <demonsingur@xxxxxxxxx>
---
 drivers/media/i2c/maxim-serdes/Kconfig    |   16 +
 drivers/media/i2c/maxim-serdes/Makefile   |    1 +
 drivers/media/i2c/maxim-serdes/max96717.c | 1685 +++++++++++++++++++++
 3 files changed, 1702 insertions(+)
 create mode 100644 drivers/media/i2c/maxim-serdes/max96717.c

diff --git a/drivers/media/i2c/maxim-serdes/Kconfig b/drivers/media/i2c/maxim-serdes/Kconfig
index cae1d5a1293e..648cb891eefe 100644
--- a/drivers/media/i2c/maxim-serdes/Kconfig
+++ b/drivers/media/i2c/maxim-serdes/Kconfig
@@ -14,3 +14,19 @@ config VIDEO_MAXIM_SERDES
    To compile this driver as a module, choose M here: the module
    will be called max_serdes.
+
+config VIDEO_MAX96717
+ tristate "Maxim MAX96717 Serializer support"
+ depends on COMMON_CLK
+ select VIDEO_MAXIM_SERDES
+ select GENERIC_PINCONF
+ select GENERIC_PINCTRL_GROUPS
+ select GENERIC_PINMUX_FUNCTIONS
+ select GPIOLIB
+ help
+   This driver supports the Maxim MAX9295A, MAX96717, MAX96717F,
+   MAX96793 Serializers, which receive video on a MIPI CSI-2
+   interface and output it on a GMSL2/3 link.
+
+   To compile this driver as a module, choose M here: the module
+   will be called max96717.
diff --git a/drivers/media/i2c/maxim-serdes/Makefile b/drivers/media/i2c/maxim-serdes/Makefile
index b54326a5c81b..04abda6a5437 100644
--- a/drivers/media/i2c/maxim-serdes/Makefile
+++ b/drivers/media/i2c/maxim-serdes/Makefile
@@ -1,3 +1,4 @@
 # SPDX-License-Identifier: GPL-2.0
 max-serdes-objs := max_serdes.o max_ser.o max_des.o
 obj-$(CONFIG_VIDEO_MAXIM_SERDES) += max-serdes.o
+obj-$(CONFIG_VIDEO_MAX96717) += max96717.o
diff --git a/drivers/media/i2c/maxim-serdes/max96717.c b/drivers/media/i2c/maxim-serdes/max96717.c
new file mode 100644
index 000000000000..60b285e547b7
--- /dev/null
+++ b/drivers/media/i2c/maxim-serdes/max96717.c
@@ -0,0 +1,1685 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Maxim MAX96717 GMSL2 Serializer Driver
+ *
+ * Copyright (C) 2025 Analog Devices Inc.
+ */
+
+#include <linux/clk.h>
+#include <linux/clk-provider.h>
+#include <linux/gpio/driver.h>
+#include <linux/pinctrl/pinctrl.h>
+#include <linux/pinctrl/pinmux.h>
+#include <linux/pinctrl/pinconf.h>
+#include <linux/pinctrl/pinconf-generic.h>
+#include <linux/regmap.h>
+
+#include "max_ser.h"
+
+#define MAX96717_REG0 0x0
+
+#define MAX96717_REG2 0x2
+#define MAX96717_REG2_VID_TX_EN_P(p) BIT(4 + (p))
+
+#define MAX96717_REG3 0x3
+#define MAX96717_REG3_RCLKSEL GENMASK(1, 0)
+#define MAX96717_REG3_RCLK_ALT BIT(2)
+
+#define MAX96717_REG6 0x6
+#define MAX96717_REG6_RCLKEN BIT(5)
+
+#define MAX96717_I2C_2(x) (0x42 + (x) * 0x2)
+#define MAX96717_I2C_2_SRC GENMASK(7, 1)
+
+#define MAX96717_I2C_3(x) (0x43 + (x) * 0x2)
+#define MAX96717_I2C_3_DST GENMASK(7, 1)
+
+#define MAX96717_TX3(p) (0x53 + (p) * 0x4)
+#define MAX96717_TX3_TX_STR_SEL GENMASK(1, 0)
+
+#define MAX96717_VIDEO_TX0(p) (0x100 + (p) * 0x8)
This is a bit confusing, looks like this register address is valid for MAX9295a VIDEO_TX0
but not for MAX96717, VIDEO_TX0 (Z) is at 0x110.


See pipe_hw_ids field of max96717_chip_info.
MAX9295A has pipes 0, 1, 2, 3, MAX96717 has pipe 2 only.
Registers and strides are the same, just pipes are missing.