Skip to content

Commit 77130ea

Browse files
vvarmapopcornmix
authored andcommitted
media: i2c: imx219: fix binning and rate_factor for 480p and 1232p
At a high FPS with RAW10, there is frame corruption for 480p because the rate_factor of 2 is used with the normal 2x2 bining [1]. This commit ties the rate_factor to the selected binning mode. For the 480p mode, analog 2x2 binning mode with a rate_factor of 2 is always used. For the 1232p mode the normal 2x2 binning mode is used for RAW10 while analog 2x2 binning mode is used for RAW8. [1] #5493 Signed-off-by: Vinay Varma <[email protected]> Signed-off-by: Dave Stevenson <[email protected]> Signed-off-by: Naushir Patuck <[email protected]> Reworked due to upstream changes
1 parent ba7fd5d commit 77130ea

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

drivers/media/i2c/imx219.c

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,12 @@
146146
#define IMX219_PIXEL_ARRAY_WIDTH 3280U
147147
#define IMX219_PIXEL_ARRAY_HEIGHT 2464U
148148

149+
enum binning_bit_depths {
150+
BINNING_IDX_8_BIT,
151+
BINNING_IDX_10_BIT,
152+
BINNING_IDX_MAX
153+
};
154+
149155
/* Mode : resolution and related config&values */
150156
struct imx219_mode {
151157
/* Frame width */
@@ -155,6 +161,10 @@ struct imx219_mode {
155161

156162
/* V-timing */
157163
unsigned int fll_def;
164+
unsigned int vts_def;
165+
166+
/* binning mode based on format code */
167+
unsigned int binning[BINNING_IDX_MAX];
158168
};
159169

160170
static const struct cci_reg_sequence imx219_common_regs[] = {
@@ -313,24 +323,44 @@ static const struct imx219_mode supported_modes[] = {
313323
.width = 3280,
314324
.height = 2464,
315325
.fll_def = 3526,
326+
.vts_def = 3526,
327+
.binning = {
328+
[BINNING_IDX_8_BIT] = IMX219_BINNING_NONE,
329+
[BINNING_IDX_10_BIT] = IMX219_BINNING_NONE,
330+
},
316331
},
317332
{
318333
/* 1080P 30fps cropped */
319334
.width = 1920,
320335
.height = 1080,
321336
.fll_def = 1763,
337+
.vts_def = 1763,
338+
.binning = {
339+
[BINNING_IDX_8_BIT] = IMX219_BINNING_NONE,
340+
[BINNING_IDX_10_BIT] = IMX219_BINNING_NONE,
341+
},
322342
},
323343
{
324344
/* 2x2 binned 60fps mode */
325345
.width = 1640,
326346
.height = 1232,
327347
.fll_def = 1707,
348+
.vts_def = 1763,
349+
.binning = {
350+
[BINNING_IDX_8_BIT] = IMX219_BINNING_X2_ANALOG,
351+
[BINNING_IDX_10_BIT] = IMX219_BINNING_X2,
352+
},
328353
},
329354
{
330355
/* 640x480 60fps mode */
331356
.width = 640,
332357
.height = 480,
333358
.fll_def = 1707,
359+
.vts_def = 1763,
360+
.binning = {
361+
[BINNING_IDX_8_BIT] = IMX219_BINNING_X2_ANALOG,
362+
[BINNING_IDX_10_BIT] = IMX219_BINNING_X2_ANALOG,
363+
},
334364
},
335365
};
336366

@@ -431,7 +461,7 @@ static unsigned int imx219_get_binning(struct v4l2_subdev_state *state,
431461
*bin_v = IMX219_BINNING_NONE;
432462

433463
if (*bin_h == 2 && *bin_v == 2)
434-
return IMX219_BINNING_X2_ANALOG;
464+
return bin_mode;
435465
else if (*bin_h == 2 || *bin_v == 2)
436466
/*
437467
* Don't use analog binning if only one dimension

0 commit comments

Comments
 (0)