summaryrefslogtreecommitdiffstats
path: root/bsp/meta-rcar/meta-rcar-gen3-adas/recipes-kernel/linux/linux-renesas/0138-lvds-AR0231-modify-with-rev7-silicon.patch
blob: 41161415bfbf5834b9de74c2b3d78cf510d4ae1d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
From 4b901263653537d51deedc2d078086ccf7f2cfb4 Mon Sep 17 00:00:00 2001
From: Vladimir Barinov <vladimir.barinov@cogentembedded.com>
Date: Thu, 3 Jan 2019 23:29:56 +0300
Subject: [PATCH 087/122] lvds: AR0231 modify with rev7 silicon

Use rev7 setup for AR0231.
Use MAX9286 and UB960 deserializer.
Use multiple sensor i2c addresses
Add crop

Signed-off-by: Vladimir Barinov <vladimir.barinov@cogentembedded.com>
---
 drivers/media/i2c/soc_camera/ar0231.c      |  86 ++++--
 drivers/media/i2c/soc_camera/ar0231_rev7.h | 418 +++++++++++++++++++++++++++++
 drivers/media/i2c/soc_camera/ov106xx.c     |  12 +-
 3 files changed, 493 insertions(+), 23 deletions(-)
 create mode 100644 drivers/media/i2c/soc_camera/ar0231_rev7.h

diff --git a/drivers/media/i2c/soc_camera/ar0231.c b/drivers/media/i2c/soc_camera/ar0231.c
index 176e1bf..f575cb7 100644
--- a/drivers/media/i2c/soc_camera/ar0231.c
+++ b/drivers/media/i2c/soc_camera/ar0231.c
@@ -20,9 +20,9 @@
 #include <media/v4l2-common.h>
 #include <media/v4l2-ctrls.h>
 
-#include "ar0231.h"
+#include "ar0231_rev7.h"
 
-#define AR0231_I2C_ADDR		0x10
+static const int ar0231_i2c_addr[] = {0x10, 0x20};
 
 #define AR0231_PID		0x3000
 #define AR0231_VERSION_REG	0x0354
@@ -39,6 +39,8 @@ struct ar0231_priv {
 	/* serializers */
 	int				max9286_addr;
 	int				max9271_addr;
+	int				ti9x4_addr;
+	int				ti9x3_addr;
 	int				port;
 	int				gpio_resetb;
 	int				gpio_fsin;
@@ -85,6 +87,25 @@ static int ar0231_s_stream(struct v4l2_subdev *sd, int enable)
 	return 0;
 }
 
+static int ar0231_set_window(struct v4l2_subdev *sd)
+{
+	struct i2c_client *client = v4l2_get_subdevdata(sd);
+	struct ar0231_priv *priv = to_ar0231(client);
+
+	dev_err(&client->dev, "L=%d T=%d %dx%d\n", priv->rect.left, priv->rect.top, priv->rect.width, priv->rect.height);
+
+	/* horiz crop start */
+	reg16_write16(client, 0x3004, priv->rect.left);
+	/* horiz crop end */
+	reg16_write16(client, 0x3008, priv->rect.left + priv->rect.width - 1);
+	/* vert crop start */
+	reg16_write16(client, 0x3002, priv->rect.top);
+	/* vert crop end */
+	reg16_write16(client, 0x3006, priv->rect.top + priv->rect.height + 1);
+
+	return 0;
+};
+
 static int ar0231_get_fmt(struct v4l2_subdev *sd,
 			 struct v4l2_subdev_pad_config *cfg,
 			 struct v4l2_subdev_format *format)
@@ -174,6 +195,8 @@ static int ar0231_set_selection(struct v4l2_subdev *sd,
 	priv->rect.width = rect->width;
 	priv->rect.height = rect->height;
 
+	ar0231_set_window(sd);
+
 	return 0;
 }
 
@@ -372,9 +395,29 @@ static int ar0231_initialize(struct i2c_client *client)
 	u16 val = 0;
 	u16 pid = 0;
 	int ret = 0;
+	int tmp_addr;
+	int i;
+
+	for (i = 0; i < ARRAY_SIZE(ar0231_i2c_addr); i++) {
+		tmp_addr = client->addr;
+		if (priv->ti9x4_addr) {
+			client->addr = priv->ti9x4_addr;		/* Deserializer I2C address */
+			reg8_write(client, 0x5d, ar0231_i2c_addr[i] << 1); /* Sensor native I2C address */
+			usleep_range(2000, 2500);			/* wait 2ms */
+		}
+		if (priv->max9286_addr) {
+			client->addr = priv->max9271_addr;		/* Serializer I2C address */
+			reg8_write(client, 0x0a, ar0231_i2c_addr[i] << 1); /* Sensor native I2C address */
+			usleep_range(2000, 2500);			/* wait 2ms */
+		};
+		client->addr = tmp_addr;
 
-	/* check and show model ID */
-	reg16_read16(client, AR0231_PID, &pid);
+		/* check model ID */
+		reg16_read16(client, AR0231_PID, &pid);
+
+		if (pid == AR0231_VERSION_REG)
+			break;
+	}
 
 	if (pid != AR0231_VERSION_REG) {
 		dev_dbg(&client->dev, "Product ID error %x\n", pid);
@@ -382,16 +425,15 @@ static int ar0231_initialize(struct i2c_client *client)
 		goto err;
 	}
 
+	/* Read OTP IDs */
+	ar0231_otp_id_read(client);
 	/* Program wizard registers */
-	ar0231_set_regs(client, ar0231_regs_wizard_rev4, ARRAY_SIZE(ar0231_regs_wizard_rev4));
+	ar0231_set_regs(client, ar0231_regs_wizard_rev7, ARRAY_SIZE(ar0231_regs_wizard_rev7));
 
 	/* Enable stream */
-	reg16_read16(client, 0x301a, &val);	// read inital reset_register value
-	val |= (1 << 2);			// Set streamOn bit
-	reg16_write16(client, 0x301a, val);	// Start Streaming
-
-	/* Read OTP IDs */
-	ar0231_otp_id_read(client);
+	reg16_read16(client, 0x301a, &val);
+	val |= (1 << 2);
+	reg16_write16(client, 0x301a, val);
 
 	dev_info(&client->dev, "ar0231 PID %x, res %dx%d, OTP_ID %02x:%02x:%02x:%02x:%02x:%02x\n",
 		 pid, AR0231_MAX_WIDTH, AR0231_MAX_HEIGHT, priv->id[0], priv->id[1], priv->id[2], priv->id[3], priv->id[4], priv->id[5]);
@@ -419,13 +461,19 @@ static int ar0231_parse_dt(struct device_node *np, struct ar0231_priv *priv)
 		if (!of_property_read_u32(rendpoint, "max9271-addr", &priv->max9271_addr) &&
 		    !of_property_read_u32(rendpoint->parent->parent, "reg", &priv->max9286_addr) &&
 		    !kstrtouint(strrchr(rendpoint->full_name, '@') + 1, 0, &priv->port))
-		    break;
+			break;
+
+		if (!of_property_read_u32(rendpoint, "ti9x3-addr", &priv->ti9x3_addr) &&
+		    !of_property_match_string(rendpoint->parent->parent, "compatible", "ti,ti9x4") &&
+		    !of_property_read_u32(rendpoint->parent->parent, "reg", &priv->ti9x4_addr) &&
+		    !kstrtouint(strrchr(rendpoint->full_name, '@') + 1, 0, &priv->port))
+			break;
 	}
 
 	of_node_put(endpoint);
 
-	if (!priv->max9286_addr) {
-		dev_err(&client->dev, "deserializer does not present\n");
+	if (!priv->ti9x4_addr && !priv->max9286_addr) {
+		dev_dbg(&client->dev, "deserializer does not present\n");
 		return -EINVAL;
 	}
 
@@ -437,12 +485,16 @@ static int ar0231_parse_dt(struct device_node *np, struct ar0231_priv *priv)
 		client->addr = priv->max9271_addr;			/* Serializer I2C address */
 
 		reg8_write(client, 0x09, tmp_addr << 1);		/* Sensor translated I2C address */
-		reg8_write(client, 0x0A, AR0231_I2C_ADDR << 1);		/* Sensor native I2C address */
 		usleep_range(2000, 2500);				/* wait 2ms */
 	};
-	client->addr = tmp_addr;
+	if (priv->ti9x4_addr) {
+		client->addr = priv->ti9x4_addr;			/* Deserializer I2C address */
 
-	mdelay(10);
+		reg8_write(client, 0x4c, (priv->port << 4) | (1 << priv->port)); /* Select RX port number */
+		usleep_range(2000, 2500);				/* wait 2ms */
+		reg8_write(client, 0x65, tmp_addr << 1);		/* Sensor translated I2C address */
+	}
+	client->addr = tmp_addr;
 
 	return 0;
 }
diff --git a/drivers/media/i2c/soc_camera/ar0231_rev7.h b/drivers/media/i2c/soc_camera/ar0231_rev7.h
new file mode 100644
index 0000000..c05c3ea
--- /dev/null
+++ b/drivers/media/i2c/soc_camera/ar0231_rev7.h
@@ -0,0 +1,418 @@
+/*
+ * ON Semiconductor AR0231 sensor camera wizard 1928x1208@30/BGGR/MIPI
+ *
+ * Copyright (C) 2018 Cogent Embedded, Inc.
+ *
+ * This program is free software; you can redistribute  it and/or modify it
+ * under  the terms of  the GNU General  Public License as published by the
+ * Free Software Foundation;  either version 2 of the  License, or (at your
+ * option) any later version.
+ */
+
+//#define AR0231_DISPLAY_PATTERN_FIXED
+//#define AR0231_DISPLAY_PATTERN_COLOR_BAR
+
+#define AR0231_MAX_WIDTH	1920
+#define AR0231_MAX_HEIGHT	1200
+
+#define AR0231_DELAY		0xffff
+
+#define AR0231_SENSOR_WIDTH	1928
+#define AR0231_SENSOR_HEIGHT	1208
+
+#define AR0231_X_START		((AR0231_SENSOR_WIDTH - AR0231_MAX_WIDTH) / 2)
+#define AR0231_Y_START		((AR0231_SENSOR_HEIGHT - AR0231_MAX_HEIGHT) / 2)
+#define AR0231_X_END		(AR0231_X_START + AR0231_MAX_WIDTH - 1)
+#define AR0231_Y_END		(AR0231_Y_START + AR0231_MAX_HEIGHT - 1)
+
+struct ar0231_reg {
+	u16	reg;
+	u16	val;
+};
+
+/* 3Exp HDR Full Resolution Mode MIPI 4lane 12bit 30FPS, XCLK=27MHz */
+static const struct ar0231_reg ar0231_regs_wizard_rev7[] = {
+{0x301A, 0x18}, // MIPI, stream OFF
+{AR0231_DELAY, 200}, // Wait 200ms
+
+{0x3070, 0x0000},	//  1: Solid color test pattern,
+			//  2: Full color bar test pattern,
+			//  3: Fade to grey color bar test pattern,
+			//256: Walking 1 test pattern (12 bit)
+{0x3072, 0x0123},	// R
+{0x3074, 0x0456},	// G(GR row)
+{0x3076, 0x0abc},	// B
+{0x3078, 0x0def},	// G(GB row)
+#ifdef AR0231_DISPLAY_PATTERN_FIXED
+{0x3070, 0x0001},
+#endif
+#ifdef AR0231_DISPLAY_PATTERN_COLOR_BAR
+{0x3070, 0x0002},
+#endif
+{AR0231_DELAY, 100}, // Wait 100ms
+
+#if 1 /* Sensor Setup */
+#if 1 /* Recommended Settings */
+{0x3092, 0x0C24},
+{0x337A, 0x0C80},
+{0x3520, 0x1288},
+{0x3522, 0x880C},
+{0x3524, 0x0C12},
+{0x352C, 0x1212},
+{0x354A, 0x007F},
+{0x350C, 0x055C},
+{0x3506, 0x3333},
+{0x3508, 0x3333},
+{0x3100, 0x4000},
+{0x3280, 0x0FA0},
+{0x3282, 0x0FA0},
+{0x3284, 0x0FA0},
+{0x3286, 0x0FA0},
+{0x3288, 0x0FA0},
+{0x328A, 0x0FA0},
+{0x328C, 0x0FA0},
+{0x328E, 0x0FA0},
+{0x3290, 0x0FA0},
+{0x3292, 0x0FA0},
+{0x3294, 0x0FA0},
+{0x3296, 0x0FA0},
+{0x3298, 0x0FA0},
+{0x329A, 0x0FA0},
+{0x329C, 0x0FA0},
+{0x329E, 0x0FA0},
+#endif /* Recommended Settings */
+
+#if 1 /* Sequencer Update */
+{0x2512, 0x8000},
+{0x2510, 0x0905},
+{0x2510, 0x3350},
+{0x2510, 0x2004},
+{0x2510, 0x1460},
+{0x2510, 0x1578},
+{0x2510, 0x0901},
+{0x2510, 0x7B24},
+{0x2510, 0xFF24},
+{0x2510, 0xFF24},
+{0x2510, 0xEA24},
+{0x2510, 0x1022},
+{0x2510, 0x2410},
+{0x2510, 0x155A},
+{0x2510, 0x0901},
+{0x2510, 0x1400},
+{0x2510, 0x24FF},
+{0x2510, 0x24FF},
+{0x2510, 0x24EA},
+{0x2510, 0x2324},
+{0x2510, 0x647A},
+{0x2510, 0x2404},
+{0x2510, 0x052C},
+{0x2510, 0x400A},
+{0x2510, 0xFF0A},
+{0x2510, 0xFF0A},
+{0x2510, 0x1008},
+{0x2510, 0x3851},
+{0x2510, 0x1440},
+{0x2510, 0x0004},
+{0x2510, 0x0801},
+{0x2510, 0x0408},
+{0x2510, 0x1180},
+{0x2510, 0x2652},
+{0x2510, 0x1518},
+{0x2510, 0x0906},
+{0x2510, 0x1348},
+{0x2510, 0x1002},
+{0x2510, 0x1016},
+{0x2510, 0x1181},
+{0x2510, 0x1189},
+{0x2510, 0x1056},
+{0x2510, 0x1210},
+{0x2510, 0x0901},
+{0x2510, 0x0D09},
+{0x2510, 0x1413},
+{0x2510, 0x8809},
+{0x2510, 0x2B15},
+{0x2510, 0x8809},
+{0x2510, 0x0311},
+{0x2510, 0xD909},
+{0x2510, 0x1214},
+{0x2510, 0x4109},
+{0x2510, 0x0312},
+{0x2510, 0x1409},
+{0x2510, 0x0110},
+{0x2510, 0xD612},
+{0x2510, 0x1012},
+{0x2510, 0x1212},
+{0x2510, 0x1011},
+{0x2510, 0xDD11},
+{0x2510, 0xD910},
+{0x2510, 0x5609},
+{0x2510, 0x1511},
+{0x2510, 0xDB09},
+{0x2510, 0x1511},
+{0x2510, 0x9B09},
+{0x2510, 0x0F11},
+{0x2510, 0xBB12},
+{0x2510, 0x1A12},
+{0x2510, 0x1014},
+{0x2510, 0x6012},
+{0x2510, 0x5010},
+{0x2510, 0x7610},
+{0x2510, 0xE609},
+{0x2510, 0x0812},
+{0x2510, 0x4012},
+{0x2510, 0x6009},
+{0x2510, 0x290B},
+{0x2510, 0x0904},
+{0x2510, 0x1440},
+{0x2510, 0x0923},
+{0x2510, 0x15C8},
+{0x2510, 0x13C8},
+{0x2510, 0x092C},
+{0x2510, 0x1588},
+{0x2510, 0x1388},
+{0x2510, 0x0C09},
+{0x2510, 0x0C14},
+{0x2510, 0x4109},
+{0x2510, 0x1112},
+{0x2510, 0x6212},
+{0x2510, 0x6011},
+{0x2510, 0xBF11},
+{0x2510, 0xBB10},
+{0x2510, 0x6611},
+{0x2510, 0xFB09},
+{0x2510, 0x3511},
+{0x2510, 0xBB12},
+{0x2510, 0x6312},
+{0x2510, 0x6014},
+{0x2510, 0x0015},
+{0x2510, 0x0011},
+{0x2510, 0xB812},
+{0x2510, 0xA012},
+{0x2510, 0x0010},
+{0x2510, 0x2610},
+{0x2510, 0x0013},
+{0x2510, 0x0011},
+{0x2510, 0x0008},
+{0x2510, 0x3053},
+{0x2510, 0x4215},
+{0x2510, 0x4013},
+{0x2510, 0x4010},
+{0x2510, 0x0210},
+{0x2510, 0x1611},
+{0x2510, 0x8111},
+{0x2510, 0x8910},
+{0x2510, 0x5612},
+{0x2510, 0x1009},
+{0x2510, 0x010D},
+{0x2510, 0x0815},
+{0x2510, 0xC015},
+{0x2510, 0xD013},
+{0x2510, 0x5009},
+{0x2510, 0x1313},
+{0x2510, 0xD009},
+{0x2510, 0x0215},
+{0x2510, 0xC015},
+{0x2510, 0xC813},
+{0x2510, 0xC009},
+{0x2510, 0x0515},
+{0x2510, 0x8813},
+{0x2510, 0x8009},
+{0x2510, 0x0213},
+{0x2510, 0x8809},
+{0x2510, 0x0411},
+{0x2510, 0xC909},
+{0x2510, 0x0814},
+{0x2510, 0x0109},
+{0x2510, 0x0B11},
+{0x2510, 0xD908},
+{0x2510, 0x1400},
+{0x2510, 0x091A},
+{0x2510, 0x1440},
+{0x2510, 0x0903},
+{0x2510, 0x1214},
+{0x2510, 0x0901},
+{0x2510, 0x10D6},
+{0x2510, 0x1210},
+{0x2510, 0x1212},
+{0x2510, 0x1210},
+{0x2510, 0x11DD},
+{0x2510, 0x11D9},
+{0x2510, 0x1056},
+{0x2510, 0x0917},
+{0x2510, 0x11DB},
+{0x2510, 0x0913},
+{0x2510, 0x11FB},
+{0x2510, 0x0905},
+{0x2510, 0x11BB},
+{0x2510, 0x121A},
+{0x2510, 0x1210},
+{0x2510, 0x1460},
+{0x2510, 0x1250},
+{0x2510, 0x1076},
+{0x2510, 0x10E6},
+{0x2510, 0x0901},
+{0x2510, 0x15A8},
+{0x2510, 0x0901},
+{0x2510, 0x13A8},
+{0x2510, 0x1240},
+{0x2510, 0x1260},
+{0x2510, 0x0925},
+{0x2510, 0x13AD},
+{0x2510, 0x0902},
+{0x2510, 0x0907},
+{0x2510, 0x1588},
+{0x2510, 0x0901},
+{0x2510, 0x138D},
+{0x2510, 0x0B09},
+{0x2510, 0x0914},
+{0x2510, 0x4009},
+{0x2510, 0x0B13},
+{0x2510, 0x8809},
+{0x2510, 0x1C0C},
+{0x2510, 0x0920},
+{0x2510, 0x1262},
+{0x2510, 0x1260},
+{0x2510, 0x11BF},
+{0x2510, 0x11BB},
+{0x2510, 0x1066},
+{0x2510, 0x090A},
+{0x2510, 0x11FB},
+{0x2510, 0x093B},
+{0x2510, 0x11BB},
+{0x2510, 0x1263},
+{0x2510, 0x1260},
+{0x2510, 0x1400},
+{0x2510, 0x1508},
+{0x2510, 0x11B8},
+{0x2510, 0x12A0},
+{0x2510, 0x1200},
+{0x2510, 0x1026},
+{0x2510, 0x1000},
+{0x2510, 0x1300},
+{0x2510, 0x1100},
+{0x2510, 0x437A},
+{0x2510, 0x0609},
+{0x2510, 0x0B05},
+{0x2510, 0x0708},
+{0x2510, 0x4137},
+{0x2510, 0x502C},
+{0x2510, 0x2CFE},
+{0x2510, 0x15FE},
+{0x2510, 0x0C2C},
+
+{0x32e6, 0xe0},
+{0x1008, 0x36f},
+{0x100c, 0x58f},
+{0x100e, 0x7af},
+{0x1010, 0x14f},
+
+{0x3230, 0x312},
+{0x3232, 0x532},
+{0x3234, 0x752},
+{0x3236, 0xf2},
+#endif /* Sequencer Update */
+
+//{0x3566, 0x3328}, // clear bit6
+{0x32D0, 0x3A02},
+{0x32D2, 0x3508},
+{0x32D4, 0x3702},
+{0x32D6, 0x3C04},
+{0x32DC, 0x370A},
+{0x30B0, 0x800}, // clear bit9
+#endif /* Sensor Setup */
+
+#if 1 /* Serial 12-bit Timing Setup */
+{0x302A, 6},  // vt_pix_clk_div
+{0x302C, 1},  // vt_sys_clk_div
+{0x302E, 2},  // pre_pll_clk_div
+{0x3030, 44}, // pll_multiplier
+{0x3036, 12}, // op_word_clk_div
+{0x3038, 1},  // op_sys_clk_div
+{0x30B0, 0x800}, // digital_test: pll_complete_bypass=0
+#endif /* Serial 12-bit Timing Setup */
+
+#if 1 /* Readout Mode Configuration */
+{0x30A2, 1}, // x_odd_inc_
+{0x30A6, 1}, // y_odd_inc_
+{0x3040, 0}, // read_mode
+//{0x3082, 0x8}, // operation_mode_ctrl
+//{0x30BA, 0x11E2}, // digital_ctrl
+{0x3044, 0x400}, // dark_control
+#ifdef AR0231_EMBEDDED_LINE
+{0x3064, 0x1982}, // SMIA_TEST
+#else
+{0x3064, 0x1802}, // SMIA_TEST
+#endif
+//{0x33E0, 0xC80},
+//{0x3180, 0x80},
+//{0x33E4, 0x80},
+#endif /* Readout Mode Configuration */
+
+#if 1 /* Full Res FOV */
+{0x3004, AR0231_X_START}, // X_ADDR_START_
+{0x3008, AR0231_X_END}, // X_ADDR_END_
+{0x3002, AR0231_Y_START}, // Y_ADDR_START_
+{0x3006, AR0231_Y_END}, // Y_ADDR_END_
+{0x3032, 0x0}, // scaling_mode
+{0x3400, 0x10},
+{0x3402, 0x0000 | AR0231_MAX_WIDTH}, // X_OUTPUT_CONTROL
+{0x3404, 0x0000 | AR0231_MAX_HEIGHT}, // Y_OUTPUT_CONTROL
+#endif /* Full Res FOV */
+
+#if 1 /* 3exp Timing and Exposure */
+{0x3082, 0x8}, // operation_mode_ctrl
+{0x30BA, 0x11E2}, // digital_ctrl: num_exp_max=2
+
+/* Row and Pixel Timing */
+{0x300C, 1674}, // line_length_pck_
+{0x300A, 1314}, // frame_length_lines_
+{0x3042, 0}, // extra_delay
+
+/* Exposure Settings */
+//{0x3238, 0x222}, // exposure_ratio
+{0x3012, 355}, // coarse_integration_time_
+{0x3014, 1874}, // fine_integration_time_
+{0x321E, 1874}, // fine_integration_time2
+{0x3222, 1874}, // fine_integration_time3
+{0x30B0, 0x800}, // digital_test: set bit11
+{0x32EA, 0x3C0E},
+{0x32EC, 0x72A1},
+#endif /* 3exp Timing and Exposure - Serial */
+
+#if 1 /* HDR 12 bit Output */
+{0x31D0, 1}, // companding
+{0x31AC, 0x140C}, // data_format_bits: RAW20, OUT12
+#endif /* HDR 12 bit Output */
+
+#if 1 /* MIPI 12 bit Settings */
+{0x31AE, 0x204}, // serial_format: MIPI 4 lanes
+//{0x3342, 0x122C}, // default, DT=0x12, DT=0x2C
+//{0x3346, 0x122C}, // default, DT=0x12, DT=0x2C
+//{0x334A, 0x122C}, // default, DT=0x12, DT=0x2C
+//{0x334E, 0x122C}, // default, DT=0x12, DT=0x2C
+//{0x3344, 0x0011}, // default, VC=0
+//{0x3348, 0x0111}, // default, VC=1
+//{0x334C, 0x0211}, // default, VC=2
+//{0x3350, 0x0311}, // default, VC=3
+//{0x31B0, 0x49}, // frame_preamble
+//{0x31B2, 0x33}, // line_preamble
+{0x31B4, 0x2185},
+{0x31B6, 0x1146},
+{0x31B8, 0x3047},
+{0x31BA, 0x186},
+{0x31BC, 0x805},
+#endif /* MIPI 12 bit Settings */
+
+/* FPS = 124.5MHz / reg0x300A / reg0x300C * (DES_XTAL/27MHz), DES_XTAL=23.5MHz */
+{0x300A, AR0231_SENSOR_HEIGHT + 100}, // Frame_length_Lines
+{0x300C, AR0231_SENSOR_WIDTH + 550}, // Line_length_pck
+{0x3012, 0x144}, //Integration_time
+
+#if 1 /* Enable trigger input */
+{0x340A, 0x00E0}, // GPIO_CONTROL1: GPIO1 is trigger
+{0x340C, 0x0002}, // GPIO_CONTROL2: GPIO1 is trigger
+{0x30CE, 0x0120}, // TRIGGER_MODE
+//{0x30DC, 0x0120}, // TRIGGER_DELAY
+{0x301A, 0x0118}, // GPI pins enable
+#endif
+};
diff --git a/drivers/media/i2c/soc_camera/ov106xx.c b/drivers/media/i2c/soc_camera/ov106xx.c
index e5d6b67..aaadcc2 100644
--- a/drivers/media/i2c/soc_camera/ov106xx.c
+++ b/drivers/media/i2c/soc_camera/ov106xx.c
@@ -51,6 +51,12 @@ static int ov106xx_probe(struct i2c_client *client,
 	int ret;
 	chip_id = -EINVAL;
 
+	ret = ar0231_probe(client, did);
+	if (!ret) {
+		chip_id = ID_AR0231;
+		goto out;
+	}
+
 	ret = ar0233_probe(client, did);
 	if (!ret) {
 		chip_id = ID_AR0233;
@@ -105,12 +111,6 @@ static int ov106xx_probe(struct i2c_client *client,
 		goto out;
 	}
 
-	ret = ar0231_probe(client, did);
-	if (!ret) {
-		chip_id = ID_AR0231;
-		goto out;
-	}
-
 	ret = ap0101_probe(client, did);
 	if (!ret) {
 		chip_id = ID_AP0101_AR014X;
-- 
2.7.4