1- From 550ad9e1df431cfe7296ace600fe70185b061dd1 Mon Sep 17 00:00:00 2001
1+ From e88999ee6eb9ea831b75426b12a21aff066274dd Mon Sep 17 00:00:00 2001
22From: ejgoldik <ehud.joseph.goldik@realsenseai.com>
3- Date: Thu, 15 Jan 2026 09:28:13 +0200
3+ Date: Wed, 21 Jan 2026 16:43:22 +0200
44Subject: [PATCH] Adding max96712 support for D4xx
55
66Signed-off-by: ejgoldik <ehud.joseph.goldik@realsenseai.com>
77---
8- drivers/media/i2c/max96712.c | 297 ++++++++++++++++++++++++++++++++++-
9- 1 file changed, 292 insertions(+), 5 deletions(-)
8+ drivers/media/i2c/max96712.c | 296 ++++++++++++++++++++++++++++++++++-
9+ 1 file changed, 291 insertions(+), 5 deletions(-)
1010
1111diff --git a/drivers/media/i2c/max96712.c b/drivers/media/i2c/max96712.c
12- index 8e237eef..92b06cf2 100644
12+ index 8e237eef..79506d58 100644
1313--- a/drivers/media/i2c/max96712.c
1414+++ b/drivers/media/i2c/max96712.c
15- @@ -16,7 +16,50 @@
15+ @@ -16,7 +16,49 @@
1616 #include <linux/gpio.h>
1717 #include <linux/of.h>
1818 #include <linux/of_gpio.h>
@@ -26,7 +26,6 @@ index 8e237eef..92b06cf2 100644
2626+ #define MAX96712_CTRL0_ADDR 0x17
2727+ #define MAX96712_CTRL1_ADDR 0x18
2828+
29- + #define MAX96712_BACKTOP24_ADDR 0x417
3029+ #define MAX96712_BACKTOP25_ADDR 0x418
3130+
3231+ #define MAX96712_MIPI_PHY0_ADDR 0x8A0
@@ -49,7 +48,7 @@ index 8e237eef..92b06cf2 100644
4948+ #define MAX96712_MIPI_TX19_SRC_3_MAP_ADDR 0x913
5049+ #define MAX96712_MIPI_TX20_DST_3_MAP_ADDR 0x914
5150+ #define MAX96712_MIPI_TX45_MAP_DPHY_DEST_ADDR 0x92D
52- + #define MAX96712_MIPI_TX51_ADDR 0x933
51+ + #define MAX96712_MIPI_TX51_ADDR 0x973
5352+
5453+ #define MAX96712_VIDEO_RX0_ADDR 0x100
5554+
@@ -64,7 +63,7 @@ index 8e237eef..92b06cf2 100644
6463
6564 struct max96712 {
6665 struct i2c_client *i2c_client;
67- @@ -99,6 +142 ,19 @@ static int max96712_read_reg(struct max96712 *priv,
66+ @@ -99,6 +141 ,19 @@ static int max96712_read_reg(struct max96712 *priv,
6867 return err;
6968 }
7069
@@ -84,7 +83,7 @@ index 8e237eef..92b06cf2 100644
8483
8584 static int max96712_stats_show(struct seq_file *s, void *data)
8685 {
87- @@ -153,8 +209 ,9 @@ static const struct file_operations max96712_debugfs_fops = {
86+ @@ -153,8 +208 ,9 @@ static const struct file_operations max96712_debugfs_fops = {
8887 .release = single_release,
8988 };
9089
@@ -95,15 +94,15 @@ index 8e237eef..92b06cf2 100644
9594 struct i2c_client *i2c_client = priv->i2c_client;
9695 struct device_node *np = i2c_client->dev.of_node;
9796 unsigned int pwdn_gpio = 0;
98- @@ -170,6 +227 ,7 @@ static int max96712_power_on(struct max96712 *priv)
97+ @@ -170,6 +226 ,7 @@ static int max96712_power_on(struct max96712 *priv)
9998 }
10099 return 0;
101100 }
102101+ EXPORT_SYMBOL(max96712_power_on);
103102
104103 static int max96712_debugfs_init(const char *dir_name,
105104 struct dentry **d_entry,
106- @@ -252,7 +310 ,9 @@ static int max96712_probe(struct i2c_client *client,
105+ @@ -252,7 +309 ,9 @@ static int max96712_probe(struct i2c_client *client,
107106
108107 mutex_init(&max96712_rw);
109108
@@ -114,7 +113,7 @@ index 8e237eef..92b06cf2 100644
114113 if (err) {
115114 dev_err(&client->dev, "Failed to power on err =%d\n",err);
116115 return err;
117- @@ -274,8 +334 ,11 @@ static int max96712_remove(struct i2c_client *client)
116+ @@ -274,8 +333 ,11 @@ static int max96712_remove(struct i2c_client *client)
118117 static void max96712_remove(struct i2c_client *client)
119118 #endif
120119 {
@@ -127,7 +126,7 @@ index 8e237eef..92b06cf2 100644
127126 i2c_unregister_device(client);
128127 client = NULL;
129128 }
130- @@ -284,13 +347 ,236 @@ static void max96712_remove(struct i2c_client *client)
129+ @@ -284,13 +346 ,236 @@ static void max96712_remove(struct i2c_client *client)
131130 #endif
132131 }
133132
@@ -214,17 +213,15 @@ index 8e237eef..92b06cf2 100644
214213+ // All mappings to PHY1 (master for port A)
215214+ {MAX96712_MIPI_TX45_MAP_DPHY_DEST_ADDR, 0x00},
216215+ {MAX96712_MIPI_TX10_ADDR, 0x40},
217- + {MAX96712_MIPI_TX51_ADDR, 0x10},
218216+ // SEQ_MISS_EN: Disabled / DIS_PKT_DET: Disabled
219- + {MAX96712_VIDEO_RX0_ADDR, 0x23 }, // pipe X
217+ + {MAX96712_VIDEO_RX0_ADDR, 0x33 }, // pipe X
220218+ };
221219+
222220+ struct reg_pair map_pipe_opt[] = {
223221+ {MAX96712_RLMS_A_RLMS58_ADDR, 0x28}, // PHY A Optimization
224222+ {MAX96712_RLMS_A_RLMS59_ADDR, 0x68}, // PHY A Optimization
225223+ {MAX96712_RLMS_B_RLMS58_ADDR, 0x28}, // PHY B Optimization
226224+ {MAX96712_RLMS_B_RLMS59_ADDR, 0x68}, // PHY B Optimization
227- + {MAX96712_BACKTOP24_ADDR, 0xf0},
228225+ {MAX96712_BACKTOP25_ADDR, 0x2f},
229226+ };
230227+
@@ -237,7 +234,7 @@ index 8e237eef..92b06cf2 100644
237234+ /* For IMU (which has no metadata) we override mapping
238235+ * to enable only 3
239236+ */
240- + map_pipe_control[1 ].val = 0x07;
237+ + map_pipe_control[0 ].val = 0x07;
241238+ }
242239+ map_pipe_control[1].val = (vc_id << 6) | data_type1;
243240+ map_pipe_control[2].val = (vc_id << 6) | data_type1;
@@ -256,6 +253,8 @@ index 8e237eef..92b06cf2 100644
256253+ err |= max96712_set_registers(priv, map_pipe_control,
257254+ ARRAY_SIZE(map_pipe_control));
258255+
256+ + max96712_write_reg(priv, MAX96712_MIPI_TX51_ADDR, 0x2);
257+ +
259258+ err |= max96712_set_registers(priv, map_pipe_opt,
260259+ ARRAY_SIZE(map_pipe_opt));
261260+
@@ -365,7 +364,7 @@ index 8e237eef..92b06cf2 100644
365364 { },
366365 };
367366
368- @@ -300,6 +586 ,7 @@ static struct i2c_driver max96712_i2c_driver = {
367+ @@ -300,6 +585 ,7 @@ static struct i2c_driver max96712_i2c_driver = {
369368 .driver = {
370369 .name = "max96712",
371370 .owner = THIS_MODULE,
0 commit comments