@@ -97,6 +97,13 @@ static const char * const ov5647_supply_names[] = {
97
97
98
98
#define OV5647_NUM_SUPPLIES ARRAY_SIZE(ov5647_supply_names)
99
99
100
+ #define FREQ_INDEX_FULL 0
101
+ #define FREQ_INDEX_VGA 1
102
+ static const s64 ov5647_link_freqs [] = {
103
+ [FREQ_INDEX_FULL ] = 218500000 ,
104
+ [FREQ_INDEX_VGA ] = 208333000 ,
105
+ };
106
+
100
107
struct regval_list {
101
108
u16 addr ;
102
109
u8 data ;
@@ -106,6 +113,7 @@ struct ov5647_mode {
106
113
struct v4l2_mbus_framefmt format ;
107
114
struct v4l2_rect crop ;
108
115
u64 pixel_rate ;
116
+ unsigned int link_freq_index ;
109
117
int hts ;
110
118
int vts ;
111
119
const struct regval_list * reg_list ;
@@ -128,6 +136,7 @@ struct ov5647 {
128
136
struct v4l2_ctrl * exposure ;
129
137
struct v4l2_ctrl * hflip ;
130
138
struct v4l2_ctrl * vflip ;
139
+ struct v4l2_ctrl * link_freq ;
131
140
bool streaming ;
132
141
};
133
142
@@ -377,6 +386,7 @@ static const struct ov5647_mode ov5647_modes[] = {
377
386
.height = 1944
378
387
},
379
388
.pixel_rate = 87500000 ,
389
+ .link_freq_index = FREQ_INDEX_FULL ,
380
390
.hts = 2844 ,
381
391
.vts = 0x7b0 ,
382
392
.reg_list = ov5647_2592x1944_10bpp ,
@@ -398,6 +408,7 @@ static const struct ov5647_mode ov5647_modes[] = {
398
408
.height = 1080 ,
399
409
},
400
410
.pixel_rate = 87500000 ,
411
+ .link_freq_index = FREQ_INDEX_FULL ,
401
412
.hts = 2416 ,
402
413
.vts = 0x450 ,
403
414
.reg_list = ov5647_1080p30_10bpp ,
@@ -419,6 +430,7 @@ static const struct ov5647_mode ov5647_modes[] = {
419
430
.height = 1944 ,
420
431
},
421
432
.pixel_rate = 87500000 ,
433
+ .link_freq_index = FREQ_INDEX_FULL ,
422
434
.hts = 1896 ,
423
435
.vts = 0x59b ,
424
436
.reg_list = ov5647_2x2binned_10bpp ,
@@ -440,6 +452,7 @@ static const struct ov5647_mode ov5647_modes[] = {
440
452
.height = 1920 ,
441
453
},
442
454
.pixel_rate = 55000000 ,
455
+ .link_freq_index = FREQ_INDEX_VGA ,
443
456
.hts = 1852 ,
444
457
.vts = 0x1f8 ,
445
458
.reg_list = ov5647_640x480_10bpp ,
@@ -943,6 +956,8 @@ static int ov5647_set_pad_fmt(struct v4l2_subdev *sd,
943
956
sensor -> exposure -> minimum ,
944
957
exposure_max , sensor -> exposure -> step ,
945
958
exposure_def );
959
+
960
+ __v4l2_ctrl_s_ctrl (sensor -> link_freq , mode -> link_freq_index );
946
961
}
947
962
* fmt = mode -> format ;
948
963
/* The code we pass back must reflect the current h/vflips. */
@@ -1248,7 +1263,7 @@ static int ov5647_init_controls(struct ov5647 *sensor, struct device *dev)
1248
1263
int hblank , exposure_max , exposure_def ;
1249
1264
struct v4l2_fwnode_device_properties props ;
1250
1265
1251
- v4l2_ctrl_handler_init (& sensor -> ctrls , 9 );
1266
+ v4l2_ctrl_handler_init (& sensor -> ctrls , 10 );
1252
1267
1253
1268
v4l2_ctrl_new_std (& sensor -> ctrls , & ov5647_ctrl_ops ,
1254
1269
V4L2_CID_AUTOGAIN , 0 , 1 , 1 , 0 );
@@ -1308,6 +1323,14 @@ static int ov5647_init_controls(struct ov5647 *sensor, struct device *dev)
1308
1323
if (sensor -> vflip )
1309
1324
sensor -> vflip -> flags |= V4L2_CTRL_FLAG_MODIFY_LAYOUT ;
1310
1325
1326
+ sensor -> link_freq =
1327
+ v4l2_ctrl_new_int_menu (& sensor -> ctrls , & ov5647_ctrl_ops ,
1328
+ V4L2_CID_LINK_FREQ ,
1329
+ ARRAY_SIZE (ov5647_link_freqs ) - 1 , 0 ,
1330
+ ov5647_link_freqs );
1331
+ if (sensor -> link_freq )
1332
+ sensor -> link_freq -> flags |= V4L2_CTRL_FLAG_READ_ONLY ;
1333
+
1311
1334
v4l2_fwnode_device_parse (dev , & props );
1312
1335
1313
1336
v4l2_ctrl_new_fwnode_properties (& sensor -> ctrls , & ov5647_ctrl_ops ,
0 commit comments