@@ -154,9 +154,6 @@ struct imx477_mode {
154
154
/* Frame height */
155
155
unsigned int height ;
156
156
157
- /* H-timing in pixels */
158
- unsigned int line_length_pix ;
159
-
160
157
/* Analog crop rectangle. */
161
158
struct v4l2_rect crop ;
162
159
@@ -857,7 +854,6 @@ static const struct imx477_mode supported_modes_12bit[] = {
857
854
/* 12MPix 10fps mode */
858
855
.width = 4056 ,
859
856
.height = 3040 ,
860
- .line_length_pix = 24000 ,
861
857
.crop = {
862
858
.left = IMX477_PIXEL_ARRAY_LEFT ,
863
859
.top = IMX477_PIXEL_ARRAY_TOP ,
@@ -874,7 +870,6 @@ static const struct imx477_mode supported_modes_12bit[] = {
874
870
/* 12MPix cropped 16:9 mode */
875
871
.width = 4056 ,
876
872
.height = 2160 ,
877
- .line_length_pix = 24000 ,
878
873
.crop = {
879
874
.left = IMX477_PIXEL_ARRAY_LEFT ,
880
875
.top = IMX477_PIXEL_ARRAY_TOP + 440 ,
@@ -891,7 +886,6 @@ static const struct imx477_mode supported_modes_12bit[] = {
891
886
/* 2x2 binned 40fps mode */
892
887
.width = 2028 ,
893
888
.height = 1520 ,
894
- .line_length_pix = 12740 ,
895
889
.crop = {
896
890
.left = IMX477_PIXEL_ARRAY_LEFT ,
897
891
.top = IMX477_PIXEL_ARRAY_TOP ,
@@ -908,7 +902,6 @@ static const struct imx477_mode supported_modes_12bit[] = {
908
902
/* 1080p 50fps cropped mode */
909
903
.width = 2028 ,
910
904
.height = 1080 ,
911
- .line_length_pix = 12740 ,
912
905
.crop = {
913
906
.left = IMX477_PIXEL_ARRAY_LEFT ,
914
907
.top = IMX477_PIXEL_ARRAY_TOP + 440 ,
@@ -928,7 +921,6 @@ static const struct imx477_mode supported_modes_10bit[] = {
928
921
/* 120fps. 2x2 binned and cropped */
929
922
.width = 1332 ,
930
923
.height = 990 ,
931
- .line_length_pix = 6664 ,
932
924
.crop = {
933
925
/*
934
926
* FIXME: the analog crop rectangle is actually
@@ -1412,6 +1404,7 @@ static int imx477_get_pad_format(struct v4l2_subdev *sd,
1412
1404
static void imx477_set_framing_limits (struct imx477 * imx477 )
1413
1405
{
1414
1406
unsigned int hblank_min ;
1407
+ u64 line_length_min ;
1415
1408
const struct imx477_mode * mode = imx477 -> mode ;
1416
1409
1417
1410
/* Default to no long exposure multiplier. */
@@ -1428,7 +1421,11 @@ static void imx477_set_framing_limits(struct imx477 *imx477)
1428
1421
__v4l2_ctrl_s_ctrl (imx477 -> vblank ,
1429
1422
mode -> frm_length_default - mode -> height );
1430
1423
1431
- hblank_min = mode -> line_length_pix - mode -> width ;
1424
+ line_length_min = mode -> width * 12 /*BPP*/ * (u64 )IMX477_PIXEL_RATE ;
1425
+ do_div (line_length_min , imx477 -> link_freq_value * 2 * 2 /*LANES*/ );
1426
+ line_length_min += 500 ; /* Allow for HS<>LP transitions */
1427
+
1428
+ hblank_min = line_length_min - mode -> width ;
1432
1429
__v4l2_ctrl_modify_range (imx477 -> hblank , hblank_min ,
1433
1430
IMX477_LINE_LENGTH_MAX , 1 , hblank_min );
1434
1431
__v4l2_ctrl_s_ctrl (imx477 -> hblank , hblank_min );
0 commit comments