Skip to content

Commit aef1e51

Browse files
6by9pelwell
authored andcommitted
media: i2c: ov5647: Separate out the common registers.
There are many registers in common between all the modes. Pull those out into one common table. Signed-off-by: Dave Stevenson <[email protected]>
1 parent 664e835 commit aef1e51

File tree

1 file changed

+50
-193
lines changed

1 file changed

+50
-193
lines changed

drivers/media/i2c/ov5647.c

Lines changed: 50 additions & 193 deletions
Original file line numberDiff line numberDiff line change
@@ -162,22 +162,16 @@ static const struct regval_list sensor_oe_enable_regs[] = {
162162
{0x3002, 0xe4},
163163
};
164164

165-
static struct regval_list ov5647_2592x1944_10bpp[] = {
165+
static struct regval_list ov5647_common_regs[] = {
166166
{0x0100, 0x00},
167167
{0x0103, 0x01},
168168
{0x3034, 0x1a},
169169
{0x3035, 0x21},
170-
{0x3036, 0x69},
171170
{0x303c, 0x11},
172171
{0x3106, 0xf5},
173-
{0x3821, 0x00},
174-
{0x3820, 0x00},
175172
{0x3827, 0xec},
176173
{0x370c, 0x03},
177-
{0x3612, 0x5b},
178-
{0x3618, 0x04},
179174
{0x5000, 0x06},
180-
{0x5002, 0x41},
181175
{0x5003, 0x08},
182176
{0x5a00, 0x08},
183177
{0x3000, 0x00},
@@ -192,24 +186,6 @@ static struct regval_list ov5647_2592x1944_10bpp[] = {
192186
{0x3a19, 0xf8},
193187
{0x3c01, 0x80},
194188
{0x3b07, 0x0c},
195-
{0x3814, 0x11},
196-
{0x3815, 0x11},
197-
{0x3708, 0x64},
198-
{0x3709, 0x12},
199-
{0x3808, 0x0a},
200-
{0x3809, 0x20},
201-
{0x380a, 0x07},
202-
{0x380b, 0x98},
203-
{0x3800, 0x00},
204-
{0x3801, 0x00},
205-
{0x3802, 0x00},
206-
{0x3803, 0x00},
207-
{0x3804, 0x0a},
208-
{0x3805, 0x3f},
209-
{0x3806, 0x07},
210-
{0x3807, 0xa3},
211-
{0x3811, 0x10},
212-
{0x3813, 0x06},
213189
{0x3630, 0x2e},
214190
{0x3632, 0xe2},
215191
{0x3633, 0x23},
@@ -229,64 +205,64 @@ static struct regval_list ov5647_2592x1944_10bpp[] = {
229205
{0x3f06, 0x10},
230206
{0x3f01, 0x0a},
231207
{0x3a08, 0x01},
232-
{0x3a09, 0x28},
233-
{0x3a0a, 0x00},
234-
{0x3a0b, 0xf6},
235-
{0x3a0d, 0x08},
236-
{0x3a0e, 0x06},
237208
{0x3a0f, 0x58},
238209
{0x3a10, 0x50},
239210
{0x3a1b, 0x58},
240211
{0x3a1e, 0x50},
241212
{0x3a11, 0x60},
242213
{0x3a1f, 0x28},
243214
{0x4001, 0x02},
244-
{0x4004, 0x04},
245215
{0x4000, 0x09},
216+
{0x3503, 0x03},
217+
};
218+
219+
static struct regval_list ov5647_2592x1944_10bpp[] = {
220+
{0x3036, 0x69},
221+
{0x3821, 0x00},
222+
{0x3820, 0x00},
223+
{0x3612, 0x5b},
224+
{0x3618, 0x04},
225+
{0x5002, 0x41},
226+
{0x3814, 0x11},
227+
{0x3815, 0x11},
228+
{0x3708, 0x64},
229+
{0x3709, 0x12},
230+
{0x3800, 0x00},
231+
{0x3801, 0x00},
232+
{0x3802, 0x00},
233+
{0x3803, 0x00},
234+
{0x3804, 0x0a},
235+
{0x3805, 0x3f},
236+
{0x3806, 0x07},
237+
{0x3807, 0xa3},
238+
{0x3808, 0x0a},
239+
{0x3809, 0x20},
240+
{0x380a, 0x07},
241+
{0x380b, 0x98},
242+
{0x3811, 0x10},
243+
{0x3813, 0x06},
244+
{0x3a09, 0x28},
245+
{0x3a0a, 0x00},
246+
{0x3a0b, 0xf6},
247+
{0x3a0d, 0x08},
248+
{0x3a0e, 0x06},
249+
{0x4004, 0x04},
246250
{0x4837, 0x19},
247251
{0x4800, 0x24},
248-
{0x3503, 0x03},
249252
{0x0100, 0x01},
250253
};
251254

252255
static struct regval_list ov5647_1080p30_10bpp[] = {
253-
{0x0100, 0x00},
254-
{0x0103, 0x01},
255-
{0x3034, 0x1a},
256-
{0x3035, 0x21},
257256
{0x3036, 0x62},
258-
{0x303c, 0x11},
259-
{0x3106, 0xf5},
260257
{0x3821, 0x00},
261258
{0x3820, 0x00},
262-
{0x3827, 0xec},
263-
{0x370c, 0x03},
264259
{0x3612, 0x5b},
265260
{0x3618, 0x04},
266-
{0x5000, 0x06},
267261
{0x5002, 0x41},
268-
{0x5003, 0x08},
269-
{0x5a00, 0x08},
270-
{0x3000, 0x00},
271-
{0x3001, 0x00},
272-
{0x3002, 0x00},
273-
{0x3016, 0x08},
274-
{0x3017, 0xe0},
275-
{0x3018, 0x44},
276-
{0x301c, 0xf8},
277-
{0x301d, 0xf0},
278-
{0x3a18, 0x00},
279-
{0x3a19, 0xf8},
280-
{0x3c01, 0x80},
281-
{0x3b07, 0x0c},
282262
{0x3814, 0x11},
283263
{0x3815, 0x11},
284264
{0x3708, 0x64},
285265
{0x3709, 0x12},
286-
{0x3808, 0x07},
287-
{0x3809, 0x80},
288-
{0x380a, 0x04},
289-
{0x380b, 0x38},
290266
{0x3800, 0x01},
291267
{0x3801, 0x5c},
292268
{0x3802, 0x01},
@@ -295,77 +271,30 @@ static struct regval_list ov5647_1080p30_10bpp[] = {
295271
{0x3805, 0xe3},
296272
{0x3806, 0x05},
297273
{0x3807, 0xf1},
274+
{0x3808, 0x07},
275+
{0x3809, 0x80},
276+
{0x380a, 0x04},
277+
{0x380b, 0x38},
298278
{0x3811, 0x04},
299279
{0x3813, 0x02},
300-
{0x3630, 0x2e},
301-
{0x3632, 0xe2},
302-
{0x3633, 0x23},
303-
{0x3634, 0x44},
304-
{0x3636, 0x06},
305-
{0x3620, 0x64},
306-
{0x3621, 0xe0},
307-
{0x3600, 0x37},
308-
{0x3704, 0xa0},
309-
{0x3703, 0x5a},
310-
{0x3715, 0x78},
311-
{0x3717, 0x01},
312-
{0x3731, 0x02},
313-
{0x370b, 0x60},
314-
{0x3705, 0x1a},
315-
{0x3f05, 0x02},
316-
{0x3f06, 0x10},
317-
{0x3f01, 0x0a},
318-
{0x3a08, 0x01},
319280
{0x3a09, 0x4b},
320281
{0x3a0a, 0x01},
321282
{0x3a0b, 0x13},
322283
{0x3a0d, 0x04},
323284
{0x3a0e, 0x03},
324-
{0x3a0f, 0x58},
325-
{0x3a10, 0x50},
326-
{0x3a1b, 0x58},
327-
{0x3a1e, 0x50},
328-
{0x3a11, 0x60},
329-
{0x3a1f, 0x28},
330-
{0x4001, 0x02},
331285
{0x4004, 0x04},
332-
{0x4000, 0x09},
333286
{0x4837, 0x19},
334287
{0x4800, 0x34},
335-
{0x3503, 0x03},
336288
{0x0100, 0x01},
337289
};
338290

339291
static struct regval_list ov5647_2x2binned_10bpp[] = {
340-
{0x0100, 0x00},
341-
{0x0103, 0x01},
342-
{0x3034, 0x1a},
343-
{0x3035, 0x21},
344292
{0x3036, 0x62},
345-
{0x303c, 0x11},
346-
{0x3106, 0xf5},
347293
{0x3821, 0x01},
348294
{0x3820, 0x41},
349-
{0x3827, 0xec},
350-
{0x370c, 0x03},
351295
{0x3612, 0x59},
352296
{0x3618, 0x00},
353-
{0x5000, 0x06},
354297
{0x5002, 0x41},
355-
{0x5003, 0x08},
356-
{0x5a00, 0x08},
357-
{0x3000, 0x00},
358-
{0x3001, 0x00},
359-
{0x3002, 0x00},
360-
{0x3016, 0x08},
361-
{0x3017, 0xe0},
362-
{0x3018, 0x44},
363-
{0x301c, 0xf8},
364-
{0x301d, 0xf0},
365-
{0x3a18, 0x00},
366-
{0x3a19, 0xf8},
367-
{0x3c01, 0x80},
368-
{0x3b07, 0x0c},
369298
{0x3800, 0x00},
370299
{0x3801, 0x00},
371300
{0x3802, 0x00},
@@ -382,42 +311,14 @@ static struct regval_list ov5647_2x2binned_10bpp[] = {
382311
{0x3813, 0x06},
383312
{0x3814, 0x31},
384313
{0x3815, 0x31},
385-
{0x3630, 0x2e},
386-
{0x3632, 0xe2},
387-
{0x3633, 0x23},
388-
{0x3634, 0x44},
389-
{0x3636, 0x06},
390-
{0x3620, 0x64},
391-
{0x3621, 0xe0},
392-
{0x3600, 0x37},
393-
{0x3704, 0xa0},
394-
{0x3703, 0x5a},
395-
{0x3715, 0x78},
396-
{0x3717, 0x01},
397-
{0x3731, 0x02},
398-
{0x370b, 0x60},
399-
{0x3705, 0x1a},
400-
{0x3f05, 0x02},
401-
{0x3f06, 0x10},
402-
{0x3f01, 0x0a},
403-
{0x3a08, 0x01},
404314
{0x3a09, 0x28},
405315
{0x3a0a, 0x00},
406316
{0x3a0b, 0xf6},
407317
{0x3a0d, 0x08},
408318
{0x3a0e, 0x06},
409-
{0x3a0f, 0x58},
410-
{0x3a10, 0x50},
411-
{0x3a1b, 0x58},
412-
{0x3a1e, 0x50},
413-
{0x3a11, 0x60},
414-
{0x3a1f, 0x28},
415-
{0x4001, 0x02},
416319
{0x4004, 0x04},
417-
{0x4000, 0x09},
418320
{0x4837, 0x16},
419321
{0x4800, 0x24},
420-
{0x3503, 0x03},
421322
{0x350a, 0x00},
422323
{0x350b, 0x10},
423324
{0x3500, 0x00},
@@ -428,42 +329,15 @@ static struct regval_list ov5647_2x2binned_10bpp[] = {
428329
};
429330

430331
static struct regval_list ov5647_640x480_10bpp[] = {
431-
{0x0100, 0x00},
432-
{0x0103, 0x01},
433-
{0x3034, 0x1a},
434-
{0x3035, 0x21},
435332
{0x3036, 0x46},
436-
{0x303c, 0x11},
437-
{0x3106, 0xf5},
438333
{0x3821, 0x01},
439334
{0x3820, 0x41},
440-
{0x3827, 0xec},
441-
{0x370c, 0x03},
442335
{0x3612, 0x59},
443336
{0x3618, 0x00},
444-
{0x5000, 0x06},
445-
{0x5003, 0x08},
446-
{0x5a00, 0x08},
447-
{0x3000, 0x00},
448-
{0x3001, 0x00},
449-
{0x3002, 0x00},
450-
{0x3016, 0x08},
451-
{0x3017, 0xe0},
452-
{0x3018, 0x44},
453-
{0x301c, 0xf8},
454-
{0x301d, 0xf0},
455-
{0x3a18, 0x00},
456-
{0x3a19, 0xf8},
457-
{0x3c01, 0x80},
458-
{0x3b07, 0x0c},
459337
{0x3814, 0x35},
460338
{0x3815, 0x35},
461339
{0x3708, 0x64},
462340
{0x3709, 0x52},
463-
{0x3808, 0x02},
464-
{0x3809, 0x80},
465-
{0x380a, 0x01},
466-
{0x380b, 0xe0},
467341
{0x3800, 0x00},
468342
{0x3801, 0x10},
469343
{0x3802, 0x00},
@@ -472,41 +346,17 @@ static struct regval_list ov5647_640x480_10bpp[] = {
472346
{0x3805, 0x2f},
473347
{0x3806, 0x07},
474348
{0x3807, 0x9f},
475-
{0x3630, 0x2e},
476-
{0x3632, 0xe2},
477-
{0x3633, 0x23},
478-
{0x3634, 0x44},
479-
{0x3636, 0x06},
480-
{0x3620, 0x64},
481-
{0x3621, 0xe0},
482-
{0x3600, 0x37},
483-
{0x3704, 0xa0},
484-
{0x3703, 0x5a},
485-
{0x3715, 0x78},
486-
{0x3717, 0x01},
487-
{0x3731, 0x02},
488-
{0x370b, 0x60},
489-
{0x3705, 0x1a},
490-
{0x3f05, 0x02},
491-
{0x3f06, 0x10},
492-
{0x3f01, 0x0a},
493-
{0x3a08, 0x01},
349+
{0x3808, 0x02},
350+
{0x3809, 0x80},
351+
{0x380a, 0x01},
352+
{0x380b, 0xe0},
494353
{0x3a09, 0x2e},
495354
{0x3a0a, 0x00},
496355
{0x3a0b, 0xfb},
497356
{0x3a0d, 0x02},
498357
{0x3a0e, 0x01},
499-
{0x3a0f, 0x58},
500-
{0x3a10, 0x50},
501-
{0x3a1b, 0x58},
502-
{0x3a1e, 0x50},
503-
{0x3a11, 0x60},
504-
{0x3a1f, 0x28},
505-
{0x4001, 0x02},
506358
{0x4004, 0x02},
507-
{0x4000, 0x09},
508359
{0x4800, 0x34},
509-
{0x3503, 0x03},
510360
{0x0100, 0x01},
511361
};
512362

@@ -715,6 +565,13 @@ static int ov5647_set_mode(struct v4l2_subdev *sd)
715565
if (ret < 0)
716566
return ret;
717567

568+
ret = ov5647_write_array(sd, ov5647_common_regs,
569+
ARRAY_SIZE(ov5647_common_regs));
570+
if (ret < 0) {
571+
dev_err(&client->dev, "write sensor common regs error\n");
572+
return ret;
573+
}
574+
718575
ret = ov5647_write_array(sd, sensor->mode->reg_list,
719576
sensor->mode->num_regs);
720577
if (ret < 0) {

0 commit comments

Comments
 (0)